public static void DrawMissionLabel(int slot, string name, string detail, string reward, AfterButton afterButton)
    {
        double y = 0.1 + slot * 0.15;

        GuiHelper.DrawText(name, MicroFontLeft, 0.1, y, 0.3, 0.15);
        GuiHelper.DrawText(detail, MicroFontLeft, 0.37, y - 0.02, 0.5, 0.15);
        GuiHelper.DrawText(reward, MicroFontLeft, 0.37, y + 0.02, 0.5, 0.15);
        GuiHelper.ButtonWithText(0.82, y + 0.02, 0.15, 0.15, "Race", SpriteManager.GetRoundButton(), SmallFont, afterButton);
    }
    override protected void OnGUIInner()
    {
        Texture texture = SpriteManager.GetIntro();
        float   scale   = (float)Screen.height / (float)texture.height;
        int     height  = Mathf.RoundToInt(scale * texture.height);
        int     width   = Mathf.RoundToInt(scale * texture.width);
        int     x       = (Screen.width - width) / 2;

        GUI.DrawTexture(new Rect(x, GuiHelper.PercentH(0.1), width, height), texture);

        GuiHelper.ButtonWithText(0.3, 0.9, 0.3, 0.3, "Classic", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){
            Minigame m = gameObject.AddComponent <Minigame>();
            Destroy(this);
            m.PrepareRace(Game.Me.Player, ScreenAfterMinigameClassic.PrepareScreen, Mission.Classic, Game.Me.ClassicCarConfig);
        });

        GuiHelper.ButtonWithText(0.14, 0.78, 0.15, 0.15, "?", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){
            ScreenText m = gameObject.AddComponent <ScreenText>();
            m.Prepare(delegate() {
                m.gameObject.AddComponent <ScreenSplash>();
                Destroy(m);
            }, "Classic mode", "In classic mode you drive as far as you get. " +
                      "Pick up oil stains to have fuel, avoid other obstacles." +
                      "\n\nThere are google leaderboards and achievements with global scores, connect to it if you want to compare with others.");
            Destroy(this);
        });

        GuiHelper.ButtonWithText(0.7, 0.9, 0.3, 0.3, "Adventure", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){
            gameObject.AddComponent <ScreenAdvModeStart>();
            Destroy(this);
        });
        GuiHelper.ButtonWithText(0.85, 0.78, 0.15, 0.15, "?", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){
            ScreenText m = gameObject.AddComponent <ScreenText>();
            m.Prepare(delegate() {
                m.gameObject.AddComponent <ScreenSplash>();
                Destroy(m);
            }, "Adventure mode",
                      "In adventure mode you have your own car. Upgrade it with coins. " +
                      "Make missions, collect coins in race. Drive further. " +
                      "The farther you get the more coins there will be. " +
                      "Pick up oil stains to have fuel, avoid other obstacles. " +
                      "At some point shields will be available. " +
                      "\n\nThere are google leaderboards with global scores, connect to it if you want to compare with others.");
            Destroy(this);
        });

        GuiHelper.DrawText("K Bobnis: Design, Programming\nM Bartynski: Design, Concept", GuiHelper.MicroFont, 0.1, 0.1, 0.8, 0.17);

        if (GUI.Button(new Rect(GuiHelper.PercentW(0.79), GuiHelper.PercentH(0.21), GuiHelper.PercentW(0.2), GuiHelper.PercentH(0.2)), SpriteManager.GetSettingsIcon(), GuiHelper.CustomButton))
        {
            gameObject.AddComponent <ScreenOptions>();

            Destroy(this);
        }
    }
    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");
        });
    }
    public static void DrawBackground(AfterButton afterButton, bool showSettings = false)
    {
        GuiHelper.DrawElement("Images/popupWindow", 0.02, 0.1, 1, 0.94);
        GuiHelper.ButtonWithText(0.9, 0.92, 0.4, 0.2, "", SpriteManager.GetBackButton(), GuiHelper.CustomButton, afterButton);

        if (showSettings && GUI.Button(new Rect(GuiHelper.PercentW(0.8), GuiHelper.PercentH(0.70), GuiHelper.PercentW(0.2), GuiHelper.PercentH(0.2)), SpriteManager.GetSettingsIcon(), GuiHelper.CustomButton))
        {
            ScreenOptions so = Camera.main.gameObject.AddComponent <ScreenOptions>();
            so.Prepare(delegate(){
                Destroy(so);
            });
        }
    }
    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");
    }
    void OnGUI()
    {
        if (!IsGameOver)
        {
            if (MissionInfo == null)
            {
                GUI.Label(new Rect(GuiHelper.PercentW(0.1), GuiHelper.PercentH(0.05), Screen.width, Screen.height), "Distance: " + Distance, GuiHelper.SmallFontLeft);
            }
            else
            {
                GUI.Label(new Rect(GuiHelper.PercentW(0.1), GuiHelper.PercentH(0.05), Screen.width, Screen.height), MissionInfo, GuiHelper.SmallFontLeft);
            }


            int coins = Car.GetComponent <Car>().PickedUpCoins;
            if (coins > 0)
            {
                GuiHelper.ButtonWithText(0.07, 0.75, 0.18, 0.18, "" + coins, SpriteManager.GetCoin(), GuiHelper.SmallFontBlack, delegate(){});
            }
        }
    }
    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);
        });
    }
示例#8
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");
    }
 void OnGUI()
 {
     GuiHelper.ButtonWithText(Pos.x, Pos.y, 0.20, 0.20, Text, Texture, GuiHelper.MicroFont, delegate(){});
 }
 public static void YesButton(AfterYesM afterYes, string text = "Yes")
 {
     GuiHelper.ButtonWithText(0.5, 0.89, 0.4, 0.3, text, SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate() {
         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();
            });
        }
    }