Esempio n. 1
0
        /**
         * 匹配成功广播
         */
        public void OnMatchPlayers(BroadcastEvent eve)
        {
            var bst = new MatchPlayersBst();

            bst.MergeFrom((ByteString)eve.Data);
            var roomInfo = new RoomInfo(bst.RoomInfo);

            this._room.RoomUtil.SetRoomInfo(roomInfo);
            if (roomInfo.PlayerList != null)
            {
                if (roomInfo.PlayerList.Any(info => Listener.IsMe(info.Id)))
                {
                    this._room.RoomUtil.ActiveFrame();
                }
            }
            string tag;

            if (bst.MatchType == MatchType.PlayerComplex)
            {
                tag = BroadcastOnce.PlayerComplex;
            }
            else
            {
                return;
            }
            eve.Data = bst;
            var e = new ResponseEvent(ErrCode.EcOk, "", "", eve.Data);

            BroadcastOnce.Once(tag, e);
        }
Esempio n. 2
0
        public static void Once(string tag, ResponseEvent eve)
        {
            var cbs = Callbacks.ContainsKey(tag) ? Callbacks[tag] : new List <Action <ResponseEvent> >();

            foreach (var cb in cbs.Where(cb => cb != null))
            {
                cb(eve);
            }
            BroadcastOnce.RemoveCallbacksByTag(tag);
        }