using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; public class FateModelBuilder : MonoBehaviour { public Material ParticleMaterial; public static FateModelBuilder Instance; public bool LoadingInProgress = false; public AnimatorOverrideController AnimatorController; private void Awake() { Instance = this; } public IEnumerator ReplaceServant(string id) { if (LoadingInProgress) { Error.Log(Color.red, "Loading already in progress!"); yield break; } if (FateViewerMain.SelectedServant != null) { FateViewerMain.SelectedServant.DeleteModel(); } yield return LoadServant(id); } public IEnumerator LoadServant(string id) { if (LoadingInProgress) yield break; LoadingInProgress = true; var Servants = FateViewerMain.Instance.Servants; int idNum = int.Parse(id); var urlBase = $"{FateViewerMain.AAContent}Servants/{idNum}"; var costume = Servants.GetAllCostumes().FirstOrDefault(s => s.battleCharaId == idNum); if (costume != null) { var servant = Servants.Entries.First(s => s.costumes.Contains(costume)); var lcButt = UIController.Instance.LoadedCharaButton; lcButt.GetComponentInChildren().text = servant.name + " - AA database"; lcButt.GetComponentInChildren