示例#1
0
 private void OnClickBuy(MessageBox.ReturnType Return)
 {
     if (Return == MessageBox.ReturnType.MB_YES)
     {
         GameObject gameObject = GameObject.Find("homeGUI");
         GameHome   gameHome   = gameObject.GetComponent("GameHome") as GameHome;
         gameHome.executeSuitPurchase(mSuits[mSelectedIndex].mIndex);
     }
 }
 public GameSelector(GameHome Parent)
 {
     mTabSkin = GUIUtil.mInstance.mTabSkin;
     if (GameData.MyFactionId == 1)
     {
         mFactionButton = mTabSkin.GetStyle("TopRightBanzai");
     }
     else
     {
         mFactionButton = mTabSkin.GetStyle("TopRightAtlas");
     }
 }
    public TabHome(GameHome Parent)
    {
        ModelTransform       = null;
        mGuestFactionTexture = (Resources.Load("Menus/ex_guest_graphic_" + GameData.MyFactionId) as Texture2D);
        GameObject gameObject = GameObject.Find("homeGUI");
        GameHome   gameHome   = gameObject.GetComponent("GameHome") as GameHome;

        if (GameData.DoesEventExist("event_news") && GameData.eventObjects["event_news"] != null)
        {
            TextAsset textAsset = GameData.eventObjects["event_news"] as TextAsset;
            mNewsData = textAsset.text;
            Debug.Log("show news: " + mNewsData);
            bNewsLoaded = true;
            NewsLabel   = null;
        }
        if (!bNewsLoaded)
        {
            gameHome.StartCoroutine(LoadNews());
        }
    }
示例#4
0
    public TabShowcase(GameHome Parent)
    {
        mParent = Parent;
        mSuitInspector.Init();
        mSuitInspector.mCameraOffset      = (mSuitInspector.mDefaultCameraPosition = Vector3.zero);
        mSuitInspector.ModelTransforms[0] = null;
        mSuitInspector.ModelTransforms[1] = GUIUtil.mInstance.mBackground;
        mSuitInspector.ModelPositions     = new Vector3[4];
        mSuitInspector.ModelPositions[0]  = new Vector3(0f, -6f, 27.5f);
        mSuitInspector.ModelPositions[1]  = new Vector3(0.25f, -6f, 28.5f);
        mSuitInspector.ModelPositions[2]  = new Vector3(0.25f, -6f, 28.5f);
        mSuitInspector.ModelPositions[3]  = new Vector3(-1.25f, 0f, 35f);
        mSuitInspector.ModelRotations     = new Vector3[4];
        mSuitInspector.ModelRotations[0]  = new Vector3(0f, 180f, 0f);
        mSuitInspector.ModelRotations[1]  = new Vector3(0f, 180f, 0f);
        mSuitInspector.ModelRotations[2]  = new Vector3(0f, 180f, 0f);
        mSuitInspector.ModelRotations[3]  = new Vector3(90f, 180f, 0f);
        setStyle();
        int num = 0;

        foreach (Exosuit value in GameData.MasterSuitList.Values)
        {
            if (value.mFactionId == GameData.MyFactionId)
            {
                SuitInspector.TempSuitInfo item = new SuitInspector.TempSuitInfo
                {
                    mSuitName             = value.mSuitName,
                    mIndex                = value.mSuitId,
                    mDescription          = value.mDescription,
                    mCost                 = value.mCost,
                    mSuitShow             = value.mShowName,
                    mShieldPower          = value.mBaseHealth,
                    mShieldRegen          = value.mBaseRegenHealth,
                    mJetpack              = value.mBaseJetFuel,
                    mSpeed                = value.mBaseSpeed,
                    mTech                 = value.mBaseTech,
                    mWeaponModName        = value.mWeaponModName,
                    mWeaponModDescription = value.mWeaponModDescription,
                    mLevelRequirement     = value.mLevelRequirement
                };
                mSuits.Add(item);
                num++;
            }
        }
        foreach (Exosuit value2 in GameData.MasterSuitList.Values)
        {
            if (value2.mFactionId == GameData.MyFactionId)
            {
                int priority = 50;
                if (value2.mSuitId == GameData.MySuitID)
                {
                    priority = 100;
                }
                else if (GameData.MyOwnedSuitIDs.Contains(value2.mSuitId))
                {
                    priority = 75;
                }
                if (GameData.getExosuit(value2.mSuitId).getHighPolyModel() == null)
                {
                    AssetLoader.AddSuitToLoad(value2.mSuitId, AssetLoader.SuitAsset.SuitType.high, priority);
                }
            }
        }
        bool flag = true;

        while (flag)
        {
            flag = false;
            for (int i = 0; i < mSuits.Count - 1; i++)
            {
                if (mSuits[i].mCost > mSuits[i + 1].mCost)
                {
                    SwapSuits(i, i + 1);
                    flag = true;
                }
                else if (mSuits[i].mCost == mSuits[i + 1].mCost && mSuits[i].mIndex > mSuits[i + 1].mIndex)
                {
                    SwapSuits(i, i + 1);
                    flag = true;
                }
            }
        }
        if (!GameData.MyOwnedSuitIDs.Contains(GameData.MySuitID))
        {
            GameData.AddOwnedSuit(GameData.MySuitID);
        }
        SetCurrentSelection(GetSuitIndexFromID(GameData.MySuitID));
    }
    private void DoWindow(int id)
    {
        curhover = ((Event.current.type != EventType.Repaint) ? lastHover : string.Empty);
        GUI.skin = mSharedSkin;
        if (mSetInputIndex != -1)
        {
            GUIUtil.GUIEnable(bEnable: false);
        }
        GUI.Label(new Rect(width / 2f - 125f, 5f, 250f, 30f), "OPTIONS MENU", "OptionsLabel");
        bool gUIEnabled = GUIUtil.GUIEnabled;

        if (GameData.CurPlayState == GameData.PlayState.GAME_STARTED || GameData.CurPlayState == GameData.PlayState.GAME_IS_PLAYING)
        {
            GUIUtil.GUIEnableOverride(bEnable: false);
        }
        GUI.BeginGroup(ControlsRect, "CONTROLS", "OptionsBase");
        for (int i = 0; i < mControlNames.Length; i++)
        {
            Rect position = new Rect(5f, 5 + i * 40, ControlsRect.width - 10f, 35f);
            if (mSetInputIndex == i)
            {
                GUI.color = Color.white;
                if (Input.GetKeyUp(KeyCode.Escape))
                {
                    break;
                }
                for (int j = 0; j < 410; j++)
                {
                    if (!Input.GetKeyUp((KeyCode)j))
                    {
                        continue;
                    }
                    GameData.mGameSettings.mControlValues[mSetInputIndex] = (KeyCode)j;
                    for (int k = 0; k < GameData.mGameSettings.mControlValues.Length; k++)
                    {
                        if (k != mSetInputIndex && GameData.mGameSettings.mControlValues[k] == GameData.mGameSettings.mControlValues[mSetInputIndex])
                        {
                            GameData.mGameSettings.mControlValues[k] = KeyCode.None;
                        }
                    }
                    mSetInputIndex = -1;
                    SaveOptions();
                    break;
                }
                GUI.color = Color.white;
                bool gUIEnabled2 = GUIUtil.GUIEnabled;
                GUIUtil.GUIEnableOverride(bEnable: true);
                Rect position2 = new Rect(position.x - 5f, position.y - 45f, position.width + 10f, position.height + 50f);
                GUI.Box(position2, "SET CONTROL", "MapKeyFrame");
                GUI.Label(position2, "PRESS ANY BUTTON TO SET AS INPUT", "MapKeyInstructions");
                GUIUtil.GUIEnableOverride(gUIEnabled2);
            }
            else if (GameData.mGameSettings.mControlValues[i] == KeyCode.None)
            {
                GUI.color = Color.red;
            }
            else
            {
                GUI.color = Color.white;
            }
            GUI.BeginGroup(position);
            if (!GUI.enabled)
            {
                GUI.color        = Color.gray;
                GUI.contentColor = Color.black;
            }
            switch (GUIUtil.Button(new Rect(0f, 0f, position.width, position.height), mControlNames[i], "ControlObject"))
            {
            case GUIUtil.GUIState.Hover:
            case GUIUtil.GUIState.Active:
                if (Event.current.type == EventType.Repaint)
                {
                    curhover = "Control " + i;
                    if (lastHover != curhover)
                    {
                        GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                    }
                }
                break;

            case GUIUtil.GUIState.Click:
                GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
                Input.ResetInputAxes();
                mSetInputIndex = i;
                break;
            }
            switch (GameData.mGameSettings.mControlValues[i])
            {
            case KeyCode.Mouse0:
                GUI.DrawTexture(new Rect(190 - MouseButtons[0].width / 2, 35 - MouseButtons[0].height, MouseButtons[0].width, MouseButtons[0].height), MouseButtons[0]);
                break;

            case KeyCode.Mouse1:
                GUI.DrawTexture(new Rect(190 - MouseButtons[0].width / 2, 35 - MouseButtons[1].height, MouseButtons[1].width, MouseButtons[1].height), MouseButtons[1]);
                break;

            default:
            {
                GUIStyle style    = mSharedSkin.GetStyle("KeyControl");
                float    minWidth = 0f;
                float    maxWidth = 0f;
                string   text     = GameData.mGameSettings.mControlValues[i].ToString().ToUpper();
                style.CalcMinMaxWidth(new GUIContent(text), out minWidth, out maxWidth);
                minWidth = Mathf.Max(30f, minWidth);
                GUI.Box(new Rect(190f - minWidth / 2f, 5f, minWidth, 25f), text, style);
                break;
            }
            }
            GUI.EndGroup();
        }
        GUI.color        = Color.white;
        GUI.contentColor = Color.white;
        switch (GUIUtil.Button(new Rect(5f, ControlsRect.height - 30f, ControlsRect.width - 10f, 25f), "RESTORE DEFAULT CONTROLS", "KeyControl"))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "RESTORE DEFAULT CONTROLS";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            GameData.mGameSettings.mControlValues = (KeyCode[])mDefaultControls.Clone();
            SaveOptions();
            break;
        }
        GUI.EndGroup();
        GUIUtil.GUIEnableOverride(gUIEnabled);
        didrepeat = (Event.current.type != EventType.Repaint && clickRepeat);
        GUI.BeginGroup(SoundRect, "SOUND", "OptionsBase");
        GUI.Label(new Rect(0f, 5f, SoundRect.width, 15f), "SOUND EFFECTS VOLUME", "OptionsInfo");
        float num = DrawSlider(SoundRect, GameData.mGameSettings.mSoundVolume);

        if (num != GameData.mGameSettings.mSoundVolume)
        {
            num = Mathf.Clamp(num, 0f, 1f);
            GameData.mGameSettings.mSoundVolume = num;
            GameData.ApplySoundSettings();
            SaveOptions();
        }
        GUI.EndGroup();
        GUI.BeginGroup(MusicRect, GUIContent.none, "OptionsBase");
        GUI.Label(new Rect(0f, 5f, MusicRect.width, 15f), "MUSIC VOLUME", "OptionsInfo");
        float num2 = DrawSlider(MusicRect, GameData.mGameSettings.mMusicVolume);

        if (num2 != GameData.mGameSettings.mMusicVolume)
        {
            num2 = Mathf.Clamp(num2, 0f, 1f);
            GameData.mGameSettings.mMusicVolume = num2;
            GameData.ApplyMusicSettings();
            SaveOptions();
        }
        GUI.EndGroup();
        clickRepeat = didrepeat;
        if (Event.current.type == EventType.Repaint && !bDown)
        {
            TimeHeld = 0f;
        }
        bDown = false;
        GUI.BeginGroup(GraphicsRect, "GRAPHICS", "OptionsBase");
        GUI.BeginGroup(new Rect(0.5f * (GraphicsRect.width - 282f), 5f, 282f, 78f), GUIContent.none, "GraphicsSliderBG");
        Settings.GraphicsLevel graphicsLevel = GameData.mGameSettings.mGraphicsLevel;
        switch (GUIUtil.Button(new Rect(0f, 0f, 41f, 46f), GUIContent.none, GUIStyle.none))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "Low Graphics";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            graphicsLevel = Settings.GraphicsLevel.Low;
            break;
        }
        switch (GUIUtil.Button(new Rect(120.5f, 0f, 41f, 46f), GUIContent.none, GUIStyle.none))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "Medium Graphics";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            graphicsLevel = Settings.GraphicsLevel.Medium;
            break;
        }
        switch (GUIUtil.Button(new Rect(241f, 0f, 41f, 46f), GUIContent.none, GUIStyle.none))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "High Graphics";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            graphicsLevel = Settings.GraphicsLevel.High;
            break;
        }
        if (graphicsLevel != GameData.mGameSettings.mGraphicsLevel)
        {
            GameData.mGameSettings.mGraphicsLevel = graphicsLevel;
            SaveOptions();
            if (GameData.CurPlayState == GameData.PlayState.GAME_STARTED || GameData.CurPlayState == GameData.PlayState.GAME_IS_PLAYING)
            {
                QualitySettings.currentLevel = (QualityLevel)GameData.mGameSettings.mGraphicsLevel;
            }
            else
            {
                QualitySettings.currentLevel = (QualityLevel)(3 + GameData.mGameSettings.mGraphicsLevel);
            }
        }
        GUI.Toggle(new Rect(0f, 0f, 41f, 46f), GameData.mGameSettings.mGraphicsLevel == Settings.GraphicsLevel.Low, "LOW", "GraphicsSliderButton");
        GUI.Toggle(new Rect(120.5f, 0f, 41f, 46f), GameData.mGameSettings.mGraphicsLevel == Settings.GraphicsLevel.Medium, "MEDIUM", "GraphicsSliderButton");
        GUI.Toggle(new Rect(241f, 0f, 41f, 46f), GameData.mGameSettings.mGraphicsLevel == Settings.GraphicsLevel.High, "HIGH", "GraphicsSliderButton");
        GUI.EndGroup();
        GUI.EndGroup();
        GUI.BeginGroup(FullScreenRect, GUIContent.none, "OptionsBase");
        bool gUIEnabled3 = GUIUtil.GUIEnabled;

        switch (GUIUtil.Toggle(new Rect(10f, 10f, (FullScreenRect.width - 30f) / 2f, 35f), !Screen.fullScreen, "PLAY IN BROWSER", "PlayBrowser"))
        {
        case (GUIUtil.GUIState) 18:
        case (GUIUtil.GUIState) 20:
        case (GUIUtil.GUIState) 34:
        case (GUIUtil.GUIState) 36:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "PLAY IN BROWSER";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case (GUIUtil.GUIState) 24:
            Screen.SetResolution(900, 600, fullscreen: false);
            break;
        }
        GUIUtil.Toggle(new Rect((FullScreenRect.width - 30f) / 2f - 25f, 17f, 28f, 21f), !Screen.fullScreen, GUIContent.none, "ScreenDongleBrowser");
        GUIUtil.GUIEnableOverride(mSetInputIndex == -1 && bCanFullscreen);
        if (!GUI.enabled)
        {
            GUI.color = Color.gray;
        }
        switch (GUIUtil.Toggle(new Rect((FullScreenRect.width - 30f) / 2f + 20f, 10f, (FullScreenRect.width - 30f) / 2f, 35f), Screen.fullScreen, "PLAY FULLSCREEN", "PlayFullScreen"))
        {
        case (GUIUtil.GUIState) 18:
        case (GUIUtil.GUIState) 20:
        case (GUIUtil.GUIState) 34:
        case (GUIUtil.GUIState) 36:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "FULLSCREEN";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case (GUIUtil.GUIState) 24:
            Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, fullscreen: true);
            break;
        }
        GUIUtil.Toggle(new Rect((FullScreenRect.width - 30f) / 2f + 25f, 17f, 28f, 21f), Screen.fullScreen, GUIContent.none, "ScreenDongleFullScreen");
        GUIUtil.GUIEnableOverride(gUIEnabled3);
        GUI.color = Color.white;
        GUI.EndGroup();
        gUIEnabled3 = GUIUtil.GUIEnabled;
        GUIUtil.GUIEnableOverride(mSetInputIndex == -1 && Application.loadedLevelName == "GameHome");
        switch (GUIUtil.Button(new Rect(20f, height - 48f, 120f, 38f), "BOOT CAMP", "ModalButton"))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "BOOT CAMP";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
        {
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            bDrawing = false;
            GameData.MyTutorialStep = 0;
            GameObject gameObject = GameObject.Find("homeGUI");
            if (gameObject != null)
            {
                GameHome gameHome = gameObject.GetComponent("GameHome") as GameHome;
                if (gameHome != null)
                {
                    gameHome.CheckTutorial(bOverride: true);
                }
            }
            break;
        }
        }
        GUIUtil.GUIEnableOverride(gUIEnabled3);
        switch (GUIUtil.Button(new Rect(width - 140f, height - 48f, 120f, 38f), "CLOSE", "ModalButton"))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "CLOSE";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            FirstUse.DoAction(FirstUse.Frame.RequiredAction.Close_Options);
            bDrawing       = false;
            mSetInputIndex = -1;
            break;
        }
        gUIEnabled3 = GUIUtil.GUIEnabled;
        GUIUtil.GUIEnableOverride(mSetInputIndex == -1 && (GameData.CurPlayState == GameData.PlayState.GAME_STARTED || GameData.CurPlayState == GameData.PlayState.GAME_IS_PLAYING));
        switch (GUIUtil.Button(new Rect(width / 2f - 60f, height - 48f, 120f, 38f), (GameData.MyTutorialStep <= 0) ? "QUIT MATCH" : "SKIP TRAINING", "ModalButton"))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "QUIT MATCH";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
        {
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            bDrawing = false;
            GameObject x = GameObject.Find("Game");
            if (x != null)
            {
                GamePlay gamePlayScript = GamePlay.GetGamePlayScript();
                if (gamePlayScript != null)
                {
                    gamePlayScript.QuitGame(6);
                }
            }
            break;
        }
        }
        GUIUtil.GUIEnableOverride(gUIEnabled3);
        lastHover = curhover;
    }