Пример #1
0
        public void ReConnect(string accountid)
        {
            SocketServer socketServer = FightServer.Instance.GetServer();
            LemonMessage msg          = new LemonMessage();

            msg.Body = new JsonSerialize().SerializeToString(Battle);

            ToCleintCommand.SendMsgToOneClient(Battle.Step, accountid, Battle, msg);
        }
Пример #2
0
        private void SendToClient(BattleCommand command, string askAccountID = null)
        {
            Battle.Step           = command;
            Battle.LibraryCardNum = CardLibrary.Count;
            string battleStr = JsonSerialize.SerializeToString(Battle);
            Battle newBattle = (Battle)JsonSerialize.DeserializeFromString(battleStr, typeof(Battle));

            Record.Add(newBattle);
            Countdown.SetCommand(command);
            ToCleintCommand.SendToClient(command, Battle, askAccountID);
        }
Пример #3
0
        public void Dissolve(string otherid)
        {
            //清除正在战斗的状态
            new BattleService().ClearBattleSidesState(Battle);
            BattlegroundManager.Instance.DeleteBattle(this);
            //通知
            SocketServer socketServer = FightServer.Instance.GetServer();
            LemonMessage msg          = new LemonMessage();

            Battle.Step = BattleCommand.NoticeDissolve;
            msg.Body    = new JsonSerialize().SerializeToString(Battle);

            ToCleintCommand.SendMsgToAllClient(BattleCommand.NoticeDissolve, Battle, msg);
        }
Пример #4
0
        public int GoOut(string otherid)
        {
            new BattleService().ClearBattleOneSideState(Battle, otherid);
            Battle.Sides.RemoveAll(c => c.AccountID == otherid);
            //通知
            SocketServer  socketServer = FightServer.Instance.GetServer();
            LemonMessage  msg          = new LemonMessage();
            BattleCommand oldSetp      = Battle.Step;

            Battle.Step = BattleCommand.NoticeGoOut;
            msg.Body    = new JsonSerialize().SerializeToString(Battle);
            Battle.Step = oldSetp;

            ToCleintCommand.SendMsgToAllClient(BattleCommand.NoticeGoOut, Battle, msg);
            //foreach (var c in socketServer.AllConnect())
            //{
            //    if (!Battle.Sides.Any(s => s.AccountID == c.ConnectID) && c.ConnectID != otherid)
            //        continue;
            //    c.SendMessage(msg);
            //    LogHelper.DebugLog("server send " + BattleCommand.NoticeGoOut);
            //}
            //BattleAIServerManager.Instance.SendToAllAIUser(BattleCommand.NoticeGoOut, Battle);
            return(0);
        }