示例#1
1
    public PIMenu()
    {
        Tick += OnTick;
        KeyDown += OnKeyDown;

        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@brave");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@confident");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@drunk");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@drunk@verydrunk");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@fat@a");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@shadyped@a");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@hurry@a");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@injured");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@intimidation@1h");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@quick");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@sad@a");
        Function.Call(Hash.REQUEST_CLIP_SET, "move_m@tool_belt@a");

        MenuColor = Color.Blue;

        MainMenu = new UIMenu(Game.Player.Name.ToString(), "INTERACTION MENU", new Point(0, 0));
        MenuPool.Add(MainMenu);
        GlobalMenuBanner = new UIResRectangle();
        GlobalMenuBanner.Color = MenuColor;
        MainMenu.SetBannerType(GlobalMenuBanner);
        MainMenu.Title.Font = GTA.Font.ChaletComprimeCologne;
        MainMenu.Title.Scale = 0.86f;
        MainMenu.Subtitle.Color = MenuColor;

        var QuickGPSList = new List<dynamic>
        {
            "None",
            "Ammu-Nation",
            "Convenience Store",
            "Mod Shop",
            "Clothes Store",
        };

        MainMenu.AddItem(QuickGPSItem = new UIMenuListItem("Quick GPS", QuickGPSList, 0, "Select to place your waypoint at a set location."));

        QuickGPSItem.Activated += (UIMenu sender, UIMenuItem selecteditem) =>
        {
            var tmpList = (UIMenuListItem)selecteditem;
            switch (tmpList.Index)
            {
                case 0:
                    Function.Call(Hash.SET_WAYPOINT_OFF);
                    break;
                case 1:
                    Vector3 NearestAmmunation = PointsOfInterest.GetClosestPoi(Game.Player.Character.Position, PointsOfInterest.Type.AmmuNation);
                    Function.Call(Hash.SET_NEW_WAYPOINT, NearestAmmunation.X, NearestAmmunation.Y);
                    break;
            }
        };

        InventoryMenu = new UIMenu(Game.Player.Name.ToString(), "INVENTORY", new Point(0, 0));
        MenuPool.Add(InventoryMenu);
        InventoryMenu.SetBannerType(GlobalMenuBanner);
        InventoryMenu.Title.Font = GTA.Font.ChaletComprimeCologne;
        InventoryMenu.Title.Scale = 0.86f;
        InventoryMenu.Subtitle.Color = MenuColor;

        var InventoryMenuItem = new UIMenuItem("Inventory", "Your inventory which contains clothing, ammo, and much more.");

        MainMenu.AddItem(InventoryMenuItem);

        MainMenu.BindMenuToItem(InventoryMenu, InventoryMenuItem);

        var PlayerMoodsList = new List<dynamic>
        {
            "None",
            "Normal",
            "Happy",
            "Angry",
            "Injured",
            "Stressed",
        };

        MainMenu.AddItem(PlayerMoodItem = new UIMenuListItem("Player Mood", PlayerMoodsList, 0, "Sets your character's facial expression."));

        var WalkStyleList = new List<dynamic>
        {
            "Normal",
            "Brave",
            "Confident",
            "Drunk",
            "Fat",
            "Gangster",
            "Hurry",
            "Injured",
            "Intimidated",
            "Quick ",
            "Sad",
            "Tough Guy"
        };

        MainMenu.AddItem(WalkStyleItem = new UIMenuListItem("Walk Style", WalkStyleList, 0, "Sets your Character's walking style."));

        var AimingStyleList = new List<dynamic>
        {
            "None",
            "Gangster",
            "Cowboy",
        };

        MainMenu.AddItem(AimingStyleItem = new UIMenuListItem("Aiming Style", AimingStyleList, 0, "Sets your Character's pistol aiming style."));

        PassiveModeItem = new UIMenuItem("Enable Passive Mode", "Passive Mode will prevent damage and wanted levels from police.");

        MainMenu.AddItem(PassiveModeItem);

        MenuOptionsMenu = new UIMenu(Game.Player.Name.ToString(), "MENU OPTIONS", new Point(0, 0));
        MenuPool.Add(MenuOptionsMenu);
        MenuOptionsMenu.SetBannerType(GlobalMenuBanner);
        MenuOptionsMenu.Title.Font = GTA.Font.ChaletComprimeCologne;
        MenuOptionsMenu.Title.Scale = 0.86f;
        MenuOptionsMenu.Subtitle.Color = MenuColor;

        var MenuOptionsMenuItem = new UIMenuItem("Menu Options", "");

        MainMenu.AddItem(MenuOptionsMenuItem);

        MainMenu.BindMenuToItem(MenuOptionsMenu, MenuOptionsMenuItem);

        AboutMenu = new UIMenu(Game.Player.Name.ToString(), "ABOUT", new Point(0, 0));
        MenuPool.Add(AboutMenu);
        AboutMenu.SetBannerType(GlobalMenuBanner);
        AboutMenu.Title.Font = GTA.Font.ChaletComprimeCologne;
        AboutMenu.Title.Scale = 0.86f;
        AboutMenu.Subtitle.Color = MenuColor;

        var AboutOptionsMenuItem = new UIMenuItem("About", "");

        MenuOptionsMenu.BindMenuToItem(AboutMenu, AboutOptionsMenuItem);

        var MenuColorList = new List<dynamic>
        {
            "Blue",
            "Red",
            "Green",
            "Orange",
            "Purple",
            "Yellow",
        };

        MenuOptionsMenu.AddItem(MenuColorItem = new UIMenuListItem("Color", MenuColorList, 0, "Select interaction menu's color theme."));

        MenuOptionsMenu.AddItem(AboutOptionsMenuItem);

        var VersionItem = new UIMenuItem("Version");
        var AuthorItem = new UIMenuItem("Author");

        AboutMenu.AddItem(VersionItem);
        AboutMenu.AddItem(AuthorItem);

        VersionItem.SetRightLabel("1.0");
        AuthorItem.SetRightLabel("jedijosh920 & Guadmaz");

        MainMenu.OnItemSelect += (UIMenu sender, UIMenuItem selectedItem, int index) =>
        {
            switch (index)
            {
                case 5:
                    if (!IsPassiveMode)
                    {
                        Game.Player.Character.IsInvincible = true;
                        Game.Player.Character.Alpha = 200;
                        Function.Call(Hash.SET_POLICE_IGNORE_PLAYER, Game.Player, true);
                        Function.Call(Hash.SET_WANTED_LEVEL_MULTIPLIER, 0.0f);
                        PassiveModeItem.Text = "Disable Passive Mode";
                        IsPassiveMode = true;
                    }

                    else if (IsPassiveMode)
                    {
                        Game.Player.Character.ResetAlpha();
                        Function.Call(Hash.SET_POLICE_IGNORE_PLAYER, Game.Player, false);
                        Function.Call(Hash.SET_WANTED_LEVEL_MULTIPLIER, 1.0f);
                        PassiveModeItem.Text = "Enable Passive Mode";
                        IsPassiveMode = false;
                    }
                    break;
            }
        };

        MenuOptionsMenu.OnListChange += (UIMenu sender, UIMenuListItem listItem, int newIndex) =>
        {
            if (listItem == MenuColorItem)
            {
                switch (newIndex)
                {
                    case 0:
                        MenuColor = Color.Blue;
                        break;
                    case 1:
                        MenuColor = Color.Red;
                        break;
                    case 2:
                        MenuColor = Color.Green;
                        break;
                    case 3:
                        MenuColor = Color.Orange;
                        break;
                    case 4:
                        MenuColor = Color.Purple;
                        break;
                    case 5:
                        MenuColor = Color.Yellow;
                        break;
                }
            }

            if (listItem == WalkStyleItem)
            {
                switch (newIndex)
                {
                    case 0:
                        Game.Player.Character.Task.ClearAll();
                        Function.Call(Hash.RESET_PED_MOVEMENT_CLIPSET, Game.Player.Character, 0x3E800000);
                        break;
                    case 1:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@brave", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 2:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@confident", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 3:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@drunk@verydrunk", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 4:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@fat@a", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 5:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@shadyped@a", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 6:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@hurry@a", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 7:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@injured", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 8:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@intimidation@1h", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 9:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@quick", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 10:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@sad@a", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                    case 11:
                        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@tool_belt@a", 0x3E800000);
                        Game.Player.Character.Task.ClearAll();
                        break;
                }
            }

            if (listItem == PlayerMoodItem)
            {
                switch (newIndex)
                {
                    case 0:
                        Function.Call(Hash.CLEAR_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character);
                        break;
                    case 1:
                        Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "mood_normal_1", 0);
                        break;
                    case 2:
                        Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "mood_happy_1", 0);
                        break;
                    case 3:
                        Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Angry_1", 0);
                        break;
                    case 4:
                        Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Injured_1", 0);
                        break;
                    case 5:
                        Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Stressed_1", 0);
                        break;
                }
            }

            if (listItem == AimingStyleItem)
            {
                switch (newIndex)
                {
                    case 0:
                        Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "default"));
                        break;
                    case 1:
                        Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "Gang1H"));
                        break;
                    case 2:
                        Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "Hillbilly"));
                        break;
                }
            }
        };

        var menu = new AmmoMenu();
        var ammoItem = new UIMenuItem("Ammo");
        InventoryMenu.AddItem(ammoItem);
        InventoryMenu.BindMenuToItem(menu, ammoItem);
        MenuPool.Add(menu);

        MainMenu.RefreshIndex();
        InventoryMenu.RefreshIndex();
    }
示例#2
0
 private static void OnIndexChange(UIMenuItem changeditem, int index)
 {
     if (changeditem == IssueTicketItem)
     {
         updatePenaltyType(index);
     }
 }
示例#3
0
        private void CreateMenu()
        {
            // Create the menu.
            menu = new UIMenu("vMenu", "About vMenu", true)
            {
                ScaleWithSafezone       = false,
                MouseControlsEnabled    = false,
                MouseEdgeEnabled        = false,
                ControlDisablingEnabled = false
            };


            //var currentVersion = ($"v{GetResourceMetadata(GetCurrentResourceName(), "version", 0)}");

            // Create menu items.
            UIMenuItem version = new UIMenuItem("Version", $"Currently installed version of vMenu: ~h~v{MainMenu.Version}~h~");

            version.SetRightLabel($"~h~v{MainMenu.Version}~h~");
            UIMenuItem credits = new UIMenuItem("Credits", $"vMenu is made by ~r~Vespura~s~. Big thank you to ~y~Briglair~s~, ~y~Shayan~s~ for helping out with various things! " +
                                                $"Also thanks to ~y~IllusiveTea~s~ for alpha testing and for providing feedback.");
            UIMenuItem info = new UIMenuItem("More Info About vMenu", "If you'd like to find out more about vMenu and all of it's features, " +
                                             "checkout the forum post at ~b~vespura.com/vmenu~s~.");
            UIMenuItem help    = new UIMenuItem("Need Help?", $"If you want to learn more about vMenu, report a bug or you need to contact me, go to ~b~vespura.com/vmenu~s~.");
            UIMenuItem support = new UIMenuItem("Info For Server Owners", "If you want to learn how to setup vMenu for your server, please visit the vMenu wiki page " +
                                                "at: ~b~vespura.com/vmenu/wiki~s~.");

            menu.AddItem(version);
            menu.AddItem(credits);
            menu.AddItem(info);
            menu.AddItem(help);
            menu.AddItem(support);
        }
示例#4
0
    public void AddActorActionToMenu(UIMenu menu, String name, Action <UIMenuItem, int> action, Func <int, bool> ticked)
    {
        var submenu = AddSubMenu(menu, name);

        for (int i = 0; i < 10; i++)
        {
            var subsubmenu = AddSubMenu(submenu, String.Format("Actors {0}-{1}", 1 + i * 10, 10 + i * 10));
            for (int j = 0; j < 10; j++)
            {
                var slot     = 1 + j + i * 10;
                var slotitem = new UIMenuItem(String.Format("Actor {0}", slot));
                subsubmenu.AddItem(slotitem);
                if (ticked(slot))
                {
                    slotitem.SetLeftBadge(UIMenuItem.BadgeStyle.Tick);
                }
                subsubmenu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == slotitem)
                    {
                        action(slotitem, slot);
                    }
                };
            }
        }
    }
示例#5
0
        /// <summary>
        /// Adds menu items from selected dictionary if not in the main menu SOTW
        /// </summary>
        /// <param name="oldMenu"></param>
        /// <param name="newMenu"></param>
        /// <param name="forward"></param>
        private void MainMenu_OnMenuChange(UIMenu oldMenu, UIMenu newMenu, bool forward)
        {
            if (_debug)
            {
                Chat.Output($"Main menu changed: {newMenu.Title.Caption}");
            }

            var menuCaption = newMenu.Subtitle.Caption;

            if (menuCaption.ToUpper() != "MAIN MENU")
            {
                if (_debug)
                {
                    Chat.Output($"populating peds: {menuCaption}. ItemsExist:{newMenu.MenuItems.Count}");
                }

                Dictionary <string, uint> peds = GetPedDict(menuCaption);
                foreach (var skin in peds)
                {
                    var menuItem = new UIMenuItem(skin.Key, skin.Value.ToString());
                    newMenu.AddItem(menuItem);
                }
                return;
            }
        }
 /// <summary>
 /// Update to show the specified menu item.
 /// </summary>
 /// <param name="item">Item.</param>
 public virtual void InitMenuItem(UIMenuItem item)
 {
     menuItem = item;
     menu = (IMenu) item.GetComponentInParent (typeof(IMenu));
     textField.color = defaultColor;
     Refresh ();
 }
示例#7
0
        private void Food(UIMenu menu)
        {
            var food = _storemenuPool.AddSubMenu(menu, "Food");

            for (int i = 0; i < 1; i++)
            {
                ;
            }

            food.MouseEdgeEnabled        = false;
            food.ControlDisablingEnabled = false;

            var bread = new UIMenuItem("Buy Bread");

            bread.SetRightLabel("$1");
            food.AddItem(bread);
            food.OnItemSelect += (sender, item, index) =>
            {
                if (item == bread)
                {
                    if (Utilities.Constructors.playerMoney >= 1)
                    {
                        //Take Away Money
                        API.SetPedMoney(API.GetPlayerPed(-1), Utilities.Constructors.playerMoney - 1);

                        //Give Item
                        Utilities.Constructors.Bread = Utilities.Constructors.Bread + 1;

                        //Refresh Main
                        MainMenu._menuPool.RefreshIndex();
                    }
                }
            };
        }
示例#8
0
        private void AddSaveVehicleItem(UIMenu menu)
        {
            var newItem = new UIMenuItem("Aracı kaydet");

            menu.AddItem(newItem);

            menu.OnItemSelect += (sender, item, index) =>
            {
                if (item != newItem)
                {
                    return;
                }

                Vehicle car = LocalPlayer.Character.CurrentVehicle;

                if (car == null)
                {
                    Screen.ShowNotification(ERROR_NOCAR);
                    return;
                }

                SaveVehicle(car);
                Screen.ShowNotification("Araç kaydedildi.");
            };
        }
示例#9
0
 void onMainMenuItemSelect(UIMenu sender, UIMenuItem item, int index)
 {
     if (item == giveJetPack)
     {
         GiveJetPack();
     }
     else if (item == spawnFriendlyJetPack_rocket)
     {
         SpawnFriendlyJetPack_rocket();
     }
     else if (item == spawnFriendlyJetPack_minigun)
     {
         SpawnFriendlyJetPack_minigun();
     }
     else if (item == spawnEnemyJetPack_rocket)
     {
         SpawnEnemyJetPack_rocket();
     }
     else if (item == spawnEnemyJetPack_minigun)
     {
         SpawnEnemyJetPack_minigun();
     }
     else if (item == killFriendlyJetPack)
     {
         KillFriendlyJetPack();
     }
     else if (item == killEnemyJetPack)
     {
         KillEnemyJetPack();
     }
 }
示例#10
0
        void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
        {
            bool hasWentDown = false;                // WORKAROUND BUGFIX

            if (selectedItem == mainScoreCollection) // Fancy thing to disallow selecting the Set
            {
                hasWentDown = true;
                mainScoreCollection.Selected = false;
                controllerMain.GoDown();
            }

            if (controllerMain.CurrentSelection == 1 && !hasWentDown)
            {
                PlayScore();
            }

            if (selectedItem == mainScoreIntensity)
            {
                SetInstensity();
            }

            if (selectedItem == mainCustomEvent) // #DEBUG
            {
                TriggerEvent(OnscreenKeyboard.GetInput());
            }
            //
            // if (selectedItem == mainCustomScene)
            // {
            //     StartScene(OnscreenKeyboard.GetInput());
            // }
        }
示例#11
0
        /// Discord ///
        public void DiscordLink(UIMenu menu)
        {
            var discord = _menuPool.AddSubMenu(menu, "Discord");

            for (int i = 0; i < 1; i++)
            {
                ;
            }

            discord.MouseEdgeEnabled        = false;
            discord.ControlDisablingEnabled = false;

            var invitelink = new UIMenuItem("Invite Link", "");

            discord.AddItem(invitelink);
            discord.OnItemSelect += (sender, item, index) =>
            {
                if (item == invitelink)
                {
                    API.SetNotificationTextEntry("STRING");
                    API.SetNotificationColorNext(4);
                    API.AddTextComponentString("discord.me/gamersnetworkjoin");
                    API.SetTextScale(0.5f, 0.5f);
                    API.SetNotificationMessage("CHAR_SOCIAL_CLUB", "CHAR_SOCIAL_CLUB", false, 0, " ~p~DISCORD", " ~g~Join Here");
                    API.DrawNotification(true, false);
                }
            };
        }
示例#12
0
        public Drag_Race() // main function
        {
            var cars = new List <dynamic>
            {
                "Buffalo",
                "Bullet",
                "Adder",
                "Zentorno",
                "Banshee",
                "B-Type",
                "BATI",
                "Entity XF",
            };

            ParseSettings();
            Tick      += OnTick;
            KeyDown   += OnKeyDown;
            Interval   = 1;
            mainMenu   = new UIMenu("Drag Race", "~g~Main Menu");
            startOne   = new UIMenuItem("Start Race: One!", "Starts race 1, the coordinates are changeable in the ini. \nX: " + custom1x + "\nY: " + custom1y + "\nZ: " + custom1z);
            startTwo   = new UIMenuItem("Start Race: Two!", "Starts race 2, the coordinates are changeable in the ini. \nX: " + custom2x + "\nY: " + custom2y + "\nZ: " + custom2z);
            startThree = new UIMenuItem("Start Race: Custom Race!", "Starts race 3, ONLY USE IF YOU'VE CHANGED THE INI");
            startFour  = new UIMenuItem("Start Race: Waypoint", "Starts waypoint race, will only start if you have a waypoint set.");
            carSel     = new UIMenuListItem("Car", cars, 0, "Select your car.");
            mainMenu.AddItem(startOne);
            mainMenu.AddItem(startTwo);
            mainMenu.AddItem(startThree);
            mainMenu.AddItem(startFour);
            mainMenu.AddItem(carSel);
            mainMenu.RefreshIndex();
            menuPool.Add(mainMenu);
            mainMenu.OnItemSelect += ItemSelectHandler;
            mainMenu.OnListChange += OnListChange;
        }
示例#13
0
        public void SaleConfirmationMenu_ItemSelected(UIMenu menu, UIMenuItem selectedItem, int index)
        {
            if (InsideMethLabIdx == -1)
            {
                return;
            }

            if (index == 0)
            {
                if (MethLabs[InsideMethLabIdx].Product < 1)
                {
                    UI.Notify("This lab doesn't have any product.");
                    return;
                }

                Vector3 position = MethLabs[InsideMethLabIdx].Position;
                int     zoneHash = Function.Call <int>(Hash.GET_HASH_OF_MAP_AREA_AT_COORDS, position.X, position.Y, position.Z);

                if (zoneHash == Game.GenerateHash("city"))
                {
                    position = Constants.CountrysideDeliveryPositions[Constants.RandomGenerator.Next(0, Constants.CountrysideDeliveryPositions.Length)];
                }
                else
                {
                    position = Constants.CityDeliveryPositions[Constants.RandomGenerator.Next(0, Constants.CityDeliveryPositions.Length)];
                }

                Mission.Start(
                    MissionType.Delivery,
                    InsideMethLabIdx,

                    new List <Vector3>
                {
                    MethLabs[InsideMethLabIdx].DeliveryPosition,
                    position
                },

                    0.0f,
                    MissionTime * 60 * 1000,
                    MethLabs[InsideMethLabIdx].Product
                    );

                Game.Player.Character.Position = MethLabs[InsideMethLabIdx].Position;

                int chance    = Constants.RandomGenerator.Next(0, 100);
                int labChance = MethLabs[InsideMethLabIdx].HasFlag(LabFlags.HasSecurityUpgrade) ? (int)Math.Floor(PoliceChance / 2.0) : PoliceChance;
                if (chance <= labChance)
                {
                    Game.Player.WantedLevel += PoliceStars;
                    Util.NotifyWithPicture("LJT", $"{Util.GetCharacterFromModel(Game.Player.Character.Model.Hash)}, the cops know about the delivery!", "CHAR_LJT", 1);
                }

                LeftMethLab.Invoke(InsideMethLabIdx, LabExitReason.Mission);
                InsideMethLabIdx = -1;
            }
            else
            {
                menu.GoBack();
            }
        }
        private async Task SetupMenu()
        {
            await Delay(1000);

            _menu = InteractionMenu.Instance._interactionMenuPool.AddSubMenuOffset(InteractionMenu.Instance._interactionMenu,
                                                                                   "Vehicle Shop", "Buy your vehicles here!", new PointF(5, Screen.Height / 2));
            _menuIndex = InteractionMenu.Instance._interactionMenu.MenuItems.Count - 1;
            foreach (var info in vehicleStoreInfo)
            {
                Debug.WriteLine(info.Model);
                UIMenuItem item = null;
                if (_irlCars.ContainsKey(info.Model))
                {
                    item = new UIMenuItem("~b~" + _irlCars[info.Model] + "-~g~$" + info.Prices + "~r~ In Stock:" + info.Stock);
                }
                else
                {
                    item = new UIMenuItem("~b~" + info.Model + "-~g~$" + info.Prices + "~r~ In Stock:" + info.Stock);
                }
                _menu.AddItem(item);
                _menu.OnItemSelect += (sender, selectedItem, index) =>
                {
                    if (selectedItem == item)
                    {
                        TriggerServerEvent("BuyVehicle", info.Model, info.Model);
                        InteractionMenu.Instance._interactionMenuPool.CloseAllMenus();
                        _menuOpen    = false;
                        _menuCreated = false;
                        InteractionMenu.Instance._interactionMenu.RemoveItemAt(_menuIndex);
                        InteractionMenu.Instance._interactionMenuPool.RefreshIndex();
                    }
                };
            }
            InteractionMenu.Instance._interactionMenuPool.RefreshIndex();
        }
示例#15
0
        private async Task InformantCheck()
        {
            while (true)
            {
                _menuOpen = false;
                foreach (var pos in Posistions)
                {
                    var dist = API.Vdist(Game.PlayerPed.Position.X, Game.PlayerPed.Position.Y, Game.PlayerPed.Position.Z, pos.X, pos.Y, pos.Z);
                    if (dist < 6f)
                    {
                        _menuOpen = true;
                    }
                }

                if (_menuOpen && !_menuCreated)
                {
                    _menu = InteractionMenu.Instance._interactionMenuPool.AddSubMenuOffset(
                        InteractionMenu.Instance._interactionMenu, "Informant", "Buy information to find criminal spots.", new PointF(5, Screen.Height / 2));
                    foreach (var info in Information)
                    {
                        var button = new UIMenuItem(info.Title, Convert.ToString(info.Price));
                        _menu.AddItem(button);
                        _menu.OnItemSelect += (sender, item, index) =>
                        {
                            if (item == button)
                            {
                                TriggerServerEvent("BuyInformerInformation", info.Title);
                            }
                        };
                    }
                    _menuCreated = true;
                    InteractionMenu.Instance._interactionMenuPool.RefreshIndex();
                }
                else if (!_menuOpen && _menuCreated)
                {
                    _menuCreated = false;
                    if (_menu.Visible)
                    {
                        _menu.Visible = false;
                        InteractionMenu.Instance._interactionMenuPool.CloseAllMenus();
                        InteractionMenu.Instance._interactionMenu.Visible = true;
                    }

                    var i = 0;
                    foreach (var item in InteractionMenu.Instance._interactionMenu.MenuItems)
                    {
                        if (item == _menu.ParentItem)
                        {
                            InteractionMenu.Instance._interactionMenu.RemoveItemAt(i);
                            break;
                        }

                        i++;
                    }

                    InteractionMenu.Instance._interactionMenuPool.RefreshIndex();
                }
                await Delay(1000);
            }
        }
示例#16
0
        private async Task StoreCheck()
        {
            while (true)
            {
                _menuOpen = false;
                foreach (var pos in Posistions)
                {
                    var dist = API.Vdist(Game.PlayerPed.Position.X, Game.PlayerPed.Position.Y, Game.PlayerPed.Position.Z, pos.X, pos.Y, pos.Z);
                    if (dist < 2.5f && !MenuRestricted)
                    {
                        _menuOpen = true;
                    }
                }

                if (_menuOpen && !_menuCreated)
                {
                    _menu = InteractionMenu.Instance._interactionMenuPool.AddSubMenuOffset(
                        InteractionMenu.Instance._interactionMenu, StoreName, StoreDesc, new PointF(5, Screen.Height / 2));
                    var buttons = new List <UIMenuItem>();
                    foreach (var item in Items)
                    {
                        var button = new UIMenuItem(item.Key, "Costs ~g~$" + item.Value);
                        buttons.Add(button);
                        _menu.AddItem(button);
                        _menu.OnItemSelect += (sender, selectedItem, index) =>
                        {
                            if (selectedItem == button)
                            {
                                TriggerServerEvent("BuyItemByName", selectedItem.Text);
                            }
                        };
                    }
                    _menuCreated = true;
                    InteractionMenu.Instance._interactionMenuPool.RefreshIndex();
                }
                else if (!_menuOpen && _menuCreated)
                {
                    _menuCreated = false;
                    if (_menu.Visible)
                    {
                        _menu.Visible = false;
                        InteractionMenu.Instance._interactionMenuPool.CloseAllMenus();
                        InteractionMenu.Instance._interactionMenu.Visible = true;
                    }

                    var i = 0;
                    foreach (var item in InteractionMenu.Instance._interactionMenu.MenuItems)
                    {
                        if (item == _menu.ParentItem)
                        {
                            InteractionMenu.Instance._interactionMenu.RemoveItemAt(i);
                            break;
                        }
                        i++;
                    }
                    InteractionMenu.Instance._interactionMenuPool.RefreshIndex();
                }
                await Delay(1000);
            }
        }
示例#17
0
文件: DevUI.cs 项目: jamieb452/FRFuel
        public DevUI()
        {
            menuPool = new MenuPool();
            mainMenu = new UIMenu("FRFuel dev menu", "things");

            position         = new UIMenuItem("Pos");
            position.Enabled = false;

            vehicleModelId         = new UIMenuItem("Vehicle model ID");
            vehicleModelId.Enabled = false;

            knownVehicle         = new UIMenuItem("Is known vehicle");
            knownVehicle.Enabled = false;

            vehicleFuelTank = new UIMenuItem("Vehicle fuel tank");

            mainMenu.AddItem(position);
            mainMenu.AddItem(knownVehicle);
            mainMenu.AddItem(vehicleModelId);
            mainMenu.AddItem(vehicleFuelTank);

            mainMenu.OnItemSelect += (sende, item, index) => {
                if (item == vehicleFuelTank && Game.PlayerPed.IsInVehicle())
                {
                    BaseScript.TriggerServerEvent(
                        "frfuel:dev:saveFuel",
                        "{" + Game.PlayerPed.CurrentVehicle.Model.Hash.ToString() + ", " + Game.PlayerPed.CurrentVehicle.FuelLevel.ToString() + "f},"
                        );
                    Screen.ShowNotification("Fuel to model saved");
                }
            };

            menuPool.Add(mainMenu);
            menuPool.RefreshIndex();
        }
示例#18
0
 public static void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
 {
     if (sender != mainMenu)
     {
         return;                     // We only want to detect changes from our menu.
     }
     // You can also detect the button by using index
     else if (selectedItem == toggleEngine)
     {
         GameFiber.StartNew(delegate // Start a new fiber if the code sleeps or waits and we don't want to block the MenusProcessFiber
         {
             try
             {
                 if (Game.LocalPlayer.Character.LastVehicle.IsEngineOn)
                 {
                     Rage.Native.NativeFunction.Natives.SET_VEHICLE_ENGINE_ON(Game.LocalPlayer.Character.LastVehicle, false, true);
                 }
                 if (!Game.LocalPlayer.Character.LastVehicle.IsEngineOn)
                 {
                     Rage.Native.NativeFunction.Natives.SET_VEHICLE_ENGINE_ON(Game.LocalPlayer.Character.LastVehicle, true, true);
                 }
             }
             catch (Rage.Exceptions.InvalidHandleableException)
             {
                 Game.DisplaySubtitle("Closest vehicle has no boot!", 2500);
             }
         });
     }
 }
 public ModAndMenuItemPair(UIMenuItem menuItem, string modtitle, string modfilename, EventWaitHandle handle)
 {
     MenuItem    = menuItem;
     ModTitle    = modtitle;
     ModFileName = modfilename;
     WaitHandle  = handle;
 }
示例#20
0
        private void AddDoorLockItem(UIMenu menu)
        {
            var newItem = new UIMenuItem("Kapıları Kitle / Aç", "NOT: Bu aynı zamanda bu aracı kaydedilmiş araç olarak ayarlayacaktır.");

            menu.AddItem(newItem);

            menu.OnItemSelect += (sender, item, index) =>
            {
                if (item == newItem)
                {
                    Vehicle car = LocalPlayer.Character.CurrentVehicle;

                    if (car == null &&
                        savedVehicle == null)
                    {
                        Screen.ShowNotification(ERROR_NOCAR);
                        return;
                    }

                    if (car != null)
                    {
                        LockDoor(car);
                        SaveVehicle(car);
                    }
                    else
                    {
                        LockDoor(savedVehicle);
                    }
                }
            };
        }
示例#21
0
        internal override void onItemSelect(UIMenu sender, UIMenuItem item, int index)
        {
            if (item == menu_repair)
            {
                if (playerPed.IsInVehicle())
                {
                    if (playerPed.CurrentVehicle.IsDamaged)
                    {
                        playerPed.CurrentVehicle.Repair();
                        playerPed.CurrentVehicle.IsDriveable = true;
                    }
                }
            }

            /*else if (item == menu_vehicles)
             * {
             *  VehicleHash hash = (VehicleHash)vehicles[menu_vehicles.Index];
             *  Vehicle veh = GTA.World.CreateVehicle(hash, playerPed.Position.Around(5));
             *  Blip b = veh.AddBlip();
             *  b.IsFriendly = true;
             *  b.IsShortRange = true;
             *  b.Name = String.Format("Spawned Car {0}", Enum.GetName(typeof(VehicleHash), (VehicleHash)veh.Model.Hash).ToString());
             *  b.Sprite = BlipSprite.PersonalVehicleCar;
             *  playerPed.SetIntoVehicle(veh,VehicleSeat.Driver);
             * }*/
        }
示例#22
0
        private void AddEngineItem(UIMenu menu)
        {
            var newItem = new UIMenuItem("Motoru Kapat / Aç");

            menu.AddItem(newItem);

            menu.OnItemSelect += (sender, item, index) =>
            {
                if (item != newItem)
                {
                    return;
                }

                Vehicle car = LocalPlayer.Character.CurrentVehicle;

                if (car == null &&
                    savedVehicle == null)
                {
                    Screen.ShowNotification(ERROR_NOCAR);
                    return;
                }

                if (car != null)
                {
                    ToggleEngine(car);
                }
                else if (savedVehicle != null)
                {
                    ToggleEngine(savedVehicle);
                }
            };
        }
示例#23
0
        public void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
        {
            if (selectedItem == StartRace)
            {
                if (Game.Player.Money >= RealMoneyBetList[MoneyBet.Index])
                {
                    foreach (Vector3 waypoint in RaceWaypoints)
                    {
                        Blip blip = World.CreateBlip(waypoint);
                        blip.IsShortRange = true;
                        blip.Scale        = 0.6f;
                        RaceWaypointBlips.Add(blip);
                    }
                    RaceStatus = RacePhase.RacePreps;

                    foreach (Blip blip in RaceTriggersBlips)
                    {
                        blip.Alpha = 0;
                    }

                    _menuPool.CloseAllMenus();
                    if (RealMoneyBetList[MoneyBet.Index] != 0)
                    {
                        Game.Player.Money -= RealMoneyBetList[MoneyBet.Index];
                    }
                    Prize = (RealMoneyBetList[MoneyBet.Index] * (SetupCarsNumber.IndexToItem(SetupCarsNumber.Index) + 1));
                    Bet   = RealMoneyBetList[MoneyBet.Index];
                    Script.Wait(1000);
                }
                else
                {
                    UI.Notify("~r~You don't have enough money join this race.");
                }
            }
        }
示例#24
0
 private void OnListChange(UIMenu sender, UIMenuItem selectedItem, int index)
 {
     if (this.trackedMenuLists.ContainsKey(selectedItem.Text))
     {
         this.trackedMenuLists[selectedItem.Text].index = index;
     }
 }
示例#25
0
        public override void OnActivated()
        {
            MenuItems.Clear();

            selectedPed = CitizenFX.Core.Game.Player.Character;
            Debug.WriteLine(((PedHash)selectedPed.Model.Hash).ToString());

            if (((PedHash)selectedPed.Model.Hash).ToString() == "FreemodeMale01" || ((PedHash)selectedPed.Model.Hash).ToString() == "FreemodeFemale01")
            {
                Debug.WriteLine("Freemode");

                var heritageMenu = new UIMenuItem("Heritage");
                heritageMenu.Activated += HeritageMenu_Activated;
                AddItem(heritageMenu);

                var clothingMenu = new UIMenuItem("Clothing");
                clothingMenu.Activated += ClothingMenu_Activated;
                AddItem(clothingMenu);
            }
            else
            {
                // Check if ped has variants, add items. (make sure to set default value to previously selected value!!!!!!)
                Debug.WriteLine("Ped");
                // add menus for ped customization
            }
        }
示例#26
0
 public static void OnItemSelect(UIMenu Sender, UIMenuItem Item, int Index)
 {
     if (Item == Items.Close)
     {
         Main.Menu.Visible = false;
     }
 }
示例#27
0
        private void AddDoorLockItem(UIMenu menu)
        {
            var newItem = new UIMenuItem("車門開關", "注意:這項操作將自動儲存此車輛");

            menu.AddItem(newItem);

            menu.OnItemSelect += (sender, item, index) =>
            {
                if (item == newItem)
                {
                    Vehicle car = LocalPlayer.Character.CurrentVehicle;

                    if (car == null &&
                        savedVehicle == null)
                    {
                        Screen.ShowNotification(ERROR_NOCAR);
                        return;
                    }

                    if (car != null)
                    {
                        LockDoor(car);
                        SaveVehicle(car);
                    }
                    else
                    {
                        LockDoor(savedVehicle);
                    }
                }
            };
        }
示例#28
0
        public void SellConfirmationMenu_OnItemSelect(UIMenu menu, UIMenuItem selectedItem, int index)
        {
            switch (index)
            {
            case 0:
            {
                if (InteractableLockerGuid == null || !GunLockers.ContainsKey(InteractableLockerGuid.Value))
                {
                    return;
                }
                Locker locker = GunLockers[InteractableLockerGuid.Value];

                Game.Player.Money += locker.RefundValue;
                UI.Notify($"Returned the gun locker for ~g~${locker.RefundValue}.");

                SPGLMenuPool.CloseAllMenus();
                locker.DestroyProp();
                GunLockers.Remove(InteractableLockerGuid.Value);
                File.Delete(locker.FilePath);

                InteractableLockerGuid = null;
                break;
            }

            case 1:
            {
                SPGLSellConfirmationMenu.GoBack();
                break;
            }
            }
        }
示例#29
0
文件: Class1.cs 项目: hesa656/RazerV
    public void PlayerModelMenu(UIMenu menu)
    {
        var playermodelmenu = _menuPool.AddSubMenu(menu, "Debug");

        for (int i = 0; i < 1; i++)
        {
            ;
        }

        var addHealth    = new UIMenuItem("Add Health", "");
        var removeHealth = new UIMenuItem("-10 Health", "");
        var malecop      = new UIMenuItem(playerPed.Health.ToString(), "");

        playermodelmenu.AddItem(addHealth);
        playermodelmenu.AddItem(removeHealth);
        playermodelmenu.AddItem(malecop);

        playermodelmenu.OnItemSelect += (sender, item, index) =>
        {
            if (item == addHealth)
            {
                playerPed.Health = playerPed.MaxHealth;
                malecop.Text     = playerPed.Health.ToString();
            }

            if (item == removeHealth)
            {
                playerPed.Health = playerPed.Health - 10;
                malecop.Text     = playerPed.Health.ToString();
            }
        };
    }
示例#30
0
 /// <summary>
 /// Add item to menu.
 /// </summary>
 /// <param name="menu">Parent menu.</param>
 /// <param name="item">The item.</param>
 /// <param name="OnSelect">What to do when item is selected.</param>
 /// <param name="OnHover">What to do if item is hovered.</param>
 public void AddItem(
     UIMenu menu, UIMenuItem item,
     Action OnSelect = null, Action OnHover = null)
 {
     menu.AddItem(item);
     if (OnSelect != null)
     {
         menu.OnItemSelect += (sender, item2, index) =>
         {
             if (item == item2)
             {
                 OnSelect();
             }
         }
     }
     ;
     if (OnHover != null)
     {
         menu.OnIndexChange += (sender, index) =>
         {
             if (sender.MenuItems[index] == item)
             {
                 OnHover();
             }
         }
     }
     ;
 }
示例#31
0
        internal override void onItemSelect(UIMenu sender, UIMenuItem item, int index)
        {
            /*switch(item)
             *  {
             *      case menu_weather:
             *      case menu_time_hr:
             *      case menu_time_min:
             *      case menu_timeInc:
             *      case menu_timeDec:
             *          break;
             *  }*/

            if (item == menu_add_ped)
            {
                Ped ped = GTA.World.CreatePed(PedHash.Chef, Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0)));
                ped.MaxDrivingSpeed = 200;
                ped.Armor           = 100;
                ped.Weapons.Give(WeaponHash.PumpShotgun, 500, true, true);
                ped.Task.ReloadWeapon();
                GTA.Native.Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, Game.Player.Character, ped, Relationship.Companion.GetHashCode());

                /*Ped[] targets = World.GetNearbyPeds(Game.Player.WantedCenterPosition, 50);
                 * for(int i=0;i<targets.Length;i++)
                 * {
                 *  GTA.World.
                 *  if(targets[i].)
                 * }*/
            }
        }
        private void AddInteractionMenuItems()
        {
            PatchesMenu patches_menu = new PatchesMenu(
                this.menus, this.interactionMenu);

            // default clothes menu is just for WIP
            UIMenuItem default_clothes =
                new UIMenuItem(Strings.MenuItem.DefaultClothes);

            this.interactionMenu.AddItem(default_clothes);

            UIMenu         character_creator = this.menus.AddSubMenu(this.interactionMenu, "Character Creator");
            List <dynamic> shapes1           = new List <dynamic>();

            shapes1.AddRange(Enumerable.Range(1, 47).Cast <dynamic>().ToList());
            character_creator.AddItem(new UIMenuListItem("Shape 1", shapes1, 0));
            character_creator.OnListChange += ListHandler;

            RecordingMenu recording_menu =
                new RecordingMenu(this.menus, this.interactionMenu);

            UIMenuItem leave_session =
                new UIMenuItem(Strings.MenuItem.LeaveSession);

            this.interactionMenu.AddItem(leave_session);

            this.interactionMenu.OnItemSelect += this.ItemHandler;
        }
 // Editor
 public override bool OnMenuActionGUI(UIMenuItem item)
 {
     GUILayout.Label("Toggle Input Action");
     inputActive = GUILayout.Toggle(inputActive, "Enable Input");
     showCursor = GUILayout.Toggle(showCursor, "Show Cursor");
     lockCursor = GUILayout.Toggle(lockCursor, "Lock Cursor");
     pauseGameTime = GUILayout.Toggle(pauseGameTime, "Pause Game (timeScale = 0)");
     reticle = GUILayout.Toggle(reticle, "Show reticle");
     return (base.OnMenuActionGUI(item));
 }
示例#34
0
    public void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
    {
        if (sender != mainMenu || selectedItem != cookItem) return; // We only want to detect changes from our menu and our button.
        // You can also detect the button by using index
        string dish = dishesListItem.IndexToItem(dishesListItem.Index).ToString();
        bool ketchup = ketchupCheckbox.Checked;

        string output = ketchup
            ? "You have ordered ~b~{0}~w~ ~r~with~w~ ketchup."
            : "You have ordered ~b~{0}~w~ ~r~without~w~ ketchup.";
        UI.ShowSubtitle(String.Format(output, dish));
    }
示例#35
0
        public bool AnyChildContainsPoint(Point p)
        {
            receiver = null;
            if (!HavePoint(p))
                return false;

            foreach (UIMenuItem item in childrens)
                if (item.HavePoint(p))
                {
                    receiver = item;
                    return true;
                }
            return false;
        }
示例#36
0
 /// <summary>
 /// Add item to menu.
 /// </summary>
 /// <param name="menu">Parent menu.</param>
 /// <param name="item">The item.</param>
 /// <param name="OnSelect">What to do when item is selected.</param>
 /// <param name="OnHover">What to do if item is hovered.</param>
 public void AddItem(
     UIMenu menu, UIMenuItem item,
     Action OnSelect = null, Action OnHover = null)
 {
     menu.AddItem(item);
     if (OnSelect != null)
         menu.OnItemSelect += (sender, item2, index) =>
         {
             if (item == item2) OnSelect();
         };
     if (OnHover != null)
         menu.OnIndexChange += (sender, index) =>
         {
             if (sender.MenuItems[index] == item) OnHover();
         };
 }
    // Editor
    public override bool OnMenuActionGUI(UIMenuItem item)
    {
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.BeginVertical();
        GUILayout.Label("Open Screen Action");

        int oldSelected = mSelected;

        mSelected = EditorGUILayout.Popup("Screen to Open", mSelected, item.ParentScreen.ScreenMenu.mScreenListNames.ToArray());
        if (oldSelected != mSelected || mScreenToOpen == null)
        {
            mScreenToOpen = item.ParentScreen.ScreenMenu.mScreenList[mSelected];
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();
        return (base.OnMenuActionGUI(item));
    }
    // Editor
    public override bool OnMenuActionGUI(UIMenuItem item)
    {
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.BeginVertical();
        GUILayout.Label("Close Screen Action");

        int oldSelected = Selected;

        Selected = EditorGUILayout.Popup("Screen to Close", Selected, item.ParentScreen.ScreenMenu.mScreenListNames.ToArray());
        if (oldSelected != Selected || ScreenToClose == null)
        {
            ScreenToClose = item.ParentScreen.ScreenMenu.mScreenList[Selected];
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();
        return (base.OnMenuActionGUI(item));
    }
示例#39
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.";
             UI.ShowSubtitle(String.Format(output, dish));
         }
     };
     menu.OnIndexChange += (sender, index) =>
     {
         if (sender.MenuItems[index] == newitem)
             newitem.SetLeftBadge(UIMenuItem.BadgeStyle.None);
     };
 }
示例#40
0
    public MenuExample()
    {
        Tick += OnTick;
        KeyDown += OnKeyDown;
        _menuPool = new MenuPool();

        mainMenu = new UIMenu("Native UI", "~b~NATIVEUI SHOWCASE");
        _menuPool.Add(mainMenu);

        mainMenu.AddItem(ketchupCheckbox = new UIMenuCheckboxItem("Add ketchup?", false, "Do you wish to add ketchup?"));
        var foods = new List<dynamic>
        {
            "Banana",
            "Apple",
            "Pizza",
            "Quartilicious",
            0xF00D, // Dynamic!
        };
        mainMenu.AddItem(dishesListItem = new UIMenuListItem("Food", foods, 0));
        mainMenu.AddItem(cookItem = new UIMenuItem("Cook!", "Cook the dish with the appropiate ingredients and ketchup."));

        var menuItem = new UIMenuItem("Go to another menu.");
        mainMenu.AddItem(menuItem);
        cookItem.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
        cookItem.SetRightBadge(UIMenuItem.BadgeStyle.Tick);
        mainMenu.RefreshIndex();

        mainMenu.OnItemSelect += OnItemSelect;
        mainMenu.OnListChange += OnListChange;
        mainMenu.OnCheckboxChange += OnCheckboxChange;
        mainMenu.OnIndexChange += OnItemChange;

        newMenu = new UIMenu("Native UI", "~r~NATIVEUI SHOWCASE");
        _menuPool.Add(newMenu);
        for (int i = 0; i < 20; i++)
        {
            newMenu.AddItem(new UIMenuItem("PageFiller", "Sample description that takes more than one line. Moreso, it takes way more than two lines since it's so long. Wow, check out this length!"));
        }
        newMenu.RefreshIndex();
        mainMenu.BindMenuToItem(newMenu, menuItem);
    }
示例#41
0
    IEnumerator GetMenuData()
    {
        WWW www = new WWW ("http://dl.dropboxusercontent.com/u/14181582/_temp/sayduckuiconfig.js");
        float elapsedTime = 0.0f;

        while (!www.isDone) {
            elapsedTime += Time.deltaTime;
            if (elapsedTime >= 10.0f)
                break;
            yield return null;
        }

        if (!www.isDone || !string.IsNullOrEmpty (www.error))
        {
            Debug.LogError (string.Format ("Fail Whale!\n{0}", www.error));
            yield break;

        }

        string response = www.text;

        IDictionary uiconfig = (IDictionary)Json.Deserialize (response);

        if (uiconfig["menu-items"] != null) {

            UIHelper.Instance.addFirstListView();
            //UIHelper.Instance.addChildView(1);

            foreach (IDictionary item in (IList)uiconfig["menu-items"])
            {
                UIMenuItem menuItem = new UIMenuItem();
                menuItem.AddMenuItemData(item);
                Context.RootUIMenuItem.Add(menuItem);
            }
        }
    }
示例#42
0
 public void AddClearAppearanceToMenu(UIMenu menu)
 {
     Action Clear = () =>
     {
         var ped = Game.Player.Character;
         foreach (SlotType slot_type in Enum.GetValues(typeof(SlotType)))
             for (int slot_id = 0; slot_id < PedData.GetNumId(slot_type); slot_id++)
             {
                 var slot_key = new SlotKey(slot_type, slot_id);
                 ped_data.ClearSlot(ped, slot_key);
             }
     };
     var clearitem = new UIMenuItem("Clear Appearance");
     AddItem(menu, clearitem, OnSelect: Clear);
 }
示例#43
0
 public void AddCategoryToMenu(UIMenu menu, string name, PedHash[] models)
 {
     var submenu = AddSubMenu(menu, name);
     foreach (PedHash model in models)
     {
         var subitem = new UIMenuItem(model.ToString());
         submenu.AddItem(subitem);
     }
     submenu.OnItemSelect += (sender, item, index) =>
     {
         ped_data.ChangePlayerModel(_pedhash[item.Text]);
     };
 }
示例#44
0
 public void AddActorActionToMenu(UIMenu menu, String name, Action<UIMenuItem, int> action, Func<int, bool> ticked)
 {
     var submenu = AddSubMenu(menu, name);
     for (int i = 0; i < 10; i++)
     {
         var subsubmenu = AddSubMenu(submenu, String.Format("Actors {0}-{1}", 1 + i * 10, 10 + i * 10));
         for (int j = 0; j < 10; j++)
         {
             var slot = 1 + j + i * 10;
             var slotitem = new UIMenuItem(String.Format("Actor {0}", slot));
             subsubmenu.AddItem(slotitem);
             if (ticked(slot)) slotitem.SetLeftBadge(UIMenuItem.BadgeStyle.Tick);
             subsubmenu.OnItemSelect += (sender, item, index) =>
             {
                 if (item == slotitem) action(slotitem, slot);
             };
         }
     }
 }
 // Editor
 public override bool OnMenuActionGUI(UIMenuItem item)
 {
     GUILayout.Label("Open Scene with fade Action");
     //fader = (GUIFader)EditorGUILayout.ObjectField("Fader to fade: ", fader, typeof(GUIFader));
     return (base.OnMenuActionGUI(item));
 }
 /// <summary>
 /// Update to show the specified menu item.
 /// </summary>
 /// <param name="item">Item.</param>
 public virtual void InitMenuItem(UIMenuItem item)
 {
     menuItem = item;
     menu = (IMenu) item.GetComponentInParent (typeof(IMenu));
     leftText.color = defaultColor;
     rightText.color = defaultColor;
     for (int i = 0; i < volumeImages.Length; i++)
     {
         UIVolumePip pip = volumeImages[i].GetComponent<UIVolumePip>();
         if (pip != null && item is UIMenuItem_Volume)
         {
             pip.Init((UIMenuItem_Volume) item, (1.0f / volumeImages.Length) * (i + 1));
         }
     }
     if (zeroVolumePip != null)
     {
         UIVolumePip zvPip = zeroVolumePip.GetComponent<UIVolumePip>();
         if (zvPip != null && item is UIMenuItem_Volume)
         {
             zvPip.Init((UIMenuItem_Volume) item, 0);
         }
     }
     Refresh ();
 }
示例#47
0
 public void LoadActor(UIMenuItem item, int slot)
 {
     var path = GetActorFilename(slot);
     UI.Notify(String.Format("Loading actor from {0}", path));
     var reader = new XmlTextReader(path);
     while (reader.Read())
     {
         if (reader.Name == "SetPlayerModel")
         {
             ped_data.ChangePlayerModel(_pedhash[reader.GetAttribute("name")]);
         }
         else if (reader.Name == "SetSlotValue")
         {
             var key = new SlotKey(reader);
             var val = new SlotValue(reader);
             ped_data.SetSlotValue(Game.Player.Character, key, val);
         }
     }
 }
示例#48
0
        void tap(UITapGestureRecognizer gr)
        {
            CGPoint point = gr.LocationInView(this);
            this.selectedLine = lineAtPoint(point);

            // If we just tapped, remove all lines in process
            // so that a tap does not result in a new line
            linesInProcess.Clear();

            if (selectedLine != null) {
                this.BecomeFirstResponder();

                // Grab the menu controller
                UIMenuController menu = UIMenuController.SharedMenuController;

                // Create a new "Delete" UIMenuItem
                UIMenuItem deleteItem = new UIMenuItem("Delete", new Selector("deleteLine:"));
                menu.MenuItems = new UIMenuItem[] {deleteItem};

                // Tell the menu item where it should come from and show it
                menu.SetTargetRect(new CGRect(point.X, point.Y, 2, 2), this);
                menu.SetMenuVisible(true, true);

                UIGestureRecognizer[] grs = this.GestureRecognizers;
                foreach (UIGestureRecognizer gestRec in grs) {
                    if (gestRec.GetType() != new UITapGestureRecognizer().GetType()) {
                        gestRec.Enabled = false;
                    }
                }
            } else {
                // Hide the menu if no line is selected
                UIMenuController menu = UIMenuController.SharedMenuController;
                menu.SetMenuVisible(false, true);

                UIGestureRecognizer[] grs = this.GestureRecognizers;
                foreach (UIGestureRecognizer gestRec in grs) {
                    if (gestRec.GetType() != new UITapGestureRecognizer().GetType()) {
                        gestRec.Enabled = true;
                    }
                }
            }
            this.SetNeedsDisplay();
        }
		void ShowResetMenu (UILongPressGestureRecognizer gestureRecognizer)
		{
			if (gestureRecognizer.State == UIGestureRecognizerState.Began) {
				var menuController = UIMenuController.SharedMenuController;
				var resetMenuItem = new UIMenuItem ("Reset", new Selector ("ResetImage"));
				var location = gestureRecognizer.LocationInView (gestureRecognizer.View);
				BecomeFirstResponder ();
				menuController.MenuItems = new [] { resetMenuItem };
				menuController.SetTargetRect (new RectangleF (location.X, location.Y, 0, 0), gestureRecognizer.View);
				menuController.MenuVisible = true;
//				menuController.Animated = true;
				imageForReset = gestureRecognizer.View;
			}
		}
示例#50
0
 /// <summary>
 /// Activate the specified menuItem.
 /// </summary>
 /// <param name="menuItem">Menu item.</param>
 public virtual void Activate(UIMenuItem menuItem)
 {
     if (activeMenuItems.Contains(menuItem)) menuItem.DoAction();
 }
示例#51
0
        void swipe(UISwipeGestureRecognizer gr)
        {
            linesInProcess.Clear();
            this.BecomeFirstResponder();
            // Grab the menu controller
            UIMenuController menu = UIMenuController.SharedMenuController;

            // Create buttons
            UIMenuItem red = new UIMenuItem("Red", new Selector("red:"));
            UIMenuItem green = new UIMenuItem("Green", new Selector("green:"));
            UIMenuItem blue = new UIMenuItem("Blue", new Selector("blue:"));

            menu.MenuItems = new UIMenuItem[]{red, green, blue};

            // Tell the menu where it should come from and show it
            menu.SetTargetRect(new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height), this);
            menu.SetMenuVisible(true, true);
        }
示例#52
0
 /// <summary>
 /// Select the specified menuItem.
 /// </summary>
 /// <param name="menuItem">Menu item.</param>
 public virtual void Select(UIMenuItem menuItem)
 {
     if (activeMenuItems.Contains(menuItem)) Select(activeMenuItems.IndexOf(menuItem));
     else Debug.LogWarning ("Tried to select a menu item that wasn't active.");
 }
 // Editor
 public override bool OnMenuActionGUI(UIMenuItem item)
 {
     GUILayout.Label("Close Menu Item Action");
     mMenuItemToClose = (UIMenuItem)EditorGUILayout.ObjectField("Menu item to close", mMenuItemToClose.gameObject, typeof(UIMenuItem));
     return (base.OnMenuActionGUI(item));
 }
 public override bool OnMenuActionGUI(UIMenuItem item)
 {
     GUILayout.Label("Select Item Action");
     return base.OnMenuActionGUI(item);
 }
示例#55
0
 public void AddFreemodeModelToMenu(UIMenu menu)
 {
     Action ChangeMale = () => ped_data.ChangePlayerModel(PedHash.FreemodeMale01);
     Action ChangeFemale = () => ped_data.ChangePlayerModel(PedHash.FreemodeFemale01);
     var male = new UIMenuItem("Male");
     var female = new UIMenuItem("Female");
     AddItem(menu, male, OnSelect: ChangeMale);
     AddItem(menu, female, OnSelect: ChangeFemale);
 }
 // Editor
 public override bool OnMenuActionGUI(UIMenuItem item)
 {
     GUILayout.Label("Begin Game Action");
     return (base.OnMenuActionGUI(item));
 }
示例#57
0
 public void AddSlotToMenu(UIMenu menu, string text, SlotKey slot_key)
 {
     var submenu = AddSubMenu(menu, text);
     var index_names = PedData.GetIndexNames(slot_key.typ);
     var listitem1 = new UIMenuListItem(index_names[0], UI_LIST, 0);
     var listitem2 = new UIMenuListItem(index_names[1], UI_LIST, 0);
     var listitem3 = new UIMenuListItem(index_names[2], UI_LIST, 0);
     var listitem4 = new UIMenuListItem(index_names[3], UI_LIST, 0);
     var randomitem = new UIMenuItem("Random");
     var clearitem = new UIMenuItem("Clear");
     submenu.AddItem(listitem1);
     submenu.AddItem(listitem2);
     submenu.AddItem(listitem3);
     submenu.AddItem(listitem4);
     submenu.AddItem(randomitem);
     submenu.AddItem(clearitem);
     // when the menu is selected, we only want submenu to be
     // enabled if its model and/or texture can be changed
     menu.ParentMenu.OnItemSelect += (sender, item, index) =>
     {
         if (item == menu.ParentItem)
         {
             var ped = Game.Player.Character;
             submenu.ParentItem.Enabled = (
                 (PedData.GetNumIndex1(ped, slot_key) >= 2) ||
                 (PedData.GetNumIndex2(ped, slot_key, 0) >= 2) ||
                 (PedData.GetNumIndex3(ped, slot_key, 0, 0) >= 2) ||
                 (PedData.GetNumIndex4(ped, slot_key, 0, 0, 0) >= 2));
         }
     };
     // when submenu is selected, display correct indices for model and texture
     // and enable those entries of this submenu
     // (model, texture, ...) where something can be changed
     submenu.ParentMenu.OnItemSelect += (sender, item, index) =>
     {
         if (item == submenu.ParentItem)
         {
             var ped = Game.Player.Character;
             var slot_value = ped_data.GetSlotValue(slot_key);
             listitem1.Index = slot_value.index1;
             listitem1.Enabled = (PedData.GetNumIndex1(ped, slot_key) >= 2);
             listitem2.Index = slot_value.index2;
             listitem2.Enabled = (ped_data.GetNumIndex2(ped, slot_key) >= 2);
             listitem3.Index = slot_value.index3;
             listitem3.Enabled = (ped_data.GetNumIndex3(ped, slot_key) >= 2);
             listitem4.Index = slot_value.index4;
             listitem4.Enabled = (ped_data.GetNumIndex4(ped, slot_key) >= 2);
         }
     };
     submenu.OnListChange += (sender, item, index) =>
     {
         if (item == listitem1 || item == listitem2 || item == listitem3 || item == listitem4)
         {
             var ped = Game.Player.Character;
             var slot_value = ped_data.GetSlotValue(slot_key);
             var numIndex1 = PedData.GetNumIndex1(ped, slot_key);
             var numIndex2 = ped_data.GetNumIndex2(ped, slot_key);
             var numIndex3 = ped_data.GetNumIndex3(ped, slot_key);
             var numIndex4 = ped_data.GetNumIndex4(ped, slot_key);
             // we need to ensure that the new id is valid as the menu has more items than number of ids supported by the game
             int maxid;
             if (item == listitem1)
                 maxid = numIndex1;
             else if (item == listitem2)
                 maxid = numIndex2;
             else if (item == listitem3)
                 maxid = numIndex3;
             else // if (item == listitem4)
                 maxid = numIndex4;
             maxid = Math.Min(maxid - 1, UI_LIST_MAX);
             System.Diagnostics.Debug.Assert(maxid >= 0);
             System.Diagnostics.Debug.Assert(maxid <= UI_LIST_MAX - 1);
             if (index > maxid)
             {
                 // wrap the index depending on whether user scrolled forward or backward
                 index = (index == UI_LIST_MAX - 1) ? maxid : 0;
                 item.Index = index;
             }
             if (item == listitem1)
                 slot_value.index1 = index;
             else if (item == listitem2)
                 slot_value.index2 = index;
             else if (item == listitem3)
                 slot_value.index3 = index;
             else // if (item == listitem4)
                 slot_value.index4 = index;
             // correct listitem2 if index2 is out of range
             var newNumIndex2 = PedData.GetNumIndex2(ped, slot_key, slot_value.index1);
             if (slot_value.index2 >= newNumIndex2) slot_value.index2 = newNumIndex2 - 1;
             listitem2.Index = slot_value.index2;
             listitem2.Enabled = (newNumIndex2 >= 2);
             // correct listitem3 if index3 is out of range
             var newNumIndex3 = PedData.GetNumIndex3(ped, slot_key, slot_value.index1, slot_value.index2);
             if (slot_value.index3 >= newNumIndex3) slot_value.index3 = newNumIndex3 - 1;
             listitem3.Index = slot_value.index3;
             listitem3.Enabled = (newNumIndex3 >= 2);
             // correct listitem3 if index3 is out of range
             var newNumIndex4 = PedData.GetNumIndex4(ped, slot_key, slot_value.index1, slot_value.index2, slot_value.index3);
             if (slot_value.index4 >= newNumIndex4) slot_value.index4 = newNumIndex4 - 1;
             listitem4.Index = slot_value.index4;
             listitem4.Enabled = (newNumIndex4 >= 2);
             // set slot value
             ped_data.SetSlotValue(ped, slot_key, slot_value);
         }
     };
     submenu.OnItemSelect += (sender, item, index) =>
     {
         if (item == clearitem)
         {
             var ped = Game.Player.Character;
             ped_data.ClearSlot(ped, slot_key);
             // update menu items
             var slot_value = ped_data.GetSlotValue(slot_key);
             listitem1.Index = slot_value.index1;
             listitem2.Index = slot_value.index2;
             listitem3.Index = slot_value.index3;
             listitem4.Index = slot_value.index4;
             listitem1.Enabled = (PedData.GetNumIndex1(ped, slot_key) >= 2);
             listitem2.Enabled = (ped_data.GetNumIndex2(ped, slot_key) >= 2);
             listitem3.Enabled = (ped_data.GetNumIndex3(ped, slot_key) >= 2);
             listitem4.Enabled = (ped_data.GetNumIndex4(ped, slot_key) >= 2);
         }
         else if (item == randomitem)
         {
             var ped = Game.Player.Character;
             var slot_value = ped_data.GetSlotValue(slot_key);
             slot_value.index1 = rnd.Next(PedData.GetNumIndex1(ped, slot_key));
             slot_value.index2 = rnd.Next(PedData.GetNumIndex2(ped, slot_key, slot_value.index1));
             slot_value.index3 = rnd.Next(PedData.GetNumIndex3(ped, slot_key, slot_value.index1, slot_value.index2));
             slot_value.index4 = rnd.Next(PedData.GetNumIndex4(ped, slot_key, slot_value.index1, slot_value.index2, slot_value.index3));
             ped_data.SetSlotValue(ped, slot_key, slot_value);
             listitem1.Index = slot_value.index1;
             listitem2.Index = slot_value.index2;
             listitem3.Index = slot_value.index3;
             listitem4.Index = slot_value.index4;
             listitem1.Enabled = (PedData.GetNumIndex1(ped, slot_key) >= 2);
             listitem2.Enabled = (ped_data.GetNumIndex2(ped, slot_key) >= 2);
             listitem3.Enabled = (ped_data.GetNumIndex3(ped, slot_key) >= 2);
             listitem4.Enabled = (ped_data.GetNumIndex4(ped, slot_key) >= 2);
         }
     };
 }
    //*************************************************************************
    private static void UpdateMenuItemPosition(UIMenuItem item)
    {
        if (item.ItemPositionState == UIMenuItemPositionState.OnScreen)
        {
            EditorGUILayout.PrefixLabel("Active (Editor)");
        }
        else
        {
            EditorGUILayout.PrefixLabel("Inactive");
        }

        item.ItemScreenPositionOn = EditorGUILayout.Vector3Field("Position - ON", item.ItemScreenPositionOn);

        if (item.ItemPositionState == UIMenuItemPositionState.OffScreen)
        {
            EditorGUILayout.PrefixLabel("Active (Editor)");
        }
        else
        {
            EditorGUILayout.PrefixLabel("Inactive");
        }

        item.ItemScreenPositionOff = EditorGUILayout.Vector3Field("Position - OFF", item.ItemScreenPositionOff);
    }
示例#59
0
 public void SaveActor(UIMenuItem item, int slot)
 {
     var path = GetActorFilename(slot);
     UI.Notify(String.Format("Saving actor to {0}", path));
     var settings = new XmlWriterSettings();
     settings.Indent = true;
     settings.NewLineOnAttributes = true;
     using (XmlWriter writer = XmlWriter.Create(path, settings))
     {
         writer.WriteStartElement("GtaVNative");
         {
             var name = ((PedHash)Game.Player.Character.Model.Hash).ToString();
             writer.WriteStartElement("SetPlayerModel");
             writer.WriteAttributeString("name", name);
             writer.WriteEndElement();
         }
         ped_data.WriteXml(writer);
         writer.WriteEndElement();
     }
 }
 // Editor
 public override bool OnMenuActionGUI(UIMenuItem item)
 {
     GUILayout.Label("Quit Game (Fully) Action");
     return (base.OnMenuActionGUI(item));
 }