//获取组件 public T GetComponent <T> () where T : MComponent { MComponent value = null; if (componDict.ContainsKey(typeof(T))) { value = componDict[typeof(T)]; } return(value as T); }
//弹出组件 public T PopComponent <T>() where T : MComponent { MComponent value = null; if (componDict.ContainsKey(typeof(T))) { value = componDict[typeof(T)]; componDict[typeof(T)].DisEnable(); componDict.Remove(typeof(T)); } return(value as T); }
public List <T> GetCommponents <T>() where T : MComponent { List <T> coms = new List <T>(); for (int i = 0; i < appServer.PeerList.Count; i++) { MComponent com = (appServer.PeerList[i] as ClientPeer).GetComponent <T>(); if (com != null) { coms.Add(com as T); } } return(coms); }