IEnumerator CheckDataLoaded(List <System.Object> allData, Action callback) { //Load Config Root and Config Mission bool isLoadRoot = false; bool isLoadMission = false; bool isLoadPlayer = false; ConfigRoot rootConfig = null; ConfigMission missionConfig = null; ConfigPlayer configPlayer = null; while (rootConfig == null && isLoadRoot == false) { rootConfig = ConfigRoot.Instance; isLoadRoot = true; yield return(null); } while (missionConfig == null && isLoadMission == false) { missionConfig = ConfigMission.Instance; isLoadMission = true; yield return(null); } while (configPlayer == null && isLoadPlayer == false) { configPlayer = ConfigPlayer.Instance; isLoadPlayer = true; yield return(null); } #if DevMode //add console GameObject console = GameObject.Find(m_consolePrefabName); if (console == null) { PrefabManager.Instance.InstantiateAsync <Transform> (m_consolePrefabName, (result) => { Debug.Log($"===========aas:{result.key}加载完成."); Debug.Log($"===========aas:{result.key}加载完成."); Transform tf = result.result as Transform; tf.gameObject.name = m_consolePrefabName; }); } #endif callback(); }
IEnumerator LoadConfig(Action callback) { enemy = Resources.Load("DataTable/ConfigEnemy", typeof(ScriptableObject)) as ConfigEnemy; yield return(new WaitUntil(() => enemy != null)); mission = Resources.Load("DataTable/ConfigMission", typeof(ScriptableObject)) as ConfigMission; yield return(new WaitUntil(() => mission != null)); wave = Resources.Load("DataTable/ConfigWave", typeof(ScriptableObject)) as ConfigWave; yield return(new WaitUntil(() => wave != null)); gun = Resources.Load("DataTable/ConfigGun", typeof(ScriptableObject)) as ConfigGun; yield return(new WaitUntil(() => gun != null)); gunDmg = Resources.Load("DataTable/ConfigGunDamage", typeof(ScriptableObject)) as ConfigGunDamage; yield return(new WaitUntil(() => gunDmg != null)); gunRof = Resources.Load("DataTable/ConfigGunRof", typeof(ScriptableObject)) as ConfigGunRof; yield return(new WaitUntil(() => gunRof != null)); playerDamage = Resources.Load("DataTable/ConfigPlayerDamage", typeof(ScriptableObject)) as ConfigPlayerDamage; yield return(new WaitUntil(() => playerDamage != null)); playerFireRate = Resources.Load("DataTable/ConfigPlayerFireRate", typeof(ScriptableObject)) as ConfigPlayerFireRate; yield return(new WaitUntil(() => playerFireRate != null)); tip = Resources.Load("DataTable/ConfigTip", typeof(ScriptableObject)) as ConfigTip; yield return(new WaitUntil(() => tip != null)); playerCoinValue = Resources.Load("DataTable/ConfigPlayerCoinValue", typeof(ScriptableObject)) as ConfigPlayerCoinValue; yield return(new WaitUntil(() => playerCoinValue != null)); playerDailyCoin = Resources.Load("DataTable/ConfigPlayerDailyCoin", typeof(ScriptableObject)) as ConfigPlayerDailyCoin; yield return(new WaitUntil(() => playerDailyCoin != null)); buffDebuff = Resources.Load("DataTable/ConfigBuffDebuff", typeof(ScriptableObject)) as ConfigBuffDebuff; yield return(new WaitUntil(() => buffDebuff != null)); pBuff = Resources.Load("DataTable/ConfigProjectileBuff", typeof(ScriptableObject)) as ConfigProjectileBuff; yield return(new WaitUntil(() => pBuff != null)); callback?.Invoke(); }