77 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.IO;
 | |
| using System.Text.RegularExpressions;
 | |
| using UnityEngine;
 | |
| using UnityEditor;
 | |
| using UnityEditor.SceneManagement;
 | |
| 
 | |
| public class DesignerTool : Editor
 | |
| {
 | |
|     [MenuItem("策划工具/导表")]
 | |
|     public static void CreateTables()
 | |
|     {
 | |
|         TableCreater.CreateTableAsset<TableLevel, DataLevel, int>();
 | |
|         TableCreater.CreateTableAsset<TableIAP, DataIAP, string>();
 | |
|         TableCreater.CreateTableAsset<TablePet, DataPet, int>();
 | |
|         TableCreater.CreateTableAsset<TableFloor, DataFloor, int>();
 | |
|         TableCreater.CreateTableAsset<TableUnit, DataUnit, string>();
 | |
|     }
 | |
| 
 | |
|     [MenuItem("策划工具/导出关卡Json")]
 | |
|     public static void CreateLevelJson()
 | |
|     {
 | |
|         LevelOnlineData tData = new LevelOnlineData();
 | |
| 
 | |
|         tData.Version = Application.version;
 | |
|         tData.Formations = new List<string>();
 | |
|         List<DataLevel> tLevelList = TableLevel.Instance.GetAll();
 | |
|         int tCount = Mathf.Min(100, tLevelList.Count);
 | |
|         for (int i = 0; i < tCount; i++)
 | |
|         {
 | |
|             tData.Formations.Add(tLevelList[i].Formation);
 | |
|         }
 | |
| 
 | |
|         string tFilePath = string.Format("Assets/Excels/LevelOnline.json");
 | |
|         FileInfo tFile = new FileInfo(tFilePath);
 | |
|         StreamWriter tSW = tFile.CreateText();
 | |
|         string tJson = LevelOnlineData.DataToJson(tData);
 | |
| 
 | |
|         tSW.WriteLine(tJson);
 | |
|         tSW.Close();
 | |
|         tSW.Dispose();
 | |
| 
 | |
|         AssetDatabase.Refresh();
 | |
|     }
 | |
| 
 | |
|     [MenuItem("策划工具/运行游戏(手摆阵容)")]
 | |
|     public static void PlayGame1()
 | |
|     {
 | |
|         GameConfig.Instance.IsAutoLevel = false;
 | |
|         RealPlay();
 | |
|     }
 | |
| 
 | |
|     [MenuItem("策划工具/运行游戏(召唤次数)")]
 | |
|     public static void PlayGame2()
 | |
|     {
 | |
|         GameConfig.Instance.IsAutoLevel = true;
 | |
|         RealPlay();
 | |
|     }
 | |
| 
 | |
|     private static void RealPlay()
 | |
|     {
 | |
|         GameConfig.Instance.IsDebug = true;
 | |
|         AssetDatabase.SaveAssets();
 | |
|         AssetDatabase.Refresh();
 | |
| 
 | |
|         if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
 | |
|         {
 | |
|             EditorSceneManager.OpenScene("Assets/Scenes/Init.unity");
 | |
|         }
 | |
| 
 | |
|         if (!EditorApplication.isPlaying)
 | |
|         {
 | |
|             EditorApplication.isPlaying = true;
 | |
|         }
 | |
|     }
 | |
| } |