You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.4 KiB

2 years ago
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 int count;
private GameObject charm;
private WeaponController controller;
public List<int> styleId;
private int style = -1;
public List<int> effectId;
private int effect = -1;
2 years ago
private int mode = 0;
2 years ago
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++;
}
count = abNameList.Count;
2 years ago
LoadAb(abDir + '\\' +abNameList[idx % count]);
2 years ago
}
void Update()
{
2 years ago
if (Input.GetMouseButtonDown(2))
{
ChangeMode();
}
2 years ago
}
void LoadAb(string abPath)
{
var 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();
2 years ago
style = -1;
2 years ago
for (int i = 0; i < controller.weaponMaterialList.Length; i++)
{
styleId.Add(controller.weaponMaterialList[i].colorIndex);
}
effectId.Clear();
2 years ago
effect = -1;
2 years ago
for (int i = 0; i < controller.specialEffectList.Length; i++)
{
effectId.Add(controller.specialEffectList[i].id);
}
2 years ago
mode = 0;
2 years ago
}
2 years ago
void ChangeMode()
{
mode++;
controller.SetAnimeSpeed(.5f);
if (mode % 2 == 0)
controller.WeaponChangeOnly(WeaponMode.WeaponTypeA);
else
controller.WeaponChangeOnly(WeaponMode.WeaponTypeB);
}
2 years ago
}