Exemplo n.º 1
0
        public override void InitManager()
        {
            base.InitManager();

            //初始化与战斗有关的单例控制器
            BattleCalculator.Instance.Init();           //战斗计算器
            MapNavigator.Instance.Init();               //导航器
            BattleFieldRenderer.Instance.Init();        //初始化战场显示器

#if UNITY_EDITOR
            //收集战斗数据

            //保存路径
            string brFolder = UtilityHelper.ConvertToObsPath(string.Format("{0}/../BR", Application.dataPath));
            if (!Directory.Exists(brFolder))
            {
                Directory.CreateDirectory(brFolder);
            }

            brPath = string.Format("{0}/{1}_{2}_{3}_{4}_{5}.csv",
                                   brFolder,
                                   System.DateTime.Now.Month,
                                   System.DateTime.Now.Day,
                                   System.DateTime.Now.Hour,
                                   System.DateTime.Now.Minute,
                                   System.DateTime.Now.Second);
#endif
        }
Exemplo n.º 2
0
        public static void ProcessUIViewConfig()
        {
            string prefabPath = UtilityHelper.ConvertToObsPath(PrefabPath);

            string[] allUIPrefab = Directory.GetFiles(
                prefabPath,
                "*.prefab",
                SearchOption.TopDirectoryOnly)
                                   .Where(
                file => file.EndsWith(".prefab") && file.ToLower().Contains("uiview_")).ToArray();

            List <string> newConfigs = new List <string>();
            int           count      = 0;

            foreach (var item in allUIPrefab)
            {
                string fileName = Path.GetFileNameWithoutExtension(item);
                string soPath   = UtilityHelper.ConvertToObsPath(string.Format("{0}/{1}.asset", OutputPath, fileName));
                ++count;
                if (!File.Exists(soPath))
                {
                    //不存在这个so,创建新的
                    SO_UIViewConfig newConfig = ScriptableObject.CreateInstance <SO_UIViewConfig>();
                    newConfig.assetName = fileName;
                    AssetDatabase.CreateAsset(newConfig, string.Format("{0}/{1}.asset", OutputPath, fileName));
                    newConfigs.Add(string.Format(string.Format("(新建) {0}. {1} -> {2} ", count, fileName, OutputPath)));
                }
                else
                {
                    newConfigs.Add(string.Format(string.Format("(已存在) {0}. {1} -> {2} ", count, fileName, OutputPath)));
                }
            }
            if (newConfigs.Count > 0)
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                //显示界面
                UIViewConfigHelperWindow.Show("刷新界面配置文件", newConfigs, new Rect(200, 200, 600, newConfigs.Count * 22 + 50));
            }
            else
            {
                EditorUtility.DisplayDialog("Complete", "There isn't any view config need to be created.", "OK");
            }
        }