Пример #1
0
    public void AddMenuKetchup(UIMenu menu)
    {
        var newitem = new UIMenuCheckboxItem("Add ketchup?", ketchup, "Do you wish to add ketchup?");

        menu.AddItem(newitem);
        menu.OnCheckboxChange += (sender, item, checked_) =>
        {
            if (item == newitem)
            {
                ketchup = checked_;
                Screen.Notify("~r~Ketchup status: ~b~" + ketchup);
            }
        };
    }
Пример #2
0
        private void MenuScript_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.N:
                mainMenu.Visible        = !mainMenu.Visible;
                itemDifficulty.AltTitle = Strings.ResourceManager.GetString("Difficulty" + Common.CurrentDifficulty.ToString());
                itemKills.AltTitle      = Common.Kills.ToString();
                break;

            case Keys.E:
                if (mainMenu.Visible)
                {
                    return;
                }

                if (buyMenu.Visible)
                {
                    buyMenu.Visible = false;
                    return;
                }

                if (AmmuController.DistanceToAmmu() && !lemonPool.AreAnyVisible)
                {
                    buyMenu.Visible = true;
                }

                if (HungryController.IsPlayerCloseReseller() && !lemonPool.AreAnyVisible)
                {
                    foodMenu.Visible = true;
                }

                if (repair.DistanceTo(Game.Player.Character.Position) <= 10f && Game.Player.Character.IsInVehicle())
                {
                    if (!Game.Player.Character.CurrentVehicle.IsDamaged)
                    {
                        Screen.ShowSubtitle(Strings.RepairUndamaged);
                        return;
                    }
                    if (!Common.Cost(100))
                    {
                        break;
                    }
                    Game.Player.Character.CurrentVehicle.Repair();
                    Screen.ShowSubtitle(Strings.RepairSuccess);
                }

                break;
            }
        }
Пример #3
0
        void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == (Keys)Enum.Parse(typeof(Keys), cfgBeginKey))
            {
                SetupOutputFile();
                if (cfgDebug)
                {
                    isDebugEnabled = true;
                }
                Screen.ShowSubtitle("Logging vehicle signals..", 2000);
            }

            if (e.KeyCode == (Keys)Enum.Parse(typeof(Keys), cfgEndKey))
            {
                isLoggingToFile = false;
                isDebugEnabled  = false;
                file.Flush();
                file.Close();
                Screen.ShowSubtitle("File write complete", 2000);
            }
        }
Пример #4
0
    public void AddMenuFoods(UIMenu menu)
    {
        var foods = new List <dynamic>
        {
            "Banana",
            "Apple",
            "Pizza",
            "Quartilicious",
            0xF00D, // Dynamic!
        };
        var newitem = new UIMenuListItem("Food", foods, 0);

        menu.AddItem(newitem);
        menu.OnListChange += (sender, item, index) =>
        {
            if (item == newitem)
            {
                dish = item.IndexToItem(index).ToString();
                Screen.Notify("Preparing ~b~" + dish + "~w~...");
            }
        };
    }
Пример #5
0
    public void AddMenuCook(UIMenu menu)
    {
        var newitem = new UIMenuItem("Cook!", "Cook the dish with the appropiate ingredients and ketchup.");

        newitem.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
        newitem.SetRightBadge(UIMenuItem.BadgeStyle.Tick);
        menu.AddItem(newitem);
        menu.OnItemSelect += (sender, item, index) =>
        {
            if (item == newitem)
            {
                string output = ketchup ? "You have ordered ~b~{0}~w~ ~r~with~w~ ketchup." : "You have ordered ~b~{0}~w~ ~r~without~w~ ketchup.";
                Screen.ShowSubtitle(String.Format(output, dish));
            }
        };
        menu.OnIndexChange += (sender, index) =>
        {
            if (sender.MenuItems[index] == newitem)
            {
                newitem.SetLeftBadge(UIMenuItem.BadgeStyle.None);
            }
        };
    }