示例#1
0
    override protected void OnGUIInner()
    {
        GuiHelper.DrawAtTop("Quit");

        GuiHelper.DrawBeneathLine("Are you sure you want to quit?");
        GuiHelper.YesButton(delegate() {
            Application.Quit();
        });
    }
示例#2
0
    override protected void OnGUIInner()
    {
        PlayerState ps = Game.Me.Player;
        bool        canAffordUpgrade = CarStatistic.CanUpgrade(ps.Coins);

        GuiHelper.DrawAtTop("Upgrade " + CarStatistic.Type.Name());

        string text = CarStatistic.Type.Description() + "\n\n";

        bool   dependenciesOk = true;
        string dependencyText = "";

        foreach (Dependency dependency in CarStatistic.Dependencies)
        {
            if (!dependency.IsMet())
            {
                dependenciesOk = false;
                dependencyText = dependency.FailText;
            }
        }
        bool minimumOk = CarStatistic.Type.AboveMinimum(CarStatistic.Type.ValueForLevel(CarStatistic.Level + 1));

        if (dependenciesOk && minimumOk)
        {
            text += "Coins: " + ps.Coins + " - " + CarStatistic.UpgradeCost() + " = " + (ps.Coins - CarStatistic.UpgradeCost()) + "\n";
            float valueBefore = CarStatistic.Value;
            float valueAfter  = CarStatistic.Type.ValueForLevel(CarStatistic.Level + 1);
            float valueDiff   = valueAfter - valueBefore;
            text += CarStatistic.Type.Name() + ": " + CarStatistic.ValueFormatted + " + " + string.Format("{0:0.00}", valueDiff) + " = " + string.Format("{0:0.00}", valueAfter) + "\n\n";
            if (canAffordUpgrade)
            {
                text += "Upgrade?";
            }
            else
            {
                text += "You have not enough coins";
            }
        }
        else if (!minimumOk)
        {
            text += "This statistic has best possible value";
        }
        else if (!dependenciesOk)
        {
            text += dependencyText;
        }

        GuiHelper.DrawBeneathLine(text);
        if (canAffordUpgrade)
        {
            GuiHelper.YesButton(delegate() {
                ps.BuyAndUpgrade(CarStatistic);
                ps.Save();
            });
        }
    }
    override protected void OnGUIInner()
    {
        GuiHelper.DrawAtTop("Settings");

        float textY   = 0.3f;
        float buttonY = 0.04f;
        float diff    = 0.1f;

        GuiHelper.DrawText("Sounds", GuiHelper.SmallFontLeft, 0.1, textY, 0.8, 0.1);
        GuiHelper.ButtonWithText(0.8, textY + buttonY, 0.2, 0.15, (Sounds.IsMuted()?" Turn on":"Turn off"), SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){
            Sounds.Mute(!Sounds.IsMuted());
        });

        textY += diff;
        GuiHelper.DrawText("Fb fan page", GuiHelper.SmallFontLeft, 0.1, textY, 0.8, 0.1);
        GuiHelper.ButtonWithText(0.8, textY + buttonY, 0.13, 0.13, "", SpriteManager.GetFbIcon(), GuiHelper.SmallFont, delegate(){
        });

        textY += diff;
        string isNow  = CarSmasherSocial.Authenticated ? "on" : "off";
        string willBe = CarSmasherSocial.Authenticated ? "disconnect" : "connect";

        GuiHelper.DrawText("Google games are " + isNow, GuiHelper.MicroFontLeft, 0.1, textY, 0.8, 0.1);
        Texture googlePlay = CarSmasherSocial.Authenticated ? SpriteManager.GetGooglePlay() : SpriteManager.GetInactiveGooglePlay();

        GuiHelper.ButtonWithText(0.8, textY + buttonY - 0.015, 0.25, 0.2, willBe, googlePlay, GuiHelper.MicroFont, delegate(){
            CarSmasherSocial.InitializeOrLogOut(true, null, null, this);
        });

        textY += diff;
        bool vibrationsOn = Parameter.IsOn(ParameterType.VIBRATION);

        GuiHelper.DrawText("Vibrations", GuiHelper.SmallFontLeft, 0.1, textY, 0.8, 0.1);
        GuiHelper.ButtonWithText(0.8, textY + buttonY, 0.2, 0.15, "Turn " + (vibrationsOn ? "off" : "on"), SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate() {
            ParameterType.VIBRATION.Switch(!vibrationsOn);
        });

        textY += diff;
        bool fasterStart = Parameter.IsOn(ParameterType.FASTER_START);

        GuiHelper.DrawText("Faster start", GuiHelper.SmallFontLeft, 0.1, textY, 0.8, 0.1);
        GuiHelper.ButtonWithText(0.8, textY + buttonY, 0.2, 0.15, "Turn " + (fasterStart ? "off" : "on"), SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate() {
            ParameterType.FASTER_START.Switch(!fasterStart);
        });
        GuiHelper.ButtonWithText(0.66, textY + buttonY, 0.2, 0.1, "i", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate() {
            ScreenText st = gameObject.AddComponent <ScreenText>();
            Destroy(this);
            st.Prepare(delegate(){
                st.gameObject.AddComponent <ScreenOptions>();
                Destroy(st);
            }, "Faster start", "If your high score is good, your car will be faster in first 300 distance to save you time."
                       + "\n\nUse this when you want to show this game to a new person, he will have slower start");
        });
    }
    override protected void OnGUIInner()
    {
        PlayerState state = Game.Me.Player;

        GuiHelper.DrawAtTop("Adventure mode");
        GuiHelper.DrawBeneathLine("Available coins: " + state.Coins);         //, GuiHelper.SmallFontTop, 0.1, 0.2, 0.8, 0.1);

        float y = 0.38f;

        foreach (KeyValuePair <CarStatisticType, CarStatistic> kvp in state.CarConfig.CarStatistics)
        {
            CarStatistic cs = kvp.Value;
            if (cs.IsUnlockedFor(state))
            {
                AfterButton upgrade = delegate() {
                    ScreenUpgrade su = gameObject.AddComponent <ScreenUpgrade>();
                    su.PrepareWith(cs);
                    Destroy(this);
                };

                string inBrackets = "";
                if (!cs.Type.AboveMinimum(cs.Type.ValueForLevel(cs.Level + 1)))
                {
                    inBrackets = "(Best)";
                }
                else if (cs.CanUpgrade(state.Coins))
                {
                    inBrackets = "(Upg for " + cs.UpgradeCost() + ")";
                }
                string text = cs.Type.Name() + ": " + cs.ValueFormatted + " " + inBrackets;
                GuiHelper.ButtonWithText(0.5, y, 1, 0.15, text, SpriteManager.GetRectangleButton(), GuiHelper.MicroFont, upgrade);


                //this has to be drawn after button with text because of overlay
                if (cs.CanUpgrade(state.Coins))
                {
                    GuiHelper.ButtonWithText(0.9, y, 0.15, 0.15, "", SpriteManager.GetUpArrow(), GuiHelper.MicroFont, upgrade);
                }
                y += 0.093f;
            }
        }


        GuiHelper.YesButton(delegate() {
            ScreenStartingMission ssm = gameObject.AddComponent <ScreenStartingMission>();
            Destroy(this);
        }, "Race");
    }
    override protected void OnGUIInner()
    {
        GuiHelper.YesButton(delegate() {
            ScreenStartingMission ssm = gameObject.AddComponent <ScreenStartingMission>();
            Destroy(this);
        }, "Race");


        GuiHelper.DrawAtTop("Mission " + (Passed ? "Completed" : "Failed") + " (" + Mission.Description + ")");
        string text = "";

        int sumOfCoins = CoinsCollected + (Passed?Mission.Reward.Coins:0);

        text += "Coins: +" + sumOfCoins + " (reward: " + (Passed?Mission.Reward.Coins:0) + ", collected: " + CoinsCollected + ") \n\n\n\n";


        text += "Distance: " + Distance;
        int best = HighScores.GetTopScore(HighScoreType.Adventure);

        if (Distance == best)
        {
            text += " New Record!!!";
        }
        else
        {
            text += ", best: " + best + "";
        }
        text += "\n";


        GuiHelper.DrawBeneathLine(text);

        Texture leaderBoard = SpriteManager.GetLeaderboard();

        GuiHelper.ButtonWithText(0.85, 0.487, 0.2, 0.15, "Scores", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){
            CarSmasherSocial.ShowLeaderBoard(GoogleLeaderboard.LEADERB_BEST_DISTANCES_ADV);
        });
    }
示例#6
0
    override protected void OnGUIInner()
    {
        PlayerState state        = Game.Me.Player;
        int         upgAvailable = 0;

        foreach (KeyValuePair <CarStatisticType, CarStatistic> kvp in state.CarConfig.CarStatistics)
        {
            if (kvp.Value.IsUnlockedFor(state) && kvp.Value.CanUpgrade(state.Coins))
            {
                upgAvailable++;
            }
        }

        GuiHelper.DrawAtTop(Mission.Description);
        string text = "Reward: " + Mission.Reward.Description +
                      "\n\n " + upgAvailable + " upgrades are available" +
                      "\n\n\n\n Your best distance: " + HighScores.GetTopScore(HighScoreType.Adventure);

        GuiHelper.DrawBeneathLine(text);

        if (upgAvailable > 0)
        {
            GuiHelper.ButtonWithText(0.85, 0.4, 0.13, 0.13, "", SpriteManager.GetUpArrow(), GuiHelper.SmallFont, BackButton);
        }

        Texture leaderBoard = SpriteManager.GetLeaderboard();

        GuiHelper.ButtonWithText(0.85, 0.585, 0.2, 0.15, "Scores", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){
            CarSmasherSocial.ShowLeaderBoard(GoogleLeaderboard.LEADERB_BEST_DISTANCES_ADV);
        });

        GuiHelper.YesButton(delegate(){
            Minigame mi = gameObject.AddComponent <Minigame>();
            Destroy(this);
            mi.PrepareRace(Game.Me.Player, ScreenAfterMinigameAdv.PrepareScreen, Mission, Game.Me.Player.CarConfig);
        }, "Start");
    }
 override protected void OnGUIInner()
 {
     GuiHelper.DrawAtTop("Google games");
     GuiHelper.DrawBeneathLine("There are leaderboards and achievements from google games in this game. The game would be a lot more fun if connected. Would you like to connect?");
     GuiHelper.YesButton(AfterYes);
 }
    override protected void OnGUIInner()
    {
        if (ShowNewHighScoreScreen)
        {
            GuiHelper.DrawBackground(delegate() {
                ShowNewHighScoreScreen = false;
            });

            GuiHelper.DrawAtTop("New High Score!");
            GuiHelper.DrawBeneathLine("You just beat your high score with distance " + Distance + ". \n\n Like to tell your friends about it?");

            if (GUI.Button(new Rect(GuiHelper.PercentW(0.2), GuiHelper.PercentH(0.70), GuiHelper.PercentW(0.6), GuiHelper.PercentH(0.11)), SpriteManager.GetFbShareButton(), GuiHelper.CustomButton))
            {
                ShowNewHighScoreScreen = false;
            }
        }
        else if (ShowRideInfoScreen)
        {
            GuiHelper.DrawBackground(delegate() {
                ShowRideInfoScreen = false;
            });

            GuiHelper.DrawAtTop(GameOverReason);
            GuiHelper.DrawBeneathLine(
                "Collect oil drops to replenish fuel tank. Avoid obstacles.\n" +
                "\nDistance made: " + Distance +
                "\nTurns made: " + Turns +
                "\nFuel picked up: " + FuelPickedUp + " " +
                "(in a row: " + FuelPickedUpInARow + ") " +
                "(when low: " + FuelPickedUpWhenLow + ") ");
        }
        else
        {
            GuiHelper.DrawBackground(delegate() {
                gameObject.AddComponent <ScreenSplash>();
                Destroy(this);
            });
            GuiHelper.DrawAtTop(GameOverReason);


            if (GUI.Button(new Rect(GuiHelper.PercentW(0.8), GuiHelper.PercentH(0.13), GuiHelper.PercentW(0.15), GuiHelper.PercentH(0.1)), "help", GuiHelper.SmallFont))
            {
                ShowRideInfoScreen = true;
            }
            DrawTopScores(0.3f);

            Texture achievements = SpriteManager.GetAchievements();
            if (GUI.Button(new Rect(GuiHelper.PercentW(0.07), GuiHelper.PercentH(0.65), GuiHelper.PercentW(0.15), GuiHelper.PercentH(0.14)), achievements, GuiHelper.CustomButton))
            {
                CarSmasherSocial.ShowAchievements();
            }

            Texture leaderBoard = SpriteManager.GetLeaderboard();
            if (GUI.Button(new Rect(GuiHelper.PercentW(0.28), GuiHelper.PercentH(0.61), GuiHelper.PercentW(0.15), GuiHelper.PercentH(0.14)), leaderBoard, GuiHelper.CustomButton))
            {
                CarSmasherSocial.ShowLeaderBoard(GoogleLeaderboard.LEADERB_BEST_DISTANCES);
            }

            GuiHelper.YesButton(delegate(){
                Minigame m = gameObject.AddComponent <Minigame>();
                m.PrepareRace(Game.Me.Player, ScreenAfterMinigameClassic.PrepareScreen, Mission.Classic, Game.Me.ClassicCarConfig);
                Destroy(this);
            }, "Start");

            GuiHelper.ButtonWithText(0.9, 0.92, 0.4, 0.2, "", SpriteManager.GetBackButton(), GuiHelper.CustomButton, delegate() {
                BackToSplash();
            });
        }
    }
示例#9
0
 override protected void OnGUIInner()
 {
     GuiHelper.DrawAtTop(Top);
     GuiHelper.DrawBeneathLine(Middle);
 }