Пример #1
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();
        }
    }
    // 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();
        }
    }
    // Use this for initialization
    void Start()
    {
        _instance = this;
        XKGlobalData.GetInstance();
        AudioListener.volume = (float)XKGlobalData.GameAudioVolume / 10f;
        if (AudioListCtrl.GetInstance() != null)
        {
            AudioListCtrl.GetInstance().CloseGameAudioBJ();
        }
        Screen.showCursor = false;
        LoadingGameCtrl.ResetLoadingInfo();
        Time.timeScale = 1.0f;
        AudioManager.Instance.SetParentTran(null);
        GameOverCtrl.IsShowGameOver = false;
        if (IsOpenFXZhenDong)
        {
            pcvr.OpenAllPlayerFangXiangPanPower();
        }
        pcvr.CloseAllQiNangArray(PlayerEnum.Null, 1);
        //IsTestLJGame = true; //test
        //IsTestXiaoScreen = true; //test
        if (!XkGameCtrl.IsGameOnQuit)
        {
            if (!Screen.fullScreen ||
                Screen.currentResolution.width != 1360 ||
                Screen.currentResolution.height != 768)
            {
                if (!IsTestLJGame && !IsTestXiaoScreen)
                {
                    Screen.SetResolution(1360, 768, 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);
        if (IsOpenFXZhenDong)
        {
            IsOpenFXZhenDong = false;
            Invoke("CloseAllFangXiangPanPower", 10f);
        }
        PlayMovie();
    }
    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();
        }
    }
Пример #5
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();
        }
    }
    // Use this for initialization
    void Awake()
    {
        _instance = this;
        try
        {
            XKGlobalData.GetInstance();
            //Debug.Log("Unity:!!!!!!GetInstance!!!!!!");
            AudioListener.volume = (float)XKGlobalData.GameAudioVolume / 10f;
            if (AudioListCtrl.GetInstance() != null)
            {
                AudioListCtrl.GetInstance().CloseGameAudioBJ();
            }
            else
            {
                Debug.Log("Unity:!!!!!!AudioListCtrl.GetInstance() == null!!!!!!");
            }
            Screen.showCursor = false;
            LoadingGameCtrl.ResetLoadingInfo();
            //Debug.Log("Unity:!!!!!!ResetLoadingInfo!!!!!!");
            Time.timeScale = 1.0f;
            AudioManager.Instance.SetParentTran(null);
            //Debug.Log("Unity:!!!!!!Instance.SetParentTran!!!!!!");
            GameOverCtrl.IsShowGameOver = false;
            //Debug.Log("Unity:!!!!!!IsOpenFXZhenDong!!!!!!"+ IsOpenFXZhenDong.ToString());
            if (IsOpenFXZhenDong)
            {
                pcvr.OpenAllPlayerFangXiangPanPower();
            }
            pcvr.CloseAllQiNangArray(PlayerEnum.Null, 1);
            //Debug.Log("Unity:!!!!!!CloseAllQiNangArray!!!!!!");
            //IsTestLJGame = true; //test
            //IsTestXiaoScreen = true; //test
            if (!XkGameCtrl.IsGameOnQuit)
            {
#if READ_SCREEN_CONFIG
                IsReadScreenConfig = true;
                //读取游戏分辨率配置信息.
                gameObject.AddComponent <ScreenConfig>();
#else
                if (Screen.fullScreen ||
                    Screen.currentResolution.width != 1280 ||
                    Screen.currentResolution.height != 720)
                {
                    if (!IsTestLJGame && !IsTestXiaoScreen)
                    {
                        Screen.SetResolution(1280, 720, false);
                    }
                }
#endif
            }
            Debug.Log("Unity:!!!!!!IsGameOnQuit!!!!!!");

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

            QualitySettings.SetQualityLevel((int)QualityLevelEnum.Fast);
            Debug.Log("Unity:!!!!!!SetQualityLevel!!!!!!");
            //AudioSourceObj = transform.GetComponent<AudioSource>();
            Invoke("DelayResetIsLoadingLevel", 4f);
            if (IsOpenFXZhenDong)
            {
                IsOpenFXZhenDong = false;
                Invoke("CloseAllFangXiangPanPower", 10f);
            }
            Debug.Log("Unity:!!!!!!IsOpenFXZhenDong!!!!!!");
            //PlayMovie();
            //创建Logo播放对象.
            CrateMovieLogoAni();
            InputEventCtrl.GetInstance().ClickTVYaoKongExitBtEvent += ClickTVYaoKongExitBtEvent;
            pcvr.GetInstance().AddTVYaoKongBtEvent();
        }
        catch (System.Exception e)
        {
            Debug.Log("Unity:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            Debug.LogException(e);
            Debug.Log("Unity:" + e.Message);
        }
    }
    //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();
    }