示例#1
0
        //获取组件
        public T GetComponent <T> () where T : MComponent
        {
            MComponent value = null;

            if (componDict.ContainsKey(typeof(T)))
            {
                value = componDict[typeof(T)];
            }

            return(value as T);
        }
示例#2
0
        //弹出组件
        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);
        }
示例#3
0
        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);
        }