Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
        private void MenuScript_Tick(object sender, EventArgs e)
        {
            lemonPool.Process();
            timerBars.Process();

            hungryBar.Progress = HungryController.ProgressBarStatus;
            waterBar.Progress  = HungryController.WaterBarStatus;
            if (AmmuController.DistanceToAmmu())
            {
                GameUI.DisplayHelp(Strings.AmmuOpenShop);
            }
            if (HungryController.IsPlayerCloseReseller())
            {
                GameUI.DisplayHelp(Strings.FoodOpenShop);
            }
            if (repair.DistanceTo(Game.Player.Character.Position) <= 10f && Game.Player.Character.IsInVehicle())
            {
                GameUI.DisplayHelp(Strings.RepairHelp);
            }
        }
Exemplo n.º 3
0
        private void Common_Start(object sender, EventArgs e)
        {
            try
            {
                logger.Trace("Loading Main Menu");
                lemonPool = new ObjectPool();
                logger.Trace("Menu Pool created");
#if DEBUG
                mainMenu = new NativeMenu("NAL Beta", Strings.MenuMainTitle);
#else
                mainMenu = new NativeMenu("NAL", Strings.MenuMainTitle);
#endif
                itemLights       = new NativeCheckboxItem(Strings.ItemLightsTitle, Strings.ItemLightsSubtitle, true);
                itemCallCops     = new NativeItem(Strings.ItemCopsTitle, Strings.ItemCopsSubtitle);
                itemDifficulty   = new NativeItem(Strings.ItemDifficulty, Strings.ItemDIfficultySubtitle);
                itemKills        = new NativeItem(Strings.ItemKills, Strings.ItemKillsSubtitle);
                itemCheatEnabled = new NativeCheckboxItem(Strings.ItemCheat, Strings.ItemCheatDescription);
                itemCommand      = new NativeItem(Strings.ItemCommand, Strings.ItemCommandDescription);
                itemModels       = new NativeItem(Strings.ItemModels, Strings.ItemModelsDescription);

                modelMenu = new NativeMenu("Models", Strings.MenuModel);

                itemDefaultModel = new NativeItem("Default", "The classic NAL Model.");
                itemCopModel     = new NativeItem("LSPD Officer", "The cop.");
                modelMenu.Add(itemDefaultModel);
                modelMenu.Add(itemCopModel);
                itemDefaultModel.Activated += ItemDefaultModel_Activated;
                itemCopModel.Activated     += ItemCopModel_Activated;
                #region Items - Load & Save
                saveMenu      = new NativeMenu(Strings.MenuSaveHeader, "SAVE");
                itemSaveSlot1 = new NativeItem(string.Format(Strings.MenuSaveItem, 1), Strings.MenuSaveItemSubtitle);
                itemSaveSlot2 = new NativeItem(string.Format(Strings.MenuSaveItem, 2), Strings.MenuSaveItemSubtitle);
                itemSaveSlot3 = new NativeItem(string.Format(Strings.MenuSaveItem, 3), Strings.MenuSaveItemSubtitle);

                itemSaveSlot1.Activated += (menu, i) => SaveController.Save(Common.Blackout, 1);
                itemSaveSlot2.Activated += (menu, i) => SaveController.Save(Common.Blackout, 2);
                itemSaveSlot3.Activated += (menu, i) => SaveController.Save(Common.Blackout, 3);

                saveMenu.Add(itemSaveSlot1);
                saveMenu.Add(itemSaveSlot2);
                saveMenu.Add(itemSaveSlot3);
                lemonPool.Add(saveMenu);

                loadMenu      = new NativeMenu(Strings.MenuLoadHeader, Strings.MenuLoadSubtitle);
                itemLoadSlot1 = new NativeItem(string.Format(Strings.MenuSaveItem, 1), Strings.MenuLoadItemSubtitle);
                itemLoadSlot2 = new NativeItem(string.Format(Strings.MenuSaveItem, 2), Strings.MenuLoadItemSubtitle);
                itemLoadSlot3 = new NativeItem(string.Format(Strings.MenuSaveItem, 3), Strings.MenuLoadItemSubtitle);

                itemLoadSlot1.Activated += (menu, i) => SaveController.Load(1);
                itemLoadSlot2.Activated += (menu, i) => SaveController.Load(2);
                itemLoadSlot3.Activated += (menu, i) => SaveController.Load(3);

                loadMenu.Add(itemLoadSlot1);
                loadMenu.Add(itemLoadSlot2);
                loadMenu.Add(itemLoadSlot3);
                lemonPool.Add(loadMenu);

                itemSave             = mainMenu.AddSubMenu(saveMenu);
                itemSave.Title       = Strings.ItemSaveTitle;
                itemSave.Description = Strings.ItemSaveSubtitle;

                itemLoad             = mainMenu.AddSubMenu(loadMenu);
                itemLoad.Title       = Strings.ItemLoadTitle;
                itemLoad.Description = Strings.ItemLoadSubtitle;
                #endregion

                foodMenu = new NativeMenu("Food", Strings.MenuFoodShopSubtitle);

                itemHamburger = HungryController.CreateFoodSellerItem(Strings.FoodBurger, Foods.Hamburger, 1);
                itemChicken   = HungryController.CreateFoodSellerItem(Strings.FoodChicken, Foods.Chicken, 3);
                itemWater     = HungryController.GenerateWaterSellItem(Strings.ItemWater, 2);

                foodMenu.Add(itemHamburger);
                foodMenu.Add(itemChicken);
                foodMenu.Add(itemWater);

                logger.Trace("All instances initialized");
                mainMenu.Add(itemLights);
                mainMenu.Add(itemSave);
                mainMenu.Add(itemLoad);
                mainMenu.Add(itemCallCops);

                itemModels             = mainMenu.AddSubMenu(modelMenu);
                itemModels.Title       = Strings.ItemModels;
                itemModels.Description = Strings.ItemModelsDescription;

                mainMenu.Add(itemDifficulty);
                mainMenu.Add(itemKills);

                lemonPool.Add(mainMenu);
                lemonPool.Add(modelMenu);
                lemonPool.Add(foodMenu);
                logger.Trace("Main Menu Done");
                Tick    += MenuScript_Tick;
                KeyDown += MenuScript_KeyDown;
                itemLights.CheckboxChanged += ItemLights_CheckboxEvent;
                itemCallCops.Activated     += ItemCallCops_Activated;
                itemCommand.Activated      += ItemCommand_Activated;
                itemCheatEnabled.Activated += ItemCheatEnabled_Activated;

                timerBars.Add(hungryBar);
                timerBars.Add(waterBar);

                Common.Unload += Common_Unload;

                logger.Trace("Loading Ammu-Nation Menu");

                buyMenu          = new NativeMenu(Strings.AmmuTitle, Strings.AmmuSubtitle);
                itemPistol       = AmmuController.GenerateWeaponSellerItem(Strings.AmmuPistol, Strings.AmmuPistolSubtitle, 100);
                itemPumpShotgun  = AmmuController.GenerateWeaponSellerItem(Strings.AmmuPumpShotgun, Strings.AmmuPumpShotgunSubtitle, 200);
                itemCarbineRifle = AmmuController.GenerateWeaponSellerItem(Strings.AmmuCarbineRifle, Strings.AmmuCarbineRifleSubtitle, 350);

                itemBodyArmor = new NativeItem(Strings.WeaponBodyArmor, Strings.WeaponBodyArmorDescription)
                {
                    AltTitle = "$380"
                };
                logger.Trace("Instances created");
                buyMenu.Add(itemPistol);
                buyMenu.Add(itemPumpShotgun);
                buyMenu.Add(itemBodyArmor);
                lemonPool.Add(buyMenu);
                itemPistol.Activated       += ItemPistol_Activated;
                itemPumpShotgun.Activated  += ItemPumpShotgun_Activated;
                itemCarbineRifle.Activated += ItemCarbineRifle_Activated;
                itemBodyArmor.Activated    += ItemBodyArmor_Activated;

                repairBlip              = World.CreateBlip(repair);
                repairBlip.IsFriendly   = true;
                repairBlip.IsShortRange = true;
                repairBlip.Sprite       = BlipSprite.Garage;
                repairBlip.Color        = BlipColor.Blue;
                repairBlip.Name         = Strings.RepairBlip;

                HungryController.AddBlipsToAllResellers();
                Instance = this;

                this.Aborted += MenuScript_Aborted;
                CommandController.Init();
            }
#pragma warning disable CA1031
            catch (Exception ex)
#pragma warning restore CA1031
            {
                GameUI.DisplayHelp(Strings.ExceptionMenu);
                logger.Fatal(ex, "Error while loading menu");
                Common.UnloadMod();
                this.Abort();
            }
        }
Exemplo n.º 4
0
 private void ItemPistol_Activated(object sender, EventArgs args) => AmmuController.SellWeapon(100, 100, WeaponHash.Pistol);
Exemplo n.º 5
0
 private void ItemPumpShotgun_Activated(object sender, EventArgs args) => AmmuController.SellWeapon(200, 50, WeaponHash.PumpShotgun);
Exemplo n.º 6
0
 private void ItemBodyArmor_Activated(object sender, EventArgs args) => AmmuController.SellArmor(50, 380);
Exemplo n.º 7
0
 private void ItemCarbineRifle_Activated(object sender, EventArgs args)
 {
     AmmuController.SellWeapon(350, 50, WeaponHash.CarbineRifle);
 }