|
|
|
|
using System.IO;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Illusion;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class Main : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
private string abPath = "";
|
|
|
|
|
private string abDir;
|
|
|
|
|
private List<string> abNameList = new List<string>();
|
|
|
|
|
private int idx = 0;
|
|
|
|
|
|
|
|
|
|
private GameObject charm;
|
|
|
|
|
private WeaponController controller;
|
|
|
|
|
private AssetBundle bundle;
|
|
|
|
|
|
|
|
|
|
public List<int> styleId;
|
|
|
|
|
private int style = 0;
|
|
|
|
|
public List<int> effectId;
|
|
|
|
|
private int effect = -1;
|
|
|
|
|
private int mode = 0;
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
if (abPath == "" || abPath == "null")
|
|
|
|
|
{
|
|
|
|
|
abPath = FileUtil.OpenFile();
|
|
|
|
|
}
|
|
|
|
|
FileInfo fileInfo = new FileInfo(abPath);
|
|
|
|
|
abDir = fileInfo.DirectoryName;
|
|
|
|
|
DirectoryInfo folderInfo = new DirectoryInfo(abDir);
|
|
|
|
|
int t = 0;
|
|
|
|
|
foreach (FileInfo NextFile in folderInfo.GetFiles())
|
|
|
|
|
{
|
|
|
|
|
Debug.Log(NextFile.Name);
|
|
|
|
|
abNameList.Add(NextFile.Name);
|
|
|
|
|
if (NextFile.Name == fileInfo.Name)
|
|
|
|
|
{
|
|
|
|
|
idx = t;
|
|
|
|
|
}
|
|
|
|
|
t++;
|
|
|
|
|
}
|
|
|
|
|
LoadAb(abDir + '\\' +abNameList[idx % abNameList.Count]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
if (Input.GetMouseButtonDown(2))
|
|
|
|
|
{
|
|
|
|
|
ChangeMode();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoadAb(string abPath)
|
|
|
|
|
{
|
|
|
|
|
bundle = AssetBundle.LoadFromFile(abPath);
|
|
|
|
|
foreach (var name in bundle.GetAllAssetNames())
|
|
|
|
|
{
|
|
|
|
|
Debug.Log(name);
|
|
|
|
|
charm = (GameObject)Instantiate(bundle.LoadAsset(name));
|
|
|
|
|
}
|
|
|
|
|
charm.transform.localScale = new Vector3(100, 100, 100);
|
|
|
|
|
controller = charm.GetComponent<WeaponController>();
|
|
|
|
|
charm.AddComponent<MouseControlModel>();
|
|
|
|
|
styleId.Clear();
|
|
|
|
|
style = 0;
|
|
|
|
|
for (int i = 0; i < controller.weaponMaterialList.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
styleId.Add(controller.weaponMaterialList[i].colorIndex);
|
|
|
|
|
}
|
|
|
|
|
effectId.Clear();
|
|
|
|
|
effect = 0;
|
|
|
|
|
effectId.Add(-1);
|
|
|
|
|
for (int i = 0; i < controller.specialEffectList.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
effectId.Add(controller.specialEffectList[i].id);
|
|
|
|
|
}
|
|
|
|
|
mode = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ChangeMode()
|
|
|
|
|
{
|
|
|
|
|
mode++;
|
|
|
|
|
controller.SetAnimeSpeed(.5f);
|
|
|
|
|
if (mode % 2 == 0)
|
|
|
|
|
controller.WeaponChangeOnly(WeaponMode.WeaponTypeA);
|
|
|
|
|
else
|
|
|
|
|
controller.WeaponChangeOnly(WeaponMode.WeaponTypeB);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ChangeSkin()
|
|
|
|
|
{
|
|
|
|
|
style++;
|
|
|
|
|
controller.ChangeWeaponStyle(styleId[style % styleId.Count]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ChangeEffect()
|
|
|
|
|
{
|
|
|
|
|
effect++;
|
|
|
|
|
controller.SetSpecialEffect(effectId[effect % effectId.Count]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void NextAb()
|
|
|
|
|
{
|
|
|
|
|
idx++;
|
|
|
|
|
if (charm) Destroy(charm);
|
|
|
|
|
if (bundle) bundle.Unload(true);
|
|
|
|
|
Camera.main.fieldOfView = 50;
|
|
|
|
|
LoadAb(abDir + '\\' +abNameList[idx % abNameList.Count]);
|
|
|
|
|
}
|
|
|
|
|
}
|