Example #1
0
        public void OnJoinTable(IEvent iEvent)
        {
            NetCmdPack pack = iEvent.parameter as NetCmdPack;

            m_Jtable = (LC_Cmd_JoinTableResult)pack.cmd;
            Debug.Log("m_Jtable.Result::: " + m_Jtable.Result);
            if (m_Jtable.Result)
            {
                //在玩家身上设置玩家桌子ID
                PlayerRole.Instance.RoleInfo.RoleMe.SetTableTypeID(m_Jtable.bTableTypeID);

                //PlayerRole.Instance.RoleGameData.OnHandleRoleJoinTable();//表示玩家已经进入房间了
                m_roomDate                 = new LinkRoomData();
                m_roomDate.RoomID          = m_Jtable.bTableTypeID;
                m_roomDate.BackgroundImage = m_Jtable.BackgroundImage;
                m_roomDate.LauncherType    = m_Jtable.LauncherType;
                m_roomDate.Seat            = m_Jtable.SeatID;
                m_roomDate.RateIndex       = m_Jtable.RateIndex;
                m_roomDate.Energy          = m_Jtable.Energy;
                //LogicManager.Instance.Forward(ncg);
            }
            else
            {
                Debug.LogError("连接桌子错误");
            }
        }
Example #2
0
    public bool Handle(NetCmdPack pack)
    {
        if (pack.cmd.GetCmdType() == NetCmdType.CMD_JOIN_ROOM_RESULT)
        {
            NetCmdJoinRoomResult ncj = (NetCmdJoinRoomResult)pack.cmd;
            JoinRoomData         ncg = new JoinRoomData();
            ncg.RoomID          = ncj.RoomID;
            ncg.BackgroundImage = ncj.BackgroundImage;
            ncg.LauncherType    = ncj.LauncherType;
            ncg.Seat            = ncj.Seat;
            ncg.RateIndex       = 0;
            if (ncj.Result == 0)
            {
                State = HallState.HALL_JOIN_FAILED;
                GlobalEffectMgr.Instance.CloseLoadingMessage();
            }
            else
            {
                NetServices.Instance.CmdHandler = null;
                LogicManager.Instance.Forward(ncg);
            }
            return(true);
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_LC_JoinTable)
        {
            LC_Cmd_JoinTableResult ncb = (LC_Cmd_JoinTableResult)pack.cmd;

            tagUserOperationEvent pUOM = new tagUserOperationEvent((ncb.Result ? UserOperateMessage.UOM_Table_JoinTable_Sucess : UserOperateMessage.UOM_Table_JoinTable_Failed_7));
            MsgEventHandle.HandleMsg(pUOM);

            if (ncb.Result)
            {
                //在玩家身上设置玩家桌子ID
                PlayerRole.Instance.RoleInfo.RoleMe.SetTableTypeID(ncb.bTableTypeID);

                NetServices.Instance.CmdHandler = null;

                PlayerRole.Instance.RoleGameData.OnHandleRoleJoinTable();//表示玩家已经进入房间了
                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.Forward(ncg);
            }
            else
            {
                State = HallState.HALL_JOIN_FAILED;
                GlobalEffectMgr.Instance.CloseLoadingMessage();
            }
            return(true);
        }
        else if (pack.cmd.GetCmdType() == NetCmdType.CMD_CHANGE_IMG)
        {
            NetCmdImgChange cmd = (NetCmdImgChange)pack.cmd;
            HeaderManager.Instance.GetPlayerHeader(cmd.PlayerID, cmd.ImgCrcValue, HeaderOptType.HEADER_FRIEND, null);
            return(true);
        }
        return(false);
    }
    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);
    }