Beispiel #1
0
        public void CSFrameMessage(Socket socket, CSFrameNotify data)
        {
            HomeMessage           homeMessage = HomeLogicManager.Instance._personToHome[socket];
            ProtocolSCFrameNotify protocol    = new ProtocolSCFrameNotify();

            protocol.data.Keys.Add(data);
            homeMessage._switchQueue.Push(protocol);
        }
Beispiel #2
0
 public void TryStartBattle(Socket socket)
 {
     while (_waitForStart.Count > 0)
     {
         HomeMessage _hMessage = BeforStartBattle(1);
         StartBattle(_hMessage);
     }
 }
Beispiel #3
0
        public HomeMessage BeforStartBattle(int number)
        {
            HomeMessage _hMessage = new HomeMessage();

            while (number-- != 0)
            {
                Socket person = _waitForStart.Dequeue();
                _hMessage._listSocket.Add(person);
                _personToHome[person] = _hMessage;
                PersonManager.Instance._listPersonStats[person] = PersonManager.PersonStats.BATTLE;
            }
            return(_hMessage);
        }
Beispiel #4
0
        public void StartBattle(HomeMessage homeMessage)
        {
            ProtocolStartGameNotify pbSCStartNotify = new ProtocolStartGameNotify();

            foreach (var item in homeMessage._listSocket)
            {
                ProtoResponseStart pb = new ProtoResponseStart();
                pb.data.Uin = ++homeMessage.num;
                Program.Send(pb, item);
                pbSCStartNotify.data.Uins.Add(pb.data.Uin);
            }

            foreach (var item in homeMessage._listSocket)
            {
                Program.Send(pbSCStartNotify, item);
            }
            homeMessage.currentFrame = 0;
            homeMessage.nextFrame    = 1;
            homeMessage.isStart      = true;
            Logic.Instance._beginHome.Add(homeMessage);
        }