add animator ui

master
wlt233 5 months ago
parent 39dbecf0ba
commit c65f8d7986

@ -13,6 +13,7 @@ public class Main : MonoBehaviour
private GameObject weaponL; private GameObject weaponL;
private GameObject weaponR; private GameObject weaponR;
private GameObject attachment; private GameObject attachment;
private RuntimeAnimatorController originAnimator;
private string basePath = "F:/Ongeki_Unity/ab/"; private string basePath = "F:/Ongeki_Unity/ab/";
public Dictionary<string, List<string>> charaAssetsNames = new Dictionary<string, List<string>>(); public Dictionary<string, List<string>> charaAssetsNames = new Dictionary<string, List<string>>();
@ -28,16 +29,8 @@ public class Main : MonoBehaviour
loadCharaCSV(); loadCharaCSV();
loadWeaponCSV(); loadWeaponCSV();
loadAttachmentCSV(); loadAttachmentCSV();
GameObject.Find("charaDropdown").GetComponent<Dropdown>().value = 14; 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 #region Internal
void addWeaponButtonListener(RemoveAnimationTransfrom rat, string LR) void addWeaponButtonListener(RemoveAnimationTransfrom rat, string LR)
{ {

Binary file not shown.

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

Loading…
Cancel
Save