Example #1
0
        public void OnAccountOnlyIDSuccess(IEvent iEvent)
        {
            NetCmdPack pack = (NetCmdPack)iEvent.parameter;
            LC_Cmd_AccountOnlyIDSuccess ncb = (LC_Cmd_AccountOnlyIDSuccess)pack.cmd;

            PlayerRole.Instance.RoleInfo.RoleMe.SetRoleInfo(ncb.RoleInfo);//设置玩家的数据
        }
    public bool Handle(NetCmdPack pack)
    {
        //登陆的后续命令处理
        if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_AccountOnlyIDSuccess)
        {
            //玩家登陆GameServer成功了
            LC_Cmd_AccountOnlyIDSuccess ncb = (LC_Cmd_AccountOnlyIDSuccess)pack.cmd;
            //保存玩家账号数据 登陆成功的时候
            PlayerRole.Instance.RoleInfo.RoleMe.SetRoleInfo(ncb.RoleInfo);//设置玩家的数据.
            ServerSetting.SetCallbckUrl(Utility.IPToString(ncb.OperateIP));
            //设置玩家身份标志
            if (m_AccountData != null)
            {
                if (PlayerRole.Instance.RoleInfo.RoleMe.GetIsCanResetAccount())
                {
                    m_AccountData.TAG = 1;
                }
                else
                {
                    m_AccountData.TAG = 0;
                }
                m_AccountData.SaveAccountData();
                //SaveAccountData(m_AccountData);//将账号数据保存起来
            }
            // NetServices.Instance.CmdHandler = null;
            // RuntimeData.MyAccount = m_AccountData;
            m_OnlyID = ncb.RandID;//用于登陆的唯一的ID
            PlayerRole.Instance.RoleExChange.SetPlayerRoleIsShowExChange();
            //PlayerRole.Instance.IsNeedResetTable = false;
            LogicManager.Instance.SkipToHall();
            PlayerRole.Instance.OnRoleResetOtherInfo();//清空数据并且提供事件
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_AccountLogonToScreen)
        {
            //玩家登陆GameServer成功了
            LC_Cmd_AccountLogonToScreen ncb = (LC_Cmd_AccountLogonToScreen)pack.cmd;
            //保存玩家账号数据 登陆成功的时候
            //PlayerRole.Instance.RoleInfo.RoleMe.SetRoleInfo(ncb.RoleInfo);//设置玩家的数据.
            //设置玩家身份标志
            if (m_AccountData != null)
            {
                if (PlayerRole.Instance.RoleInfo.RoleMe.GetIsCanResetAccount())
                {
                    GlobalLogon.Instance.AccountData.TAG = 1;
                }
                else
                {
                    GlobalLogon.Instance.AccountData.TAG = 0;
                }
                m_AccountData.SaveAccountData();
                //SaveAccountData(m_AccountData);//将账号数据保存起来
                // NetServices.Instance.CmdHandler = null;
            }
            //RuntimeData.MyAccount = m_AccountData;
            m_OnlyID = ncb.RandID;//用于登陆的唯一的ID

            // PlayerRole.Instance.IsNeedResetTable = true;
            //直接进入场景
            JoinRoomData ncg = new JoinRoomData();
            ncg.RoomID          = ncb.bTableTypeID;
            ncg.BackgroundImage = ncb.BackgroundImage;
            ncg.LauncherType    = ncb.LauncherType;
            ncg.Seat            = ncb.SeatID;
            ncg.RateIndex       = ncb.RateIndex;
            ncg.Energy          = ncb.Energy;
            //场景
            LogicManager.Instance.SkipToScene(ncg);
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_ResetLogonGameServer)
        {
            //玩家重新连接服务器失败了 让玩家返回登陆界面去
            LogicManager.Instance.LogOff();
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Logon_Reset_Error);
            MsgEventHandle.HandleMsg(pUOM);
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_JoinTable)
        {
            LC_Cmd_JoinTableResult ncb = (LC_Cmd_JoinTableResult)pack.cmd;
            if (ncb.Result)
            {
                PlayerRole.Instance.RoleInfo.RoleMe.SetTableTypeID(ncb.bTableTypeID);

                JoinRoomData ncg = new JoinRoomData();
                ncg.RoomID          = ncb.bTableTypeID;
                ncg.BackgroundImage = ncb.BackgroundImage;
                ncg.LauncherType    = ncb.LauncherType;
                ncg.Seat            = ncb.SeatID;
                ncg.RateIndex       = ncb.RateIndex;
                ncg.Energy          = ncb.Energy;
                SceneRuntime.SceneLogic.ResetPlayerData(ncg, false);
                //LogicManager.Instance.Forward(ncg);
            }
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_ServerChangeSocket)
        {
            //提示玩家已经在其他地方登陆了 被踢掉了
            LogicManager.Instance.LogOff();
            string str = StringTable.GetString("Account_OtherLogon");
            if (str != null)
            {
                GlobalHallUIMgr.Instance.ShowSystemTipsUI(str, 5, false);
            }
        }
        //else if(pack.cmd.GetCmdType() == NetCmdType.CMD_LC_ResetPassword)
        //{
        //    LC_Cmd_ResetPassword ncb = (LC_Cmd_ResetPassword)pack.cmd;
        //    if(ncb.Result)
        //    {
        //        GlobalLogon.Instance.AccountData.CRC1 = ncb.NewPasswordCrc1;
        //        GlobalLogon.Instance.AccountData.CRC2 = ncb.NewPasswordCrc2;
        //        GlobalLogon.Instance.AccountData.CRC3 = ncb.NewPasswordCrc3;

        //        tagErrorCodeEvent pEvent = new tagErrorCodeEvent(ErrorCode.EC_ResetPassword_Sucess);
        //        MsgEventHandle.HandleMsg(pEvent);
        //    }
        //    else
        //    {
        //        tagErrorCodeEvent pEvent = new tagErrorCodeEvent(ErrorCode.EC_ResetPassword_Failed);
        //        MsgEventHandle.HandleMsg(pEvent);
        //    }
        //    return true;
        //}
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_CheckVersionError)
        {
            LogicManager.Instance.LogOff();
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Logon_Version_Error);
            MsgEventHandle.HandleMsg(pUOM);
            return(true);
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_LogonQueueWrite)
        {
            //排队的消息  我们让客户端继续等待
            LC_Cmd_LogonQueueWrite ncb = (LC_Cmd_LogonQueueWrite)pack.cmd;
            //触发排队等待的事件
            tagQueueWriteEvent pEvent = new tagQueueWriteEvent(ncb.WriteIndex, ncb.WriteSec, true);
            MsgEventHandle.HandleMsg(pEvent);
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_AccountIsFreeze)
        {
            LC_Cmd_AccountIsFreeze ncb = (LC_Cmd_AccountIsFreeze)pack.cmd;

            System.DateTime starTime = System.TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
            System.DateTime pTime    = starTime.AddSeconds(System.Convert.ToDouble(ncb.EndTime));

            tagLogonAccountFreezeEvent pEvent = new tagLogonAccountFreezeEvent(pTime);
            MsgEventHandle.HandleMsg(pEvent);

            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Logon_Account_Freeze_2);
            MsgEventHandle.HandleMsg(pUOM);

            LogicManager.Instance.LogOff();
            return(true);
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_SaveAccountInfo)
        {
            LC_Cmd_SaveAccountInfo ncb = (LC_Cmd_SaveAccountInfo)pack.cmd;
            //将账号 和 3个 密码保持起来 供使用
            if (GlobalLogon.Instance.AccountData == null)
            {
                GlobalLogon.Instance.AccountData = new AccountData();
            }
            GlobalLogon.Instance.AccountData.AccountInfo.UID  = ncb.AccountName;
            GlobalLogon.Instance.AccountData.AccountInfo.CRC1 = ncb.PasswordCrc1;
            GlobalLogon.Instance.AccountData.AccountInfo.CRC2 = ncb.PasswordCrc2;
            GlobalLogon.Instance.AccountData.AccountInfo.CRC3 = ncb.PasswordCrc3;
            GlobalLogon.Instance.AccountData.SaveAccountData();
            //GlobalLogon.Instance.SaveAccountData(GlobalLogon.Instance.AccountData);//立刻保存一次
            return(true);
        }
        else
        {
            return(false);
        }
        GlobalHallUIMgr.Instance.UpdateSystemTipsUITime(0.5f);
        return(true);
    }