You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			99 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			99 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C#
		
	
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| using Articy.Touhou;
 | |
| 
 | |
| namespace Game
 | |
| {
 | |
|     public delegate void GmHandler(List<object> param);
 | |
|     public enum EgmLayerType
 | |
|     {
 | |
|         Common,
 | |
|         Battle,
 | |
|         Bless,
 | |
|         Level,
 | |
|     }
 | |
|     public class GmInfo
 | |
|     {
 | |
|         public string MName;
 | |
|         public EgmLayerType MLayer;
 | |
|         public GmHandler MCallback;
 | |
|         public Color MColor;
 | |
|         public GmInfo(string name, EgmLayerType layer, GmHandler callback)
 | |
|         {
 | |
|             MName = name;
 | |
|             MLayer = layer;
 | |
|             MCallback = callback;
 | |
|         }
 | |
|     }
 | |
|     public class GmManager : ManagerBase<GmManager>
 | |
|     {
 | |
|         public List<GmInfo> MGmList = new List<GmInfo>();
 | |
|         public override void OnCreate()
 | |
|         {
 | |
|             BuildCommon();//通用
 | |
|             BuildMonster();//怪物
 | |
|             // buildBless();//祝福交互物
 | |
|             BuildLevel();//关卡
 | |
|         }
 | |
|         public override void Update() { }
 | |
|         public override void OnDestroy() { }
 | |
|         private void BuildCommon()
 | |
|         {
 | |
|             var debugLog = new GmInfo("GM测试打印", EgmLayerType.Common, (param) =>
 | |
|             {
 | |
|                 Util.Print("GM测试打印");
 | |
|             });
 | |
|             MGmList.Add(debugLog);
 | |
|         }
 | |
|         private void BuildMonster()
 | |
|         {
 | |
|             var allEntities = Util.GetMonsterConfigDataAll();
 | |
|             var allEntitiesSorted = new List<Monster>(allEntities);
 | |
|             allEntitiesSorted.Sort((a, b) =>
 | |
|             {
 | |
|                 var aBasicInfo = a.GetFeatureEntityParam();
 | |
|                 var bBasicInfo = b.GetFeatureEntityParam();
 | |
|                 return aBasicInfo.AnimationName.CompareTo(bBasicInfo.AnimationName);
 | |
|             });
 | |
|             foreach (var item in allEntitiesSorted)
 | |
|             {
 | |
|                 var basicInfo = (item as IObjectWithFeatureEntityParam).GetFeatureEntityParam();
 | |
|                 if ((EEntityType)basicInfo.EntityType != EEntityType.Monster)
 | |
|                 {
 | |
|                     continue;
 | |
|                 }
 | |
|                 var name = basicInfo.Name;
 | |
|                 var newGm = new GmInfo($"创建{name}", EgmLayerType.Battle, (param) =>
 | |
|                 {
 | |
|                     Util.CreateEntity(item.TechnicalName, (entity) =>
 | |
|                     {
 | |
|                         entity.SetPos(Util.GetMaster().Pos() + Vector3.right);
 | |
|                     });
 | |
|                 });
 | |
|                 MGmList.Add(newGm);
 | |
|             }
 | |
|         }
 | |
|         private void BuildLevel()
 | |
|         {
 | |
|             var allLevels = Util.GetLevelConfigDataAll();
 | |
|             var allLevelsSorted = new List<Level>(allLevels);
 | |
|             allLevelsSorted.Sort((a, b) =>
 | |
|             {
 | |
|                 var aBasicInfo = a.GetFeatureLevel();
 | |
|                 var bBasicInfo = b.GetFeatureLevel();
 | |
|                 return aBasicInfo.Prefab.CompareTo(bBasicInfo.Prefab);
 | |
|             });
 | |
| 
 | |
|             foreach (var item in allLevels)
 | |
|             {
 | |
|                 var name = item.DisplayName;
 | |
|                 var newGm = new GmInfo($"{name}", EgmLayerType.Level, (param) =>
 | |
|                 {
 | |
|                     Util.EnterLevel(item.TechnicalName);
 | |
|                 });
 | |
|                 MGmList.Add(newGm);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|     }
 | |
| } |