예제 #1
0
 void ConnectAndCreatePrivateByServerID(int iServerID, CMD_GR_Create_Private kNet)
 {
     GameManagerBaseNet.InstanceBase().connectGameServerByServerID(iServerID);
     m_kCreatePrivateNet = kNet;
     //memcpy(&m_kCreatePrivateNet,&kNet,sizeof(kNet));
     m_eLinkAction = Type_LinkAction.Type_Link_Create;
 }
예제 #2
0
 public void ConnectAndCreatePrivateByKindIDAndServerType(int iKindID, ushort wServerType, CMD_GR_Create_Private kNet) //WQ add
 {
     GameManagerBaseNet.InstanceBase().connectGameServerByKindIDAndServerType((ushort)iKindID, wServerType);
     //memcpy(&m_kCreatePrivateNet, &kNet, sizeof(kNet));
     m_kCreatePrivateNet = kNet;
     m_eLinkAction       = Type_LinkAction.Type_Link_Create;
 }
예제 #3
0
        public void ExitGame()
        {
            clearInfo();
            m_kIndividualMission.stop();
            //ScenceManagerBase::InstanceBase().GameBackScence();
            Loom.QueueOnMainThread(() =>
            {
#if ApplyAutoReConnect
                ///if (GameScene.getGameState() == GameScene.MJState.HNMJ_STATE_PLAYING)
                if (hnManager.m_cbGameEndReason == HNMJ_Defines.GER_NOT_END)//if (hnManager.m_cbGameEndReason = HNMJ_Defines.GER_NOT_END; && hnManager.m_bRoomStartGame)
                {
                    hnManager.ShowOfflineUI(HNGameManager.m_iLocalChairID, true);
                    hnManager.ResetGameAfterDisconnect();
                }
                else
                {
                    HNGameManager.GameType = HNPrivateScenceBase.GAME_TYPE_Null;    //用于单人解散改gametype
                    hnManager.LeaveGameToHall();
                }
#else
                //enServiceStatus serviceStatus = CServerItem.get().GetServiceStatus();
                //var kernel = (GameScene)CServerItem.get().GetClientKernelSink();
                //if (kernel != null && kernel.getGameState() == GameScene.MJState.HNMJ_STATE_PLAYING && serviceStatus == enServiceStatus.ServiceStatus_NetworkDown)//UIState != GameUIState.UI_Starting)
                //{
                //}

                HNGameManager.GameType = HNPrivateScenceBase.GAME_TYPE_Null;    //用于单人解散改gametype
                hnManager.LeaveGameToHall();
#endif
            });
            //UserInfo.getInstance().reqAccountInfo();
            GameManagerBaseNet.InstanceBase().disconnectServer();
        }
예제 #4
0
 public static GameManagerBaseNet InstanceBase()
 {
     if (ms_pkInstanceBase == null)
     {
         ms_pkInstanceBase = new GameManagerBaseNet();
         hnManager         = GameObject.FindObjectOfType <HNGameManager>();
     }
     return(ms_pkInstanceBase);
 }
예제 #5
0
        public void onUserInGameServerID(CMD_GP_InGameSeverID pNetInfo)
        {
            Debug.Log("onUserInGameServerID: " + pNetInfo.LockServerID + "," + pNetInfo.LockKindID);
            if (pNetInfo.LockServerID != 0)
            {
                //Debug.Log("connectGameServerByServerID " + pNetInfo.LockServerID);
                GameManagerBaseNet.InstanceBase().connectGameServerByServerID((int)pNetInfo.LockServerID);
                Debug.Log("断线重连onUserInGameServerID:" + pNetInfo.LockKindID);
                if (pNetInfo.LockKindID == GameScene.KIND_ID_JianDe)
                {
                    GameScene.KIND_ID      = GameScene.KIND_ID_JianDe;
                    HNGameManager.GameType = HNPrivateScenceBase.GAME_TYPE_JianDe;
                }
                else if (pNetInfo.LockKindID == GameScene.KIND_ID_13Shui)
                {
                    Debug.LogError("13shui断线重连");
                    GameScene.KIND_ID      = GameScene.KIND_ID_13Shui;
                    HNGameManager.GameType = HNPrivateScenceBase.GAME_TYPE_13Shui;
                }
            }
            else
            {
                GameScene.KIND_ID      = 0;
                HNGameManager.GameType = HNPrivateScenceBase.GAME_TYPE_Null;

                // for HideSeek:强制离开
                //玩家没被锁在GameScoreLocker表中
                Debug.LogError("onUserInGameServerID: 玩家没被锁在GameScoreLocker表中");
                if (m_hnManager != null)
                {
                    if (m_hnManager.bEnteredGameScene)
                    {
                        if (CServerItem.get() != null)
                        {
                            CServerItem.get().IntermitConnect(true);
                        }
                        Loom.QueueOnMainThread(() =>
                        {
                            m_hnManager.LeaveGameToHall(false);
                        });
                    }
                }
                else
                {
                    Debug.LogError("onUserInGameServerID: m_hnManager==null");
                }
            }
        }
예제 #6
0
        //加入房间
        public void Button_JoinRoom(int roomId)
        {
            PlayerPrefs.SetInt("PubOrPrivate", (int)RoomType.Type_Private);
            PlayerPrefs.Save();

            m_iJoinRoomId = roomId;
            var             iServerId   = roomId / 10000 - 10;
            CGameServerItem pGameServer = GameManagerBaseNet.InstanceBase().SearchGameServer(iServerId);

            if (pGameServer != null && pGameServer.IsPrivateRoom())
            {
                GameManagerBaseNet.InstanceBase().connectGameServerByServerID(iServerId);
                m_eLinkAction = Type_LinkAction.Type_Link_Join;

                m_cbGameTypeIdex = HNGameManager.GameType;//WQ add

                Debug.Log("Button_JoinRoom: m_cbGameTypeIdex=" + m_cbGameTypeIdex);
            }
            else
            {
                //NoticeMsg::Instance().ShowTopMsgByScript("JoinRoomNumError");
                Debug.Log("Join Room error!!!");
            }
        }