Exemplo n.º 1
0
        /// <summary>指令业务</summary>
        public void Service(ProtocolQueue model)
        {
#if DEBUG
            XTrace.WriteLine("commandNumber:{0}", model.Protocol.commandNumber);
#endif
            try
            {
                if (model.Session == null)
                {
                    return;
                }
                TGGSession session = model.Session;

                var key = string.Format("{0}_{1}_{2}", session.Player.User.id, model.Protocol.moduleNumber, model.Protocol.commandNumber);
                if (Variable.CCI.ContainsKey(key))
                {
                    session.SendData(session.InitProtocol(model, (int)ResponseType.TYPE_COMMAND_FAST, null));
                    return;
                }
                Variable.CCI.TryAdd(key, true);

                var data = CommandSwitch.GetInstance().Switch(model.Protocol.commandNumber, session, model.Protocol.data);
                var pv   = session.InitProtocol(model, (int)ResponseType.TYPE_SUCCESS, data);
                session.SendData(pv);
                RemoveCommand(key);
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
                if (model.Session != null)
                {
                    model.Session.CommandEnd(model);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>推送协议</summary>
        private void RoleHireEndSend(TGGSession session)
        {
            var data = new ASObject();
            var pv   = session.InitProtocol((int)ModuleNumber.ROLE, (int)RoleCommand.ROLE_HIRE_END, (int)ResponseType.TYPE_SUCCESS, data);

            session.SendData(pv);
        }
Exemplo n.º 3
0
        /// <summary> 推送协议 </summary>
        /// <param name="session">session</param>
        /// <param name="task">任务实体</param>
        public void SendProtocol(TGGSession session, tg_task task)
        {
            var aso = new ASObject(BulidData(task));
            var pv  = session.InitProtocol((int)ModuleNumber.WORK, (int)WorkCommand.WORK_PUSH_UPDATE, (int)ResponseType.TYPE_SUCCESS, aso);

            session.SendData(pv);
        }
Exemplo n.º 4
0
        /// <summary> 推送协议 </summary>
        /// <param name="session">session</param>
        /// <param name="id">战斗Vo</param>
        public void SendProtocol(TGGSession session, Int64 id)
        {
            var aso = new ASObject(BulidData(id));
            var pv  = session.InitProtocol((int)ModuleNumber.TASK, (int)TaskCommand.TASK_PUSH_DELETE, (int)ResponseType.TYPE_SUCCESS, aso);

            session.SendData(pv);
        }
Exemplo n.º 5
0
        /// <summary> 推送协议 </summary>
        /// <param name="session">session</param>
        /// <param name="model">战斗Vo</param>
        public void SendProtocol(TGGSession session, FightVo model)
        {
            var aso = new ASObject(FIGHT_PERSONAL_ENTER.GetInstance().BuildData(Convert.ToInt32(ResultType.SUCCESS), model));
            var pv  = session.InitProtocol((int)ModuleNumber.FIGHT, (int)FightCommand.FIGHT_PERSONAL_ENTER, (int)ResponseType.TYPE_SUCCESS, aso);

            session.SendData(pv);
        }
Exemplo n.º 6
0
        /// <summary>推送玩家离开家族</summary>
        private static void LogPush(TGGSession session, ASObject data)
        {
#if DEBUG
            XTrace.WriteLine("{0}:{1}", "FAMILY_LEAVE_PUSH", "推送玩家离开家族");
#endif
            var pv = session.InitProtocol((int)ModuleNumber.FAMILY, (int)TGG.Core.Enum.Command.FamilyCommand.FAMILY_LEAVE_PUSH, (int)ResponseType.TYPE_SUCCESS, data);
            session.SendData(pv);
        }
Exemplo n.º 7
0
        /// <summary>战斗推送</summary>
        private static void FightPush(TGGSession session, ASObject data)
        {
#if DEBUG
            XTrace.WriteLine("{0}:{1}", "WORK_FIGHT_PUSH", "战斗推送");
#endif
            var pv = session.InitProtocol((int)ModuleNumber.WORK, (int)TGG.Core.Enum.Command.WorkCommand.WORK_FIGHT_PUSH, (int)ResponseType.TYPE_SUCCESS, data);
            session.SendData(pv);
        }
Exemplo n.º 8
0
        /// <summary>发送修行结束协议</summary>
        private static void TrainRolePush(TGGSession session, ASObject data)
        {
#if DEBUG
            XTrace.WriteLine("{0}:{1}", "TRAIN_ROLE_PUSH", "武将修行结束协议发送");
#endif
            var pv = session.InitProtocol((int)ModuleNumber.ROLETRAIN, (int)RoleTrainCommand.TRAIN_ROLE_PUSH, (int)ResponseType.TYPE_SUCCESS, data);
            session.SendData(pv);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 发送协议
        /// </summary>
        /// <param name="session"></param>
        /// <param name="data"></param>
        /// <param name="commandNumber"></param>
        /// <param name="mn"></param>
        public void SendPushCommand(TGGSession session, ASObject data, int commandNumber, int mn)
        {
            var pv = new ProtocolVo
            {
                serialNumber     = 1,
                verificationCode = 1,
                moduleNumber     = mn,
                commandNumber    = commandNumber,
                sendTime         = 1000,
                serverTime       = (DateTime.Now.Ticks - 621355968000000000) / 10000,
                status           = (int)ResponseType.TYPE_SUCCESS,
                data             = data,
            };

            session.SendData(pv);
        }
Exemplo n.º 10
0
        //private static REWARDS ObjInstance;
        ///// <summary>REWARDS单例模式</summary>
        //public static REWARDS GetInstance()
        //{
        //    return ObjInstance ?? (ObjInstance = new REWARDS());
        //}

        /// <summary>物品更新指令</summary>
        public void CommandStart(TGGSession session, ASObject data)
        {
#if DEBUG
            XTrace.WriteLine("{0}:{1}", "REWARDS", "物品更新");
#endif
            var pv = new ProtocolVo
            {
                serialNumber     = 1,
                verificationCode = 1,
                moduleNumber     = (int)ModuleNumber.USER,
                commandNumber    = (int)UserCommand.REWARDS,
                sendTime         = 1000,
                serverTime       = (DateTime.Now.Ticks - 621355968000000000) / 10000,
                status           = (int)ResponseType.TYPE_SUCCESS,
                data             = data,
            };
            session.SendData(pv);
        }
Exemplo n.º 11
0
        /// <summary>推送发送</summary>
        private void TrainingRoleEndSend(TGGSession session, ASObject data)
        {
            var pv = session.InitProtocol((int)ModuleNumber.SCENE, (int)SceneCommand.LOGIN_ENTER_SCENE, (int)ResponseType.TYPE_SUCCESS, data);

            session.SendData(pv);
        }
Exemplo n.º 12
0
        /// <summary> 推送协议 </summary>
        /// <param name="session">session</param>
        /// <param name="aso">aso</param>
        public void SendProtocol(TGGSession session, ASObject aso)
        {
            var pv = session.InitProtocol((int)ModuleNumber.FIGHT, (int)FightCommand.FIGHT_PERSONAL_JOIN, (int)ResponseType.TYPE_SUCCESS, aso);

            session.SendData(pv);
        }
Exemplo n.º 13
0
        /// <summary>推送协议</summary>
        public void TrainingRoleEndSend(TGGSession session, ASObject data)
        {
            var pv = session.InitProtocol((int)ModuleNumber.CHAT, (int)ChatsCommand.CHATS_PUSH, (int)ResponseType.TYPE_SUCCESS, data);

            session.SendData(pv);
        }
Exemplo n.º 14
0
        /// <summary>推送协议</summary>
        private void TrainingRoleEndSend(TGGSession session, ASObject data, int commandnumber)
        {
            var pv = session.InitProtocol((int)ModuleNumber.CHAT, commandnumber, (int)ResponseType.TYPE_SUCCESS, data);

            session.SendData(pv);
        }
Exemplo n.º 15
0
        /// <summary>推送协议</summary>
        public void TrainingSiegeEndSend(TGGSession session, ASObject data, int type)
        {
            var pv = session.InitProtocol((int)ModuleNumber.SIEGE, type, (int)ResponseType.TYPE_SUCCESS, data);

            session.SendData(pv);
        }