add animator ui

master
wlt233 8 months ago
parent 39dbecf0ba
commit c65f8d7986

@ -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<string, List<string>> charaAssetsNames = new Dictionary<string, List<string>>();
@ -29,15 +30,7 @@ public class Main : MonoBehaviour
loadWeaponCSV();
loadAttachmentCSV();
GameObject.Find("charaDropdown").GetComponent<Dropdown>().value = 14;
//var bundlec = AssetBundle.LoadFromFile(basePath + "ch_000000_01_003");
//var ac = bundlec.LoadAsset<AnimatorOverrideController>("ch_000000_01_003");
//chara.GetComponent<Animator>().runtimeAnimatorController = ac;
}
@ -243,6 +236,43 @@ public class Main : MonoBehaviour
#region Animator
public void loadAnimator(int i)
{
if (i == 0)
{
chara.GetComponent<Animator>().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<AnimatorOverrideController>(animatorName);
if (originAnimator == null)
originAnimator = chara.GetComponent<Animator>().runtimeAnimatorController;
chara.GetComponent<Animator>().runtimeAnimatorController = aoc;
bundle.Unload(false);
}
}
#endregion
#region Internal
void addWeaponButtonListener(RemoveAnimationTransfrom rat, string LR)
{

Binary file not shown.

@ -48,4 +48,9 @@ public class UIFunction : MonoBehaviour
main.loadAttachment(attachmentName);
}
}
public void chooseAnimator(int i)
{
main.loadAnimator(i);
}
}

Loading…
Cancel
Save