コード例 #1
0
    void OnGUI()
    {
        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 22;
        style.alignment = TextAnchor.UpperRight;

        string title = mode == 0 ? "Your Scores" : "Top Scores";

        GUI.BeginGroup(new Rect(Screen.width - 210, 10, 200, 300));

        ExtraMethods.DrawOutline(new Rect(0, 0, 200, 50), title, style, Color.black, Color.white);

        if (mode == 0)
        {
            ShowYourScores();
        }
        else
        {
            ShowTopScores();
        }

        GUI.EndGroup();
    }
コード例 #2
0
    void OnGUI()
    {
        GUIStyle style = new GUIStyle(skin.label);

        style.font     = skin.font;
        style.fontSize = 18;

        ExtraMethods.DrawOutline(new Rect(130, 10, 200, 50), playerList.Count + " Player(s) Online", style, Color.black, Color.white);
    }
コード例 #3
0
    void OnGUI()
    {
        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperCenter;

        GUI.BeginGroup(new Rect(Screen.width / 2 - 75, 10, 150, 150));

        ExtraMethods.DrawOutline(new Rect(0, 0, 150, 50), "Year " + year, style, Color.black, Color.white);
        ExtraMethods.DrawOutline(new Rect(0, 25, 150, 50), DateTimeFormatInfo.CurrentInfo.GetMonthName(month), style, Color.black, Color.white);
        ExtraMethods.DrawOutline(new Rect(0, 50, 150, 50), "Day " + day, style, Color.black, Color.white);

        GUI.EndGroup();
    }
コード例 #4
0
    public void ShowTopScores()
    {
        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperRight;

        GUIStyle scoreStyle = new GUIStyle(skin.label);

        scoreStyle.font      = skin.font;
        scoreStyle.fontSize  = 18;
        scoreStyle.alignment = TextAnchor.UpperRight;

        {
            Rect rect = new Rect(0, 30, 200, 50);
            ExtraMethods.DrawOutline(rect, "High Score", style, Color.black, new Color(1.0f, 0.93f, 0.73f, 1.0f));

            for (int i = 0; i < highScoreList.Length; i++)
            {
                string scoreText = highScoreList[i] == 0 ? "-" : highScoreList[i].ToString("n0");
                ExtraMethods.DrawOutline(new Rect(rect.x, rect.y + 20 + i * 20, 200, 50), scoreText, scoreStyle, Color.black, Color.white);
            }
        }

        {
            Rect rect = new Rect(0, 120, 200, 50);
            ExtraMethods.DrawOutline(rect, "Total Score", style, Color.black, new Color(1.0f, 0.93f, 0.73f, 1.0f));

            for (int i = 0; i < totalScoreList.Length; i++)
            {
                string scoreText = totalScoreList[i] == 0 ? "-" : totalScoreList[i].ToString("n0");
                ExtraMethods.DrawOutline(new Rect(rect.x, rect.y + 20 + i * 20, 200, 50), scoreText, scoreStyle, Color.black, Color.white);
            }
        }

        {
            Rect rect = new Rect(0, 200, 200, 50);
            ExtraMethods.DrawOutline(rect, "Current Score", style, Color.black, new Color(1.0f, 0.93f, 0.73f, 1.0f));

            for (int i = 0; i < currentScoreList.Length; i++)
            {
                string scoreText = currentScoreList[i] == 0 ? "-" : currentScoreList[i].ToString("n0");
                ExtraMethods.DrawOutline(new Rect(rect.x, rect.y + 20 + i * 20, 200, 50), scoreText, scoreStyle, Color.black, Color.white);
            }
        }
    }
コード例 #5
0
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(Screen.width / 2 - 100, 85, 200, 100));
        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperCenter;

        Color color = new Color(1.0f, 0.93f, 0.73f, 1.0f);

        ExtraMethods.DrawOutline(new Rect(0, 0, 200, 50), "Environment Score", style, Color.black, color);

        style           = new GUIStyle(skin.label);
        style.font      = skin.font;
        style.fontSize  = 24;
        style.alignment = TextAnchor.UpperCenter;

        ExtraMethods.DrawOutline(new Rect(0, 25, 200, 50), score.ToString("n0"), style, Color.black, Color.white);
        GUI.EndGroup();
    }
コード例 #6
0
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(Screen.width * 0.75f - 200, 10, 400, 100));

        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperRight;

        ExtraMethods.DrawOutline(new Rect(-170, 0, 400, 50), credits.ToString("n0") + " Credits", style, Color.black, Color.green);

        style           = new GUIStyle(skin.label);
        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperRight;

        ExtraMethods.DrawOutline(new Rect(-170, 20, 400, 50), coins.ToString("n0") + " Coins", style, Color.black, Color.yellow);

        GUI.EndGroup();
    }
コード例 #7
0
    void OnGUI()
    {
        GUI.skin = skin;

        GUI.BeginGroup(new Rect(Screen.width / 2 - 100, 145, 200, 100));
        GUIStyle style = new GUIStyle(GUI.skin.label);

        style.font      = (Font)Resources.Load("coopbl", typeof(Font));
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperCenter;

        if (!currentlyOnChallenge)
        {
            ExtraMethods.DrawOutline(new Rect(0, 0, 200, 50), "Current Biomass", style, Color.black, new Color(1.0f, 0.93f, 0.73f, 1.0f));

            style.font      = (Font)Resources.Load("coopbl", typeof(Font));
            style.fontSize  = 24;
            style.alignment = TextAnchor.UpperCenter;

            ExtraMethods.DrawOutline(new Rect(0, 25, 200, 50), biomass.ToString("n0"), style, Color.black, Color.white);
        }
        GUI.EndGroup();

        // Display challenge info
        if (tutorialIndex >= challengeStartIndex && tutorialIndex <= challengeEndIndex)
        {
            if (!objectiveCompleted && !failedChallenge)
            {
                Rect rect1  = new Rect(Screen.width - 250, 145, 240, 40);
                Rect rect2  = new Rect(Screen.width - 255, 175, 200, 40);
                Rect rect3  = new Rect(Screen.width - 145, 175, 200, 40);
                Rect rect4  = new Rect(Screen.width - 245, 205, 200, 40);
                Rect rect5  = new Rect(Screen.width - 135, 205, 200, 40);
                Rect rect6  = new Rect(Screen.width - 288, 235, 200, 40);
                Rect rect7  = new Rect(Screen.width - 145, 238, 200, 40);
                Rect rect8  = new Rect(Screen.width - 285, 265, 200, 40);
                Rect rect9  = new Rect(Screen.width - 145, 268, 200, 40);
                Rect rect10 = new Rect(Screen.width - 295, 295, 200, 40);
                Rect rect11 = new Rect(Screen.width - 155, 298, 200, 40);

                style.normal.textColor = Color.red;
                style.font             = (Font)Resources.Load("coopbl", typeof(Font));
                style.fontSize         = 21;
                ExtraMethods.DrawOutline(rect1, "Current Challenge:  " + currentChallenge, style, Color.black, new Color(1.0f, 0.93f, 0.73f, 1.0f));
                style.fontSize = 17;
                ExtraMethods.DrawOutline(rect2, "Days remaining: ", style, Color.black, Color.white);
                ExtraMethods.DrawOutline(rect3, daysLeft.ToString(), style, Color.white, Color.red);
                ExtraMethods.DrawOutline(rect4, "Credits Remaining: ", style, Color.black, Color.white);
                ExtraMethods.DrawOutline(rect5, currentTutorialCredits.ToString(), style, Color.black, Color.green);
                ExtraMethods.DrawOutline(rect6, "Species: ", style, Color.black, Color.white);

                if (speciesNumber >= challengeMinimumSpecies)
                {
                    GUI.Label(rect7, "<color=#008000ff><b> " + speciesNumber.ToString() + "/" + challengeMinimumSpecies.ToString() + "</b></color>");
                }
                else
                {
                    GUI.Label(rect7, "<color=#000000><b> " + speciesNumber.ToString() + "/" + challengeMinimumSpecies.ToString() + "</b></color>");
                }

                ExtraMethods.DrawOutline(rect8, "Biomass:", style, Color.black, Color.white);

                if (biomass >= challengeRequiredBiomass)
                {
                    GUI.Label(rect9, "<color=#008000ff><b>   " + biomass.ToString("n0") + "/" + challengeRequiredBiomass.ToString("n0") + "</b></color>");
                }
                else
                {
                    GUI.Label(rect9, "<color=#000000><b>   " + biomass.ToString("n0") + "/" + challengeRequiredBiomass.ToString("n0") + "</b></color>");
                }

                ExtraMethods.DrawOutline(rect10, "Score: ", style, Color.black, Color.white);

                if (score >= challengeRequiredEnvironmentScore)
                {
                    GUI.Label(rect11, "<color=#008000ff><b> " + score.ToString("n0") + "/" + challengeRequiredEnvironmentScore.ToString("n0") + "</b></color>");
                }
                else
                {
                    GUI.Label(rect11, "<color=#000000><b> " + score.ToString("n0") + "/" + challengeRequiredEnvironmentScore.ToString("n0") + "</b></color>");
                }
            }
            else if (objectiveCompleted && !instantiatedPics)
            {
                showVictoryPics();
            }
        }

        Rect increaseScore = new Rect(Screen.width - 220, 360, 200, 35);

        if (GUI.Button(increaseScore, "Env Score += 1000 (Debug)"))
        {
            score += 1000;
            GetComponent <EnvironmentScore>().SetScore(score);
        }

        resetTutorial = new Rect(Screen.width - 220, 400, 200, 35);
        if (GUI.Button(resetTutorial, "Reset Tutorial (Debug)"))
        {
            tutorialIndex        = 0;
            tutorialText         = Strings.ecosystemTutorialStrings[0];
            tutorialComplete     = false;
            objectiveCompleted   = false;
            readyForNextTutorial = Strings.ecosystemTutorialStringIsNextable[0];
            initializedShop      = false;
            currentlyOnChallenge = false;
            failedChallenge      = false;
            removeVictoryPics();
            resetSpecies();
            initializeShopAll();
            ConnectionManager cManager = mainObject.GetComponent <ConnectionManager>();
            if (cManager)
            {
                cManager.Send(RequestUpdateCurTut(Constants.USER_ID, 0));
            }
        }

        Rect failTheChallenge = new Rect(Screen.width - 220, 440, 200, 35);

        if (currentlyOnChallenge && GUI.Button(failTheChallenge, "Fail The Challenge (Debug)"))
        {
            daysPassed = 0;
            initializeDay();
            resetSpecies();
            failedChallenge = true;
            tutorialText    = failedChallengeMsg;
            if (instantiatedPics)
            {
                removeVictoryPics();
                instantiatedPics = false;
            }
        }

        Rect completeChallengeButtonRect = new Rect(Screen.width - 220, 480, 200, 35);

        if (tutorialIndex >= challengeStartIndex && tutorialIndex <= challengeEndIndex &&
            GUI.Button(completeChallengeButtonRect, "Complete Challenge(Debug)"))
        {
            objectiveCompleted   = true;
            readyForNextTutorial = true;
            tutorialText         = objectiveCompletedMsg;
        }

        if (isHidden && (failedChallenge || objectiveCompleted))
        {
            isHidden = !isHidden;
        }

        GUIStyle btnStyle = new GUIStyle(GUI.skin.button);

        btnStyle.font = (Font)Resources.Load("coopbl", typeof(Font));

        if (!isHidden)
        {
            GUI.backgroundColor = new Color(0.0f, 0.0f, 0.0f, 1.0f); // black color
            Color color = GUI.color;
            color.a   = 1f;                                          // transparency
            GUI.color = color;

            windowRect = GUI.Window((int)Constants.GUI_ID.Tutorial, windowRect, MakeWindow, Strings.tutorialTitles[tutorialIndex]);
        }

        else if (GUI.Button(new Rect(Screen.width - 260, Screen.height - 40, 120, 30), "Tutorial", btnStyle))
        {
            isHidden = !isHidden;
        }

        /*if (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return) {
         *      SendMessage();
         * }*/
    }