Exemple #1
0
    private void CheckUiEvents()
    {
        if (IsCurrentEvent(GameEventsList.eType.GE_GAME_LOADING))
        {
            mUi.SetScreen(UiSystem.eMode.INTRO_SCREEN);

            mProfile.LoadProfile();
            mLevels.LoadLevels();
            mLevels.SetLevelForStart(mProfile.GetSave().currentLevel);

            foreach (var objectBase in mGameObjects)
            {
                objectBase.Value.Init(mGameData);
            }

            mTimer.Set(100, GameEventsList.eType.GE_GAME_READY);
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_GAME_READY))
        {
            mUi.SetScreen(UiSystem.eMode.BRIEFING_SCREEN);
            mUi.ProgressReset();

            var level = mLevels.GetCurrentLevel();
            ((Wall)mGameObjects["Road"]).Build(level);

            ((Ball)mGameObjects["Hero"]).PlaceToStart(level);
            ((Ball)mGameObjects["Hero"]).SetMoveType(HeroBase.eMoveType.INPLACE);
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_REMOVE_AD_BUTTON))
        {
            Debug.Log("Purchase: remove ads");

            // todo
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_SHOW_SHOP_BUTTON))
        {
            mUi.SetScreen(UiSystem.eMode.SHOP_SCREEN);
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_HIDE_SHOP_BUTTON))
        {
            mUi.SetScreen(UiSystem.eMode.BRIEFING_SCREEN);
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_SHOW_SETTINGS_BUTTON))
        {
            mUi.SetScreen(UiSystem.eMode.SETTINGS_SCREEN);
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_HIDE_SETTINGS_BUTTON))
        {
            mUi.SetScreen(UiSystem.eMode.BRIEFING_SCREEN);
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_START_GAME))
        {
            mUi.SetScreen(UiSystem.eMode.GAME_SCREEN);

            float levelLength = mGameData.initialWallLength * mParameters.mBlockSizeZ +
                                mGameData.blockDeltaZ * mGameData.finishOffset;

            mUi.ProgressStart(mParameters.mHorizontalSpeed, levelLength);
            ((Ball)mGameObjects["Hero"]).SetMoveType(HeroBase.eMoveType.FORWARD);
            mGameProcess = true;
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_SHOW_AD_BUTTON))
        {
            mUi.SetScreen(UiSystem.eMode.ADS_SCREEN);
            mTimer.Set(100, GameEventsList.eType.GE_GAME_READY);
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_PURCHASE_1_BUTTON))
        {
            Debug.Log("Purchase: shop purchase 1");

            // todo
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_PURCHASE_2_BUTTON))
        {
            Debug.Log("Purchase: shop purchase 2");

            // todo
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_PURCHASE_3_BUTTON))
        {
            Debug.Log("Purchase: shop purchase 3");

            // todo
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_SOUND_BUTTON))
        {
            Debug.Log("UI: sound button");

            // todo
        }

        if (IsCurrentEvent(GameEventsList.eType.GE_VIBRO_BUTTON))
        {
            Debug.Log("UI: vibro button");

            // todo
        }
    }