internal void ChangeRoom(int sceneId, int roomId)
 {
     try {
         if (PluginFramework.Instance.IsMainUiScene)
         {
         }
         else
         {
             NodeMessage msg = new NodeMessage(LobbyMessageDefine.ChangeSceneRoom);
             msg.SetHeaderWithGuid(m_Guid);
             GameFrameworkMessage.ChangeSceneRoom protoData = new GameFrameworkMessage.ChangeSceneRoom();
             protoData.m_SceneId = sceneId;
             protoData.m_RoomId  = roomId;
             msg.m_ProtoData     = protoData;
             SendMessage(msg);
         }
     } catch (Exception ex) {
         LogSystem.Error("Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
示例#2
0
        private void HandleVersionVerifyResult(NodeMessage lobbyMsg)
        {
            GameFrameworkMessage.VersionVerifyResult verifyResult = lobbyMsg.m_ProtoData as GameFrameworkMessage.VersionVerifyResult;
            if (null == verifyResult)
            {
                return;
            }
            int ret       = verifyResult.m_Result;
            int enableLog = verifyResult.m_EnableLog;

            //GlobalVariables.Instance.ShopMask = verifyResult.m_ShopMask;
            if (0 == ret)
            {
                //版本校验失败,提示用户需要更新版本。
                StopLoginLobby();
                GfxStorySystem.Instance.SendMessage("version_verify_failed");
            }
            else
            {
                if (enableLog == 0)
                {
                    GameControler.FileLogger.Enabled = false;
                }
                else
                {
                    GameControler.FileLogger.Enabled = true;
                }
                //向服务器发送登录消息
                NodeMessage loginMsg = new NodeMessage(LobbyMessageDefine.AccountLogin, m_AccountId);
                GameFrameworkMessage.AccountLogin protoMsg = new GameFrameworkMessage.AccountLogin();
                loginMsg.m_ProtoData  = protoMsg;
                protoMsg.m_AccountId  = m_AccountId;
                protoMsg.m_Password   = m_Password;
                protoMsg.m_ClientInfo = m_ClientInfo;

                if (null != m_AccountId)
                {
                    SendMessage(loginMsg);
                }
            }
        }
示例#3
0
 private void HandleEnterSceneResult(NodeMessage lobbyMsg)
 {
     GameFrameworkMessage.EnterSceneResult protoData = lobbyMsg.m_ProtoData as GameFrameworkMessage.EnterSceneResult;
     if (null != protoData)
     {
         GeneralOperationResult result = (GeneralOperationResult)protoData.result;
         if (GeneralOperationResult.LC_Succeed == result)
         {
             uint   key     = protoData.key;
             string ip      = protoData.server_ip;
             int    port    = (int)protoData.server_port;
             int    campId  = protoData.camp_id;
             int    sceneId = protoData.scene_type;
             ClientInfo.Instance.PropertyKey = protoData.prime;
             //延迟处理,防止当前正在切场景过程中
             PluginFramework.Instance.QueueAction(PluginFramework.Instance.TryEnterScene, key, ip, port, campId, sceneId);
         }
         else
         {
             PluginFramework.Instance.HighlightPrompt("Tip_SceneEnterFailed");
         }
     }
 }
示例#4
0
        private void HandleStoryMessage(NodeMessage lobbyMsg)
        {
            GameFrameworkMessage.Msg_CLC_StoryMessage protoMsg = lobbyMsg.m_ProtoData as GameFrameworkMessage.Msg_CLC_StoryMessage;
            if (null != protoMsg)
            {
                try {
                    string    msgId = protoMsg.m_MsgId;
                    ArrayList args  = new ArrayList();
                    for (int i = 0; i < protoMsg.m_Args.Count; i++)
                    {
                        switch (protoMsg.m_Args[i].val_type)
                        {
                        case LobbyArgType.NULL:    //null
                            args.Add(null);
                            break;

                        case LobbyArgType.INT:    //int
                            args.Add(int.Parse(protoMsg.m_Args[i].str_val));
                            break;

                        case LobbyArgType.FLOAT:    //float
                            args.Add(float.Parse(protoMsg.m_Args[i].str_val));
                            break;

                        default:    //string
                            args.Add(protoMsg.m_Args[i].str_val);
                            break;
                        }
                    }
                    object[] objArgs = args.ToArray();
                    GfxStorySystem.Instance.SendMessage(msgId, objArgs);
                } catch (Exception ex) {
                    LogSystem.Error("HandleStoryMessage throw exception:{0}\n{1}", ex.Message, ex.StackTrace);
                }
            }
        }
        private void SendHeartbeat()
        {
            NodeMessage msg = new NodeMessage(LobbyMessageDefine.UserHeartbeat, m_Guid);

            SendMessage(msg);
        }
        private void SendGetQueueingCount()
        {
            NodeMessage msg = new NodeMessage(LobbyMessageDefine.GetQueueingCount, m_AccountId);

            SendMessage(msg);
        }
示例#7
0
 internal void HandleQuitRoom(NodeMessage lobbyMsg)
 {
     if (!PluginFramework.Instance.IsMainUiScene)
     {
     }
 }
示例#8
0
 private void HandleNewMail(NodeMessage lobbyMsg)
 {
 }
示例#9
0
 private void HandleServerShutdown(NodeMessage lobbyMsg)
 {
 }
示例#10
0
        private void HandleAccountLoginResult(NodeMessage lobbyMsg)
        {
            GameFrameworkMessage.AccountLoginResult protoData = lobbyMsg.m_ProtoData as GameFrameworkMessage.AccountLoginResult;
            if (null == protoData)
            {
                return;
            }
            GameFrameworkMessage.AccountLoginResult.AccountLoginResultEnum ret = protoData.m_Result;
            ulong userGuid = protoData.m_UserGuid;

            UserNetworkSystem.Instance.IsQueueing = false;
            if (m_HasLoggedOn)  //重连处理
            {
                if (ret == AccountLoginResult.AccountLoginResultEnum.Success)
                {
                    //登录成功,向服务器请求玩家角色
                    m_Guid = userGuid;
                    NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId);
                    GameFrameworkMessage.RoleEnter protoMsg = new GameFrameworkMessage.RoleEnter();
                    msg.m_ProtoData = protoMsg;
                    SendMessage(msg);
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.Queueing ||
                         ret == AccountLoginResult.AccountLoginResultEnum.QueueFull ||
                         ret == AccountLoginResult.AccountLoginResultEnum.Wait)
                {
                    Disconnect();
                }
                else
                {
                    //PluginFramework.Instance.ReturnToLogin();
                }
            }
            else    //首次登录处理
            {
                if (ret == AccountLoginResult.AccountLoginResultEnum.Success)
                {
                    m_Guid = userGuid;
                    //登录成功,向服务器请求玩家角色
                    NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId);
                    GameFrameworkMessage.RoleEnter protoMsg = new GameFrameworkMessage.RoleEnter();
                    protoMsg.m_Nickname = string.Empty;
                    msg.m_ProtoData     = protoMsg;
                    SendMessage(msg);
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.FirstLogin)
                {
                    //账号首次登录,需要指定昵称
                    m_Guid = userGuid;
                    RequestNickname();
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.Wait)
                {
                    //同时登录人太多,需要等待一段时间后再登录
                    PluginFramework.Instance.HighlightPrompt("Tip_TooManyPeople");
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.Banned)
                {
                    //账号已被封停,禁止登录
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.Queueing)
                {
                    PluginFramework.Instance.HighlightPrompt("Tip_Queueing");
                    UserNetworkSystem.Instance.IsQueueing  = true;
                    UserNetworkSystem.Instance.QueueingNum = -1;
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.QueueFull)
                {
                    //排队满
                    StopLoginLobby();
                    PluginFramework.Instance.HighlightPrompt("Tip_QueueFull");
                }
                else
                {
                    //账号登录失败
                    PluginFramework.Instance.HighlightPrompt("Tip_AccountLoginFailed");
                }
            }
        }
示例#11
0
 internal void HandleQuitRoom(NodeMessage lobbyMsg)
 {
     if (!ClientModule.Instance.IsMainUiScene)
     {
     }
 }
 private static string BuildNodeMessage(NodeMessage msg)
 {
     byte[] msgData = Encoding.Encode(msg.m_ID, msg.m_NodeHeader, msg.m_ProtoData);
     return(Convert.ToBase64String(msgData));
 }
        internal static bool SendMessage(NodeMessage msg)
        {
            string msgStr = BuildNodeMessage(msg);

            LogSystem.Info("SendToLobby:{0} {1}", msg.m_ID, msgStr);

            /*
             * /// 测试发包
             * if (msg.m_ID == (int)LobbyMessageDefine.GetMorrowReward
             || msg.m_ID == (int)LobbyMessageDefine.SellItem
             || msg.m_ID == (int)LobbyMessageDefine.DiscardItem
             || msg.m_ID == (int)LobbyMessageDefine.MountEquipment
             || msg.m_ID == (int)LobbyMessageDefine.UnmountEquipment
             || msg.m_ID == (int)LobbyMessageDefine.UpgradeSkill
             || msg.m_ID == (int)LobbyMessageDefine.CompoundEquip
             || msg.m_ID == (int)LobbyMessageDefine.CompoundTalentCard
             || msg.m_ID == (int)LobbyMessageDefine.BuyEliteCount
             || msg.m_ID == (int)LobbyMessageDefine.StartPartnerBattle
             || msg.m_ID == (int)LobbyMessageDefine.EndPartnerBattle
             || msg.m_ID == (int)LobbyMessageDefine.BuyPartnerCombatTicket
             || msg.m_ID == (int)LobbyMessageDefine.RefreshPartnerCombatResult
             || msg.m_ID == (int)LobbyMessageDefine.UpgradeItem
             || msg.m_ID == (int)LobbyMessageDefine.StageClear
             || msg.m_ID == (int)LobbyMessageDefine.SweepStage
             || msg.m_ID == (int)LobbyMessageDefine.LiftSkill
             || msg.m_ID == (int)LobbyMessageDefine.BuyStamina
             || msg.m_ID == (int)LobbyMessageDefine.FinishMission
             || msg.m_ID == (int)LobbyMessageDefine.UpgradeLegacy
             || msg.m_ID == (int)LobbyMessageDefine.AddXSoulExperience
             || msg.m_ID == (int)LobbyMessageDefine.XSoulChangeShowModel
             || msg.m_ID == (int)LobbyMessageDefine.FinishExpedition
             || msg.m_ID == (int)LobbyMessageDefine.ExpeditionAward
             || msg.m_ID == (int)LobbyMessageDefine.MidasTouch
             || msg.m_ID == (int)LobbyMessageDefine.ExchangeGoods
             || msg.m_ID == (int)LobbyMessageDefine.SecretAreaTrial
             || msg.m_ID == (int)LobbyMessageDefine.SecretAreaFightingInfo
             || msg.m_ID == (int)LobbyMessageDefine.RequestRefreshExchange
             || msg.m_ID == (int)LobbyMessageDefine.SelectPartner
             || msg.m_ID == (int)LobbyMessageDefine.UpgradePartnerLevel
             || msg.m_ID == (int)LobbyMessageDefine.UpgradePartnerStage
             || msg.m_ID == (int)LobbyMessageDefine.CompoundPartner
             || msg.m_ID == (int)LobbyMessageDefine.SignInAndGetReward
             || msg.m_ID == (int)LobbyMessageDefine.WeeklyLoginReward
             || msg.m_ID == (int)LobbyMessageDefine.GetOnlineTimeReward
             || msg.m_ID == (int)LobbyMessageDefine.RequestMpveAward
             || msg.m_ID == (int)LobbyMessageDefine.EquipTalent
             || msg.m_ID == (int)LobbyMessageDefine.AddTalentExperience
             || msg.m_ID == (int)LobbyMessageDefine.GainVipReward
             || msg.m_ID == (int)LobbyMessageDefine.GainFirstPayReward
             || msg.m_ID == (int)LobbyMessageDefine.RequestEnhanceEquipmentStar
             || msg.m_ID == (int)LobbyMessageDefine.UpgradeEquipBatch
             || msg.m_ID == (int)LobbyMessageDefine.BuyFashion
             || msg.m_ID == (int)LobbyMessageDefine.LuckyDraw
             || msg.m_ID == (int)LobbyMessageDefine.EquipmentStrength) {
             ||
             ||/// Test codes
             ||/// 每次发送32个包,测试多线程死锁或其他BUG
             ||for (int i = 0; i < 32; ++i) {
             || LobbyNetworkSystem.Instance.SendMessage(msgStr);
             ||}
             ||return true;
             ||}
             */
            return(UserNetworkSystem.Instance.SendMessage(msgStr));
        }
        protected override bool ExecCommand(StoryInstance instance, long delta)
        {
            string _msg = m_Msg.Value;

            Msg_CLC_StoryMessage protoData = new Msg_CLC_StoryMessage();
            protoData.m_MsgId = _msg;

            for (int i = 0; i < m_Args.Count; ++i) {
                IStoryValue<object> val = m_Args[i];
                object v = val.Value;
                if (null == v) {
                    Msg_CLC_StoryMessage.MessageArg arg = new Msg_CLC_StoryMessage.MessageArg();
                    arg.val_type = LobbyArgType.NULL;
                    arg.str_val = "";
                    protoData.m_Args.Add(arg);
                } else if (v is int) {
                    Msg_CLC_StoryMessage.MessageArg arg = new Msg_CLC_StoryMessage.MessageArg();
                    arg.val_type = LobbyArgType.INT;
                    arg.str_val = ((int)v).ToString();
                    protoData.m_Args.Add(arg);
                } else if (v is float) {
                    Msg_CLC_StoryMessage.MessageArg arg = new Msg_CLC_StoryMessage.MessageArg();
                    arg.val_type = LobbyArgType.FLOAT;
                    arg.str_val = ((float)v).ToString();
                    protoData.m_Args.Add(arg);
                } else {
                    Msg_CLC_StoryMessage.MessageArg arg = new Msg_CLC_StoryMessage.MessageArg();
                    arg.val_type = LobbyArgType.STRING;
                    arg.str_val = v.ToString();
                    protoData.m_Args.Add(arg);
                }
            }

            try {
                Network.NodeMessage msg = new Network.NodeMessage(LobbyMessageDefine.Msg_CLC_StoryMessage, Network.UserNetworkSystem.Instance.Guid);
                msg.m_ProtoData = protoData;
                Network.NodeMessageDispatcher.SendMessage(msg);
            } catch (Exception ex) {
                LogSystem.Error("LobbyNetworkSystem.SendMessage throw Exception:{0}\n{1}", ex.Message, ex.StackTrace);
            }
            return false;
        }