Esempio n. 1
0
        public void SaveToFile(string path, bool bAutoSave)
        {
            SavePreprocess();
            StreamWriter sw = File.CreateText(path);

            sw.WriteLine("{0}", _waves.Count);

            LevelEntityStatistics.CulWaves(_waves);

            int preLoadCount = LevelEntityStatistics.suggest.Count;

            sw.WriteLine("{0}", preLoadCount);

            foreach (var item in LevelEntityStatistics.suggest)
            {
                if (item.Value > 0)
                {
                    sw.WriteLine("pi:" + item.Key + "," + item.Value);
                }
            }
            foreach (EditorWave _wave in _waves)
            {
                _wave.WriteToFile(sw);
            }
            sw.Flush();
            sw.Close();
            AssetDatabase.Refresh();
        }
Esempio n. 2
0
        public void LoadFromFile()
        {
            current_level = "";
            string path = EditorUtility.OpenFilePanel("Select a file to load", XEditorLibrary.Lev, "txt");

            RemoveSceneViewInstance();
            _waves.Clear();
            _currentEdit = -1;
            int v   = path.LastIndexOf("Level/");
            int dot = path.LastIndexOf(".");

            current_level = path.Substring(v + 6, dot - v - 6);
            LoadFromFile(path);
            LevelEntityStatistics.CulWaves(_waves);
        }
Esempio n. 3
0
        private void DrawPreloadView()
        {
            LevelEntityStatistics.CulWaves(levelMgr._waves);
            GUIStyle style = new GUIStyle();

            EditorGUILayout.LabelField("Preload  : ");
            foreach (var item in LevelEntityStatistics.suggest)
            {
                int suggest = item.Value;
                int max     = 10;
                if (suggest > max || suggest == 0)
                {
                    style.normal.textColor = Color.red;
                }
                else
                {
                    style.normal.textColor = Color.white;
                }
                int all = LevelEntityStatistics.statistics[item.Key];
                EditorGUILayout.LabelField(string.Format("MonsterID: {0}   (预加载数量: {1})   统计数量:{2}", item.Key, suggest, all), style);
                GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });
            }
        }