Exemplo n.º 1
0
        //初始化技能
        private void InitSkills()
        {
#if UNITY_EDITOR
            string[] files = System.IO.Directory.GetFiles(
                string.Format("{0}/HalfSLG/ScriptableObjects/BattleSkill", Application.dataPath), "*.asset", System.IO.SearchOption.TopDirectoryOnly);
            foreach (var item in files)
            {
                string         file  = UtilityHelper.ConverToRelativePath(item.Replace("\\", "/"));
                SO_BattleSkill skill = UnityEditor.AssetDatabase.LoadAssetAtPath <SO_BattleSkill>(file);
                if (skill != null)
                {
                    dicBattleSkills.Add(skill.skillID, skill);
                }
            }
#endif
        }
Exemplo n.º 2
0
        //初始化界面配置
        private void InitViewConfig()
        {
            //加载界面配置
#if UNITY_EDITOR
            //编辑器下读取
            string   configPath = "Assets/HalfSLG/ScriptableObjects/UIView";
            string[] configs    = Directory.GetFiles(UtilityHelper.ConvertToObsPath(configPath), "*.asset", SearchOption.TopDirectoryOnly);
            foreach (var item in configs)
            {
                string path   = UtilityHelper.ConverToRelativePath(item.Replace("\\", "/"));
                var    config = AssetDatabase.LoadAssetAtPath <SO_UIViewConfig>(path);
                //对config进行一次纠正,常驻内存的界面,必须是唯一的
                if (config.cacheScheme == UIViewCacheScheme.Cache)
                {
                    config.unique = true;
                }
                uiViewConfig.Add(config.viewName, config);
            }
#endif
            Debug.Log("View config inited.");
        }