public void ActiveJiFenJieMian()
    {
        if (Network.peerType == NetworkPeerType.Server)
        {
            return;
        }

        if (JiFenJieMianObj.activeSelf)
        {
            return;
        }
        FinishTaskObj.SetActive(false);

        if (!JiFenZongJieMianObj.activeSelf)
        {
            DanYaoInfoCtrl.GetInstanceOne().HiddenPlayerDanYaoInfo();
            DanYaoInfoCtrl.GetInstanceTwo().HiddenPlayerDanYaoInfo();
            ZhunXingCtrl.GetInstanceOne().SetActiveZhunXingObj(false);
            ZhunXingCtrl.GetInstanceTwo().SetActiveZhunXingObj(false);
            CoinPlayerCtrl.GetInstanceOne().HiddenPlayerCoin();
            CoinPlayerCtrl.GetInstanceTwo().HiddenPlayerCoin();
            YouLiangAddCtrl.GetInstance().HiddenYouLiangAdd();
            YouLiangCtrl.GetInstance().HiddenYouLiang();
            JiFenZongJieMianObj.SetActive(true);
        }
        else
        {
            XkGameCtrl.HiddenMissionCleanup();

            if (Network.peerType == NetworkPeerType.Client)
            {
                if (NetCtrl.GetInstance() != null)
                {
                    NetCtrl.GetInstance().TryCloseServerPort();
                }
            }
        }

        System.GC.Collect();
        if (XkPlayerCtrl.GetInstanceFeiJi() != null)
        {
            XkPlayerCtrl.GetInstanceFeiJi().StopPlayerMoveAudio();
        }

        if (XkPlayerCtrl.GetInstanceTanKe() != null)
        {
            XkPlayerCtrl.GetInstanceTanKe().StopPlayerMoveAudio();
        }
        JiFenJieMianObj.SetActive(true);

        if (XkGameCtrl.IsPlayGamePOne)
        {
            XunZhangJBCtrl.GetInstanceOne().ShowPlayerXunZhangJB();
        }

        if (XkGameCtrl.IsPlayGamePTwo)
        {
            XunZhangJBCtrl.GetInstanceTwo().ShowPlayerXunZhangJB();
        }
    }
Ejemplo n.º 2
0
    void OnFinishTaskAlphaToEnd()
    {
        VRCameraObj.SetActive(false);
        if (SceneManager.GetActiveScene().buildIndex < (int)GameLevel.Scene_2 &&
            SceneManager.GetActiveScene().buildIndex < (Application.levelCount - 1) &&
            !GameOverCtrl.IsShowGameOver)
        {
            int loadLevel = SceneManager.GetActiveScene().buildIndex + 1;
            Debug.Log("loadLevel *** " + loadLevel);
            XkGameCtrl.IsLoadingLevel = true;
            if (NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().ResetGameInfo();
            }
            LoadingGameCtrl.ResetLoadingInfo();

            if (!XkGameCtrl.IsGameOnQuit)
            {
                System.GC.Collect();
                SceneManager.LoadScene(loadLevel);
            }
        }
        else
        {
            //loading movie scene.
            XkGameCtrl.LoadingGameMovie();
        }
    }
    public void HanldeClientSelectLink()
    {
        if (NetCtrlScript == null)
        {
            NetCtrlScript = NetCtrl.GetInstance();
            if (NetCtrlScript == null)
            {
                return;
            }
        }

        NetworkServerNet NetworkServerScript = NetworkServerNet.GetInstance();

        if (NetworkServerScript != null && !NetworkServerScript.CheckIsLinkedServerPort())
        {
            //ScreenLog.LogWarning("the client have not linked server...");
            return;
        }

        if (!isHandleNetLink)
        {
            //ScreenLog.Log("link server mode");
            isHandleNetLink = true;
            NetCtrlScript.ClientCallHandleSelectLinkCount(true);
        }
    }
Ejemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     _Instance = this;
     if (GlobalData.GetInstance().gameMode == GameMode.OnlineMode)
     {
         GameObject bikegamectrl = GameObject.Find(GlobalData.bikeGameCtrl);
         playerCreatScript   = bikegamectrl.GetComponent <PlayerCreatNet>();
         NetworkServerScript = NetworkServerNet.GetInstance();
         netCtrlScript       = NetCtrl.GetInstance();
         if (NetworkServerScript != null && NetworkServerScript.GetIsServer())
         {
             return;
         }
         else
         {
             SoureAudio = AudioManager.Instance.audio;
         }
     }
     else
     {
         SoureAudio = AudioManager.Instance.audio;
         ui         = GetComponent <UISprite>();
         scale      = GetComponent <TweenScale>();
         StartCoroutine("Gogo");
     }
 }
Ejemplo n.º 5
0
    public void SetIsDisconnect()
    {
        ScreenLog.Log("SetIsDisconnect...");
        if (NetCtrlScript == null)
        {
            NetCtrlScript = NetCtrl.GetInstance();
        }
        bIsDisconnect = true;

        switch (Network.peerType)
        {
        case NetworkPeerType.Server:
            OnServer();
            break;

        case NetworkPeerType.Client:
            OnClient();
            break;
        }

        if (NetCtrl.GetInstance() != null)
        {
            NetCtrl.GetInstance().DestroyNetCtrl();
        }
        Destroy(gameObject);
    }
    IEnumerator CheckPlayerCountLoop()
    {
        bool isStopCheck = false;

        do
        {
            if (Network.peerType == NetworkPeerType.Server)
            {
                if (PlayerCount >= Network.connections.Length)
                {
                    isStopCheck = true;
                    gameObject.SetActive(false);
                    NetCtrl.GetInstance().HandleLoadingGameHiddenLoadingGame();
                    XkPlayerCtrl.GetInstanceCartoon().DelayMoveCartoonCamera();
                    XKGlobalData.GetInstance().PlayGuanKaBeiJingAudio();
                    yield break;
                }
            }
            else
            {
                if (IsHiddenLoadingGame)
                {
                    isStopCheck = true;
                    gameObject.SetActive(false);
                    XkPlayerCtrl.GetInstanceCartoon().DelayMoveCartoonCamera();
                    XKGlobalData.GetInstance().PlayGuanKaBeiJingAudio();
                    yield break;
                }
            }
            yield return(new WaitForSeconds(0.1f));
        } while (!isStopCheck);
    }
 void SendPlayerIntoGame()
 {
     if (Network.peerType != NetworkPeerType.Client)
     {
         return;
     }
     NetCtrl.GetInstance().SendPlayerIntoGame();
 }
	void MakeOtherPortStopJiFenTime()
	{
		if (Network.peerType == NetworkPeerType.Disconnected) {
			return;
		}

		if (NetCtrl.GetInstance() != null) {
			NetCtrl.GetInstance().MakeOtherPortStopJiFenTime();
		}
	}
    void HandleServerKaQiuShaFire()
    {
        if (Network.peerType != NetworkPeerType.Client)
        {
            return;
        }

        if (NetCtrl.GetInstance() != null)
        {
            NetCtrl.GetInstance().TryActiveKaQiuShaFire();
        }
    }
Ejemplo n.º 10
0
    void MakeOtherClientShowFinishTask()
    {
        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            return;
        }

        if (NetCtrl.GetInstance() != null)
        {
            NetCtrl.GetInstance().MakeOtherClientShowFinishTask();
        }
    }
    void MakeServerShowGameOver()
    {
        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            return;
        }

        if (NetCtrl.GetInstance() != null)
        {
            NetCtrl.GetInstance().MakeServerShowGameOver();
        }
    }
Ejemplo n.º 12
0
    public void AddStartMovePlayerCount()
    {
        StartMovePlayerCount++;
//		Debug.Log("AddStartMovePlayerCount -> StartMovePlayerCount "+StartMovePlayerCount
//		          +", netLen"+Network.connections.Length);
        if (Network.peerType == NetworkPeerType.Server)
        {
            if (StartMovePlayerCount > Network.connections.Length)
            {
                NetCtrl.GetInstance().MakeClientPlayerMove();                 //MakeClientPlayerMove
            }
        }
    }
    void OnPlayerConnectedInfo()
    {
        int max = Network.connections.Length;

        ScreenLog.Log("OnPlayerConnected -> init, clientCount " + max);
        for (int i = 0; i < max; i++)
        {
            CreatLinkPlayer(Network.connections[i]);
        }
        NetworkServerNet.CountPlayerStatic = 0;
        ServerWaitUI.SetActive(false);
        NetCtrl.GetInstance().SendCheckIsPlayGame();
    }
    void CheckGameBtEvent()
    {
//		if (!ModeObj.activeSelf) {
//			return;
//		}

        ModeVal = GameMode.LianJi;
//		if (ModeVal == GameMode.Null) {
//			return;
//		}

//		if (!StartBtObj.activeSelf) {
//			return;
//		}

        XKGlobalData.GetInstance().PlayModeQueRenAudio();
        if (ModeVal != GameMode.LianJi)
        {
            IsSelectDanJiMode = true;
            HiddenGameMode();
            if (NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().SendSubLinkCount();
            }
            GameTypeCtrl.SetAppTypeVal(AppGameType.LianJiFeiJi);
            NetworkServerNet.GetInstance().MakeServerDisconnect();             //Close ServerNet.
            NetworkServerNet.GetInstance().MakeClientDisconnect();             //Close ClientNet.
            SetActiveLoading(true);
        }
        else
        {
            IsSelectDanJiMode = false;
//			if (NetworkServerNet.GetInstance() != null) {
//				NetworkServerNet.GetInstance().TryToLinkServer();
//			}

            if (NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().SendAddLinkCount();                 //ServerPort.
            }
            else
            {
                //ClientPort.
                IsActiveClientPort = true;
                HiddenGameMode();
                GameTypeCtrl.SetAppTypeVal(AppGameType.LianJiFeiJi);
                SetActiveLoading(true);
            }
        }
        SetActiveStartBt(false);
    }
    public void MakeServerDisconnect()
    {
        if (Network.peerType != NetworkPeerType.Server)
        {
            return;
        }

        if (IsInvoking("DelayMakeServerDisconnect"))
        {
            return;
        }
        NetCtrl.GetInstance().CloseClientPortSendRPC();
        Invoke("DelayMakeServerDisconnect", 3f);
    }
Ejemplo n.º 16
0
    void OnPlayerConnected(NetworkPlayer player)
    {
        clientCount++;
        if (Application.loadedLevel == (int)GameLeve.Movie)
        {
            int lenVal   = Network.connections.Length;
            int indexVal = lenVal - 1;
            NetCtrl.OnPlayerConnectedServer(player, indexVal);

            string ipInfo = Network.connections[indexVal].ipAddress;
            NetCtrl.GetInstance().SendPlayerIndexNameInfo(ipInfo, indexVal);
        }
        //ScreenLog.Log("NetworkServerNet::OnPlayerConnected -> init, clientCount " + clientCount);
    }
Ejemplo n.º 17
0
 void OnServerInitialized()
 {
     //ScreenLog.Log("OnServerInitialized -> init");
     IsServer = true;
     if (NetCtrlPrefab != null && GameObject.Find(NetCtrlPrefab.name) == null)
     {
         int playerID = int.Parse(Network.player.ToString());
         Network.Instantiate(NetCtrlPrefab, NetCtrlPrefab.position, NetCtrlPrefab.rotation, playerID);
         NetCtrlScript = NetCtrl.GetInstance();
         if (NetCtrlScript != null)
         {
             NetCtrlScript.IsServerPort = true;
         }
     }
 }
Ejemplo n.º 18
0
    public void StopJiFenTime()
    {
        if (IsInvoking("DelayStopJiFenPanel"))
        {
            CancelInvoke("DelayStopJiFenPanel");
        }

        if (Time.realtimeSinceStartup - TimeStartVal < 8f)
        {
            Debug.Log("StopJiFenTime -> TimeStartVal was wrong!");
            return;
        }

        if (IsMakeJiFenStop)
        {
            return;
        }
        IsMakeJiFenStop = true;

        //GameOverCtrl.IsShowGameOver = true; //test
        if (Application.loadedLevel < (int)GameLevel.Scene_4
            //if (Application.loadedLevel < XkGameCtrl.TestGameEndLv //test
            && Application.loadedLevel < (Application.levelCount - 1) &&
            !GameOverCtrl.IsShowGameOver)
        {
            MakeOtherPortStopJiFenTime();
            int loadLevel = Application.loadedLevel + 1;
            Debug.Log("loadLevel *** " + loadLevel);
            XkGameCtrl.IsLoadingLevel = true;
            if (NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().ResetGameInfo();
            }
            LoadingGameCtrl.ResetLoadingInfo();

            if (!XkGameCtrl.IsGameOnQuit)
            {
                System.GC.Collect();
                Application.LoadLevel(loadLevel);
            }
        }
        else
        {
            XkGameCtrl.LoadingGameMovie();
        }
    }
    public void StopJiFenTime()
    {
        if (IsInvoking("DelayStopJiFenPanel"))
        {
            CancelInvoke("DelayStopJiFenPanel");
        }

        if (Time.realtimeSinceStartup - TimeStartVal < 8f)
        {
            Debug.Log("StopJiFenTime -> TimeStartVal was wrong!");
            return;
        }

        if (IsMakeJiFenStop)
        {
            return;
        }
        IsMakeJiFenStop = true;

        //GameOverCtrl.IsShowGameOver = true; //test
        if (SceneManager.GetActiveScene().buildIndex < (int)GameLevel.Scene_4
            //if (SceneManager.GetActiveScene().buildIndex < XkGameCtrl.TestGameEndLv //test
            && SceneManager.GetActiveScene().buildIndex < (SceneManager.sceneCountInBuildSettings - 1) &&
            !GameOverCtrl.IsShowGameOver)
        {
            MakeOtherPortStopJiFenTime();
            int loadLevel = SceneManager.GetActiveScene().buildIndex + 1;
            Debug.Log("loadLevel *** " + loadLevel);
            XkGameCtrl.IsLoadingLevel = true;
            if (NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().ResetGameInfo();
            }
            LoadingGameCtrl.ResetLoadingInfo();

            if (!XkGameCtrl.IsGameOnQuit)
            {
                System.GC.Collect();
                SceneManager.LoadScene(loadLevel);
            }
        }
        else
        {
            XkGameCtrl.LoadingGameMovie();
        }
    }
    public void MakeClientDisconnect()
    {
        if (Network.peerType != NetworkPeerType.Client)
        {
            return;
        }

        if (IsInvoking("DelayMakeClientDisconnect"))
        {
            return;
        }

        if (NetCtrl.GetInstance() != null)
        {
            NetCtrl.GetInstance().CloseServerPortSendRPC();
        }
        Invoke("DelayMakeClientDisconnect", 1f);
    }
 void HiddenLoadingGame()
 {
     Debug.Log("HiddenLoadingGame -> peerType " + Network.peerType);
     if (Network.peerType == NetworkPeerType.Disconnected)
     {
         gameObject.SetActive(false);
         XkPlayerCtrl.GetInstanceCartoon().DelayMoveCartoonCamera();
         XKGlobalData.GetInstance().PlayGuanKaBeiJingAudio();
     }
     else
     {
         StartCoroutine(CheckPlayerCountLoop());
         if (Network.peerType == NetworkPeerType.Client)
         {
             NetCtrl.GetInstance().HandleLoadingGamePlayerCount();
         }
     }
 }
    void CheckGameBtEvent()
    {
        if (!ModeObj.activeSelf)
        {
            return;
        }

        if (ModeVal == GameMode.Null)
        {
            return;
        }

        if (!StartBtObj.activeSelf)
        {
            return;
        }

        XKGlobalData.GetInstance().PlayModeQueRenAudio();
        if (ModeVal != GameMode.LianJi)
        {
            IsSelectDanJiMode = true;
            HiddenGameMode();
            if (NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().SendSubLinkCount();
            }
            NetworkServerNet.GetInstance().MakeClientDisconnect();             //Close ClientNet
            SetActiveLoading(true);
        }
        else
        {
            IsSelectDanJiMode = false;
            if (NetworkServerNet.GetInstance() != null)
            {
                NetworkServerNet.GetInstance().TryToLinkServer();
            }

            if (NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().SendAddLinkCount();
            }
        }
        SetActiveStartBt(false);
    }
Ejemplo n.º 23
0
    public void TryToLinkServer()
    {
        if (Network.peerType != NetworkPeerType.Disconnected)
        {
            return;
        }

        //ScreenLog.Log("try to link server...");
        if (NetCtrlScript == null)
        {
            NetCtrlScript = NetCtrl.GetInstance();
            if (NetCtrlScript != null)
            {
                NetCtrlScript.IsBackStartLevel = false;
                NetCtrlScript.SetIsConnectServer(true);
            }
        }
        isTryLinkServer = true;
        bIsLinkServer   = true;
    }
Ejemplo n.º 24
0
    void MakeOtherPortCloseCartoon()
    {
        if (!gameObject.activeSelf)
        {
            return;
        }

        if (ScreenDanHeiCtrl.IsStartGame)
        {
            return;
        }

        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            return;
        }

        if (NetCtrl.GetInstance() != null)
        {
            NetCtrl.GetInstance().MakeOtherPortCloseCartoon();
        }
    }
Ejemplo n.º 25
0
    void CheckIsActiveGameOver(XkPlayerCtrl script)
    {
        if (DaoJiShiCtrl.GetInstance() != null && DaoJiShiCtrl.GetInstance().GetIsPlayDaoJishi())
        {
            XkGameCtrl.IsActivePlayerOne = DaoJiShiCtrl.IsActivePlayerOne;
            XkGameCtrl.IsActivePlayerTwo = DaoJiShiCtrl.IsActivePlayerTwo;
            DaoJiShiCtrl.GetInstance().StopDaoJiShi();
        }

        if (Network.peerType != NetworkPeerType.Disconnected)
        {
            if (Network.peerType == NetworkPeerType.Client)
            {
                return;
            }

            if (NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().TryActiveGameOverEvent();
            }
        }
        else
        {
            if (GameOverCtrl.IsShowGameOver)
            {
                return;
            }
        }

        if (IsActiveGameOver)
        {
            return;
        }
        Debug.Log("CheckIsActiveGameOver...");
        IsActiveGameOver = true;
        XKGlobalData.GetInstance().StopAudioRanLiaoJingGao();
        SpawnPlayerDaoDan(script);
    }
    public static void OnPlayerIntoGame()
    {
        if (Network.peerType != NetworkPeerType.Server)
        {
            return;
        }

        ClientCount++;
        if (ClientCount < Network.connections.Length)
        {
            return;
        }

        if (NetCtrl.GetInstance() != null)
        {
            NetCtrl.GetInstance().AddPlayerIntoGameCount(ClientCount);
        }

        if (_Instance != null)
        {
            _Instance.CheckServerInitGame();
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (Network.peerType != NetworkPeerType.Disconnected)
        {
            if (Network.peerType == NetworkPeerType.Server)
            {
                return;
            }
        }

        XkPlayerCtrl playerScript = other.GetComponent <XkPlayerCtrl>();

        if (playerScript == null)
        {
            return;
        }

        HandleHeTiPlayerEvent();
        if (Network.peerType != NetworkPeerType.Disconnected)
        {
            NetCtrl.GetInstance().HandleHeTiPlayerEvent();
        }
        gameObject.SetActive(false);
    }
Ejemplo n.º 28
0
    void OnSreenAlphaToMax()
    {
        GameMode modeVal = XkGameCtrl.GameModeVal;

        Debug.Log("OnSreenAlphaToMax -> GameMode " + modeVal);

        bool isClearCartoonNpc = true;

        if (!XKTriggerOpenPlayerUI.IsActiveOpenPlayerUI)
        {
            XKPlayerCamera.GetInstanceCartoon().SetActiveCamera(false);
        }

        switch (modeVal)
        {
        case GameMode.DanJiFeiJi:
            XkPlayerCtrl.GetInstanceFeiJi().MakePlayerFlyToPathMark();
            break;

        case GameMode.DanJiTanKe:
            XkPlayerCtrl.GetInstanceTanKe().MakePlayerFlyToPathMark();
            break;

        case GameMode.LianJi:
            if (XkPlayerCtrl.GetInstanceFeiJi() != null)
            {
                XkPlayerCtrl.GetInstanceFeiJi().MakePlayerFlyToPathMark();
            }

            if (XkPlayerCtrl.GetInstanceTanKe() != null)
            {
                XkPlayerCtrl.GetInstanceTanKe().MakePlayerFlyToPathMark();
            }

            if (Network.peerType != NetworkPeerType.Disconnected)
            {
                isClearCartoonNpc = false;
            }

            if (Network.peerType == NetworkPeerType.Client)
            {
                NetCtrl.GetInstance().SendSetScreenDanHeiIsStartGame();
            }
            break;
        }
        DestroyObject(DanHeiTweenAlpha);
        DanHeiTweenAlpha         = ScreenDanHeiObj.AddComponent <TweenAlpha>();
        DanHeiTweenAlpha.enabled = false;
        DanHeiTweenAlpha.from    = 1f;
        DanHeiTweenAlpha.to      = 0f;
        EventDelegate.Add(DanHeiTweenAlpha.onFinished, delegate {
            Invoke("OnSreenAlphaToMin", 0.2f);
        });
        DanHeiTweenAlpha.enabled = true;
        DanHeiTweenAlpha.PlayForward();

        if (isClearCartoonNpc)
        {
            XkGameCtrl.ClearCartoonSpawnNpc();
        }

        if (Network.peerType != NetworkPeerType.Server)
        {
            IsStartGame = true;
        }
        Time.timeScale = 1.0f;
        switch (modeVal)
        {
        case GameMode.DanJiFeiJi:
            XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer();
            break;

        case GameMode.DanJiTanKe:
            XkPlayerCtrl.GetInstanceTanKe().RestartMovePlayer();
            break;

        case GameMode.LianJi:
            if (Network.peerType != NetworkPeerType.Server)
            {
                if (Network.peerType != NetworkPeerType.Client)
                {
                    if (XkPlayerCtrl.GetInstanceFeiJi() != null)
                    {
                        XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer();
                    }

                    if (XkPlayerCtrl.GetInstanceTanKe() != null)
                    {
                        XkPlayerCtrl.GetInstanceTanKe().RestartMovePlayer();
                    }
                    XKCameraMapCtrl.GetInstance().SetCameraMapState();                     //test
                }
                else
                {
                    //SendServerMovePlayer
                    NetCtrl.GetInstance().SetScreenDanHieStartMovePlayer();
                }
            }
            else
            {
                AddStartMovePlayerCount();
            }
            break;
        }
    }
Ejemplo n.º 29
0
    public void ActiveJiFenJieMian()
    {
        if (Network.peerType == NetworkPeerType.Server)
        {
            return;
        }

        if (JiFenJieMianObj.activeSelf)
        {
            return;
        }
        FinishTaskObj.SetActive(false);

        if (!JiFenZongJieMianObj.activeSelf)
        {
            DanYaoInfoCtrl.GetInstanceOne().HiddenPlayerDanYaoInfo();
            DanYaoInfoCtrl.GetInstanceTwo().HiddenPlayerDanYaoInfo();
            ZhunXingCtrl.GetInstanceOne().SetActiveZhunXingObj(false);
            ZhunXingCtrl.GetInstanceTwo().SetActiveZhunXingObj(false);
            CoinPlayerCtrl.GetInstanceOne().HiddenPlayerCoin();
            CoinPlayerCtrl.GetInstanceTwo().HiddenPlayerCoin();
            YouLiangAddCtrl.GetInstance().HiddenYouLiangAdd();
            YouLiangCtrl.GetInstance().HiddenYouLiang();
            JiFenZongJieMianObj.SetActive(true);
        }
        else
        {
            XkGameCtrl.HiddenMissionCleanup();

            if (Network.peerType == NetworkPeerType.Client)
            {
                if (NetCtrl.GetInstance() != null)
                {
                    NetCtrl.GetInstance().TryCloseServerPort();
                }
            }
        }

        System.GC.Collect();
        if (XkPlayerCtrl.GetInstanceFeiJi() != null)
        {
            XkPlayerCtrl.GetInstanceFeiJi().StopPlayerMoveAudio();
        }

        if (XkPlayerCtrl.GetInstanceTanKe() != null)
        {
            XkPlayerCtrl.GetInstanceTanKe().StopPlayerMoveAudio();
        }
        JiFenJieMianObj.SetActive(true);

        if (XkGameCtrl.IsPlayGamePOne)
        {
            XunZhangJBCtrl.GetInstanceOne().ShowPlayerXunZhangJB();
        }

        if (XkGameCtrl.IsPlayGamePTwo)
        {
            XunZhangJBCtrl.GetInstanceTwo().ShowPlayerXunZhangJB();
        }

        pcvr.CloseGunZhenDongDengJi();
        pcvr.CloseAllQiNangArray();
        if (pcvr.GetInstance() != null)
        {
            pcvr.GetInstance().CloseFangXiangPanPower(PlayerEnum.Null);
        }

        Invoke("DelayForceRestartComPort", 0.5f);
    }
    void OnTriggerEnter(Collider other)
    {
        if (XKTriggerKaQiuShaFire.IsCloseKaQiuShaTest)
        {
            return;             //test;
        }

        if (Network.peerType != NetworkPeerType.Disconnected)
        {
            if (Network.peerType == NetworkPeerType.Server)
            {
                if (FeiJiMarkCom != null && TanKeMarkCom != null)
                {
                    IsActiveHeTiCloseUI = true;
                    ServerPortCameraCtrl.CloseAllServerPortCamera();
                }
                return;
            }
        }

        if (DaoJiShiCtrl.GetInstance().GetIsPlayDaoJishi() || GameOverCtrl.IsShowGameOver)
        {
            return;
        }

        XkPlayerCtrl playerScript = other.GetComponent <XkPlayerCtrl>();

        if (playerScript == null)
        {
            return;
        }

        if (playerScript.PlayerSt == PlayerTypeEnum.FeiJi && XkGameCtrl.GameJiTaiSt != GameJiTaiType.FeiJiJiTai)
        {
            return;
        }

        if (playerScript.PlayerSt == PlayerTypeEnum.TanKe && XkGameCtrl.GameJiTaiSt != GameJiTaiType.TanKeJiTai)
        {
            return;
        }

        if (FeiJiMarkCom != null && TanKeMarkCom != null && IsActiveHeTiCloseUI)
        {
            return;
        }
        IsClosePlayerUI = true;
        CheckIsPlayDaoJiShi();

        ScreenDanHeiCtrl.GetInstance().ClosePlayerUI();
        if (FeiJiMarkCom != null && TanKeMarkCom != null)
        {
            IsActiveHeTiCloseUI = true;
            if (Network.peerType == NetworkPeerType.Client && NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().TryActiveHeTiPlayerEvent();
            }
            ScreenDanHeiCtrl.GetInstance().OpenStartCamera();
            ScreenDanHeiCtrl.GetInstance().OpenScreenDanHui(1);
            GameMode modeVal = XkGameCtrl.GameModeVal;
            switch (modeVal)
            {
            case GameMode.DanJiFeiJi:
                playerScript.MakePlayerMoveToAiMark(FeiJiMarkCom);
                break;

            case GameMode.DanJiTanKe:
                playerScript.MakePlayerMoveToAiMark(TanKeMarkCom);
                break;

            case GameMode.LianJi:
                if (Network.peerType != NetworkPeerType.Disconnected)
                {
                    if (XkPlayerCtrl.GetInstanceFeiJi() != null)
                    {
                        XkPlayerCtrl.GetInstanceFeiJi().MakePlayerMoveToAiMark(FeiJiMarkCom);
                    }

                    if (XkPlayerCtrl.GetInstanceTanKe() != null)
                    {
                        XkPlayerCtrl.GetInstanceTanKe().MakePlayerMoveToAiMark(TanKeMarkCom);
                    }
                }
                else
                {
                    XkPlayerCtrl.GetInstanceFeiJi().MakePlayerMoveToAiMark(FeiJiMarkCom);
                    XkPlayerCtrl.GetInstanceTanKe().MakePlayerMoveToAiMark(TanKeMarkCom);
                }

//				if (XkGameCtrl.GetInstance().IsServerCameraTest) {
//					ServerPortCameraCtrl.CloseAllServerPortCamera();
//				}
                break;
            }
        }
        gameObject.SetActive(false);
    }