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.
		
		
		
		
		
			
		
			
	
	
		
			94 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C#
		
	
		
		
			
		
	
	
			94 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C#
		
	
| 
											2 years ago
										 | using System.Collections.Generic; | ||
|  | using Game.Common; | ||
|  | 
 | ||
|  | namespace Game | ||
|  | { | ||
|  |     public class PageGmPanel : UIPageBase<ViewGMPanel> | ||
|  |     { | ||
|  |         private Dictionary<string, List<GmInfo>> _mGmDict; | ||
|  |         public PageGmPanel() | ||
|  |         { | ||
|  |             _mGmDict = new Dictionary<string, List<GmInfo>>(); | ||
|  |         } | ||
|  |         protected override void OnCreate() | ||
|  |         { | ||
|  |             CreateUI(true); | ||
|  | 
 | ||
|  |             View.m_ConsoleInput.onClick.Clear(); | ||
|  |             View.m_ConsoleInput.onClick.Add(() => | ||
|  |             { | ||
|  |                 View.m_ConsoleInput.RequestFocus(); | ||
|  |             }); | ||
|  |         } | ||
|  |         protected override void OnDestroy() { } | ||
|  |         protected override void OnOpen() | ||
|  |         { | ||
|  |             View.m_LayerList.RemoveChildrenToPool(); | ||
|  |             _mGmDict.Clear(); | ||
|  | 
 | ||
|  |             var gmList = GmManager.Instance.MGmList; | ||
|  |             foreach (var gmInfo in gmList) | ||
|  |             { | ||
|  |                 var layerName = gmInfo.MLayer.ToString(); | ||
|  |                 if (!_mGmDict.ContainsKey(layerName)) | ||
|  |                 { | ||
|  |                     _mGmDict[layerName] = new List<GmInfo>(); | ||
|  |                     var item = View.m_LayerList.AddItemFromPool().asButton; | ||
|  |                     item.title = layerName; | ||
|  |                     item.onClick.Clear(); | ||
|  |                     item.onClick.Add(() => | ||
|  |                     { | ||
|  |                         RefreshSubPanel(item.title); | ||
|  |                     }); | ||
|  |                 } | ||
|  |                 _mGmDict[layerName].Add(gmInfo); | ||
|  |             } | ||
|  |             RefreshSubPanel("_first"); | ||
|  |         } | ||
|  |         protected override void OnClose() | ||
|  |         { | ||
|  |         } | ||
|  |         public override void Update() | ||
|  |         { | ||
|  | 
 | ||
|  |         } | ||
|  |         public void RefreshSubPanel(string layerName) | ||
|  |         { | ||
|  |             View.m_GmList.RemoveChildrenToPool(); | ||
|  |             if (layerName == "_first") | ||
|  |             { | ||
|  |                 if (_mGmDict.Count == 0) | ||
|  |                 { | ||
|  |                     return; | ||
|  |                 } | ||
|  |                 else | ||
|  |                 { | ||
|  |                     var e = _mGmDict.Keys.GetEnumerator(); | ||
|  |                     e.MoveNext(); | ||
|  |                     layerName = e.Current; | ||
|  |                 } | ||
|  |             } | ||
|  |             var gmList = _mGmDict[layerName]; | ||
|  |             foreach (var gmInfo in gmList) | ||
|  |             { | ||
|  |                 var item = View.m_GmList.AddItemFromPool().asButton; | ||
|  |                 item.title = gmInfo.MName; | ||
|  |                 item.onClick.Clear(); | ||
|  |                 item.onClick.Add(() => | ||
|  |                 { | ||
|  |                     gmInfo.MCallback(StringHelper.ParseToParam(View.m_ConsoleInput.text)); | ||
|  |                 }); | ||
|  |             } | ||
|  |         } | ||
|  |         protected override void OnInput(PPlayerInput context) | ||
|  |         { | ||
|  |             if (context.Action == EKeyActionType.Press) | ||
|  |             { | ||
|  |                 if (context.Key == EFunctionKey.Menu) | ||
|  |                 { | ||
|  |                     UIManager.Instance.Close(); | ||
|  |                 } | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | } |