Пример #1
0
 void OnGUI()
 {
     if (PlayerSt != PlayerEnum.PlayerOne)
     {
         return;
     }
     XkGameCtrl.TestNetInfo();
 }
    void OnGUI()
    {
        if (MovieRender != null)
        {
            return;
        }

        if (!IsPlayMovie)
        {
            return;
        }

        if (IsPlayMvLogo)
        {
            ShowGameMovieLogo();
            if (Time.realtimeSinceStartup - TimeLogo >= 3f)
            {
                IsPlayMvLogo          = false;
                TimeStartMV           = Time.realtimeSinceStartup;
                TimeDelayHiddenMvLogo = Time.realtimeSinceStartup;
                Movie.Play();
                AudioSourceObj.Play();
                return;
            }
            return;
        }

        if (Time.realtimeSinceStartup - TimeDelayHiddenMvLogo < 0.2f)
        {
            ShowGameMovieLogo();
            return;
        }

        if (IsStopMovie)
        {
            return;
        }
        CheckClientPortMovieInfo();
        GUI.DrawTexture(RectMv, Movie, ScaleMode.StretchToFill);

        TimeVal += Time.deltaTime;
        int timeTmp = (int)TimeVal;

        if (!XKGlobalData.IsFreeMode)
        {
            if (timeTmp % 2 == 0)
            {
                if (XKGlobalData.CoinPlayerOne < XKGlobalData.GameNeedCoin)
                {
                    GUI.DrawTexture(RectArray[0], TextureMv[0]);
                }
                else
                {
                    GUI.DrawTexture(RectArray[2], TextureMv[1]);
                }

                if (XKGlobalData.CoinPlayerTwo < XKGlobalData.GameNeedCoin)
                {
                    GUI.DrawTexture(RectArray[1], TextureMv[0]);
                }
                else
                {
                    GUI.DrawTexture(RectArray[3], TextureMv[1]);
                }
            }
            else
            {
                if (XKGlobalData.CoinPlayerOne >= XKGlobalData.GameNeedCoin)
                {
                    GUI.DrawTexture(RectArray[2], TextureMv[2]);
                }

                if (XKGlobalData.CoinPlayerTwo >= XKGlobalData.GameNeedCoin)
                {
                    GUI.DrawTexture(RectArray[3], TextureMv[2]);
                }
            }
        }
        else
        {
            if (timeTmp % 2 == 0)
            {
                GUI.DrawTexture(RectArray[2], TextureMv[1]);
                GUI.DrawTexture(RectArray[3], TextureMv[1]);
            }
            else
            {
                GUI.DrawTexture(RectArray[2], TextureMv[2]);
                GUI.DrawTexture(RectArray[3], TextureMv[2]);
            }
        }

        XkGameCtrl.TestNetInfo();
        if (Camera.main != null && IsThreeScreenGame)
        {
            Vector3 posTmp = Camera.main.WorldToScreenPoint(InsertCoinTr[0].position);
            float   testPX = posTmp.x - (RectArray[0].width / 2f);
            float   testPY = posTmp.y + (RectArray[0].height * 0.7f);
            testPY         = Screen.height - testPY;
            RectArray[0].x = testPX;
            RectArray[0].y = testPY;

            posTmp         = Camera.main.WorldToScreenPoint(InsertCoinTr[1].position);
            testPX         = posTmp.x - (RectArray[1].width / 2f);
            RectArray[1].x = testPX;
            RectArray[1].y = testPY;

            posTmp         = Camera.main.WorldToScreenPoint(StartBtTr[0].position);
            testPX         = posTmp.x - (RectArray[2].width / 2f);
            testPY         = posTmp.y + (RectArray[2].height * 0.7f);
            testPY         = Screen.height - testPY;
            RectArray[2].x = testPX;
            RectArray[2].y = testPY;

            posTmp         = Camera.main.WorldToScreenPoint(StartBtTr[1].position);
            testPX         = posTmp.x - (RectArray[3].width / 2f);
            RectArray[3].x = testPX;
            RectArray[3].y = testPY;
        }

        TimeMovieVal = Time.realtimeSinceStartup - TimeStartMV;
        if (TimeMovieVal >= Movie.duration + 3f)
        {
            TimeLogo     = Time.realtimeSinceStartup;
            IsPlayMvLogo = true;
            Movie.Stop();
            AudioSourceObj.Stop();

            TimeStartMV = Time.realtimeSinceStartup;
            CountMV++;
        }

        ShowGameMvLG();
        if (!pcvr.bIsHardWare)
        {
            string mvInfo = "mvTime " + Movie.duration + ", CountMV " + CountMV + ", timeVal " + TimeMovieVal.ToString("f2");
            GUI.Label(new Rect(10f, 0f, Screen.width * 0.5f, 30f), mvInfo);
        }
        XKGameFPSCtrl.DrawGameFPS();
    }
 void OnGUI()
 {
     XkGameCtrl.TestNetInfo();
 }