diff --git a/Assets/Scenes/Main.cs b/Assets/Scenes/Main.cs index 0a34628..17754ff 100644 --- a/Assets/Scenes/Main.cs +++ b/Assets/Scenes/Main.cs @@ -13,6 +13,7 @@ public class Main : MonoBehaviour private GameObject weaponL; private GameObject weaponR; private GameObject attachment; + private RuntimeAnimatorController originAnimator; private string basePath = "F:/Ongeki_Unity/ab/"; public Dictionary> charaAssetsNames = new Dictionary>(); @@ -28,16 +29,8 @@ public class Main : MonoBehaviour loadCharaCSV(); loadWeaponCSV(); loadAttachmentCSV(); - GameObject.Find("charaDropdown").GetComponent().value = 14; - - - //var bundlec = AssetBundle.LoadFromFile(basePath + "ch_000000_01_003"); - //var ac = bundlec.LoadAsset("ch_000000_01_003"); - //chara.GetComponent().runtimeAnimatorController = ac; - - } @@ -243,6 +236,43 @@ public class Main : MonoBehaviour + #region Animator + public void loadAnimator(int i) + { + if (i == 0) + { + chara.GetComponent().runtimeAnimatorController = originAnimator; + } + else + { + string[] names = { + "", + "ch_000000_01_002", + "ch_000000_01_003", + "ch_000000_02_002", + "ch_000000_02_003", + "ch_000000_03_002", + "ch_000000_03_003", + "ch_000000_04_002", + "ch_000000_04_003", + "ch_000000_05_002", + "ch_000000_05_003", + "ch_000000_06_002", + "ch_000000_06_003", + }; + var animatorName = names[i]; + var bundle = AssetBundle.LoadFromFile(basePath + animatorName); + var aoc = bundle.LoadAsset(animatorName); + if (originAnimator == null) + originAnimator = chara.GetComponent().runtimeAnimatorController; + chara.GetComponent().runtimeAnimatorController = aoc; + bundle.Unload(false); + } + } + #endregion + + + #region Internal void addWeaponButtonListener(RemoveAnimationTransfrom rat, string LR) { diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 82c29ff..b2d5b72 100644 Binary files a/Assets/Scenes/MainScene.unity and b/Assets/Scenes/MainScene.unity differ diff --git a/Assets/Scenes/UIFunction.cs b/Assets/Scenes/UIFunction.cs index 770c623..bff1c1b 100644 --- a/Assets/Scenes/UIFunction.cs +++ b/Assets/Scenes/UIFunction.cs @@ -48,4 +48,9 @@ public class UIFunction : MonoBehaviour main.loadAttachment(attachmentName); } } + + public void chooseAnimator(int i) + { + main.loadAnimator(i); + } }