// Use this for initialization
    void Start()
    {
        MovieRender = GetComponent <Renderer>();
        if (XKGlobalData.GetInstance() != null)
        {
            AudioListener.volume = (float)XKGlobalData.GameAudioVolume / 10f;
        }

        _instance = this;
        XkGameCtrl.ResetIsLoadingLevel();
        pcvr.CloseGunZhenDongDengJi();
        PlayerIPInfo = Network.player.ipAddress;
//		TimeLast = Time.realtimeSinceStartup;
        GameTextType gameTextVal = XKGlobalData.GetGameTextMode();

        //gameTextVal = GameTextType.English; //test.
        switch (gameTextVal)
        {
        case GameTextType.Chinese:
            TextureMv = TextureMv_Ch;
            break;

        case GameTextType.English:
            TextureMv = TextureMv_En;
            break;
        }

        if (AudioListCtrl.GetInstance() != null)
        {
            AudioListCtrl.GetInstance().CloseGameAudioBJ();
        }
        Cursor.visible = pcvr.bIsHardWare;
        LoadingGameCtrl.ResetLoadingInfo();
        Time.timeScale = 1.0f;
        CheckClientPortMovieInfo(1);
        AudioManager.Instance.SetParentTran(null);
        GameOverCtrl.IsShowGameOver = false;

        if (!IsTestLJGame)
        {
            IsActivePlayer = true;
            if (IsTestXiaoScreen)
            {
                Screen.SetResolution((int)(XkGameCtrl.ScreenWidth / 4), (int)(XkGameCtrl.ScreenHeight / 4), false);                 //test
            }
        }

        QualitySettings.SetQualityLevel((int)QualityLevelEnum.Fast);
        AudioSourceObj = transform.GetComponent <AudioSource>();
        Invoke("DelayResetIsLoadingLevel", 5f);
        CountMovie++;
        if (CountMovie == 1 && IsOpenVR)
        {
            Invoke("DelayPlayMovie", 3f);
        }
        else
        {
            PlayMovie();
        }
    }
 void DelayResetIsLoadingLevel()
 {
     XkGameCtrl.ResetIsLoadingLevel();
     if (NetworkServerNet.GetInstance() != null)
     {
         NetworkServerNet.GetInstance().TryToCreateServer();
     }
 }
    void DelayResetIsLoadingLevel()
    {
        Debug.Log("Unity:!!!!!!DelayResetIsLoadingLevel2!!!!!!");
        XkGameCtrl.ResetIsLoadingLevel();
        if (NetworkServerNet.GetInstance() != null)
        {
            NetworkServerNet.GetInstance().TryToCreateServer();
        }
        Debug.Log("Unity:!!!!!!DelayResetIsLoadingLevel3!!!!!!");

        //InputEventCtrl.GetInstance().ClickStartBtOne(ButtonState.DOWN); //test.
        //InputEventCtrl.GetInstance().ClickStartBtOne(ButtonState.UP);
        //Debug.Log("Unity:!!!!!!DelayResetIsLoadingLevel4!!!!!!");
    }
    // Use this for initialization
    void Start()
    {
        _Instance                 = this;
        Time.timeScale            = 1.0f;
        IsOpenSetPanel            = true;
        XkGameCtrl.IsLoadingLevel = false;

        XkGameCtrl.ResetIsLoadingLevel();
        if (pcvr.GetInstance() != null)
        {
            pcvr.GetInstance().CloseFangXiangPanPower(PlayerEnum.Null);
        }
        pcvr.CloseAllQiNangArray(1);
        pcvr.OpenPlayerGunZhenDong();
        if (GameMovieCtrl.IsActivePlayer)
        {
            if (GameTypeCtrl.AppTypeStatic == AppGameType.DanJiFeiJi ||
                GameTypeCtrl.AppTypeStatic == AppGameType.LianJiFeiJi)
            {
                GameJiTai = GameJiTaiType.FeiJiJiTai;
            }

            if (GameTypeCtrl.AppTypeStatic == AppGameType.DanJiTanKe ||
                GameTypeCtrl.AppTypeStatic == AppGameType.LianJiTanKe)
            {
                GameJiTai = GameJiTaiType.TanKeJiTai;
            }

            if (GameTypeCtrl.AppTypeStatic == AppGameType.LianJiServer ||
                GameTypeCtrl.AppTypeStatic == AppGameType.Null)
            {
                GameJiTai = GameJiTaiType.Null;
            }
        }
        GameOverCtrl.IsShowGameOver = false;
        pcvr.OpenDongGanState();
        pcvr.StartLightStateP1 = LedState.Mie;
        pcvr.StartLightStateP2 = LedState.Mie;
        XkGameCtrl.SetActivePlayerOne(false);
        XkGameCtrl.SetActivePlayerTwo(false);

        switch (GameJiTai)
        {
        case GameJiTaiType.TanKeJiTai:
            TanKeStarPos    = TankStarPosTmp;
            SetPanelStarPos = TanKeStarPos;
            break;

        case GameJiTaiType.FeiJiJiTai:
            FeiJiStarPos    = TankStarPosTmp;
            SetPanelStarPos = FeiJiStarPos;
            break;
        }
        StarObj = StarTran.gameObject;
        SetStarObjActive(true);

        InitHandleJson();
        InitStarImgPos();
        InitGameAudioValue();
        InitCoinStartLabel();
        InitGameDiffDuiGou();
        InitGameModeDuiGou();
        InitGunZDInfo();
        InitDianJiSpeedInfo();
        SetGameLanguageVal();

        InputEventCtrl.GetInstance().ClickSetEnterBtEvent       += ClickSetEnterBtEvent;
        InputEventCtrl.GetInstance().ClickSetMoveBtEvent        += ClickSetMoveBtEvent;
        InputEventCtrl.GetInstance().ClickFireBtOneEvent        += ClickFireBtOneEvent;
        InputEventCtrl.GetInstance().ClickFireBtTwoEvent        += ClickFireBtTwoEvent;
        InputEventCtrl.GetInstance().ClickStartBtOneEvent       += ClickStartBtEventP1;
        InputEventCtrl.GetInstance().ClickStartBtTwoEvent       += ClickStartBtEventP2;
        InputEventCtrl.GetInstance().ClickDaoDanBtOneEvent      += ClickDaoDanBtOneEvent;
        InputEventCtrl.GetInstance().ClickDaoDanBtTwoEvent      += ClickDaoDanBtTwoEvent;
        InputEventCtrl.GetInstance().ClickStopDongGanBtOneEvent += ClickStopDongGanBtOneEvent;
    }
    //public static string TestGameFile = "TestGame.info";
    // Use this for initialization
    void Start()
    {
        XkGameCtrl.IsLoadingLevel = false;
        string threeScreen = HandleJson.GetInstance().ReadFromFilePathXml(GameTypeCtrl.TestGameFile, "threeScreen");

        if (threeScreen == "")
        {
            threeScreen = "0";
            HandleJson.GetInstance().WriteToFilePathXml(GameTypeCtrl.TestGameFile, "threeScreen", threeScreen);
        }
        IsTestThreeScreen = threeScreen == "0" ? false : true;

        switch (GameTypeCtrl.AppTypeStatic)
        {
        case AppGameType.DanJiFeiJi:
        case AppGameType.LianJiFeiJi:
            IsThreeScreenGame = true;
            if (!IsTestThreeScreen)
            {
                IsThreeScreenGame = false;
            }
            break;

        default:
            IsThreeScreenGame = false;
            break;
        }

        if (XKGlobalData.GetInstance() != null)
        {
            if (GameTypeCtrl.AppTypeStatic == AppGameType.LianJiServer)
            {
                AudioListener.volume = 0f;
            }
            else
            {
                AudioListener.volume = (float)XKGlobalData.GameAudioVolume / 10f;
            }
        }

        _instance = this;
        XkGameCtrl.ResetIsLoadingLevel();
        if (pcvr.GetInstance() != null)
        {
            pcvr.GetInstance().CloseFangXiangPanPower(PlayerEnum.Null);
        }
        pcvr.CloseAllQiNangArray(1);
        pcvr.CloseGunZhenDongDengJi();
        PlayerIPInfo = Network.player.ipAddress;
        TimeLast     = Time.realtimeSinceStartup;
        GameTextType gameTextVal = XKGlobalData.GetGameTextMode();

        //gameTextVal = GameTextType.English; //test.
        switch (gameTextVal)
        {
        case GameTextType.Chinese:
            TextureMv = TextureMv_Ch;
            break;

        case GameTextType.English:
            TextureMv = TextureMv_En;
            break;
        }

        if (AudioListCtrl.GetInstance() != null)
        {
            AudioListCtrl.GetInstance().CloseGameAudioBJ();
        }
        Screen.showCursor = false;
        LoadingGameCtrl.ResetLoadingInfo();
        Time.timeScale = 1.0f;
        RectMv.width   = Screen.width;
        RectMv.height  = Screen.height * 0.93f;
        float perY  = 620f / 768f;
        float perXA = 180f / 1360f;
        float perXB = 955f / 1360f;
        float perXC = 100f / 1360f;
        float perXD = 875f / 1360f;

        RectArray[0].y = Screen.height * perY;
        RectArray[1].y = Screen.height * perY;
        RectArray[2].y = Screen.height * perY;
        RectArray[3].y = Screen.height * perY;

        RectArray[0].x = Screen.width * perXA;
        RectArray[1].x = Screen.width * perXB;
        RectArray[2].x = Screen.width * perXC;
        RectArray[3].x = Screen.width * perXD;
        AudioManager.Instance.SetParentTran(null);
        GameOverCtrl.IsShowGameOver = false;
        //IsTestLJGame = true; //test
        //IsTestXiaoScreen = true; //test
        if (!XkGameCtrl.IsGameOnQuit)
        {
            if (!IsThreeScreenGame)
            {
                if (!Screen.fullScreen ||
                    Screen.currentResolution.width != (int)XkGameCtrl.ScreenWidth ||
                    Screen.currentResolution.height != (int)XkGameCtrl.ScreenHeight)
                {
                    if (!IsTestLJGame && !IsTestXiaoScreen)
                    {
                        if (XkGameCtrl.ScreenWidth != 1360f)
                        {
                            Screen.SetResolution(1360, 768, true);
                        }
                        else
                        {
                            Screen.SetResolution((int)XkGameCtrl.ScreenWidth,
                                                 (int)XkGameCtrl.ScreenHeight,
                                                 true);
                        }
                    }
                }
            }
            else
            {
                if (!Screen.fullScreen ||
                    Screen.currentResolution.width != (int)XkGameCtrl.ScreenWidth3 ||
                    Screen.currentResolution.height != (int)XkGameCtrl.ScreenHeight3)
                {
                    if (!IsTestLJGame && !IsTestXiaoScreen)
                    {
                        Screen.SetResolution((int)XkGameCtrl.ScreenWidth3,
                                             (int)XkGameCtrl.ScreenHeight3,
                                             true);
                    }
                }
            }
        }

        if (!IsTestLJGame)
        {
            IsActivePlayer = true;
            if (IsTestXiaoScreen)
            {
                Screen.SetResolution(680, 384, false);                 //test
            }
        }

        QualitySettings.SetQualityLevel((int)QualityLevelEnum.Fast);
        AudioSourceObj = transform.GetComponent <AudioSource>();
        Invoke("DelayResetIsLoadingLevel", 4f);
        PlayMovie();
    }
    // Use this for initialization
    void Start()
    {
        _Instance = this;
        if (GameMovieCtrl.IsActivePlayer)
        {
            IsOpenVR = GameMovieCtrl.IsOpenVR;
        }

        if (IsOpenVR)
        {
            if (GameMovieCtrl.IsHaveDisplayTV)
            {
                VRCameraTr.gameObject.SetActive(false);
            }
            else
            {
                Transform trRoot = transform.root;
                trRoot.parent        = VRCameraTr;
                trRoot.localPosition = new Vector3(0f, 0f, 3f);
            }
        }
        else
        {
            VRCameraTr.gameObject.SetActive(false);
        }
        AudioListener.volume = 1f;
        Time.timeScale       = 1.0f;

        XkGameCtrl.ResetIsLoadingLevel();
//		if (pcvr.GetInstance() != null) {
//			pcvr.GetInstance().CloseFangXiangPanPower(PlayerEnum.Null);
//		}
        pcvr.CloseAllQiNangArray();
//		pcvr.OpenPlayerGunZhenDong();
        if (GameMovieCtrl.IsActivePlayer)
        {
            if (GameTypeCtrl.AppTypeStatic == AppGameType.DanJiFeiJi ||
                GameTypeCtrl.AppTypeStatic == AppGameType.LianJiFeiJi)
            {
                GameJiTai = GameJiTaiType.FeiJiJiTai;
            }

            if (GameTypeCtrl.AppTypeStatic == AppGameType.DanJiTanKe ||
                GameTypeCtrl.AppTypeStatic == AppGameType.LianJiTanKe)
            {
                GameJiTai = GameJiTaiType.TanKeJiTai;
            }

            if (GameTypeCtrl.AppTypeStatic == AppGameType.LianJiServer ||
                GameTypeCtrl.AppTypeStatic == AppGameType.Null)
            {
                //GameJiTai = GameJiTaiType.FeiJiJiTai;
                GameJiTai = GameJiTaiType.TanKeJiTai;
            }
        }
        GameOverCtrl.IsShowGameOver = false;
        pcvr.DongGanState           = 1;
        pcvr.StartLightStateP1      = LedState.Mie;
        pcvr.StartLightStateP2      = LedState.Mie;
        XkGameCtrl.SetActivePlayerOne(false);
        XkGameCtrl.SetActivePlayerTwo(false);

        switch (GameJiTai)
        {
        case GameJiTaiType.TanKeJiTai:
            TanKeStarPos    = TankStarPosTmp;
            SetPanelStarPos = TanKeStarPos;
            break;

        case GameJiTaiType.FeiJiJiTai:
            FeiJiStarPos    = TankStarPosTmp;
            SetPanelStarPos = FeiJiStarPos;
            break;
        }
        StarObj = StarTran.gameObject;
        SetStarObjActive(true);

        InitHandleJson();
        InitStarImgPos();
        InitGameAudioValue();
        InitCoinStartLabel();
        InitGameDiffDuiGou();
        InitGameModeDuiGou();
        InitGunZDInfo();
        SetGameLanguageVal();

        InputEventCtrl.GetInstance().ClickSetEnterBtEvent       += ClickSetEnterBtEvent;
        InputEventCtrl.GetInstance().ClickSetMoveBtEvent        += ClickSetMoveBtEvent;
        InputEventCtrl.GetInstance().ClickFireBtOneEvent        += ClickFireBtOneEvent;
        InputEventCtrl.GetInstance().ClickFireBtTwoEvent        += ClickFireBtTwoEvent;
        InputEventCtrl.GetInstance().ClickStartBtOneEvent       += ClickStartBtEventP1;
        InputEventCtrl.GetInstance().ClickStartBtTwoEvent       += ClickStartBtEventP2;
        InputEventCtrl.GetInstance().ClickDaoDanBtOneEvent      += ClickDaoDanBtOneEvent;
        InputEventCtrl.GetInstance().ClickDaoDanBtTwoEvent      += ClickDaoDanBtTwoEvent;
        InputEventCtrl.GetInstance().ClickStopDongGanBtOneEvent += ClickStopDongGanBtOneEvent;
    }