Наследование: MonoBehaviour
Пример #1
0
 void OnCollisionEnter(Collision other)
 {
     Debug.Log("Collision");
     go = (MenuController)other.gameObject.GetComponent("MenuController");
     go.context.Release();
     Application.LoadLevel(siguienteNivel);
 }
Пример #2
0
 void OnDestroy()
 {
     if(menuController != null)
     {
         menuController = null;
     }
 }
Пример #3
0
	// Use this for initialization
	void Start () {
		menu = FindObjectOfType <MenuController> ();
		anim = GetComponent<Animator> ();
		rb2d = GetComponent<Rigidbody2D> ();
		grounded = true;
		curHp = maxHp;
	}
Пример #4
0
	void FindCueController (MenuController menuController)
	{
		StopCoroutine("WaitAndFindCueController");
		StopCoroutine("WaitAndEnabledCueController");

		StartCoroutine("WaitAndFindCueController", menuController.preloader);
	}
Пример #5
0
	void MakeInstance() {
	
		if(instance == null) {
			instance = this;
		}
	
	}
Пример #6
0
    void Awake()
    {
        DontDestroyOnLoad(this);

        sc = GameObject.Find ("ServerConnect").GetComponent<ServerConnect> ();
        mc = GameObject.Find ("MenuController").GetComponent<MenuController> ();
        Socket = sc.Socket;
    }
Пример #7
0
    void Awake()
    {
        menuController = this;

        Debug.Log("Awake() .......");
        //menuController.RegisterUserDeviceOnServer ();
        menuController.SetMenuButtonsText();
    }
Пример #8
0
        public void PerformSetupMenuActionTest()
        {
            int button = 0;

            MenuController _testMethod = new MenuController();
            _testMethod.PerformSetupMenuAction(button);

            Assert.IsTrue(GameController._aiSetting == AIOption.Easy);
        }
Пример #9
0
    void Start()
    {
        menuController = MenuController.instance;

        _zDefault = transform.position.z;
        _zOffset = transform.position.z - 1;

        _btnTag = gameObject.tag;
    }
Пример #10
0
    // Use this for initialization
    void Start()
    {
        menuController = MenuController.instance;

        duration = 3.5f;
        flashing = true;
        textMesh = transform.GetComponent<TextMesh>();

        StartCoroutine(FadeSequence());
    }
 public FileMatrixWindow()
 {
     InitializeComponent();
     MenuController menu = new MenuController();
     menu.Configure(mainMenu);
     //FileMatrixDbAdapter db =
     //    new FileMatrixDbAdapter(
     //        ConnectionStrings.ByName("MySqlConnectionString"));
     //new FileMatrixMenuController().Configure(menu, db, dataGrid, statusBar);
 }
Пример #12
0
    void Start()
    {
        menuController = MenuController.instance;
        wheel = transform.parent.GetComponent<Wheel>();

        _zDefault = transform.position.z;
        _zOffset = transform.position.z - 1;

        _btnTag = gameObject.tag;
    }
Пример #13
0
	void Awake(){

		menuController = new MenuController ();
		menuCanvas = GetComponent<Canvas> ();

		//set the timescale to zero so initially paused
		Time.timeScale = 0;
	
		highestScoreDetailsCanvas.enabled = false;
	}
 public void Start()
 {
     Instance = this;
     mScript = GameObject.Find("Main Camera").GetComponent<MenuController>();
     screenWidth = Screen.width;
     screenHeight = Screen.height;
     groupWidth = 200f;
     groupHeight = 230f;
     setWidth = (screenWidth - groupWidth);
     setHeight = (screenHeight - groupHeight);
 }
        public void GivenAShowAction_WhenTheSelectedOptionIsDifferentThan_1_Or_2_ThenTheResponseRedirectsToIVRWelcome()
        {
            var controller = new MenuController { Url = Url };
            var result = controller.Show("*");

            result.ExecuteResult(MockControllerContext.Object);

            var document = LoadXml(Result.ToString());

            Assert.That(document.SelectSingleNode("Response/Redirect").InnerText, Is.EqualTo("/IVR/Welcome"));
        }
        public ObjectGridWindow()
        {
            InitializeComponent();
            rowObjects = new ObservableCollection<SynergyRowObject>();
            dataGrid.ItemsSource = rowObjects;
            MenuController menu = new MenuController();
            menu.Configure(mainMenu);

            menu.AddMenuItem("Phone", "Load Synced FileMatrix", LoadSyncedPhoneFileMatrix);
            menu.AddMenuItem("RowObjects", "Load Metadata", LoadMetaData);
        }
Пример #17
0
    // Use this for initialization
    void Start()
    {
        okay = true;
        Controller = GameObject.FindGameObjectWithTag("GameController");
        anim = GetComponent<Animator>();
        sword = Weapon.GetComponent<BoxCollider>();
        sword.enabled = false;
        clip = GetComponent<Animation>();
        menuController = GameObject.FindGameObjectWithTag("MenuController").GetComponent<MenuController>();
        //Time.timeScale = 0.5F;

    }
        public void GivenAShowAction_WhenTheSelectedOptionIs1_ThenTheResponseContainsSayTwiceAndAHangup()
        {
            var controller = new MenuController();
            var result = controller.Show("1");

            result.ExecuteResult(MockControllerContext.Object);

            var document = LoadXml(Result.ToString());

            Assert.That(document.SelectNodes("Response/Say").Count, Is.EqualTo(2));
            Assert.That(document.SelectSingleNode("Response/Hangup"), Is.Not.Null);
        }
        public void GivenAShowAction_WhenTheSelectedOptionIs2_ThenTheResponseContainsGatherAndSay()
        {
            var controller = new MenuController {Url = Url};
            var result = controller.Show("2");

            result.ExecuteResult(MockControllerContext.Object);

            var document = LoadXml(Result.ToString());

            Assert.That(document.SelectSingleNode("Response/Gather/Say"), Is.Not.Null);
            Assert.That(document.SelectSingleNode("Response/Gather").Attributes["action"].Value,
                Is.EqualTo("/PhoneExchange/Interconnect"));
        }
Пример #20
0
	// Use this for initialization
	void Start () {
		menuController = GameObject.FindObjectOfType<MenuController>();
		gameController = GameObject.FindObjectOfType<GameController>();

		SetupController();

		//get all the ships
		shipSelectionDisplay = GetComponentsInChildren<ShipSelectionDisplay>();
		foreach (ShipSelectionDisplay display in shipSelectionDisplay) display.gameObject.SetActive(false);
		shipSelectionDisplay[selectionIndex].gameObject.SetActive(true);

		shipSelector.SetActive (false);
	}
Пример #21
0
    // Use this for initialization
    void Start()
    {
        gameState = GameState.START;

        if (gameManager == null) gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();

        if (timer == null) timer = GameObject.Find("Timer").GetComponent<Timer>();
        if (cameraController == null) cameraController = GameObject.Find("MainCamera").GetComponent<CameraController>();
        if (gaugeController == null) gaugeController = GameObject.Find("Gauge").GetComponent<GaugeController>();
        if (fillterController == null) fillterController = GameObject.Find("Fillter").GetComponent<FillterController>();
        //if (playerController == null) playerController = GameObject.Find("Player").GetComponent<PlayerController>();
        if (menuController == null) menuController = GameObject.Find("MenuController").GetComponent<MenuController>();
    }
    void Awake()
    {
        Instance = this;
        menuObject = GameObject.Find("MainMenu");
        mScript = menuObject.GetComponent<MenuScript>();
        gameMObject = GameObject.Find("GameModes");
        gmScript = gameMObject.GetComponent<GameModeScript>();
        optionsObject = GameObject.Find("Options");
        oScript = optionsObject.GetComponent<OptionsScript>();

        menuActive = true;
        optionsActive = false;
        modesActive = false;
    }
 // Use this for initialization
 void Start()
 {
     ef = transform.FindChild("effect").gameObject;//エフェクトオブジェ取得
     bar = transform.FindChild("HpBar").gameObject;
     bar.transform.localPosition = new Vector3(-1f, -1.5f, -3f);
     bar.GetComponent<SpriteRenderer>().color = mikata ? Color.blue : Color.red;
     sp_s = sp;
     sp_cn = sp;
     menCon = GameObject.Find("Menu").GetComponent<MenuController>();
     if(!mikata)
     {
         menCon.eCount++;
         menCon.eCountMax++;
     }
 }
Пример #24
0
    void Awake()
    {
        streak = 0;
        _previousTrigger = 0;
        _playerState = PlayerState.Inactive;
        _inputController = InputController.Instance;
        _rhythmController = RhythmController.Instance;
        _worldController = WorldController.Instance;
        _soundManager = SoundManager.Instance;
        _config = Config.Instance;
        _scoreController = ScoreController.Instance;
        _menuController = MenuController.Instance;
        _titleController = TitleController.Instance;
        
		feedbackAnim = GameObject.Find ("Feedbacks/Feedback" + index).GetComponent<Animator>();
    }
 // Use this for initialization
 void Start()
 {
     menu = GameObject.Find("Menu");
     menuCon = menu.GetComponent<MenuController>();
     filter = transform.FindChild("Filter").gameObject;
     phase = 0;
     if (DataManager.dataInstance != null && DataManager.dataInstance.onTutorial)
     {
         SelectTutorial();
         filterOn = true;
     }
     else
     {
         gameObject.SetActive(false);
     }
 }
Пример #26
0
	void Awake ()
	{
		if(!controller)
		{
			bool checkLeyers = CheckLayers ();

			SetPhysics ();

            controller = MenuController.Instantiate (controllerPrefab) as MenuController;
			//controller = controllerPrefab;
//			controller.name = "Controller";
			controller.isPaused = false;
			DontDestroyOnLoad(controller.gameObject);
			if(PlayerPrefs.GetInt("IsFirstTimeStarted") != 1)
			{
				PlayerPrefs.SetInt("IsFirstTimeStarted", 1);
				controller.IsFirstTimeStarted = true;
			}
			else
			controller.IsFirstTimeStarted = false;
			if(checkLeyers)
			{
                //if(controller.layerHelp)
                //Destroy(controller.layerHelp);

#if !UNITY_EDITOR
				controller.isTouchScreen = Application.platform != RuntimePlatform.WindowsWebPlayer && Application.platform != RuntimePlatform.OSXWebPlayer && Application.platform != RuntimePlatform.WebGLPlayer
					&& Application.platform != RuntimePlatform.WindowsPlayer && Application.platform != RuntimePlatform.OSXPlayer && Application.platform != RuntimePlatform.LinuxPlayer;
				if(controller.isTouchScreen)
					Screen.sleepTimeout = SleepTimeout.NeverSleep;
#endif
				if(Application.levelCount >= 3)
					controller.OnStart();
				else
					Debug.LogError("Please add the scenes (GameStart, Game and Loader) in the File/Build Settings" +
					               " as shown in the image  Assets/BallPool/TagAndLayers.png");
			}
			else
			{
				Debug.LogError("Please add the layers \n " +
				                 "Ball, Canvas, Wall, MainBall, Graund, GUI \n" +
				                 "as shown in the image ");

			}
		}
	}
 public void Configure(MenuController mc,
                       IListMatrix ilm,
                       IGauntletDbAdapter sqliteDb,
                       StoryboardStatusBar statusBar)
 {
     this.ilm = ilm;
     this.sqliteDb = sqliteDb;
     this.statusBar = statusBar;
     mc.AddMenuItem("Gauntlet", "Export Active SQLite Lists To FileSystem Sync Folder", ExportActiveSqliteLists);
     //mc.AddMenuItem("Gauntlet", "Export Active MySQL Lists To FileSystem Sync Folder", ExportActiveMySqlLists);
     mc.AddMenuItem("Gauntlet", "Active List Management", ShowActiveListManagement);
     mc.AddMenuItem("Gauntlet", "Import Synced Files", ImportSyncedFiles);
     mc.AddMenuItem("Gauntlet", "Import Synced Archive Files", ImportSyncedArchiveFiles);
     mc.AddMenuItem("Gauntlet", "Consume All Imported Files", ConsumeAllImportedFiles);
     mc.AddMenuItem("Tools", "FileMatrix...", LaunchFileMatrix);
     mc.AddMenuItem("Tools", "ObjectGrid...", LaunchObjectGrid);
 }
Пример #28
0
    // Use this for initialization
    void Start()
    {
        instance = gameObject.GetComponent<MenuController>();

        menuCanvas = GameObject.Find("MenuCanvas");

        gameCanvas = GameObject.Find("GameCanvas");
        gameCanvas.SetActive(false);

        //Set menu positions based on ratio
        float screenRatio = Camera.main.aspect;

        RectTransform bigButtons = GameObject.Find("BigButtons").GetComponent<RectTransform>();
        RectTransform smallButtons = GameObject.Find("SmallButtons").GetComponent<RectTransform>();
        RectTransform titleText = GameObject.Find("TitleText").GetComponent<RectTransform>();
        RectTransform scoreTexts = GameObject.Find("ScoreTexts").GetComponent<RectTransform>();

        if (screenRatio > 0.7){

            titleText.offsetMax = new Vector2(titleText.offsetMax.x, -34);
            smallButtons.offsetMax = new Vector2(smallButtons.offsetMax.x, 335);
            bigButtons.offsetMax = new  Vector2(bigButtons.offsetMax.x, -560);
            scoreTexts.offsetMax = new Vector2(scoreTexts.offsetMax.x, -660);
        }
        else if (screenRatio > 0.6){

            titleText.offsetMax = new Vector2(titleText.offsetMax.x, -34);
            smallButtons.offsetMax = new Vector2(smallButtons.offsetMax.x, 335);
            bigButtons.offsetMax = new Vector2(bigButtons.offsetMax.x, -640);
            scoreTexts.offsetMax = new Vector2(scoreTexts.offsetMax.x, -745);
        }

        //Initialize app links
        #if UNITY_ANDROID
        appLink = ""http://itunes.apple.com/us/app/escape-from-orbit-amazing/id1017559814?l=da&ls=1&mt=8";
        #elif UNITY_IPHONE
        appLink = "itms-apps://itunes.apple.com/us/app/escape-from-orbit-amazing/id1017559814?l=da&ls=1&mt=8";
        #else
        appLink = "http://itunes.apple.com/us/app/escape-from-orbit-amazing/id1017559814?l=da&ls=1&mt=8";
        #endif

        webLink = "http://www.SandsWorks.com";
    }
Пример #29
0
        /// <summary>
        /// Creates the menu.
        /// </summary>
        private void CreateMenu()
        {
            menu = new Menu(Game.Player.Name, "Banned Players Management");

            bannedPlayer.AddMenuItem(new MenuItem("Player Name"));
            bannedPlayer.AddMenuItem(new MenuItem("Banned By"));
            bannedPlayer.AddMenuItem(new MenuItem("Banned Until"));
            bannedPlayer.AddMenuItem(new MenuItem("Player Identifiers"));
            bannedPlayer.AddMenuItem(new MenuItem("Banned For"));
            bannedPlayer.AddMenuItem(new MenuItem("~r~Unban", "~r~Warning, unbanning the player can NOT be undone. You will NOT be able to ban them agian until they re-join the server. Are you absolutely sure you want to unban this player? ~s~Tip: Tempbanned players will automatically get unbanned if they log on to the server after their ban date has expired."));

            // should be enough for now to cover all possible identifiers.
            List <string> colors = new List <string>()
            {
                "~r~", "~g~", "~b~", "~o~", "~y~", "~p~", "~s~", "~t~",
            };

            bannedPlayer.OnMenuClose += (sender) =>
            {
                BaseScript.TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle);
                bannedPlayer.GetMenuItems()[5].Label = "";
                UpdateBans();
            };

            bannedPlayer.OnIndexChange += (sender, oldItem, newItem, oldIndex, newIndex) =>
            {
                bannedPlayer.GetMenuItems()[5].Label = "";
            };

            bannedPlayer.OnItemSelect += (sender, item, index) =>
            {
                if (index == 5 && IsAllowed(Permission.OPUnban))
                {
                    if (item.Label == "Are you sure?")
                    {
                        if (banlist.Contains(currentRecord))
                        {
                            UnbanPlayer(banlist.IndexOf(currentRecord));
                            bannedPlayer.GetMenuItems()[5].Label = "";
                            bannedPlayer.GoBack();
                        }
                        else
                        {
                            Notify.Error("Somehow you managed to click the unban button but this ban record you're apparently viewing does not even exist. Weird...");
                        }
                    }
                    else
                    {
                        item.Label = "Are you sure?";
                    }
                }
                else
                {
                    bannedPlayer.GetMenuItems()[5].Label = "";
                }
            };

            menu.OnItemSelect += (sender, item, index) =>
            {
                if (index < banlist.Count)
                {
                    currentRecord             = banlist[index];
                    bannedPlayer.MenuSubtitle = "Ban Record: ~y~" + currentRecord.playerName;
                    var nameItem              = bannedPlayer.GetMenuItems()[0];
                    var bannedByItem          = bannedPlayer.GetMenuItems()[1];
                    var bannedUntilItem       = bannedPlayer.GetMenuItems()[2];
                    var playerIdentifiersItem = bannedPlayer.GetMenuItems()[3];
                    var banReasonItem         = bannedPlayer.GetMenuItems()[4];
                    nameItem.Label           = currentRecord.playerName;
                    nameItem.Description     = "Player name: ~y~" + currentRecord.playerName;
                    bannedByItem.Label       = currentRecord.bannedBy;
                    bannedByItem.Description = "Player banned by: ~y~" + currentRecord.bannedBy;
                    if (currentRecord.bannedUntil.Date.Year == 3000)
                    {
                        bannedUntilItem.Label = "Forever";
                    }
                    else
                    {
                        bannedUntilItem.Label = currentRecord.bannedUntil.Date.ToString();
                    }
                    bannedUntilItem.Description       = "This player is banned until: " + currentRecord.bannedUntil.Date.ToString();
                    playerIdentifiersItem.Description = "";

                    int i = 0;
                    foreach (string id in currentRecord.identifiers)
                    {
                        // only (admins) people that can unban players are allowed to view IP's.
                        // this is just a slight 'safety' feature in case someone who doesn't know what they're doing
                        // gave builtin.everyone access to view the banlist.
                        if (id.StartsWith("ip:") && !IsAllowed(Permission.OPUnban))
                        {
                            playerIdentifiersItem.Description += $"{colors[i]}ip: (hidden) ";
                        }
                        else
                        {
                            playerIdentifiersItem.Description += $"{colors[i]}{id.Replace(":", ": ")} ";
                        }
                        i++;
                    }
                    banReasonItem.Description = "Banned for: " + currentRecord.banReason;

                    var unbanPlayerBtn = bannedPlayer.GetMenuItems()[5];
                    unbanPlayerBtn.Label = "";
                    if (!IsAllowed(Permission.OPUnban))
                    {
                        unbanPlayerBtn.Enabled     = false;
                        unbanPlayerBtn.Description = "You are not allowed to unban players. You are only allowed to view their ban record.";
                        unbanPlayerBtn.LeftIcon    = MenuItem.Icon.LOCK;
                    }

                    bannedPlayer.RefreshIndex();
                    //bannedPlayer.UpdateScaleform();
                }
            };
            MenuController.AddMenu(bannedPlayer);
        }
Пример #30
0
        /// <summary>
        /// Creates the menu.
        /// </summary>
        private void CreateMenu()
        {
            // Setup weapon dictionaries.
            weaponInfo       = new Dictionary <Menu, ValidWeapon>();
            weaponComponents = new Dictionary <MenuItem, string>();

            #region create main weapon options menu and add items
            // Create the menu.
            menu = new Menu(Game.Player.Name, "Weapon Options");

            MenuItem         getAllWeapons    = new MenuItem("Get All Weapons", "Get all weapons.");
            MenuItem         removeAllWeapons = new MenuItem("Remove All Weapons", "Removes all weapons in your inventory.");
            MenuCheckboxItem unlimitedAmmo    = new MenuCheckboxItem("Unlimited Ammo", "Unlimited ammonition supply.", UnlimitedAmmo);
            MenuCheckboxItem noReload         = new MenuCheckboxItem("No Reload", "Never reload.", NoReload);
            MenuItem         setAmmo          = new MenuItem("Set All Ammo Count", "Set the amount of ammo in all your weapons.");
            MenuItem         refillMaxAmmo    = new MenuItem("Refill All Ammo", "Give all your weapons max ammo.");
            MenuItem         spawnByName      = new MenuItem("Spawn Weapon By Name", "Enter a weapon mode name to spawn.");

            // Add items based on permissions
            if (IsAllowed(Permission.WPGetAll))
            {
                menu.AddMenuItem(getAllWeapons);
            }
            if (IsAllowed(Permission.WPRemoveAll))
            {
                menu.AddMenuItem(removeAllWeapons);
            }
            if (IsAllowed(Permission.WPUnlimitedAmmo))
            {
                menu.AddMenuItem(unlimitedAmmo);
            }
            if (IsAllowed(Permission.WPNoReload))
            {
                menu.AddMenuItem(noReload);
            }
            if (IsAllowed(Permission.WPSetAllAmmo))
            {
                menu.AddMenuItem(setAmmo);
                menu.AddMenuItem(refillMaxAmmo);
            }
            if (IsAllowed(Permission.WPSpawnByName))
            {
                menu.AddMenuItem(spawnByName);
            }
            #endregion

            #region addonweapons submenu
            MenuItem addonWeaponsBtn  = new MenuItem("Addon Weapons", "Equip / remove addon weapons available on this server.");
            Menu     addonWeaponsMenu = new Menu("Addon Weapons", "Equip/Remove Addon Weapons");
            menu.AddMenuItem(addonWeaponsBtn);

            #region manage creating and accessing addon weapons menu
            if (IsAllowed(Permission.WPSpawn) && AddonWeapons != null && AddonWeapons.Count > 0)
            {
                MenuController.BindMenuItem(menu, addonWeaponsMenu, addonWeaponsBtn);
                foreach (KeyValuePair <string, uint> weapon in AddonWeapons)
                {
                    string name  = weapon.Key.ToString();
                    uint   model = weapon.Value;
                    var    item  = new MenuItem(name, $"Click to add/remove this weapon ({name}) to/from your inventory.");
                    addonWeaponsMenu.AddMenuItem(item);
                    if (!IsWeaponValid(model))
                    {
                        item.Enabled     = false;
                        item.LeftIcon    = MenuItem.Icon.LOCK;
                        item.Description = "This model is not available. Please ask the server owner to verify it's being streamed correctly.";
                    }
                }
                addonWeaponsMenu.OnItemSelect += (sender, item, index) =>
                {
                    var weapon = AddonWeapons.ElementAt(index);
                    if (HasPedGotWeapon(Game.PlayerPed.Handle, weapon.Value, false))
                    {
                        RemoveWeaponFromPed(Game.PlayerPed.Handle, weapon.Value);
                    }
                    else
                    {
                        var maxAmmo = 200;
                        GetMaxAmmo(Game.PlayerPed.Handle, weapon.Value, ref maxAmmo);
                        GiveWeaponToPed(Game.PlayerPed.Handle, weapon.Value, maxAmmo, false, true);
                    }
                };
                addonWeaponsBtn.Label = "→→→";
            }
            else
            {
                addonWeaponsBtn.LeftIcon    = MenuItem.Icon.LOCK;
                addonWeaponsBtn.Enabled     = false;
                addonWeaponsBtn.Description = "This option is not available on this server because you don't have permission to use it, or it is not setup correctly.";
            }
            #endregion
            addonWeaponsMenu.RefreshIndex();
            #endregion

            #region parachute options menu

            if (IsAllowed(Permission.WPParachute))
            {
                // main parachute options menu setup
                Menu     parachuteMenu = new Menu("Parachute Options", "Parachute Options");
                MenuItem parachuteBtn  = new MenuItem("Parachute Options", "All parachute related options can be changed here.")
                {
                    Label = "→→→"
                };

                MenuController.AddSubmenu(menu, parachuteMenu);
                menu.AddMenuItem(parachuteBtn);
                MenuController.BindMenuItem(menu, parachuteMenu, parachuteBtn);

                List <string> chutes = new List <string>()
                {
                    GetLabelText("PM_TINT0"),
                    GetLabelText("PM_TINT1"),
                    GetLabelText("PM_TINT2"),
                    GetLabelText("PM_TINT3"),
                    GetLabelText("PM_TINT4"),
                    GetLabelText("PM_TINT5"),
                    GetLabelText("PM_TINT6"),
                    GetLabelText("PM_TINT7"),

                    // broken in FiveM for some weird reason:
                    GetLabelText("PS_CAN_0"),
                    GetLabelText("PS_CAN_1"),
                    GetLabelText("PS_CAN_2"),
                    GetLabelText("PS_CAN_3"),
                    GetLabelText("PS_CAN_4"),
                    GetLabelText("PS_CAN_5")
                };
                List <string> chuteDescriptions = new List <string>()
                {
                    GetLabelText("PD_TINT0"),
                    GetLabelText("PD_TINT1"),
                    GetLabelText("PD_TINT2"),
                    GetLabelText("PD_TINT3"),
                    GetLabelText("PD_TINT4"),
                    GetLabelText("PD_TINT5"),
                    GetLabelText("PD_TINT6"),
                    GetLabelText("PD_TINT7"),

                    // broken in FiveM for some weird reason:
                    GetLabelText("PSD_CAN_0") + " ~r~For some reason this one doesn't seem to work in FiveM.",
                    GetLabelText("PSD_CAN_1") + " ~r~For some reason this one doesn't seem to work in FiveM.",
                    GetLabelText("PSD_CAN_2") + " ~r~For some reason this one doesn't seem to work in FiveM.",
                    GetLabelText("PSD_CAN_3") + " ~r~For some reason this one doesn't seem to work in FiveM.",
                    GetLabelText("PSD_CAN_4") + " ~r~For some reason this one doesn't seem to work in FiveM.",
                    GetLabelText("PSD_CAN_5") + " ~r~For some reason this one doesn't seem to work in FiveM."
                };

                MenuItem         togglePrimary       = new MenuItem("Toggle Primary Parachute", "Equip or remove the primary parachute");
                MenuItem         toggleReserve       = new MenuItem("Enable Reserve Parachute", "Enables the reserve parachute. Only works if you enabled the primary parachute first. Reserve parachute can not be removed from the player once it's activated.");
                MenuListItem     primaryChutes       = new MenuListItem("Primary Chute Style", chutes, 0, $"Primary chute: {chuteDescriptions[0]}");
                MenuListItem     secondaryChutes     = new MenuListItem("Reserve Chute Style", chutes, 0, $"Reserve chute: {chuteDescriptions[0]}");
                MenuCheckboxItem unlimitedParachutes = new MenuCheckboxItem("Unlimited Parachutes", "Enable unlimited parachutes and reserve parachutes.", UnlimitedParachutes);
                MenuCheckboxItem autoEquipParachutes = new MenuCheckboxItem("Auto Equip Parachutes", "Automatically equip a parachute and reserve parachute when entering planes/helicopters.", AutoEquipChute);

                // smoke color list
                List <string> smokeColorsList = new List <string>()
                {
                    GetLabelText("PM_TINT8"),  // no smoke
                    GetLabelText("PM_TINT9"),  // red
                    GetLabelText("PM_TINT10"), // orange
                    GetLabelText("PM_TINT11"), // yellow
                    GetLabelText("PM_TINT12"), // blue
                    GetLabelText("PM_TINT13"), // black
                };
                List <int[]> colors = new List <int[]>()
                {
                    new int[3] {
                        255, 255, 255
                    },
                    new int[3] {
                        255, 0, 0
                    },
                    new int[3] {
                        255, 165, 0
                    },
                    new int[3] {
                        255, 255, 0
                    },
                    new int[3] {
                        0, 0, 255
                    },
                    new int[3] {
                        20, 20, 20
                    },
                };

                MenuListItem smokeColors = new MenuListItem("Smoke Trail Color", smokeColorsList, 0, "Choose a smoke trail color, then press select to change it. Changing colors takes 4 seconds, you can not use your smoke while the color is being changed.");

                parachuteMenu.AddMenuItem(togglePrimary);
                parachuteMenu.AddMenuItem(toggleReserve);
                parachuteMenu.AddMenuItem(autoEquipParachutes);
                parachuteMenu.AddMenuItem(unlimitedParachutes);
                parachuteMenu.AddMenuItem(smokeColors);
                parachuteMenu.AddMenuItem(primaryChutes);
                parachuteMenu.AddMenuItem(secondaryChutes);

                parachuteMenu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == togglePrimary)
                    {
                        if (HasPedGotWeapon(Game.PlayerPed.Handle, (uint)GetHashKey("gadget_parachute"), false))
                        {
                            Subtitle.Custom("Primary parachute removed.");
                            RemoveWeaponFromPed(Game.PlayerPed.Handle, (uint)GetHashKey("gadget_parachute"));
                        }
                        else
                        {
                            Subtitle.Custom("Primary parachute added.");
                            GiveWeaponToPed(Game.PlayerPed.Handle, (uint)GetHashKey("gadget_parachute"), 0, false, false);
                        }
                    }
                    else if (item == toggleReserve)
                    {
                        SetPlayerHasReserveParachute(Game.Player.Handle);
                        Subtitle.Custom("Reserve parachute has been added.");
                    }
                };

                parachuteMenu.OnCheckboxChange += (sender, item, index, _checked) =>
                {
                    if (item == unlimitedParachutes)
                    {
                        UnlimitedParachutes = _checked;
                    }
                    else if (item == autoEquipParachutes)
                    {
                        AutoEquipChute = _checked;
                    }
                };

                bool switching = false;
                async void IndexChangedEventHandler(Menu sender, MenuListItem item, int oldIndex, int newIndex, int itemIndex)
                {
                    if (item == smokeColors && oldIndex == -1)
                    {
                        if (!switching)
                        {
                            switching = true;
                            SetPlayerCanLeaveParachuteSmokeTrail(Game.Player.Handle, false);
                            await Delay(4000);

                            int[] color = colors[newIndex];
                            SetPlayerParachuteSmokeTrailColor(Game.Player.Handle, color[0], color[1], color[2]);
                            SetPlayerCanLeaveParachuteSmokeTrail(Game.Player.Handle, newIndex != 0);
                            switching = false;
                        }
                    }
                    else if (item == primaryChutes)
                    {
                        item.Description = $"Primary chute: {chuteDescriptions[newIndex]}";
                        SetPlayerParachuteTintIndex(Game.Player.Handle, newIndex);
                    }
                    else if (item == secondaryChutes)
                    {
                        item.Description = $"Reserve chute: {chuteDescriptions[newIndex]}";
                        SetPlayerReserveParachuteTintIndex(Game.Player.Handle, newIndex);
                    }
                }

                parachuteMenu.OnListItemSelect  += (sender, item, index, itemIndex) => IndexChangedEventHandler(sender, item, -1, index, itemIndex);
                parachuteMenu.OnListIndexChange += IndexChangedEventHandler;
            }
            #endregion

            #region Create Weapon Category Submenus
            MenuItem spacer = GetSpacerMenuItem("↓ Weapon Categories ↓");
            menu.AddMenuItem(spacer);

            Menu     handGuns    = new Menu("Weapons", "Handguns");
            MenuItem handGunsBtn = new MenuItem("Handguns");

            Menu     rifles    = new Menu("Weapons", "Assault Rifles");
            MenuItem riflesBtn = new MenuItem("Assault Rifles");

            Menu     shotguns    = new Menu("Weapons", "Shotguns");
            MenuItem shotgunsBtn = new MenuItem("Shotguns");

            Menu     smgs    = new Menu("Weapons", "Sub-/Light Machine Guns");
            MenuItem smgsBtn = new MenuItem("Sub-/Light Machine Guns");

            Menu     throwables    = new Menu("Weapons", "Throwables");
            MenuItem throwablesBtn = new MenuItem("Throwables");

            Menu     melee    = new Menu("Weapons", "Melee");
            MenuItem meleeBtn = new MenuItem("Melee");

            Menu     heavy    = new Menu("Weapons", "Heavy Weapons");
            MenuItem heavyBtn = new MenuItem("Heavy Weapons");

            Menu     snipers    = new Menu("Weapons", "Sniper Rifles");
            MenuItem snipersBtn = new MenuItem("Sniper Rifles");

            MenuController.AddSubmenu(menu, handGuns);
            MenuController.AddSubmenu(menu, rifles);
            MenuController.AddSubmenu(menu, shotguns);
            MenuController.AddSubmenu(menu, smgs);
            MenuController.AddSubmenu(menu, throwables);
            MenuController.AddSubmenu(menu, melee);
            MenuController.AddSubmenu(menu, heavy);
            MenuController.AddSubmenu(menu, snipers);
            #endregion

            #region Setup weapon category buttons and submenus.
            handGunsBtn.Label = "→→→";
            menu.AddMenuItem(handGunsBtn);
            MenuController.BindMenuItem(menu, handGuns, handGunsBtn);

            riflesBtn.Label = "→→→";
            menu.AddMenuItem(riflesBtn);
            MenuController.BindMenuItem(menu, rifles, riflesBtn);

            shotgunsBtn.Label = "→→→";
            menu.AddMenuItem(shotgunsBtn);
            MenuController.BindMenuItem(menu, shotguns, shotgunsBtn);

            smgsBtn.Label = "→→→";
            menu.AddMenuItem(smgsBtn);
            MenuController.BindMenuItem(menu, smgs, smgsBtn);

            throwablesBtn.Label = "→→→";
            menu.AddMenuItem(throwablesBtn);
            MenuController.BindMenuItem(menu, throwables, throwablesBtn);

            meleeBtn.Label = "→→→";
            menu.AddMenuItem(meleeBtn);
            MenuController.BindMenuItem(menu, melee, meleeBtn);

            heavyBtn.Label = "→→→";
            menu.AddMenuItem(heavyBtn);
            MenuController.BindMenuItem(menu, heavy, heavyBtn);

            snipersBtn.Label = "→→→";
            menu.AddMenuItem(snipersBtn);
            MenuController.BindMenuItem(menu, snipers, snipersBtn);
            #endregion

            #region Loop through all weapons, create menus for them and add all menu items and handle events.
            foreach (ValidWeapon weapon in ValidWeapons.WeaponList)
            {
                uint cat = (uint)GetWeapontypeGroup(weapon.Hash);
                if (!string.IsNullOrEmpty(weapon.Name) && IsAllowed(weapon.Perm))
                {
                    //Log($"[DEBUG LOG] [WEAPON-BUG] {weapon.Name} - {weapon.Perm} = {IsAllowed(weapon.Perm)} & All = {IsAllowed(Permission.WPGetAll)}");
                    #region Create menu for this weapon and add buttons
                    Menu weaponMenu = new Menu("Weapon Options", weapon.Name)
                    {
                        ShowWeaponStatsPanel = true
                    };
                    var stats = new Game.WeaponHudStats();
                    Game.GetWeaponHudStats(weapon.Hash, ref stats);
                    weaponMenu.SetWeaponStats((float)stats.hudDamage / 100f, (float)stats.hudSpeed / 100f, (float)stats.hudAccuracy / 100f, (float)stats.hudRange / 100f);
                    MenuItem weaponItem = new MenuItem(weapon.Name, $"Open the options for ~y~{weapon.Name}~s~.")
                    {
                        Label    = "→→→",
                        LeftIcon = MenuItem.Icon.GUN,
                        ItemData = stats
                    };

                    weaponInfo.Add(weaponMenu, weapon);

                    MenuItem getOrRemoveWeapon = new MenuItem("Equip/Remove Weapon", "Add or remove this weapon to/form your inventory.")
                    {
                        LeftIcon = MenuItem.Icon.GUN
                    };
                    weaponMenu.AddMenuItem(getOrRemoveWeapon);
                    if (!IsAllowed(Permission.WPSpawn))
                    {
                        getOrRemoveWeapon.Enabled     = false;
                        getOrRemoveWeapon.Description = "You do not have permission to use this option.";
                        getOrRemoveWeapon.LeftIcon    = MenuItem.Icon.LOCK;
                    }

                    MenuItem fillAmmo = new MenuItem("Re-fill Ammo", "Get max ammo for this weapon.")
                    {
                        LeftIcon = MenuItem.Icon.AMMO
                    };
                    weaponMenu.AddMenuItem(fillAmmo);

                    List <string> tints = new List <string>();
                    if (weapon.Name.Contains(" Mk II"))
                    {
                        foreach (var tint in ValidWeapons.WeaponTintsMkII)
                        {
                            tints.Add(tint.Key);
                        }
                    }
                    else
                    {
                        foreach (var tint in ValidWeapons.WeaponTints)
                        {
                            tints.Add(tint.Key);
                        }
                    }

                    MenuListItem weaponTints = new MenuListItem("Tints", tints, 0, "Select a tint for your weapon.");
                    weaponMenu.AddMenuItem(weaponTints);
                    #endregion

                    #region Handle weapon specific list changes
                    weaponMenu.OnListIndexChange += (sender, item, oldIndex, newIndex, itemIndex) =>
                    {
                        if (item == weaponTints)
                        {
                            if (HasPedGotWeapon(Game.PlayerPed.Handle, weaponInfo[sender].Hash, false))
                            {
                                SetPedWeaponTintIndex(Game.PlayerPed.Handle, weaponInfo[sender].Hash, newIndex);
                            }
                            else
                            {
                                Notify.Error("You need to get the weapon first!");
                            }
                        }
                    };
                    #endregion

                    #region Handle weapon specific button presses
                    weaponMenu.OnItemSelect += (sender, item, index) =>
                    {
                        var  info = weaponInfo[sender];
                        uint hash = info.Hash;

                        SetCurrentPedWeapon(Game.PlayerPed.Handle, hash, true);

                        if (item == getOrRemoveWeapon)
                        {
                            if (HasPedGotWeapon(Game.PlayerPed.Handle, hash, false))
                            {
                                RemoveWeaponFromPed(Game.PlayerPed.Handle, hash);
                                TriggerServerEvent("vMenu:DamonLog", $"{Game.Player.Name} removed their {info.Name}");
                                Subtitle.Custom("Weapon removed.");
                            }
                            else
                            {
                                var ammo = 255;
                                GetMaxAmmo(Game.PlayerPed.Handle, hash, ref ammo);
                                GiveWeaponToPed(Game.PlayerPed.Handle, hash, ammo, false, true);
                                TriggerServerEvent("vMenu:DamonLog", $"{Game.Player.Name} gave themself a {info.Name}");

                                Subtitle.Custom("Weapon added.");
                            }
                        }
                        else if (item == fillAmmo)
                        {
                            if (HasPedGotWeapon(Game.PlayerPed.Handle, hash, false))
                            {
                                var ammo = 900;
                                GetMaxAmmo(Game.PlayerPed.Handle, hash, ref ammo);
                                SetPedAmmo(Game.PlayerPed.Handle, hash, ammo);
                            }
                            else
                            {
                                Notify.Error("You need to get the weapon first before re-filling ammo!");
                            }
                        }
                    };
                    #endregion

                    #region load components
                    if (weapon.Components != null)
                    {
                        if (weapon.Components.Count > 0)
                        {
                            foreach (var comp in weapon.Components)
                            {
                                //Log($"{weapon.Name} : {comp.Key}");
                                MenuItem compItem = new MenuItem(comp.Key, "Click to equip or remove this component.");
                                weaponComponents.Add(compItem, comp.Key);
                                weaponMenu.AddMenuItem(compItem);

                                #region Handle component button presses
                                weaponMenu.OnItemSelect += (sender, item, index) =>
                                {
                                    if (item == compItem)
                                    {
                                        var Weapon        = weaponInfo[sender];
                                        var componentHash = Weapon.Components[weaponComponents[item]];
                                        if (HasPedGotWeapon(Game.PlayerPed.Handle, Weapon.Hash, false))
                                        {
                                            SetCurrentPedWeapon(Game.PlayerPed.Handle, Weapon.Hash, true);
                                            if (HasPedGotWeaponComponent(Game.PlayerPed.Handle, Weapon.Hash, componentHash))
                                            {
                                                RemoveWeaponComponentFromPed(Game.PlayerPed.Handle, Weapon.Hash, componentHash);

                                                Subtitle.Custom("Component removed.");
                                            }
                                            else
                                            {
                                                int ammo = GetAmmoInPedWeapon(Game.PlayerPed.Handle, Weapon.Hash);

                                                int clipAmmo = GetMaxAmmoInClip(Game.PlayerPed.Handle, Weapon.Hash, false);
                                                GetAmmoInClip(Game.PlayerPed.Handle, Weapon.Hash, ref clipAmmo);

                                                GiveWeaponComponentToPed(Game.PlayerPed.Handle, Weapon.Hash, componentHash);

                                                SetAmmoInClip(Game.PlayerPed.Handle, Weapon.Hash, clipAmmo);

                                                SetPedAmmo(Game.PlayerPed.Handle, Weapon.Hash, ammo);
                                                Subtitle.Custom("Component equiped.");
                                            }
                                        }
                                        else
                                        {
                                            Notify.Error("You need to get the weapon first before you can modify it.");
                                        }
                                    }
                                };
                                #endregion
                            }
                        }
                    }
                    #endregion

                    // refresh and add to menu.
                    weaponMenu.RefreshIndex();

                    if (cat == 970310034) // 970310034 rifles
                    {
                        MenuController.AddSubmenu(rifles, weaponMenu);
                        MenuController.BindMenuItem(rifles, weaponMenu, weaponItem);
                        rifles.AddMenuItem(weaponItem);
                    }
                    else if (cat == 416676503 || cat == 690389602) // 416676503 hand guns // 690389602 stun gun
                    {
                        MenuController.AddSubmenu(handGuns, weaponMenu);
                        MenuController.BindMenuItem(handGuns, weaponMenu, weaponItem);
                        handGuns.AddMenuItem(weaponItem);
                    }
                    else if (cat == 860033945) // 860033945 shotguns
                    {
                        MenuController.AddSubmenu(shotguns, weaponMenu);
                        MenuController.BindMenuItem(shotguns, weaponMenu, weaponItem);
                        shotguns.AddMenuItem(weaponItem);
                    }
                    else if (cat == 3337201093 || cat == 1159398588) // 3337201093 sub machine guns // 1159398588 light machine guns
                    {
                        MenuController.AddSubmenu(smgs, weaponMenu);
                        MenuController.BindMenuItem(smgs, weaponMenu, weaponItem);
                        smgs.AddMenuItem(weaponItem);
                    }
                    else if (cat == 1548507267 || cat == 4257178988 || cat == 1595662460) // 1548507267 throwables // 4257178988 fire extinghuiser // jerry can
                    {
                        MenuController.AddSubmenu(throwables, weaponMenu);
                        MenuController.BindMenuItem(throwables, weaponMenu, weaponItem);
                        throwables.AddMenuItem(weaponItem);
                    }
                    else if (cat == 3566412244 || cat == 2685387236) // 3566412244 melee weapons // 2685387236 knuckle duster
                    {
                        MenuController.AddSubmenu(melee, weaponMenu);
                        MenuController.BindMenuItem(melee, weaponMenu, weaponItem);
                        melee.AddMenuItem(weaponItem);
                    }
                    else if (cat == 2725924767) // 2725924767 heavy weapons
                    {
                        MenuController.AddSubmenu(heavy, weaponMenu);
                        MenuController.BindMenuItem(heavy, weaponMenu, weaponItem);
                        heavy.AddMenuItem(weaponItem);
                    }
                    else if (cat == 3082541095) // 3082541095 sniper rifles
                    {
                        MenuController.AddSubmenu(snipers, weaponMenu);
                        MenuController.BindMenuItem(snipers, weaponMenu, weaponItem);
                        snipers.AddMenuItem(weaponItem);
                    }
                }
            }
            #endregion

            #region Disable submenus if no weapons in that category are allowed.
            if (handGuns.Size == 0)
            {
                handGunsBtn.LeftIcon    = MenuItem.Icon.LOCK;
                handGunsBtn.Description = "The server owner removed the permissions for all weapons in this category.";
                handGunsBtn.Enabled     = false;
            }
            if (rifles.Size == 0)
            {
                riflesBtn.LeftIcon    = MenuItem.Icon.LOCK;
                riflesBtn.Description = "The server owner removed the permissions for all weapons in this category.";
                riflesBtn.Enabled     = false;
            }
            if (shotguns.Size == 0)
            {
                shotgunsBtn.LeftIcon    = MenuItem.Icon.LOCK;
                shotgunsBtn.Description = "The server owner removed the permissions for all weapons in this category.";
                shotgunsBtn.Enabled     = false;
            }
            if (smgs.Size == 0)
            {
                smgsBtn.LeftIcon    = MenuItem.Icon.LOCK;
                smgsBtn.Description = "The server owner removed the permissions for all weapons in this category.";
                smgsBtn.Enabled     = false;
            }
            if (throwables.Size == 0)
            {
                throwablesBtn.LeftIcon    = MenuItem.Icon.LOCK;
                throwablesBtn.Description = "The server owner removed the permissions for all weapons in this category.";
                throwablesBtn.Enabled     = false;
            }
            if (melee.Size == 0)
            {
                meleeBtn.LeftIcon    = MenuItem.Icon.LOCK;
                meleeBtn.Description = "The server owner removed the permissions for all weapons in this category.";
                meleeBtn.Enabled     = false;
            }
            if (heavy.Size == 0)
            {
                heavyBtn.LeftIcon    = MenuItem.Icon.LOCK;
                heavyBtn.Description = "The server owner removed the permissions for all weapons in this category.";
                heavyBtn.Enabled     = false;
            }
            if (snipers.Size == 0)
            {
                snipersBtn.LeftIcon    = MenuItem.Icon.LOCK;
                snipersBtn.Description = "The server owner removed the permissions for all weapons in this category.";
                snipersBtn.Enabled     = false;
            }
            #endregion

            #region Handle button presses
            menu.OnItemSelect += (sender, item, index) =>
            {
                Ped ped = new Ped(Game.PlayerPed.Handle);
                if (item == getAllWeapons)
                {
                    foreach (ValidWeapon vw in ValidWeapons.WeaponList)
                    {
                        if (IsAllowed(vw.Perm))
                        {
                            GiveWeaponToPed(Game.PlayerPed.Handle, vw.Hash, vw.GetMaxAmmo, false, true);

                            int ammoInClip = GetMaxAmmoInClip(Game.PlayerPed.Handle, vw.Hash, false);
                            SetAmmoInClip(Game.PlayerPed.Handle, vw.Hash, ammoInClip);
                            int ammo = 0;
                            GetMaxAmmo(Game.PlayerPed.Handle, vw.Hash, ref ammo);
                            SetPedAmmo(Game.PlayerPed.Handle, vw.Hash, ammo);
                        }
                    }

                    SetCurrentPedWeapon(Game.PlayerPed.Handle, (uint)GetHashKey("weapon_unarmed"), true);
                }
                else if (item == removeAllWeapons)
                {
                    ped.Weapons.RemoveAll();
                    TriggerServerEvent("vMenu:DamonLog", $"{Game.Player.Name} removed all weapons");
                }
                else if (item == setAmmo)
                {
                    SetAllWeaponsAmmo();
                }
                else if (item == refillMaxAmmo)
                {
                    foreach (ValidWeapon vw in ValidWeapons.WeaponList)
                    {
                        if (HasPedGotWeapon(Game.PlayerPed.Handle, vw.Hash, false))
                        {
                            int ammoInClip = GetMaxAmmoInClip(Game.PlayerPed.Handle, vw.Hash, false);
                            SetAmmoInClip(Game.PlayerPed.Handle, vw.Hash, ammoInClip);
                            int ammo = 0;
                            GetMaxAmmo(Game.PlayerPed.Handle, vw.Hash, ref ammo);
                            SetPedAmmo(Game.PlayerPed.Handle, vw.Hash, ammo);
                        }
                    }
                }
                else if (item == spawnByName)
                {
                    SpawnCustomWeapon();
                }
            };
            #endregion

            #region Handle checkbox changes
            menu.OnCheckboxChange += (sender, item, index, _checked) =>
            {
                if (item == noReload)
                {
                    NoReload = _checked;
                    Subtitle.Custom($"No reload is now {(_checked ? "enabled" : "disabled")}.");
                }
                else if (item == unlimitedAmmo)
                {
                    UnlimitedAmmo = _checked;
                    Subtitle.Custom($"Unlimited ammo is now {(_checked ? "enabled" : "disabled")}.");
                }
            };
            #endregion

            void OnIndexChange(Menu m, MenuItem i)
            {
                if (i.ItemData is Game.WeaponHudStats stats)
                {
                    m.SetWeaponStats((float)stats.hudDamage / 100f, (float)stats.hudSpeed / 100f, (float)stats.hudAccuracy / 100f, (float)stats.hudRange / 100f);
                    m.ShowWeaponStatsPanel = true;
                }
                else
                {
                    m.ShowWeaponStatsPanel = false;
                }
            }

            handGuns.OnIndexChange   += (sender, oldItem, newItem, oldIndex, newIndex) => { OnIndexChange(sender, newItem); };
            rifles.OnIndexChange     += (sender, oldItem, newItem, oldIndex, newIndex) => { OnIndexChange(sender, newItem); };
            shotguns.OnIndexChange   += (sender, oldItem, newItem, oldIndex, newIndex) => { OnIndexChange(sender, newItem); };
            smgs.OnIndexChange       += (sender, oldItem, newItem, oldIndex, newIndex) => { OnIndexChange(sender, newItem); };
            throwables.OnIndexChange += (sender, oldItem, newItem, oldIndex, newIndex) => { OnIndexChange(sender, newItem); };
            melee.OnIndexChange      += (sender, oldItem, newItem, oldIndex, newIndex) => { OnIndexChange(sender, newItem); };
            heavy.OnIndexChange      += (sender, oldItem, newItem, oldIndex, newIndex) => { OnIndexChange(sender, newItem); };
            snipers.OnIndexChange    += (sender, oldItem, newItem, oldIndex, newIndex) => { OnIndexChange(sender, newItem); };

            handGuns.OnMenuOpen   += (sender) => { OnIndexChange(sender, sender.GetCurrentMenuItem()); };
            rifles.OnMenuOpen     += (sender) => { OnIndexChange(sender, sender.GetCurrentMenuItem()); };
            shotguns.OnMenuOpen   += (sender) => { OnIndexChange(sender, sender.GetCurrentMenuItem()); };
            smgs.OnMenuOpen       += (sender) => { OnIndexChange(sender, sender.GetCurrentMenuItem()); };
            throwables.OnMenuOpen += (sender) => { OnIndexChange(sender, sender.GetCurrentMenuItem()); };
            melee.OnMenuOpen      += (sender) => { OnIndexChange(sender, sender.GetCurrentMenuItem()); };
            heavy.OnMenuOpen      += (sender) => { OnIndexChange(sender, sender.GetCurrentMenuItem()); };
            snipers.OnMenuOpen    += (sender) => { OnIndexChange(sender, sender.GetCurrentMenuItem()); };
        }
Пример #31
0
        /// <summary>
        /// Creates the menu.
        /// </summary>
        private void CreateMenu()
        {
            // Create the menu.
            menu = new Menu(Game.Player.Name, "Online Players")
            {
            };
            menu.CounterPreText = "Players: ";

            MenuController.AddSubmenu(menu, playerMenu);

            MenuItem sendMessage      = new MenuItem("Send Private Message", "Sends a private message to this player. ~r~Note: staff may be able to see all PM's.");
            MenuItem teleport         = new MenuItem("Teleport To Player", "Teleport to this player.");
            MenuItem teleportVeh      = new MenuItem("Teleport Into Player Vehicle", "Teleport into the vehicle of the player.");
            MenuItem summon           = new MenuItem("Summon Player", "Teleport the player to you.");
            MenuItem toggleGPS        = new MenuItem("Toggle GPS", "Enables or disables the GPS route on your radar to this player.");
            MenuItem spectate         = new MenuItem("Spectate Player", "Spectate this player. Click this button again to stop spectating.");
            MenuItem printIdentifiers = new MenuItem("Print Identifiers", "This will print the player's identifiers to the client console (F8). And also save it to the CitizenFX.log file.");
            MenuItem kill             = new MenuItem("~r~Kill Player", "Kill this player, note they will receive a notification saying that you killed them. It will also be logged in the Staff Actions log.");
            MenuItem kick             = new MenuItem("~r~Kick Player", "Kick the player from the server.");
            MenuItem ban     = new MenuItem("~r~Ban Player Permanently", "Ban this player permanently from the server. Are you sure you want to do this? You can specify the ban reason after clicking this button.");
            MenuItem tempban = new MenuItem("~r~Ban Player Temporarily", "Give this player a tempban of up to 30 days (max). You can specify duration and ban reason after clicking this button.");

            // always allowed
            playerMenu.AddMenuItem(sendMessage);
            // permissions specific
            if (IsAllowed(Permission.OPTeleport))
            {
                playerMenu.AddMenuItem(teleport);
                playerMenu.AddMenuItem(teleportVeh);
            }
            if (IsAllowed(Permission.OPSummon))
            {
                playerMenu.AddMenuItem(summon);
            }
            if (IsAllowed(Permission.OPSpectate))
            {
                playerMenu.AddMenuItem(spectate);
            }
            if (IsAllowed(Permission.OPWaypoint))
            {
                playerMenu.AddMenuItem(toggleGPS);
            }
            if (IsAllowed(Permission.OPIdentifiers))
            {
                playerMenu.AddMenuItem(printIdentifiers);
            }
            if (IsAllowed(Permission.OPKill))
            {
                playerMenu.AddMenuItem(kill);
            }
            if (IsAllowed(Permission.OPKick))
            {
                playerMenu.AddMenuItem(kick);
            }
            if (IsAllowed(Permission.OPTempBan))
            {
                playerMenu.AddMenuItem(tempban);
            }
            if (IsAllowed(Permission.OPPermBan))
            {
                playerMenu.AddMenuItem(ban);
                ban.LeftIcon = MenuItem.Icon.WARNING;
            }

            playerMenu.OnMenuClose += (sender) =>
            {
                playerMenu.RefreshIndex();
                ban.Label = "";
            };

            playerMenu.OnIndexChange += (sender, oldItem, newItem, oldIndex, newIndex) =>
            {
                ban.Label = "";
            };

            // handle button presses for the specific player's menu.
            playerMenu.OnItemSelect += async(sender, item, index) =>
            {
                // send message
                if (item == sendMessage)
                {
                    if (MainMenu.MiscSettingsMenu != null && !MainMenu.MiscSettingsMenu.MiscDisablePrivateMessages)
                    {
                        string message = await GetUserInput($"Private Message To {currentPlayer.Name}", 200);

                        if (string.IsNullOrEmpty(message))
                        {
                            Notify.Error(CommonErrors.InvalidInput);
                        }
                        else
                        {
                            TriggerServerEvent("vMenu:SendMessageToPlayer", currentPlayer.ServerId, message);
                            PrivateMessage(currentPlayer.ServerId.ToString(), message, true);
                        }
                    }
                    else
                    {
                        Notify.Error("You can't send a private message if you have private messages disabled yourself. Enable them in the Misc Settings menu and try again.");
                    }
                }
                // teleport (in vehicle) button
                else if (item == teleport || item == teleportVeh)
                {
                    if (Game.Player.Handle != currentPlayer.Handle)
                    {
                        TeleportToPlayer(currentPlayer.Handle, item == teleportVeh); // teleport to the player. optionally in the player's vehicle if that button was pressed.
                    }
                    else
                    {
                        Notify.Error("You can not teleport to yourself!");
                    }
                }
                // summon button
                else if (item == summon)
                {
                    if (Game.Player.Handle != currentPlayer.Handle)
                    {
                        SummonPlayer(currentPlayer);
                    }
                    else
                    {
                        Notify.Error("You can't summon yourself.");
                    }
                }
                // spectating
                else if (item == spectate)
                {
                    SpectatePlayer(currentPlayer);
                }
                // kill button
                else if (item == kill)
                {
                    KillPlayer(currentPlayer);
                }
                // manage the gps route being clicked.
                else if (item == toggleGPS)
                {
                    bool selectedPedRouteAlreadyActive = false;
                    if (PlayersWaypointList.Count > 0)
                    {
                        if (PlayersWaypointList.Contains(currentPlayer.Handle))
                        {
                            selectedPedRouteAlreadyActive = true;
                        }
                        foreach (int playerId in PlayersWaypointList)
                        {
                            int playerPed = GetPlayerPed(playerId);
                            if (DoesEntityExist(playerPed) && DoesBlipExist(GetBlipFromEntity(playerPed)))
                            {
                                int oldBlip = GetBlipFromEntity(playerPed);
                                SetBlipRoute(oldBlip, false);
                                RemoveBlip(ref oldBlip);
                                Notify.Custom($"~g~GPS route to ~s~<C>{GetSafePlayerName(currentPlayer.Name)}</C>~g~ is now disabled.");
                            }
                        }
                        PlayersWaypointList.Clear();
                    }

                    if (!selectedPedRouteAlreadyActive)
                    {
                        if (currentPlayer.Handle != Game.Player.Handle)
                        {
                            int ped  = GetPlayerPed(currentPlayer.Handle);
                            int blip = GetBlipFromEntity(ped);
                            if (DoesBlipExist(blip))
                            {
                                SetBlipColour(blip, 58);
                                SetBlipRouteColour(blip, 58);
                                SetBlipRoute(blip, true);
                            }
                            else
                            {
                                blip = AddBlipForEntity(ped);
                                SetBlipColour(blip, 58);
                                SetBlipRouteColour(blip, 58);
                                SetBlipRoute(blip, true);
                            }
                            PlayersWaypointList.Add(currentPlayer.Handle);
                            Notify.Custom($"~g~GPS route to ~s~<C>{GetSafePlayerName(currentPlayer.Name)}</C>~g~ is now active, press the ~s~Toggle GPS Route~g~ button again to disable the route.");
                        }
                        else
                        {
                            Notify.Error("You can not set a waypoint to yourself.");
                        }
                    }
                }
                else if (item == printIdentifiers)
                {
                    Func <string, string> CallbackFunction = (data) =>
                    {
                        Debug.WriteLine(data);
                        string ids = "~s~";
                        foreach (string s in JsonConvert.DeserializeObject <string[]>(data))
                        {
                            ids += "~n~" + s;
                        }
                        Notify.Custom($"~y~<C>{GetSafePlayerName(currentPlayer.Name)}</C>~g~'s Identifiers: {ids}", false);
                        return(data);
                    };
                    BaseScript.TriggerServerEvent("vMenu:GetPlayerIdentifiers", currentPlayer.ServerId, CallbackFunction);
                }
                // kick button
                else if (item == kick)
                {
                    if (currentPlayer.Handle != Game.Player.Handle)
                    {
                        KickPlayer(currentPlayer, true);
                    }
                    else
                    {
                        Notify.Error("You cannot kick yourself!");
                    }
                }
                // temp ban
                else if (item == tempban)
                {
                    BanPlayer(currentPlayer, false);
                }
                // perm ban
                else if (item == ban)
                {
                    if (ban.Label == "Are you sure?")
                    {
                        ban.Label = "";
                        UpdatePlayerlist();
                        playerMenu.GoBack();
                        BanPlayer(currentPlayer, true);
                    }
                    else
                    {
                        ban.Label = "Are you sure?";
                    }
                }
            };

            // handle button presses in the player list.
            menu.OnItemSelect += (sender, item, index) =>
            {
                if (MainMenu.PlayersList.ToList().Any(p => p.ServerId.ToString() == item.Label.Replace(" →→→", "").Replace("Server #", "")))
                {
                    currentPlayer             = MainMenu.PlayersList.ToList().Find(p => p.ServerId.ToString() == item.Label.Replace(" →→→", "").Replace("Server #", ""));
                    playerMenu.MenuSubtitle   = $"~s~Player: ~y~{GetSafePlayerName(currentPlayer.Name)}";
                    playerMenu.CounterPreText = $"[Server ID: ~y~{currentPlayer.ServerId}~s~] ";
                }
                else
                {
                    playerMenu.GoBack();
                }
            };
        }
Пример #32
0
        private void GenerateSubMenus()
        {
            #region Inhetirance menu
            Menu     InheritanceMenu     = new Menu("Inheritance", "Inheritance options");
            MenuItem InheritanceMenuItem = new MenuItem("Inheritance", "Change your characters inheritance");
            InheritanceMenu.ClearMenuItems();

            MenuListItem   Father   = new MenuListItem("Father", Faces, InitialFatherFace);
            MenuListItem   Mother   = new MenuListItem("Mother", Faces, InitialMotherFace);
            MenuSliderItem ShapeMix = new MenuSliderItem("Head Shape Mix", "Select how much of your head shape should be inherited from your father or mother.", 0, 10, 5, true)
            {
                SliderLeftIcon = MenuItem.Icon.MALE, SliderRightIcon = MenuItem.Icon.FEMALE
            };
            MenuSliderItem SkinMix = new MenuSliderItem("Body Skin Mix", "Select how much of your body skin tone should be inherited from your father or mother.", 0, 10, 5, true)
            {
                SliderLeftIcon = MenuItem.Icon.MALE, SliderRightIcon = MenuItem.Icon.FEMALE
            };

            InheritanceMenu.AddMenuItem(Father);
            InheritanceMenu.AddMenuItem(Mother);
            InheritanceMenu.AddMenuItem(ShapeMix);
            InheritanceMenu.AddMenuItem(SkinMix);

            CCMenu.AddMenuItem(InheritanceMenuItem);
            MenuController.BindMenuItem(CCMenu, InheritanceMenu, InheritanceMenuItem);

            InheritanceMenu.OnListIndexChange += (menu, listItem, oldIndex, newIndex, itemIndex) =>
            {
                SetPedHeadBlendData(GetPlayerPed(-1), Father.ListIndex, Mother.ListIndex, 0, Father.ListIndex, Mother.ListIndex, 0, mixValues[ShapeMix.Position], mixValues[SkinMix.Position], 0f, false);
            };
            InheritanceMenu.OnSliderPositionChange += (menu, listItem, oldIndex, newIndex, itemIndex) =>
            {
                SetPedHeadBlendData(GetPlayerPed(-1), Father.ListIndex, Mother.ListIndex, 0, Father.ListIndex, Mother.ListIndex, 0, mixValues[ShapeMix.Position], mixValues[SkinMix.Position], 0f, false);
            };
            InheritanceMenu.OnMenuOpen  += (menu) => SetFaceCam();
            InheritanceMenu.OnMenuClose += (menu) => SetBodyCam();
            #endregion

            #region Face Shape
            Menu     FaceShape     = new Menu("Face shape", "Face shape options");
            MenuItem FaceShapeItem = new MenuItem("Face shape", "Tweak the details of your characters face");
            FaceShape.ClearMenuItems();

            for (int i = 0; i < 20; i++)
            {
                MenuSliderItem faceFeature = new MenuSliderItem(faceFeaturesNamesList[i], $"Set the {faceFeaturesNamesList[i]} face feature value.", 0, 20, 10, true);
                FaceShape.AddMenuItem(faceFeature);
            }

            FaceShape.OnSliderPositionChange += async(sender, sliderItem, oldPosition, newPosition, itemIndex) =>
            {
                float value = faceFeaturesValuesList[newPosition];
                SetPedFaceFeature(Game.PlayerPed.Handle, itemIndex, value);
            };

            FaceShape.OnMenuOpen  += (menu) => SetFaceCam();
            FaceShape.OnMenuClose += (menu) => SetBodyCam();


            CCMenu.AddMenuItem(FaceShapeItem);
            MenuController.BindMenuItem(CCMenu, FaceShape, FaceShapeItem);

            #endregion

            #region Appearance
            Menu     AppearanceMenu     = new Menu("Appearance", "Appearance options");
            MenuItem AppearanceMenuItem = new MenuItem("Appearance", "Change your characters appearance");
            AppearanceMenu.ClearMenuItems();

            if (Gender == 0)
            {
                Hair = MaleHair;
            }
            else
            {
                Hair = FemaleHair;
            }

            #region MenuList
            MenuListItem HairStyle  = new MenuListItem("Hair", MaleHair, InitialHairStyle);
            MenuListItem HairColour = new MenuListItem("Hair Colour", OverlayColours, InitialHairColour)
            {
                ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair
            };
            MenuListItem HairHighlights = new MenuListItem("Hair Highlights", OverlayColours, InitialHairColour)
            {
                ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair
            };
            AppearanceMenu.AddMenuItem(HairStyle);
            AppearanceMenu.AddMenuItem(HairColour);
            AppearanceMenu.AddMenuItem(HairHighlights);

            MenuListItem BlemishStyle   = new MenuListItem("Blemish", Blemish, random.Next(0, GetNumHeadOverlayValues(0) - 1));
            MenuListItem BlemishOpacity = new MenuListItem("Blemish Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            AppearanceMenu.AddMenuItem(BlemishStyle);
            AppearanceMenu.AddMenuItem(BlemishOpacity);


            MenuListItem BeardStyle   = new MenuListItem("Beard", BeardList, 1);
            MenuListItem BeardOpacity = new MenuListItem("Beard Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            MenuListItem BeardColour = new MenuListItem("Beard Colour", OverlayColours, InitialHairColour)
            {
                ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair
            };
            if (Gender == 0)
            {
                AppearanceMenu.AddMenuItem(BeardStyle);
                AppearanceMenu.AddMenuItem(BeardOpacity);
                AppearanceMenu.AddMenuItem(BeardColour);
            }

            MenuListItem EyebrowsStyle   = new MenuListItem("Eyebrows", EyebrowsList, random.Next(0, EyebrowsList.Count()));
            MenuListItem EyebrowsOpacity = new MenuListItem("Eyebrow Opacity", Opacity, 8)
            {
                ShowOpacityPanel = true
            };
            MenuListItem EyebrowsColour = new MenuListItem("Eyebrow Colour", OverlayColours, 0)
            {
                ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair
            };
            AppearanceMenu.AddMenuItem(EyebrowsStyle);
            AppearanceMenu.AddMenuItem(EyebrowsOpacity);
            AppearanceMenu.AddMenuItem(EyebrowsColour);

            MenuListItem Ageing        = new MenuListItem("Ageing", AgeingList, 4);
            MenuListItem AgeingOpacity = new MenuListItem("Ageing Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            AppearanceMenu.AddMenuItem(Ageing);
            AppearanceMenu.AddMenuItem(AgeingOpacity);

            MenuListItem MakeupStyle   = new MenuListItem("Makeup", MakeupList, 4);
            MenuListItem MakeupOpacity = new MenuListItem("Makeup Opacity", Opacity, 8)
            {
                ShowOpacityPanel = true
            };
            MenuListItem MakeupColour = new MenuListItem("Makeup Colour", OverlayColours, 0)
            {
                ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair
            };
            AppearanceMenu.AddMenuItem(MakeupStyle);
            AppearanceMenu.AddMenuItem(MakeupOpacity);
            AppearanceMenu.AddMenuItem(MakeupColour);

            MenuListItem BlushStyle   = new MenuListItem("Blush", BlushList, 4);
            MenuListItem BlushOpacity = new MenuListItem("Blush Opacity", Opacity, 8)
            {
                ShowOpacityPanel = true
            };
            MenuListItem BlushColour = new MenuListItem("Blush Colour", OverlayColours, 0)
            {
                ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair
            };
            AppearanceMenu.AddMenuItem(BlushStyle);
            AppearanceMenu.AddMenuItem(BlushOpacity);
            AppearanceMenu.AddMenuItem(BlushColour);

            MenuListItem ComplexionStyle   = new MenuListItem("Complexion", ComplexionList, 4);
            MenuListItem ComplexionOpacity = new MenuListItem("Complexion Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            AppearanceMenu.AddMenuItem(ComplexionStyle);
            AppearanceMenu.AddMenuItem(ComplexionOpacity);

            MenuListItem SunDamageStyle   = new MenuListItem("Sun Damage", SundamageList, 4);
            MenuListItem SunDamageOpacity = new MenuListItem("Sun Damage Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            AppearanceMenu.AddMenuItem(SunDamageStyle);
            AppearanceMenu.AddMenuItem(SunDamageOpacity);

            MenuListItem LipstickStyle   = new MenuListItem("Lipstick", LipstickList, 4);
            MenuListItem LipstickOpacity = new MenuListItem("Lipstick Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            MenuListItem LipstickColour = new MenuListItem("Lipstick Colour", OverlayColours, 0)
            {
                ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair
            };
            AppearanceMenu.AddMenuItem(LipstickStyle);
            AppearanceMenu.AddMenuItem(LipstickOpacity);
            AppearanceMenu.AddMenuItem(LipstickColour);

            MenuListItem MolesFrecklesStyle   = new MenuListItem("Moles and Freckles", MolesFrecklesList, 4);
            MenuListItem MolesFrecklesOpacity = new MenuListItem("Moles and Freckles Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            AppearanceMenu.AddMenuItem(MolesFrecklesStyle);
            AppearanceMenu.AddMenuItem(MolesFrecklesOpacity);


            MenuListItem ChestHairStyle   = new MenuListItem("Chest Hair", ChestHairList, 1);
            MenuListItem ChestHairOpacity = new MenuListItem("Chest Hair Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            MenuListItem ChestHairColour = new MenuListItem("Chest Hair Colour", OverlayColours, 0)
            {
                ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair
            };
            if (Gender == 0)
            {
                AppearanceMenu.AddMenuItem(ChestHairStyle);
                AppearanceMenu.AddMenuItem(ChestHairOpacity);
                AppearanceMenu.AddMenuItem(ChestHairColour);
            }

            MenuListItem BodyBlemishStyle   = new MenuListItem("Body Blemish", BodyBlemishList, 4);
            MenuListItem BodyBlemishOpacity = new MenuListItem("Body Blemish Opacity", Opacity, 0)
            {
                ShowOpacityPanel = true
            };
            AppearanceMenu.AddMenuItem(BodyBlemishStyle);
            AppearanceMenu.AddMenuItem(BodyBlemishOpacity);

            MenuListItem EyeColour = new MenuListItem("Eye Colour", EyeColours, InitialEyeColour);
            AppearanceMenu.AddMenuItem(EyeColour);

            CCMenu.AddMenuItem(AppearanceMenuItem);
            MenuController.BindMenuItem(CCMenu, AppearanceMenu, AppearanceMenuItem);
            #endregion
            AppearanceMenu.OnListIndexChange += async(menu, listItem, oldIndex, newIndex, itemIndex) =>
            {
                switch (listItem.Text)
                {
                case "Hair":
                    SetFaceCam();
                    SetPedComponentVariation(Game.PlayerPed.Handle, 2, HairStyle.ListIndex, 0, 1);
                    break;

                case "Hair Colour":
                case "Hair Highlights":
                    SetFaceCam();
                    SetPedHairColor(Game.PlayerPed.Handle, HairColour.ListIndex, HairHighlights.ListIndex);
                    break;

                case "Blemish":
                case "Blemish Opacity":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 0, BlemishStyle.ListIndex, (float)BlemishOpacity.ListIndex / 10);
                    break;

                case "Beard":
                case "Beard Opacity":
                case "Beard Colour":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 1, BeardStyle.ListIndex, (float)BeardOpacity.ListIndex / 10);
                    SetPedHeadOverlayColor(Game.PlayerPed.Handle, 1, 1, BeardColour.ListIndex, BeardColour.ListIndex);
                    break;

                case "Eyebrows":
                case "Eyebrow Opacity":
                case "Eyebrow Colour":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 2, EyebrowsStyle.ListIndex, (float)EyebrowsOpacity.ListIndex / 10);
                    SetPedHeadOverlayColor(Game.PlayerPed.Handle, 2, 1, EyebrowsColour.ListIndex, EyebrowsColour.ListIndex);
                    break;

                case "Ageing":
                case "Ageing Opacity":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 3, Ageing.ListIndex, (float)AgeingOpacity.ListIndex / 10);
                    break;

                case "Makeup":
                case "Makeup Opacity":
                case "Makeup Colour":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 4, MakeupStyle.ListIndex, (float)MakeupOpacity.ListIndex / 10);
                    SetPedHeadOverlayColor(Game.PlayerPed.Handle, 4, 1, MakeupColour.ListIndex, MakeupColour.ListIndex);
                    break;

                case "Blush":
                case "Blush Opacity":
                case "Blush Colour":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 5, BlushStyle.ListIndex, (float)BlushOpacity.ListIndex / 10);
                    SetPedHeadOverlayColor(Game.PlayerPed.Handle, 5, 1, BlushColour.ListIndex, BlushColour.ListIndex);
                    break;

                case "Complexion":
                case "Complexion Opacity":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 6, ComplexionStyle.ListIndex, (float)ComplexionOpacity.ListIndex / 10);
                    break;

                case "Sun Damage":
                case "Sun Damage Opacity":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 7, SunDamageStyle.ListIndex, (float)SunDamageOpacity.ListIndex / 10);
                    break;

                case "Lipstick":
                case "Lipstick Opacity":
                case "Lipstick Colour":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 8, LipstickStyle.ListIndex, (float)LipstickOpacity.ListIndex / 10);
                    SetPedHeadOverlayColor(Game.PlayerPed.Handle, 8, 1, LipstickColour.ListIndex, LipstickColour.ListIndex);
                    break;

                case "Moles and Freckles":
                case "Moles and Freckles Opacity":
                    SetFaceCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 9, MolesFrecklesStyle.ListIndex, (float)MolesFrecklesOpacity.ListIndex / 10);
                    break;

                case "Chest Hair":
                case "Chest Hair Opacity":
                case "Chest Hair Colour":
                    SetBodyCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 10, ChestHairStyle.ListIndex, (float)ChestHairOpacity.ListIndex / 10);
                    SetPedHeadOverlayColor(Game.PlayerPed.Handle, 10, 1, ChestHairColour.ListIndex, ChestHairColour.ListIndex);
                    break;

                case "Body Blemish":
                case "Body Blemish Opacity":
                    SetBodyCam();
                    SetPedHeadOverlay(Game.PlayerPed.Handle, 11, BodyBlemishStyle.ListIndex, (float)BodyBlemishOpacity.ListIndex / 10);
                    break;

                case "Eye Colour":
                    SetFaceCam();
                    SetPedEyeColor(Game.PlayerPed.Handle, EyeColour.ListIndex);
                    break;
                }
            };
            AppearanceMenu.OnMenuClose += (menu) => SetBodyCam();
            #endregion

            return;
        }
Пример #33
0
    /// <summary>
    ///     ''' Draws the current state of the game to the screen.
    ///     ''' </summary>
    ///     ''' <remarks>
    ///     ''' What is drawn depends upon the state of the game.
    ///     ''' </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu: {
            MenuController.DrawMainMenu();
            break;
        }

        case GameState.ViewingGameMenu: {
            MenuController.DrawGameMenu();
            break;
        }

        case GameState.AlteringSettings: {
            MenuController.DrawSettings();
            break;
        }

        case GameState.Deploying: {
            DeploymentController.DrawDeployment();
            break;
        }


        case GameState.Discovering: {
            DiscoveryController.DrawDiscovery();
            break;
        }

        case GameState.EndingGame: {
            EndingGameController.DrawEndOfGame();
            break;
        }

        case GameState.ViewingHighScores: {
            HighScoreController.DrawHighScores();
            break;
        }

        case GameState.ViewingInstruction: {
            InstructionController.DrawInstruction();
            break;
        }

        case GameState.Reveal: {
            RevealController.DrawReveal();
            break;
        }

        case GameState.ViewingInstructionImg: {
            InstructionImgController.DrawInstructionImg();
            break;
        }
        }

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
Пример #34
0
 private void Start()
 {
     menuController = transform.parent.parent.parent.parent.parent.GetComponent <MenuController>();
 }
Пример #35
0
 private void Start()
 {
     menu = FindObjectOfType <MenuController>();
 }
Пример #36
0
        /// <summary>
        /// Creates the menu.
        /// </summary>
        private void CreateMenu()
        {
            // Menu
            menu = new Menu(GetSafePlayerName(Game.Player.Name), "Personal Vehicle Options");

            // menu items
            MenuItem setVehice = new MenuItem("Set Vehicle", "Sets your current vehicle as your personal vehicle. If you already have a personal vehicle set then this will override your selection.")
            {
                Label = "Current Vehicle: None"
            };
            MenuItem     toggleEngine = new MenuItem("Toggle Engine", "Toggles the engine on or off, even when you're not inside of the vehicle. This does not work if someone else is currently using your vehicle.");
            MenuListItem toggleLights = new MenuListItem("Set Vehicle Lights", new List <string>()
            {
                "Force On", "Force Off", "Reset"
            }, 0, "This will enable or disable your vehicle headlights, the engine of your vehicle needs to be running for this to work.");
            MenuItem kickAllPassengers = new MenuItem("Kick Passengers", "This will remove all passengers from your personal vehicle.");
            //MenuItem
            MenuItem lockDoors    = new MenuItem("Lock Vehicle Doors", "This will lock all your vehicle doors for all players. Anyone already inside will always be able to leave the vehicle, even if the doors are locked.");
            MenuItem unlockDoors  = new MenuItem("Unlock Vehicle Doors", "This will unlock all your vehicle doors for all players.");
            MenuItem doorsMenuBtn = new MenuItem("Vehicle Doors", "Open, close, remove and restore vehicle doors here.")
            {
                Label = "→→→"
            };
            MenuItem         soundHorn   = new MenuItem("Sound Horn", "Sounds the horn of the vehicle.");
            MenuItem         toggleAlarm = new MenuItem("Toggle Alarm Sound", "Toggles the vehicle alarm sound on or off. This does not set an alarm. It only toggles the current sounding status of the alarm.");
            MenuCheckboxItem enableBlip  = new MenuCheckboxItem("Add Blip For Personal Vehicle", "Enables or disables the blip that gets added when you mark a vehicle as your personal vehicle.", EnableVehicleBlip)
            {
                Style = MenuCheckboxItem.CheckboxStyle.Cross
            };
            MenuCheckboxItem exclusiveDriver = new MenuCheckboxItem("Exclusive Driver", "If enabled, then you will be the only one that can enter the drivers seat. Other players will not be able to drive the car. They can still be passengers.", false)
            {
                Style = MenuCheckboxItem.CheckboxStyle.Cross
            };

            //submenu
            VehicleDoorsMenu = new Menu("Vehicle Doors", "Vehicle Doors Management");
            MenuController.AddSubmenu(menu, VehicleDoorsMenu);
            MenuController.BindMenuItem(menu, VehicleDoorsMenu, doorsMenuBtn);

            // This is always allowed if this submenu is created/allowed.
            menu.AddMenuItem(setVehice);

            // Add conditional features.

            // Toggle engine.
            if (IsAllowed(Permission.PVToggleEngine))
            {
                menu.AddMenuItem(toggleEngine);
            }

            // Toggle lights
            if (IsAllowed(Permission.PVToggleLights))
            {
                menu.AddMenuItem(toggleLights);
            }

            // Kick vehicle passengers
            if (IsAllowed(Permission.PVKickPassengers))
            {
                menu.AddMenuItem(kickAllPassengers);
            }

            // Lock and unlock vehicle doors
            if (IsAllowed(Permission.PVLockDoors))
            {
                menu.AddMenuItem(lockDoors);
                menu.AddMenuItem(unlockDoors);
            }

            if (IsAllowed(Permission.PVDoors))
            {
                menu.AddMenuItem(doorsMenuBtn);
            }

            // Sound horn
            if (IsAllowed(Permission.PVSoundHorn))
            {
                menu.AddMenuItem(soundHorn);
            }

            // Toggle alarm sound
            if (IsAllowed(Permission.PVToggleAlarm))
            {
                menu.AddMenuItem(toggleAlarm);
            }

            // Enable blip for personal vehicle
            if (IsAllowed(Permission.PVAddBlip))
            {
                menu.AddMenuItem(enableBlip);
            }

            if (IsAllowed(Permission.PVExclusiveDriver))
            {
                menu.AddMenuItem(exclusiveDriver);
            }


            // Handle list presses
            menu.OnListItemSelect += (sender, item, itemIndex, index) =>
            {
                var veh = CurrentPersonalVehicle;
                if (veh != null && veh.Exists())
                {
                    if (!NetworkHasControlOfEntity(CurrentPersonalVehicle.Handle))
                    {
                        if (!NetworkRequestControlOfEntity(CurrentPersonalVehicle.Handle))
                        {
                            Notify.Error("You currently can't control this vehicle. Is someone else currently driving your car? Please try again after making sure other players are not controlling your vehicle.");
                            return;
                        }
                    }

                    if (item == toggleLights)
                    {
                        PressKeyFob(CurrentPersonalVehicle);
                        if (itemIndex == 0)
                        {
                            SetVehicleLights(CurrentPersonalVehicle.Handle, 3);
                        }
                        else if (itemIndex == 1)
                        {
                            SetVehicleLights(CurrentPersonalVehicle.Handle, 1);
                        }
                        else
                        {
                            SetVehicleLights(CurrentPersonalVehicle.Handle, 0);
                        }
                    }
                }
                else
                {
                    Notify.Error("You have not yet selected a personal vehicle, or your vehicle has been deleted. Set a personal vehicle before you can use these options.");
                }
            };

            // Handle checkbox changes
            menu.OnCheckboxChange += (sender, item, index, _checked) =>
            {
                if (item == enableBlip)
                {
                    EnableVehicleBlip = _checked;
                    if (EnableVehicleBlip)
                    {
                        if (CurrentPersonalVehicle != null && CurrentPersonalVehicle.Exists())
                        {
                            if (CurrentPersonalVehicle.AttachedBlip == null || !CurrentPersonalVehicle.AttachedBlip.Exists())
                            {
                                CurrentPersonalVehicle.AttachBlip();
                            }
                            CurrentPersonalVehicle.AttachedBlip.Sprite = BlipSprite.PersonalVehicleCar;
                            CurrentPersonalVehicle.AttachedBlip.Name   = "Personal Vehicle";
                        }
                        else
                        {
                            Notify.Error("You have not yet selected a personal vehicle, or your vehicle has been deleted. Set a personal vehicle before you can use these options.");
                        }
                    }
                    else
                    {
                        if (CurrentPersonalVehicle != null && CurrentPersonalVehicle.Exists() && CurrentPersonalVehicle.AttachedBlip != null && CurrentPersonalVehicle.AttachedBlip.Exists())
                        {
                            CurrentPersonalVehicle.AttachedBlip.Delete();
                        }
                    }
                }
                else if (item == exclusiveDriver)
                {
                    if (CurrentPersonalVehicle != null && CurrentPersonalVehicle.Exists())
                    {
                        if (NetworkRequestControlOfEntity(CurrentPersonalVehicle.Handle))
                        {
                            if (_checked)
                            {
                                SetVehicleExclusiveDriver(CurrentPersonalVehicle.Handle, Game.PlayerPed.Handle);
                                SetVehicleExclusiveDriver_2(CurrentPersonalVehicle.Handle, Game.PlayerPed.Handle, 1);
                            }
                            else
                            {
                                SetVehicleExclusiveDriver(CurrentPersonalVehicle.Handle, 0);
                                SetVehicleExclusiveDriver_2(CurrentPersonalVehicle.Handle, 0, 1);
                            }
                        }
                        else
                        {
                            item.Checked = !_checked;
                            Notify.Error("You currently can't control this vehicle. Is someone else currently driving your car? Please try again after making sure other players are not controlling your vehicle.");
                        }
                    }
                }
            };

            // Handle button presses.
            menu.OnItemSelect += (sender, item, index) =>
            {
                if (item == setVehice)
                {
                    if (Game.PlayerPed.IsInVehicle())
                    {
                        var veh = GetVehicle();
                        if (veh != null && veh.Exists())
                        {
                            if (Game.PlayerPed == veh.Driver)
                            {
                                CurrentPersonalVehicle      = veh;
                                veh.PreviouslyOwnedByPlayer = true;
                                veh.IsPersistent            = true;
                                if (EnableVehicleBlip && IsAllowed(Permission.PVAddBlip))
                                {
                                    if (veh.AttachedBlip == null || !veh.AttachedBlip.Exists())
                                    {
                                        veh.AttachBlip();
                                    }
                                    veh.AttachedBlip.Sprite = BlipSprite.PersonalVehicleCar;
                                    veh.AttachedBlip.Name   = "Personal Vehicle";
                                }
                                var name = GetLabelText(veh.DisplayName);
                                if (string.IsNullOrEmpty(name) || name.ToLower() == "null")
                                {
                                    name = veh.DisplayName;
                                }
                                item.Label = $"Current Vehicle: {name}";
                            }
                            else
                            {
                                Notify.Error(CommonErrors.NeedToBeTheDriver);
                            }
                        }
                        else
                        {
                            Notify.Error(CommonErrors.NoVehicle);
                        }
                    }
                    else
                    {
                        Notify.Error(CommonErrors.NoVehicle);
                    }
                }
                else if (CurrentPersonalVehicle != null && CurrentPersonalVehicle.Exists())
                {
                    if (item == kickAllPassengers)
                    {
                        if (CurrentPersonalVehicle.Occupants.Count() > 0 && CurrentPersonalVehicle.Occupants.Any(p => p != Game.PlayerPed))
                        {
                            var netId = VehToNet(CurrentPersonalVehicle.Handle);
                            TriggerServerEvent("vMenu:GetOutOfCar", netId, Game.Player.ServerId);
                        }
                        else
                        {
                            Notify.Info("There are no other players in your vehicle that need to be kicked out.");
                        }
                    }
                    else
                    {
                        if (!NetworkHasControlOfEntity(CurrentPersonalVehicle.Handle))
                        {
                            if (!NetworkRequestControlOfEntity(CurrentPersonalVehicle.Handle))
                            {
                                Notify.Error("You currently can't control this vehicle. Is someone else currently driving your car? Please try again after making sure other players are not controlling your vehicle.");
                                return;
                            }
                        }

                        if (item == toggleEngine)
                        {
                            PressKeyFob(CurrentPersonalVehicle);
                            SetVehicleEngineOn(CurrentPersonalVehicle.Handle, !CurrentPersonalVehicle.IsEngineRunning, true, true);
                        }

                        else if (item == lockDoors || item == unlockDoors)
                        {
                            PressKeyFob(CurrentPersonalVehicle);
                            bool _lock = item == lockDoors;
                            LockOrUnlockDoors(CurrentPersonalVehicle, _lock);
                        }

                        else if (item == soundHorn)
                        {
                            PressKeyFob(CurrentPersonalVehicle);
                            SoundHorn(CurrentPersonalVehicle);
                        }

                        else if (item == toggleAlarm)
                        {
                            PressKeyFob(CurrentPersonalVehicle);
                            ToggleVehicleAlarm(CurrentPersonalVehicle);
                        }
                    }
                }
                else
                {
                    Notify.Error("You have not yet selected a personal vehicle, or your vehicle has been deleted. Set a personal vehicle before you can use these options.");
                }
            };

            #region Doors submenu
            MenuItem openAll  = new MenuItem("Open All Doors", "Open all vehicle doors.");
            MenuItem closeAll = new MenuItem("Close All Doors", "Close all vehicle doors.");
            MenuItem LF       = new MenuItem("Left Front Door", "Open/close the left front door.");
            MenuItem RF       = new MenuItem("Right Front Door", "Open/close the right front door.");
            MenuItem LR       = new MenuItem("Left Rear Door", "Open/close the left rear door.");
            MenuItem RR       = new MenuItem("Right Rear Door", "Open/close the right rear door.");
            MenuItem HD       = new MenuItem("Hood", "Open/close the hood.");
            MenuItem TR       = new MenuItem("Trunk", "Open/close the trunk.");
            MenuItem E1       = new MenuItem("Extra 1", "Open/close the extra door (#1). Note this door is not present on most vehicles.");
            MenuItem E2       = new MenuItem("Extra 2", "Open/close the extra door (#2). Note this door is not present on most vehicles.");
            MenuItem BB       = new MenuItem("Bomb Bay", "Open/close the bomb bay. Only available on some planes.");
            var      doors    = new List <string>()
            {
                "Front Left", "Front Right", "Rear Left", "Rear Right", "Hood", "Trunk", "Extra 1", "Extra 2", "Bomb Bay"
            };
            MenuListItem     removeDoorList = new MenuListItem("Remove Door", doors, 0, "Remove a specific vehicle door completely.");
            MenuCheckboxItem deleteDoors    = new MenuCheckboxItem("Delete Removed Doors", "When enabled, doors that you remove using the list above will be deleted from the world. If disabled, then the doors will just fall on the ground.", false);

            VehicleDoorsMenu.AddMenuItem(LF);
            VehicleDoorsMenu.AddMenuItem(RF);
            VehicleDoorsMenu.AddMenuItem(LR);
            VehicleDoorsMenu.AddMenuItem(RR);
            VehicleDoorsMenu.AddMenuItem(HD);
            VehicleDoorsMenu.AddMenuItem(TR);
            VehicleDoorsMenu.AddMenuItem(E1);
            VehicleDoorsMenu.AddMenuItem(E2);
            VehicleDoorsMenu.AddMenuItem(BB);
            VehicleDoorsMenu.AddMenuItem(openAll);
            VehicleDoorsMenu.AddMenuItem(closeAll);
            VehicleDoorsMenu.AddMenuItem(removeDoorList);
            VehicleDoorsMenu.AddMenuItem(deleteDoors);

            VehicleDoorsMenu.OnListItemSelect += (sender, item, index, itemIndex) =>
            {
                Vehicle veh = CurrentPersonalVehicle;
                if (veh != null && veh.Exists())
                {
                    if (!NetworkHasControlOfEntity(CurrentPersonalVehicle.Handle))
                    {
                        if (!NetworkRequestControlOfEntity(CurrentPersonalVehicle.Handle))
                        {
                            Notify.Error("You currently can't control this vehicle. Is someone else currently driving your car? Please try again after making sure other players are not controlling your vehicle.");
                            return;
                        }
                    }

                    if (item == removeDoorList)
                    {
                        PressKeyFob(veh);
                        SetVehicleDoorBroken(veh.Handle, index, deleteDoors.Checked);
                    }
                }
            };

            VehicleDoorsMenu.OnItemSelect += (sender, item, index) =>
            {
                Vehicle veh = CurrentPersonalVehicle;
                if (veh != null && veh.Exists() && !veh.IsDead)
                {
                    if (!NetworkHasControlOfEntity(CurrentPersonalVehicle.Handle))
                    {
                        if (!NetworkRequestControlOfEntity(CurrentPersonalVehicle.Handle))
                        {
                            Notify.Error("You currently can't control this vehicle. Is someone else currently driving your car? Please try again after making sure other players are not controlling your vehicle.");
                            return;
                        }
                    }

                    if (index < 8)
                    {
                        bool open = GetVehicleDoorAngleRatio(veh.Handle, index) > 0.1f;
                        PressKeyFob(veh);
                        if (open)
                        {
                            SetVehicleDoorShut(veh.Handle, index, false);
                        }
                        else
                        {
                            SetVehicleDoorOpen(veh.Handle, index, false, false);
                        }
                    }
                    else if (item == openAll)
                    {
                        PressKeyFob(veh);
                        for (var door = 0; door < 8; door++)
                        {
                            SetVehicleDoorOpen(veh.Handle, door, false, false);
                        }
                    }
                    else if (item == closeAll)
                    {
                        PressKeyFob(veh);
                        for (var door = 0; door < 8; door++)
                        {
                            SetVehicleDoorShut(veh.Handle, door, false);
                        }
                    }
                    else if (item == BB && veh.HasBombBay)
                    {
                        PressKeyFob(veh);
                        bool bombBayOpen = AreBombBayDoorsOpen(veh.Handle);
                        if (bombBayOpen)
                        {
                            veh.CloseBombBay();
                        }
                        else
                        {
                            veh.OpenBombBay();
                        }
                    }
                    else
                    {
                        Notify.Error("You have not yet selected a personal vehicle, or your vehicle has been deleted. Set a personal vehicle before you can use these options.");
                    }
                }
            };
            #endregion
        }
Пример #37
0
 public void setController(MenuController menuController)
 {
     controller = menuController;
 }
Пример #38
0
        private void CreateMenu()
        {
            // Create the menu.
            menu = new Menu(Game.Player.Name, "Enhanced Camera");

            #region checkbox items

            // Enabling angular drift cam
            leadCam = new MenuCheckboxItem("Enable lead camera", "Make sure you have disabled X and Y camera lock in misc settings.", false);
            // Enabling chase cam
            chaseCam = new MenuCheckboxItem("Enable chase camera", "Locks to a target in front, switches to regular cam if target not in range. Make sure you have disabled X and Y camera lock in misc settings.", false);
            // Enabling chase cam
            droneCam = new MenuCheckboxItem("[WIP] Enable drone camera", "Free drone camera to spectate/fly around", false);

            #endregion

            #region adding menu items
            // Checkboxes
            menu.AddMenuItem(leadCam);
            menu.AddMenuItem(chaseCam);
            menu.AddMenuItem(droneCam);

            // Custom cam parameters menu
            CustomCamMenu = new CustomCam();
            Menu     customCamMenu = CustomCamMenu.GetMenu();
            MenuItem buttonCustom  = new MenuItem("Lead/chase cam parameters", "Tune parameters for lead and chase camera")
            {
                Label = "→→→"
            };
            menu.AddMenuItem(buttonCustom);
            MenuController.AddSubmenu(menu, customCamMenu);
            MenuController.BindMenuItem(menu, customCamMenu, buttonCustom);
            customCamMenu.RefreshIndex();

            // Drone cam parameters menu
            DroneCamMenu = new DroneCam();
            Menu     droneCamMenu = DroneCamMenu.GetMenu();
            MenuItem buttonDrone  = new MenuItem("Drone cam parameters", "Tune parameters for drone camera")
            {
                Label = "→→→"
            };
            menu.AddMenuItem(buttonDrone);
            MenuController.AddSubmenu(menu, droneCamMenu);
            MenuController.BindMenuItem(menu, droneCamMenu, buttonDrone);
            droneCamMenu.RefreshIndex();

            #endregion

            #region handling menu changes

            // Handle checkbox
            menu.OnCheckboxChange += (_menu, _item, _index, _checked) => {
                if (_item == leadCam)
                {
                    LeadCam = _checked;
                    MainMenu.EnhancedCamMenu.chaseCam.Checked = false;
                    MainMenu.EnhancedCamMenu.droneCam.Checked = false;
                    ChaseCam = false;
                    DroneCam = false;

                    if (!_checked)
                    {
                        ResetCameras();
                    }
                }
                if (_item == chaseCam)
                {
                    ChaseCam = _checked;
                    MainMenu.EnhancedCamMenu.leadCam.Checked  = false;
                    MainMenu.EnhancedCamMenu.droneCam.Checked = false;
                    LeadCam  = false;
                    DroneCam = false;

                    if (!_checked)
                    {
                        ResetCameras();
                    }
                    else
                    {
                        CustomCam.target = CustomCam.GetClosestVehicle(2000, CustomCam.maxAngle);
                    }
                }
                if (_item == droneCam)
                {
                    DroneCam = _checked;
                    MainMenu.EnhancedCamMenu.chaseCam.Checked = false;
                    MainMenu.EnhancedCamMenu.leadCam.Checked  = false;
                    ChaseCam = false;
                    LeadCam  = false;

                    if (!_checked)
                    {
                        ResetCameras();
                    }
                }
            };
            #endregion
        }
Пример #39
0
 public override void activate(MenuController menuController)
 {
     return;
 }
Пример #40
0
 public void ClosePopup()
 {
     MenuController.CloseCurrent();
 }
Пример #41
0
 public void QuitToMain()
 {
     HUD.Running = false;
     MenuController.OpenMenu(MainMenu.Instance);
 }
Пример #42
0
        /// <summary>
        /// Creates the menu.
        /// </summary>
        private void CreateMenu()
        {
            menu = new Menu(Game.Player.Name, "封鎖玩家管理");

            menu.InstructionalButtons.Add(Control.Jump, "篩選選項");
            menu.ButtonPressHandlers.Add(new Menu.ButtonPressHandler(Control.Jump, Menu.ControlPressCheckType.JUST_RELEASED, new Action <Menu, Control>(async(a, b) =>
            {
                if (banlist.Count > 1)
                {
                    string filterText = await GetUserInput("篩選列表(按用戶名排序)(將此保留為空以重置過濾器!)");
                    if (string.IsNullOrEmpty(filterText))
                    {
                        Subtitle.Custom("篩選列表已清除.");
                        menu.ResetFilter();
                        UpdateBans();
                    }
                    else
                    {
                        menu.FilterMenuItems(item => item.ItemData is BanRecord br && br.playerName.ToLower().Contains(filterText.ToLower()));
                        Subtitle.Custom("用戶名過濾已套用.");
                    }
                }
                else
                {
                    Notify.Error("要使用過濾功能,至少需要兩位以上的封鎖玩家");
                }

                Log($"Button pressed: {a} {b}");
            }), true));

            bannedPlayer.AddMenuItem(new MenuItem("玩家名字"));
            bannedPlayer.AddMenuItem(new MenuItem("封鎖人"));
            bannedPlayer.AddMenuItem(new MenuItem("解封時間"));
            bannedPlayer.AddMenuItem(new MenuItem("玩家識別碼"));
            bannedPlayer.AddMenuItem(new MenuItem("封鎖理由"));
            bannedPlayer.AddMenuItem(new MenuItem("~r~解封", "~r~警告,禁止玩家無法撤消。 在它們重新加入服務器之前,您將無法再次禁止它們。 您確定要取消該此玩家的封鎖嗎? 〜s〜提示:如果被禁的玩家在封鎖日期結束後他們仍可以進入伺服器."));

            // should be enough for now to cover all possible identifiers.
            List <string> colors = new List <string>()
            {
                "~r~", "~g~", "~b~", "~o~", "~y~", "~p~", "~s~", "~t~",
            };

            bannedPlayer.OnMenuClose += (sender) =>
            {
                BaseScript.TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle);
                bannedPlayer.GetMenuItems()[5].Label = "";
                UpdateBans();
            };

            bannedPlayer.OnIndexChange += (sender, oldItem, newItem, oldIndex, newIndex) =>
            {
                bannedPlayer.GetMenuItems()[5].Label = "";
            };

            bannedPlayer.OnItemSelect += (sender, item, index) =>
            {
                if (index == 5 && IsAllowed(Permission.OPUnban))
                {
                    if (item.Label == "您確定嗎?")
                    {
                        if (banlist.Contains(currentRecord))
                        {
                            UnbanPlayer(banlist.IndexOf(currentRecord));
                            bannedPlayer.GetMenuItems()[5].Label = "";
                            bannedPlayer.GoBack();
                        }
                        else
                        {
                            Notify.Error("您設法以某種方式單擊了取消禁止按鈕,但是您顯然正在查看的禁止記錄甚至不存在...");
                        }
                    }
                    else
                    {
                        item.Label = "您確定嗎?";
                    }
                }
                else
                {
                    bannedPlayer.GetMenuItems()[5].Label = "";
                }
            };

            menu.OnItemSelect += (sender, item, index) =>
            {
                //if (index < banlist.Count)
                //{
                currentRecord = item.ItemData;

                bannedPlayer.MenuSubtitle = "封鎖理由: ~y~" + currentRecord.playerName;
                var nameItem              = bannedPlayer.GetMenuItems()[0];
                var bannedByItem          = bannedPlayer.GetMenuItems()[1];
                var bannedUntilItem       = bannedPlayer.GetMenuItems()[2];
                var playerIdentifiersItem = bannedPlayer.GetMenuItems()[3];
                var banReasonItem         = bannedPlayer.GetMenuItems()[4];
                nameItem.Label           = currentRecord.playerName;
                nameItem.Description     = "玩家名字: ~y~" + currentRecord.playerName;
                bannedByItem.Label       = currentRecord.bannedBy;
                bannedByItem.Description = "被 ~y~" + currentRecord.bannedBy + "封鎖";
                if (currentRecord.bannedUntil.Date.Year == 3000)
                {
                    bannedUntilItem.Label = "永遠";
                }
                else
                {
                    bannedUntilItem.Label = currentRecord.bannedUntil.Date.ToString();
                }
                bannedUntilItem.Description       = "這個玩家將再: " + currentRecord.bannedUntil.Date.ToString() + "後解鎖";
                playerIdentifiersItem.Description = "";

                int i = 0;
                foreach (string id in currentRecord.identifiers)
                {
                    // only (admins) people that can unban players are allowed to view IP's.
                    // this is just a slight 'safety' feature in case someone who doesn't know what they're doing
                    // gave builtin.everyone access to view the banlist.
                    if (id.StartsWith("ip:") && !IsAllowed(Permission.OPUnban))
                    {
                        playerIdentifiersItem.Description += $"{colors[i]}ip: (hidden) ";
                    }
                    else
                    {
                        playerIdentifiersItem.Description += $"{colors[i]}{id.Replace(":", ": ")} ";
                    }
                    i++;
                }
                banReasonItem.Description = "封鎖理由: " + currentRecord.banReason;

                var unbanPlayerBtn = bannedPlayer.GetMenuItems()[5];
                unbanPlayerBtn.Label = "";
                if (!IsAllowed(Permission.OPUnban))
                {
                    unbanPlayerBtn.Enabled     = false;
                    unbanPlayerBtn.Description = "您不能取消玩家封鎖。 您只能查看其封鎖記錄.";
                    unbanPlayerBtn.LeftIcon    = MenuItem.Icon.LOCK;
                }

                bannedPlayer.RefreshIndex();
                //}
            };
            MenuController.AddMenu(bannedPlayer);
        }
Пример #43
0
 public abstract void Action(MenuController mc);
Пример #44
0
 /// <summary>
 /// Returns the currently opened menu, if no menu is open, it'll return null.
 /// </summary>
 /// <returns></returns>
 public static Menu GetOpenMenu()
 {
     return(MenuController.GetCurrentMenu());
 }
Пример #45
0
 void Start()
 {
     controller = MenuController.GetInstance();
 }
Пример #46
0
        private async void ManageMenu()
        {
            CCMenu = new Menu("Character Creation", "Create your character");

            MenuListItem GenderItem = new MenuListItem("Gender", new List <string> {
                "Male", "Female"
            }, 0);
            MenuItem SaveAndCreate = new MenuItem("Save and Create", "Saves your character, and spawns you in");

            CCMenu.AddMenuItem(GenderItem);

            GenerateParts();
            GenerateSubMenus();

            CCMenu.AddMenuItem(SaveAndCreate);

            CCMenu.OnMenuOpen        += async(menu) => MenuController.DisableBackButton = true;
            CCMenu.OnMenuClose       += async(menu) => MenuController.DisableBackButton = false;
            CCMenu.OnListIndexChange += async(menu, listItem, oldIndex, newIndex, itemIndex) =>
            {
                if (listItem == GenderItem)
                {
                    if (listItem.ListIndex == 0)
                    {
                        DoScreenFadeOut(250);
                        await Delay(250);

                        Gender = 0;

                        CreatePed(Game.Player, InitialFatherFace = random.Next(0, 46), InitialMotherFace = random.Next(0, 46), InitialHairStyle = random.Next(0, 38),
                                  InitialHairColour = random.Next(0, GetNumHairColors() - 4), InitialEyeColour = random.Next(0, 31), "mp_m_freemode_01");

                        CCMenu.ClearMenuItems();
                        CCMenu.AddMenuItem(GenderItem);
                        GenerateSubMenus();
                        CCMenu.AddMenuItem(SaveAndCreate);

                        await Delay(250);

                        CCMenu.RefreshIndex();
                        DoScreenFadeIn(500);
                    }
                    else if (listItem.ListIndex == 1)
                    {
                        DoScreenFadeOut(250);
                        await Delay(250);

                        Gender = 1;

                        CreatePed(Game.Player, InitialFatherFace = random.Next(0, 46), InitialMotherFace = random.Next(0, 46), InitialHairStyle = random.Next(0, 38),
                                  InitialHairColour = random.Next(0, GetNumHairColors() - 4), InitialEyeColour = random.Next(0, 31), "mp_f_freemode_01");

                        CCMenu.ClearMenuItems();
                        CCMenu.AddMenuItem(GenderItem);
                        GenerateSubMenus();
                        CCMenu.AddMenuItem(SaveAndCreate);

                        await Delay(250);

                        CCMenu.RefreshIndex();
                        DoScreenFadeIn(500);
                    }
                }
            };
            CCMenu.OnItemSelect += async(menu, listItem, index) =>
            {
                if (listItem == SaveAndCreate)
                {
                    Debug.WriteLine(Gender.ToString());
                    if (GenderItem.ListIndex == 0 && GetPedDrawableVariation(Game.PlayerPed.Handle, 2) == 23)
                    {
                        SetNotificationTextEntry("CELL_EMAIL_BCON"); // 10x ~a~
                        AddTextComponentSubstringPlayerName($"~r~You are unable to create a character with that hair style");
                        DrawNotification(false, false);
                    }
                    else if (GenderItem.ListIndex == 1 && GetPedDrawableVariation(Game.PlayerPed.Handle, 2) == 24)
                    {
                        SetNotificationTextEntry("CELL_EMAIL_BCON"); // 10x ~a~
                        AddTextComponentSubstringPlayerName($"~r~You are unable to create a character with that hair style");
                        DrawNotification(false, false);
                    }
                    else
                    {
                        SavePedAndCreate();
                    }
                }
            };
            await Delay(750);

            MenuController.AddMenu(CCMenu);

            DoScreenFadeIn(500);

            CCMenu.OpenMenu();
        }
Пример #47
0
 void Awake()
 {
     instance = this;
 }
Пример #48
0
    public void SetIAP(Product product)
    {
        iapItem.InitIap(product.definition.id);
        string tankId = "";

        foreach (PayoutDefinition payout in product.definition.payouts)
        {
            ShopMenu.ShopItem shopItem = ShopMenu.ShopItem.FromPayoutDefinition(payout);
            switch (shopItem.type)
            {
            case ShopMenu.ShopItemType.Coin:
                coins = shopItem.count;
                coinAmountText.text = shopItem.count.ToString();
                break;

            case ShopMenu.ShopItemType.Gem:
                gems = shopItem.count;
                gemAmountText.text = shopItem.count.ToString();
                break;

            case ShopMenu.ShopItemType.TankCard:
            {
                Tank tank = Variables.instance.GetTank(shopItem.id);
                tankName = tank.name;
                int result = 1;
                int.TryParse(tank.id.Replace("tank", ""), out result);
                int num = tankIndex = Variables.instance.tankOrder[result];
                tanks[--result].parent.SetActive(value: true);
                tanks[result].tankContainer.BulletTypeIndex = num;
                tanks[result].tankContainer.BulletDef       = Variables.instance.tanks[num].bullet;
                GarageMenu menu = MenuController.GetMenu <GarageMenu>();
                if (tank.bullet.type == BulletType.Missile || tank.bullet.type == BulletType.Laser)
                {
                    menu.StartCoroutine(menu.MissileShoot(tanks[result].tankContainer));
                }
                else if (tank.bullet.type == BulletType.Flame)
                {
                    menu.StartCoroutine(menu.FlamerShoot(tanks[result].tankContainer));
                }
                else if (tank.bullet.type == BulletType.Small)
                {
                    menu.StartCoroutine(menu.BulletShoot(tanks[result].tankContainer));
                }
                else if (tank.bullet.type == BulletType.Lightning)
                {
                    menu.StartCoroutine(menu.LightningShoot(tanks[result].tankContainer));
                }
                else
                {
                    tanks[result].tankContainer.Shoot();
                }
                tankNameText.text = ScriptLocalization.Get(tank.name);
                tankId            = tank.id;
                break;
            }
            }
        }
        iapItem.SetOnComplete(delegate
        {
            bought = true;
            MenuController.HideMenu <BundlePopup>();
            MenuController.ShowMenu <NewCardPopup>().Init(Variables.instance.GetTank(tankId));
        });
    }
 override public void Interact()
 {
     MenuController.PrevPageClicked();
 }
Пример #50
0
        public static async Task <string> PromptTextInput(string defaultText = "", int maxChars = 80, MenuController controller = null)
        {
            var startValue = controller?.DisableControls ?? false;

            if (controller != null)
            {
                controller.DisableControls = true;
            }

            var result = "";

            try {
                API.DisplayOnscreenKeyboard(0, "FMMC_MPM_NA", "", defaultText, "", "", "", maxChars);
                while (API.UpdateOnscreenKeyboard() == 0)
                {
                    Game.DisableAllControlsThisFrame(2);
                    await BaseScript.Delay(0);
                }
                result = API.GetOnscreenKeyboardResult();
            }
            catch (Exception ex) {
                Log.Error(ex);
            }

            if (controller != null)
            {
                await BaseScript.Delay(0);

                controller.DisableControls = startValue;
            }
            return(result);
        }
 void Start()
 {
     walking = Resources.Load<AudioClip>("_sounds/Walking");
     aS = GetComponent<AudioSource>();
     controller = GetComponent<MenuController>();
 }
Пример #52
0
        /// <summary>
        /// Creates the menu.
        /// </summary>
        private void CreateMenu()
        {
            #region create menu and menu items
            // Create the menu.
            menu = new Menu(Game.Player.Name, "Player Options");

            // Create all checkboxes.
            MenuCheckboxItem playerGodModeCheckbox    = new MenuCheckboxItem("Godmode", "Makes you invincible.", PlayerGodMode);
            MenuCheckboxItem invisibleCheckbox        = new MenuCheckboxItem("Invisible", "Makes you invisible to yourself and others.", PlayerInvisible);
            MenuCheckboxItem unlimitedStaminaCheckbox = new MenuCheckboxItem("Unlimited Stamina", "Allows you to run forever without slowing down or taking damage.", PlayerStamina);
            MenuCheckboxItem fastRunCheckbox          = new MenuCheckboxItem("Fast Run", "Get ~g~Snail~s~ powers and run very fast!", PlayerFastRun);
            SetRunSprintMultiplierForPlayer(Game.Player.Handle, (PlayerFastRun && IsAllowed(Permission.POFastRun) ? 1.49f : 1f));
            MenuCheckboxItem fastSwimCheckbox = new MenuCheckboxItem("Fast Swim", "Get ~g~Snail 2.0~s~ powers and swim super fast!", PlayerFastSwim);
            SetSwimMultiplierForPlayer(Game.Player.Handle, (PlayerFastSwim && IsAllowed(Permission.POFastSwim) ? 1.49f : 1f));
            MenuCheckboxItem superJumpCheckbox             = new MenuCheckboxItem("Super Jump", "Get ~g~Snail 3.0~s~ powers and jump like a champ!", PlayerSuperJump);
            MenuCheckboxItem noRagdollCheckbox             = new MenuCheckboxItem("No Ragdoll", "Disables player ragdoll, makes you not fall off your bike anymore.", PlayerNoRagdoll);
            MenuCheckboxItem neverWantedCheckbox           = new MenuCheckboxItem("Never Wanted", "Disables all wanted levels.", PlayerNeverWanted);
            MenuCheckboxItem everyoneIgnoresPlayerCheckbox = new MenuCheckboxItem("Everyone Ignore Player", "Everyone will leave you alone.", PlayerIsIgnored);
            MenuCheckboxItem playerStayInVehicleCheckbox   = new MenuCheckboxItem("Stay In Vehicle", "When this is enabled, NPCs will not be able to drag you out of your vehicle if they get angry at you.", PlayerStayInVehicle);
            MenuCheckboxItem playerFrozenCheckbox          = new MenuCheckboxItem("Freeze Player", "Freezes your current location.", PlayerFrozen);

            // Wanted level options
            List <string> wantedLevelList = new List <string> {
                "No Wanted Level", "1", "2", "3", "4", "5"
            };
            MenuListItem setWantedLevel = new MenuListItem("Set Wanted Level", wantedLevelList, GetPlayerWantedLevel(Game.Player.Handle), "Set your wanted level by selecting a value, and pressing enter.");
            MenuListItem setArmorItem   = new MenuListItem("Set Armor Type", new List <string> {
                "No Armor", GetLabelText("WT_BA_0"), GetLabelText("WT_BA_1"), GetLabelText("WT_BA_2"), GetLabelText("WT_BA_3"), GetLabelText("WT_BA_4"),
            }, 0, "Set the armor level/type for your player.");

            MenuItem healPlayerBtn    = new MenuItem("Heal Player", "Give the player max health.");
            MenuItem cleanPlayerBtn   = new MenuItem("Clean Player Clothes", "Clean your player clothes.");
            MenuItem dryPlayerBtn     = new MenuItem("Dry Player Clothes", "Make your player clothes dry.");
            MenuItem wetPlayerBtn     = new MenuItem("Wet Player Clothes", "Make your player clothes wet.");
            MenuItem suicidePlayerBtn = new MenuItem("~r~Commit Suicide", "Kill yourself by taking the pill. Or by using a pistol if you have one.");

            Menu vehicleAutoPilot = new Menu("Auto Pilot", "Vehicle auto pilot options.");

            MenuController.AddSubmenu(menu, vehicleAutoPilot);

            MenuItem vehicleAutoPilotBtn = new MenuItem("Vehicle Auto Pilot Menu", "Manage vehicle auto pilot options.")
            {
                Label = "→→→"
            };

            List <string> drivingStyles = new List <string>()
            {
                "Normal", "Rushed", "Avoid highways", "Drive in reverse", "Custom"
            };
            MenuListItem drivingStyle = new MenuListItem("Driving Style", drivingStyles, 0, "Set the driving style that is used for the Drive to Waypoint and Drive Around Randomly functions.");

            // Scenarios (list can be found in the PedScenarios class)
            MenuListItem playerScenarios = new MenuListItem("Player Scenarios", PedScenarios.Scenarios, 0, "Select a scenario and hit enter to start it. Selecting another scenario will override the current scenario. If you're already playing the selected scenario, selecting it again will stop the scenario.");
            MenuItem     stopScenario    = new MenuItem("Force Stop Scenario", "This will force a playing scenario to stop immediately, without waiting for it to finish it's 'stopping' animation.");
            #endregion

            #region add items to menu based on permissions
            // Add all checkboxes to the menu. (keeping permissions in mind)
            if (IsAllowed(Permission.POGod))
            {
                menu.AddMenuItem(playerGodModeCheckbox);
            }
            if (IsAllowed(Permission.POInvisible))
            {
                menu.AddMenuItem(invisibleCheckbox);
            }
            if (IsAllowed(Permission.POUnlimitedStamina))
            {
                menu.AddMenuItem(unlimitedStaminaCheckbox);
            }
            if (IsAllowed(Permission.POFastRun))
            {
                menu.AddMenuItem(fastRunCheckbox);
            }
            if (IsAllowed(Permission.POFastSwim))
            {
                menu.AddMenuItem(fastSwimCheckbox);
            }
            if (IsAllowed(Permission.POSuperjump))
            {
                menu.AddMenuItem(superJumpCheckbox);
            }
            if (IsAllowed(Permission.PONoRagdoll))
            {
                menu.AddMenuItem(noRagdollCheckbox);
            }
            if (IsAllowed(Permission.PONeverWanted))
            {
                menu.AddMenuItem(neverWantedCheckbox);
            }
            if (IsAllowed(Permission.POSetWanted))
            {
                menu.AddMenuItem(setWantedLevel);
            }
            if (IsAllowed(Permission.POIgnored))
            {
                menu.AddMenuItem(everyoneIgnoresPlayerCheckbox);
            }
            if (IsAllowed(Permission.POStayInVehicle))
            {
                menu.AddMenuItem(playerStayInVehicleCheckbox);
            }
            if (IsAllowed(Permission.POMaxHealth))
            {
                menu.AddMenuItem(healPlayerBtn);
            }
            if (IsAllowed(Permission.POMaxArmor))
            {
                menu.AddMenuItem(setArmorItem);
            }
            if (IsAllowed(Permission.POCleanPlayer))
            {
                menu.AddMenuItem(cleanPlayerBtn);
            }
            if (IsAllowed(Permission.PODryPlayer))
            {
                menu.AddMenuItem(dryPlayerBtn);
            }
            if (IsAllowed(Permission.POWetPlayer))
            {
                menu.AddMenuItem(wetPlayerBtn);
            }

            menu.AddMenuItem(suicidePlayerBtn);

            if (IsAllowed(Permission.POVehicleAutoPilotMenu))
            {
                menu.AddMenuItem(vehicleAutoPilotBtn);
                MenuController.BindMenuItem(menu, vehicleAutoPilot, vehicleAutoPilotBtn);

                vehicleAutoPilot.AddMenuItem(drivingStyle);

                MenuItem startDrivingWaypoint = new MenuItem("Drive To Waypoint", "Make your player ped drive your vehicle to your waypoint.");
                MenuItem startDrivingRandomly = new MenuItem("Drive Around Randomly", "Make your player ped drive your vehicle randomly around the map.");
                MenuItem stopDriving          = new MenuItem("Stop Driving", "The player ped will find a suitable place to stop the vehicle. The task will be stopped once the vehicle has reached the suitable stop location.");
                MenuItem forceStopDriving     = new MenuItem("Force Stop Driving", "This will stop the driving task immediately without finding a suitable place to stop.");
                MenuItem customDrivingStyle   = new MenuItem("Custom Driving Style", "Select a custom driving style. Make sure to also enable it by selecting the 'Custom' driving style in the driving styles list.")
                {
                    Label = "→→→"
                };
                MenuController.AddSubmenu(vehicleAutoPilot, CustomDrivingStyleMenu);
                vehicleAutoPilot.AddMenuItem(customDrivingStyle);
                MenuController.BindMenuItem(vehicleAutoPilot, CustomDrivingStyleMenu, customDrivingStyle);
                Dictionary <int, string> knownNames = new Dictionary <int, string>()
                {
                    { 0, "Stop before vehicles" },
                    { 1, "Stop before peds" },
                    { 2, "Avoid vehicles" },
                    { 3, "Avoid empty vehicles" },
                    { 4, "Avoid peds" },
                    { 5, "Avoid objects" },

                    { 7, "Stop at traffic lights" },
                    { 8, "Use blinkers" },
                    { 9, "Allow going wrong way" },
                    { 10, "Go in reverse gear" },

                    { 18, "Use shortest path" },

                    { 22, "Ignore roads" },

                    { 24, "Ignore all pathing" },

                    { 29, "Avoid highways (if possible)" },
                };
                for (var i = 0; i < 31; i++)
                {
                    string name = "~r~Unknown Flag";
                    if (knownNames.ContainsKey(i))
                    {
                        name = knownNames[i];
                    }
                    MenuCheckboxItem checkbox = new MenuCheckboxItem(name, "Toggle this driving style flag.", false);
                    CustomDrivingStyleMenu.AddMenuItem(checkbox);
                }
                CustomDrivingStyleMenu.OnCheckboxChange += (sender, item, index, _checked) =>
                {
                    int style = GetStyleFromIndex(drivingStyle.ListIndex);
                    CustomDrivingStyleMenu.MenuSubtitle = $"custom style: {style}";
                    if (drivingStyle.ListIndex == 4)
                    {
                        Notify.Custom("Driving style updated.");
                        SetDriveTaskDrivingStyle(Game.PlayerPed.Handle, style);
                    }
                    else
                    {
                        Notify.Custom("Driving style NOT updated because you haven't enabled the Custom driving style in the previous menu.");
                    }
                };

                vehicleAutoPilot.AddMenuItem(startDrivingWaypoint);
                vehicleAutoPilot.AddMenuItem(startDrivingRandomly);
                vehicleAutoPilot.AddMenuItem(stopDriving);
                vehicleAutoPilot.AddMenuItem(forceStopDriving);

                vehicleAutoPilot.RefreshIndex();

                vehicleAutoPilot.OnItemSelect += async(sender, item, index) =>
                {
                    if (Game.PlayerPed.IsInVehicle() && item != stopDriving && item != forceStopDriving)
                    {
                        if (Game.PlayerPed.CurrentVehicle != null && Game.PlayerPed.CurrentVehicle.Exists() && !Game.PlayerPed.CurrentVehicle.IsDead && Game.PlayerPed.CurrentVehicle.IsDriveable)
                        {
                            if (Game.PlayerPed.CurrentVehicle.Driver == Game.PlayerPed)
                            {
                                if (item == startDrivingWaypoint)
                                {
                                    if (IsWaypointActive())
                                    {
                                        int style = GetStyleFromIndex(drivingStyle.ListIndex);
                                        DriveToWp(style);
                                        Notify.Info("Your player ped is now driving the vehicle for you. You can cancel any time by pressing the Stop Driving button. The vehicle will stop when it has reached the destination.");
                                    }
                                    else
                                    {
                                        Notify.Error("You need a waypoint before you can drive to it!");
                                    }
                                }
                                else if (item == startDrivingRandomly)
                                {
                                    int style = GetStyleFromIndex(drivingStyle.ListIndex);
                                    DriveWander(style);
                                    Notify.Info("Your player ped is now driving the vehicle for you. You can cancel any time by pressing the Stop Driving button.");
                                }
                            }
                            else
                            {
                                Notify.Error("You must be the driver of this vehicle!");
                            }
                        }
                        else
                        {
                            Notify.Error("Your vehicle is broken or it does not exist!");
                        }
                    }
                    else if (item != stopDriving && item != forceStopDriving)
                    {
                        Notify.Error("You need to be in a vehicle first!");
                    }
                    if (item == stopDriving)
                    {
                        if (Game.PlayerPed.IsInVehicle())
                        {
                            Vehicle veh = GetVehicle();
                            if (veh != null && veh.Exists() && !veh.IsDead)
                            {
                                Vector3 outPos = new Vector3();
                                if (GetNthClosestVehicleNode(Game.PlayerPed.Position.X, Game.PlayerPed.Position.Y, Game.PlayerPed.Position.Z, 3, ref outPos, 0, 0, 0))
                                {
                                    Notify.Info("The player ped will find a suitable place to park the car and will then stop driving. Please wait.");
                                    ClearPedTasks(Game.PlayerPed.Handle);
                                    TaskVehiclePark(Game.PlayerPed.Handle, veh.Handle, outPos.X, outPos.Y, outPos.Z, Game.PlayerPed.Heading, 3, 60f, true);
                                    while (Game.PlayerPed.Position.DistanceToSquared2D(outPos) > 3f)
                                    {
                                        await BaseScript.Delay(0);
                                    }
                                    SetVehicleHalt(veh.Handle, 3f, 0, false);
                                    ClearPedTasks(Game.PlayerPed.Handle);
                                    Notify.Info("The player ped has stopped driving.");
                                }
                            }
                        }
                        else
                        {
                            ClearPedTasks(Game.PlayerPed.Handle);
                            Notify.Alert("Your ped is not in any vehicle.");
                        }
                    }
                    else if (item == forceStopDriving)
                    {
                        ClearPedTasks(Game.PlayerPed.Handle);
                        Notify.Info("Driving task cancelled.");
                    }
                };

                vehicleAutoPilot.OnListItemSelect += (sender, item, listIndex, itemIndex) =>
                {
                    if (item == drivingStyle)
                    {
                        int style = GetStyleFromIndex(listIndex);
                        SetDriveTaskDrivingStyle(Game.PlayerPed.Handle, style);
                        Notify.Info($"Driving task style is now set to: ~r~{drivingStyles[listIndex]}~s~.");
                    }
                };
            }

            if (IsAllowed(Permission.POFreeze))
            {
                menu.AddMenuItem(playerFrozenCheckbox);
            }
            if (IsAllowed(Permission.POScenarios))
            {
                menu.AddMenuItem(playerScenarios);
                menu.AddMenuItem(stopScenario);
            }
            #endregion

            #region handle all events
            // Checkbox changes.
            menu.OnCheckboxChange += (sender, item, itemIndex, _checked) =>
            {
                // God Mode toggled.
                if (item == playerGodModeCheckbox)
                {
                    PlayerGodMode = _checked;
                }
                // Invisibility toggled.
                else if (item == invisibleCheckbox)
                {
                    PlayerInvisible = _checked;
                    SetEntityVisible(Game.PlayerPed.Handle, !PlayerInvisible, false);
                }
                // Unlimited Stamina toggled.
                else if (item == unlimitedStaminaCheckbox)
                {
                    PlayerStamina = _checked;
                    StatSetInt((uint)GetHashKey("MP0_STAMINA"), _checked ? 100 : 0, true);
                }
                // Fast run toggled.
                else if (item == fastRunCheckbox)
                {
                    PlayerFastRun = _checked;
                    SetRunSprintMultiplierForPlayer(Game.Player.Handle, (_checked ? 1.49f : 1f));
                }
                // Fast swim toggled.
                else if (item == fastSwimCheckbox)
                {
                    PlayerFastSwim = _checked;
                    SetSwimMultiplierForPlayer(Game.Player.Handle, (_checked ? 1.49f : 1f));
                }
                // Super jump toggled.
                else if (item == superJumpCheckbox)
                {
                    PlayerSuperJump = _checked;
                }
                // No ragdoll toggled.
                else if (item == noRagdollCheckbox)
                {
                    PlayerNoRagdoll = _checked;
                }
                // Never wanted toggled.
                else if (item == neverWantedCheckbox)
                {
                    PlayerNeverWanted = _checked;
                    if (!_checked)
                    {
                        SetMaxWantedLevel(5);
                    }
                    else
                    {
                        SetMaxWantedLevel(0);
                    }
                }
                // Everyone ignores player toggled.
                else if (item == everyoneIgnoresPlayerCheckbox)
                {
                    PlayerIsIgnored = _checked;

                    // Manage player is ignored by everyone.
                    SetEveryoneIgnorePlayer(Game.Player.Handle, PlayerIsIgnored);
                    SetPoliceIgnorePlayer(Game.Player.Handle, PlayerIsIgnored);
                    SetPlayerCanBeHassledByGangs(Game.Player.Handle, !PlayerIsIgnored);
                }
                else if (item == playerStayInVehicleCheckbox)
                {
                    PlayerStayInVehicle = _checked;
                }
                // Freeze player toggled.
                else if (item == playerFrozenCheckbox)
                {
                    PlayerFrozen = _checked;

                    if (MainMenu.NoClipMenu != null && !MainMenu.NoClipEnabled)
                    {
                        FreezeEntityPosition(Game.PlayerPed.Handle, PlayerFrozen);
                    }
                    else if (!MainMenu.NoClipEnabled)
                    {
                        FreezeEntityPosition(Game.PlayerPed.Handle, PlayerFrozen);
                    }
                }
            };

            // List selections
            menu.OnListItemSelect += (sender, listItem, listIndex, itemIndex) =>
            {
                // Set wanted Level
                if (listItem == setWantedLevel)
                {
                    SetPlayerWantedLevel(Game.Player.Handle, listIndex, false);
                    SetPlayerWantedLevelNow(Game.Player.Handle, false);
                }
                // Player Scenarios
                else if (listItem == playerScenarios)
                {
                    PlayScenario(PedScenarios.ScenarioNames[PedScenarios.Scenarios[listIndex]]);
                }
                else if (listItem == setArmorItem)
                {
                    Game.PlayerPed.Armor = (listItem.ListIndex) * 20;
                }
            };

            // button presses
            menu.OnItemSelect += (sender, item, index) =>
            {
                // Force Stop Scenario button
                if (item == stopScenario)
                {
                    // Play a new scenario named "forcestop" (this scenario doesn't exist, but the "Play" function checks
                    // for the string "forcestop", if that's provided as th scenario name then it will forcefully clear the player task.
                    PlayScenario("forcestop");
                }
                else if (item == healPlayerBtn)
                {
                    Game.PlayerPed.Health = Game.PlayerPed.MaxHealth;
                    Notify.Success("Player healed.");
                }
                else if (item == cleanPlayerBtn)
                {
                    Game.PlayerPed.ClearBloodDamage();
                    Notify.Success("Player clothes have been cleaned.");
                }
                else if (item == dryPlayerBtn)
                {
                    Game.PlayerPed.WetnessHeight = 0f;
                    Notify.Success("Player is now dry.");
                }
                else if (item == wetPlayerBtn)
                {
                    Game.PlayerPed.WetnessHeight = 2f;
                    Notify.Success("Player is now wet.");
                }
                else if (item == suicidePlayerBtn)
                {
                    CommitSuicide();
                }
            };
            #endregion
        }
Пример #53
0
        public MegaClass(
            UserLicensesController a2,
            TimeEntrySuggestedRowsController a3,
            WorkHourSuggestedRowsController a4,
            KpiFormulasController a5,
            UserSettingsController a6,
            SecurityController a7,
            SoapApiKeysController a8,
            NotificationSettingsController a9,
            FlextimeAdjustmentsController a10,
            AuthorizedIpAddressesController a11,
            BankAccountsController a12,
            ApiClientsController a13,
            OrganizationSettingsController a14,
            LogosController a15,
            ProjectMemberCostExceptionsController a16,
            OrganizationDetailsController a17,
            AddonsController a18,
            TravelExpenseCountrySettingsController a19,
            ProductCountrySettingsController a20,
            CustomerCountrySettingsController a21,
            KpiComparisonController a22,
            TravelExpenseReceiptsController a23,
            TravelReimbursementStatusController a24,
            TravelReimbursementsController a25,
            ResourcingOverviewController a26,
            TermsOfServiceApprovalsController a27,
            FinancialsController a28,
            CalendarGroupMembersController a29,
            ActivityParticipantsController a30,
            ActivitiesController a31,
            PermissionProfilesController a32,
            CalendarGroupsController a33,
            ResourcesController a34,
            DemoDataController a35,
            LinksController a36,
            ReimbursedWorkHoursController a37,
            ReimbursedProjectTravelExpensesController a38,
            ReimbursedProjectFeesController a39,
            ProjectsOverviewController a40,
            ContactRolesController a41,
            CustomerMarketSegmentsController a42,
            ProjectTotalFeesController a43,
            BillingInformationUpdateController a44,
            KeywordsController a45,
            FlatRatesController a46,
            BusinessOverviewController a47,
            SpecialUserOptionsController a48,
            UninvoicedProjectsController a49,
            TeamProductivityController a50,
            ProjectBillingCustomersController a51,
            MarketSegmentsController a52,
            ProjectProductsController a53,
            ScheduleOverviewController a54,
            SharedDashboardAccessRightProfilesController a55,
            SharedDashboardsController a56,
            InvoicesOverviewController a57,
            ProposalBillingPlanController a58,
            SalesOverviewController a59,
            CustomersOverviewController a60,
            ProposalProjectPlanController a61,
            TimeEntryTypesController a62,
            CommunicationTypesController a63,
            ContactCommunicationsController a64,
            FlextimeController a65,
            ProjectForecastsController a66,
            ResourceAllocationsController a67,
            TemporaryProjectFeesController a68,
            InvoiceTemplateSettingsController a69,
            TemporaryProjectTravelExpensesController a70,
            TemporaryWorkHoursController a71,
            InvoiceTemplatesController a72,
            WorkdaysController a73,
            InvoiceSettingsController a74,
            OrganizationsController a75,
            ProjectTaskStatusesController a76,
            ActivityTypesController a77,
            AddressesController a78,
            DashboardPartsController a79,
            DashboardWithPartsController a80,
            DashboardsController a81,
            InvoiceRowsController a82,
            InvoicesController a83,
            HolidaysController a84,
            PermissionsController a85,
            QuickSearchController a86,
            ProposalTemplatesController a87,
            InvoiceTotalsController a88,
            ProposalTotalsController a89,
            ProposalWorkhoursController a90,
            ProposalSubtotalsController a91,
            ProposalFeesController a92,
            ReportsController a93,
            ProposalStatusesController a94,
            InvoiceStatusesController a95,
            ProposalsController a96,
            StatusHistoryController a97,
            PhaseStatusTypesController a98,
            CostCentersController a99,
            ProjectWorktypesController a100,
            PricelistVersionsController a101,
            OvertimePricesController a102,
            AllUsersController a103,
            TimeEntriesController a104,
            WorkTypesController a105,
            WorkHoursController a106,
            ProjectWorkHourPricesController a107,
            TravelPricesController a108,
            WorkHourPricesController a109,
            ProductPricesController a110,
            ProjectRecurringFeeRulesController a111,
            ProjectTravelExpensesController a112,
            TravelExpensesController a113,
            ProjectFeesController a114,
            SalesReceivableAccountsController a115,
            ValueAddedTaxesController a116,
            ProductsController a117,
            BusinessUnitsController a118,
            CollaborationNotesController a119,
            ContactsController a120,
            CurrencyBasesController a121,
            CurrenciesController a122,
            CountriesController a123,
            CustomersController a124,
            FileDataController a125,
            FilesController a126,
            FormattingCulturesController a127,
            IndustriesController a128,
            LanguagesController a129,
            LeadSourcesController a130,
            MenuController a131,
            PersonalSettingsController a132,
            PhaseMembersController a133,
            PhasesController a134,
            PricelistsController a135,
            OvertimesController a136,
            ProjectsController a137,
            ProjectStatusTypesController a138,
            SalesAccountsController a139,
            SalesNotesController a140,
            ProductCategoriesController a141,
            WorkContractsController a142,
            SalesStatusController a143,
            SalesStatusTypeController a144,
            TimeZonesController a145,
            UsersController a146,
            ScheduledWorkJobsController a147,
            PasswordChangeController a148,
            UserInactivationInformationController a149,
            EmailAddressChangeController a150,
            EmailController a151,
            PdfController a152,
            BearerAuthenticationController a153,
            ExternalAuthenticationController a154,
            HeartBeatController a155

            )
        {
            _a2   = a2;
            _a3   = a3;
            _a4   = a4;
            _a5   = a5;
            _a6   = a6;
            _a7   = a7;
            _a8   = a8;
            _a9   = a9;
            _a10  = a10;
            _a11  = a11;
            _a12  = a12;
            _a13  = a13;
            _a14  = a14;
            _a15  = a15;
            _a16  = a16;
            _a17  = a17;
            _a18  = a18;
            _a19  = a19;
            _a20  = a20;
            _a21  = a21;
            _a22  = a22;
            _a23  = a23;
            _a24  = a24;
            _a25  = a25;
            _a26  = a26;
            _a27  = a27;
            _a28  = a28;
            _a29  = a29;
            _a30  = a30;
            _a31  = a31;
            _a32  = a32;
            _a33  = a33;
            _a34  = a34;
            _a35  = a35;
            _a36  = a36;
            _a37  = a37;
            _a38  = a38;
            _a39  = a39;
            _a40  = a40;
            _a41  = a41;
            _a42  = a42;
            _a43  = a43;
            _a44  = a44;
            _a45  = a45;
            _a46  = a46;
            _a47  = a47;
            _a48  = a48;
            _a49  = a49;
            _a50  = a50;
            _a51  = a51;
            _a52  = a52;
            _a53  = a53;
            _a54  = a54;
            _a55  = a55;
            _a56  = a56;
            _a57  = a57;
            _a58  = a58;
            _a59  = a59;
            _a60  = a60;
            _a61  = a61;
            _a62  = a62;
            _a63  = a63;
            _a64  = a64;
            _a65  = a65;
            _a66  = a66;
            _a67  = a67;
            _a68  = a68;
            _a69  = a69;
            _a70  = a70;
            _a71  = a71;
            _a72  = a72;
            _a73  = a73;
            _a74  = a74;
            _a75  = a75;
            _a76  = a76;
            _a77  = a77;
            _a78  = a78;
            _a79  = a79;
            _a80  = a80;
            _a81  = a81;
            _a82  = a82;
            _a83  = a83;
            _a84  = a84;
            _a85  = a85;
            _a86  = a86;
            _a87  = a87;
            _a88  = a88;
            _a89  = a89;
            _a90  = a90;
            _a91  = a91;
            _a92  = a92;
            _a93  = a93;
            _a94  = a94;
            _a95  = a95;
            _a96  = a96;
            _a97  = a97;
            _a98  = a98;
            _a99  = a99;
            _a100 = a100;
            _a101 = a101;
            _a102 = a102;
            _a103 = a103;
            _a104 = a104;
            _a105 = a105;
            _a106 = a106;
            _a107 = a107;
            _a108 = a108;
            _a109 = a109;
            _a110 = a110;
            _a111 = a111;
            _a112 = a112;
            _a113 = a113;
            _a114 = a114;
            _a115 = a115;
            _a116 = a116;
            _a117 = a117;
            _a118 = a118;
            _a119 = a119;
            _a120 = a120;
            _a121 = a121;
            _a122 = a122;
            _a123 = a123;
            _a124 = a124;
            _a125 = a125;
            _a126 = a126;
            _a127 = a127;
            _a128 = a128;
            _a129 = a129;
            _a130 = a130;
            _a131 = a131;
            _a132 = a132;
            _a133 = a133;
            _a134 = a134;
            _a135 = a135;
            _a136 = a136;
            _a137 = a137;
            _a138 = a138;
            _a139 = a139;
            _a140 = a140;
            _a141 = a141;
            _a142 = a142;
            _a143 = a143;
            _a144 = a144;
            _a145 = a145;
            _a146 = a146;
            _a147 = a147;
            _a148 = a148;
            _a149 = a149;
            _a150 = a150;
            _a151 = a151;
            _a152 = a152;
            _a153 = a153;
            _a154 = a154;
            _a155 = a155;
        }
Пример #54
0
 private void OnEnable()
 {
     UnityEngine.Object.Destroy(MenuController.GetMenu <GarageMenu>().EasterEgg);
 }
Пример #55
0
 public MenuUI(MenuController menuController)
     : base(menuController)
 {
 }
Пример #56
0
        private static void SetupMenu()
        {
            if (setupDone)
            {
                return;
            }
            setupDone = true;
            MenuController.AddMenu(mainMenu);

            MenuController.EnableMenuToggleKeyOnController = false;
            MenuController.MenuToggleKey = (Control)0;

            List <string> beardValues = new List <string>();

            if (IsPedMale(PlayerPedId()))
            {
                beardValues.Add(GetConfig.Langs["NoBeard"]);

                for (int b = 1; b < SkinUtils.BEARD_MALE.Count + 1; b++)
                {
                    beardValues.Add(GetConfig.Langs["Beard"] + b.ToString());
                }
            }
            else
            {
                beardValues.Add(GetConfig.Langs["NoExist"]);
            }

            BeardsBtn = new MenuListItem(GetConfig.Langs["BeardList"], beardValues, 0, GetConfig.Langs["BeardDesc"])
            {
            };

            mainMenu.AddMenuItem(BeardsBtn);

            List <string> hairValues = new List <string>();

            if (IsPedMale(PlayerPedId()))
            {
                hairValues.Add(GetConfig.Langs["NoHair"]);

                for (int b = 1; b < SkinUtils.HAIR_MALE.Count + 1; b++)
                {
                    hairValues.Add(GetConfig.Langs["Hair"] + b.ToString());
                }
            }
            else
            {
                hairValues.Add(GetConfig.Langs["NoHair"]);

                for (int b = 1; b < SkinUtils.HAIR_FEMALE.Count + 1; b++)
                {
                    hairValues.Add(GetConfig.Langs["Hair"] + b.ToString());
                }
            }

            HairBtn = new MenuListItem(GetConfig.Langs["HairList"], hairValues, 0, GetConfig.Langs["HairDesc"])
            {
            };

            mainMenu.AddMenuItem(HairBtn);

            //Finish Button
            MenuItem FinishBtn = new MenuItem(string.Format(GetConfig.Langs["FinishBtn"], GetConfig.Config["BarberCost"].ToString()), GetConfig.Langs["SubFinishBtn"])
            {
                RightIcon = MenuItem.Icon.TICK
            };

            mainMenu.AddMenuItem(FinishBtn);

            //Events
            mainMenu.OnListIndexChange += (_menu, _listItem, _oldIndex, _newIndex, _itemIndex) =>
            {
                if (_itemIndex == 0)
                {
                    barbershops_cl.SetComponentToPed("Beard", _newIndex);
                }
                else if (_itemIndex == 1)
                {
                    barbershops_cl.SetComponentToPed("Hair", _newIndex);
                }
            };

            mainMenu.OnMenuClose += (_menu) =>
            {
                if (!isBuy)
                {
                    barbershops_cl.ExitBarber();
                }
            };

            mainMenu.OnMenuOpen += (_menu) =>
            {
                isBuy = false;
                barbershops_cl.LoadComps();
            };

            mainMenu.OnItemSelect += (_menu, _item, _index) =>
            {
                // Code in here would get executed whenever an item is pressed.
                if (_index == 2)
                {
                    isBuy = true;
                    barbershops_cl.BuyService();
                    mainMenu.CloseMenu();
                }
            };
        }
Пример #57
0
        /// <summary>
        /// Main OnTick task runs every game tick and handles all the menu stuff.
        /// </summary>
        /// <returns></returns>
        private async Task OnTick()
        {
            #region FirstTick
            // Only run this the first tick.
            if (firstTick)
            {
                firstTick = false;
                switch (GetSettingsInt(Setting.vmenu_pvp_mode))
                {
                case 1:
                    NetworkSetFriendlyFireOption(true);
                    SetCanAttackFriendly(Game.PlayerPed.Handle, true, false);
                    break;

                case 2:
                    NetworkSetFriendlyFireOption(false);
                    SetCanAttackFriendly(Game.PlayerPed.Handle, false, false);
                    break;

                case 0:
                default:
                    break;
                }
                // Clear all previous pause menu info/brief messages on resource start.
                ClearBrief();

                // Request the permissions data from the server.
                TriggerServerEvent("vMenu:RequestPermissions");

                // Wait until the data is received and the player's name is loaded correctly.
                while (!ConfigOptionsSetupComplete || !PermissionsSetupComplete || Game.Player.Name == "**Invalid**" || Game.Player.Name == "** Invalid **")
                {
                    await Delay(0);
                }
                if ((IsAllowed(Permission.Staff) && GetSettingsBool(Setting.vmenu_menu_staff_only)) || GetSettingsBool(Setting.vmenu_menu_staff_only) == false)
                {
                    if (GetSettingsInt(Setting.vmenu_menu_toggle_key) != -1)
                    {
                        MenuToggleKey = (Control)GetSettingsInt(Setting.vmenu_menu_toggle_key);
                        //MenuToggleKey = GetSettingsInt(Setting.vmenu_menu_toggle_key);
                    }
                    if (GetSettingsInt(Setting.vmenu_noclip_toggle_key) != -1)
                    {
                        NoClipKey = GetSettingsInt(Setting.vmenu_noclip_toggle_key);
                    }

                    // Create the main menu.
                    Menu           = new Menu(Game.Player.Name, "Main Menu");
                    PlayerSubmenu  = new Menu(Game.Player.Name, "Player Related Options");
                    VehicleSubmenu = new Menu(Game.Player.Name, "Vehicle Related Options");
                    WorldSubmenu   = new Menu(Game.Player.Name, "World Options");

                    // Add the main menu to the menu pool.
                    MenuController.AddMenu(Menu);
                    MenuController.MainMenu = Menu;

                    MenuController.AddSubmenu(Menu, PlayerSubmenu);
                    MenuController.AddSubmenu(Menu, VehicleSubmenu);
                    MenuController.AddSubmenu(Menu, WorldSubmenu);

                    // Create all (sub)menus.
                    CreateSubmenus();
                }
                else
                {
                    MenuController.MainMenu           = null;
                    MenuController.DisableMenuButtons = true;
                    MenuController.DontOpenAnyMenu    = true;
                    MenuController.MenuToggleKey      = (Control)(-1); // disables the menu toggle key
                }

                // Manage Stamina
                if (PlayerOptionsMenu != null && PlayerOptionsMenu.PlayerStamina && IsAllowed(Permission.POUnlimitedStamina))
                {
                    StatSetInt((uint)GetHashKey("MP0_STAMINA"), 100, true);
                }
                else
                {
                    StatSetInt((uint)GetHashKey("MP0_STAMINA"), 0, true);
                }

                // Manage other stats, in order of appearance in the pause menu (stats) page.
                StatSetInt((uint)GetHashKey("MP0_SHOOTING_ABILITY"), 100, true);        // Shooting
                StatSetInt((uint)GetHashKey("MP0_STRENGTH"), 100, true);                // Strength
                StatSetInt((uint)GetHashKey("MP0_STEALTH_ABILITY"), 100, true);         // Stealth
                StatSetInt((uint)GetHashKey("MP0_FLYING_ABILITY"), 100, true);          // Flying
                StatSetInt((uint)GetHashKey("MP0_WHEELIE_ABILITY"), 100, true);         // Driving
                StatSetInt((uint)GetHashKey("MP0_LUNG_CAPACITY"), 100, true);           // Lung Capacity
                StatSetFloat((uint)GetHashKey("MP0_PLAYER_MENTAL_STATE"), 0f, true);    // Mental State
            }
            #endregion


            // If the setup (permissions) is done, and it's not the first tick, then do this:
            if (ConfigOptionsSetupComplete && !firstTick)
            {
                #region Handle Opening/Closing of the menu.


                var tmpMenu = GetOpenMenu();
                if (MpPedCustomizationMenu != null)
                {
                    bool IsOpen()
                    {
                        return
                            (MpPedCustomizationMenu.appearanceMenu.Visible ||
                             MpPedCustomizationMenu.faceShapeMenu.Visible ||
                             MpPedCustomizationMenu.createCharacterMenu.Visible ||
                             MpPedCustomizationMenu.inheritanceMenu.Visible ||
                             MpPedCustomizationMenu.propsMenu.Visible ||
                             MpPedCustomizationMenu.clothesMenu.Visible ||
                             MpPedCustomizationMenu.tattoosMenu.Visible);
                    }

                    if (IsOpen())
                    {
                        if (tmpMenu == MpPedCustomizationMenu.createCharacterMenu)
                        {
                            MpPedCustomization.DisableBackButton = true;
                        }
                        else
                        {
                            MpPedCustomization.DisableBackButton = false;
                        }
                        MpPedCustomization.DontCloseMenus = true;
                    }
                    else
                    {
                        MpPedCustomization.DisableBackButton = false;
                        MpPedCustomization.DontCloseMenus    = false;
                    }
                }

                if (Game.IsDisabledControlJustReleased(0, Control.PhoneCancel) && MpPedCustomization.DisableBackButton)
                {
                    await Delay(0);

                    Notify.Alert("You must save your ped first before exiting, or click the ~r~Exit Without Saving~s~ button.");
                }

                if (Game.CurrentInputMode == InputMode.MouseAndKeyboard)
                {
                    if (!MenuController.IsAnyMenuOpen() || NoClipEnabled)
                    {
                        if (Game.IsControlJustPressed(0, (Control)NoClipKey) && IsAllowed(Permission.NoClip) && UpdateOnscreenKeyboard() != 0)
                        {
                            if (MenuController.IsAnyMenuOpen())
                            {
                                if (MenuController.GetCurrentMenu() != null && MenuController.GetCurrentMenu() != NoClipMenu)
                                {
                                    MenuController.CloseAllMenus();
                                }
                            }
                            if (Game.PlayerPed.IsInVehicle())
                            {
                                Vehicle veh = GetVehicle();
                                if (veh != null && veh.Exists() && veh.Driver == Game.PlayerPed)
                                {
                                    NoClipEnabled = !NoClipEnabled;
                                    MenuController.DontOpenAnyMenu = NoClipEnabled;
                                }
                                else
                                {
                                    NoClipEnabled = false;
                                    MenuController.DontOpenAnyMenu = NoClipEnabled;
                                    Notify.Error("This vehicle does not exist (somehow) or you need to be the driver of this vehicle to enable noclip!");
                                }
                            }
                            else
                            {
                                NoClipEnabled = !NoClipEnabled;
                                MenuController.DontOpenAnyMenu = NoClipEnabled;
                            }
                        }
                    }
                }

                if (NoClipEnabled)
                {
                    MenuController.DontOpenAnyMenu = true;
                }

                #endregion

                // Menu toggle button.
                Game.DisableControlThisFrame(0, MenuToggleKey);
            }
        }
Пример #58
0
 private void Awake()
 {
     try
     {
         instance        = this;
         errorText2.text = "Error: 100";
         SetIfArabic();
         errorText2.text = "Error: 101";
         LanguageSelectScript.ParseLangData();
         errorText2.text = "Error: 102";
         if (PlayerPrefsManager.GetHiddenMenu())
         {
             hiddenMenuButton.SetActive(value: true);
         }
         else
         {
             hiddenMenuButton.SetActive(value: false);
         }
         errorText2.text = "Error: 103";
         errorText2.text = "Error: 104";
         errorText2.text = "Error: 105";
         if (GoogleAnalyticsScript.instance == null)
         {
             if (PlayerPrefsManager.GetGARandom() == -1)
             {
                 PlayerPrefsManager.SetGARandom(UnityEngine.Random.Range(0, 10000));
             }
             UnityEngine.Object.Instantiate(googleAnalyticsPrefab).name = "GoogleAnalytics";
         }
         errorText2.text = "Error: 106";
         if (RequestManager.instance == null)
         {
             UnityEngine.Object.Instantiate(reqManager).name = "RequestManager";
             RequestManager.instance.GetLogRequest();
         }
         errorText2.text = "Error: 107";
         errorText2.text = "Error: 108";
         errorText2.text = "Error: 109";
         if (PlayerPrefsManager.GetLang() == string.Empty)
         {
             OpenLanguagePopup(flag: false);
             shouldSetTexts = false;
         }
         else
         {
             LanguageScript.ParseStrings();
             errorText2.text = "Error: 110";
             if (Games.sections == null)
             {
                 Games.ParseGameData(string.Empty);
             }
             errorText2.text = "Error: 111";
             errorText2.text = "Error: 112";
             startButton.transform.localScale  = Vector3.zero;
             questButton.transform.localScale  = Vector3.zero;
             levelsButton.transform.localScale = Vector3.zero;
             dailyButton.transform.localScale  = Vector3.zero;
             errorText2.text = "Error: 113";
             SettingsCloseButtonClicked(0.001f);
             errorText2.text = "Error: 114";
             CloseDailyGiftPopup(0.001f);
             errorText2.text = "Error: 115";
             ShopCloseButtonClicked(0.001f);
             errorText2.text = "Error: 116";
             CloseRewardedPopup(0.001f);
             errorText2.text = "Error: 117";
             CloseHiddenMenu(0.001f);
             errorText2.text = "Error: 118";
             CloseSetTutorialPopup(0.001f);
             CloseQuestPopup(0.001f);
             CloseHiddenLevelPopup(0.001f);
             CloseWheelPopup(0.001f);
             errorText2.text             = "Error: 119";
             QualitySettings.vSyncCount  = 0;
             Application.targetFrameRate = 60;
             errorText2.text             = "Error: 120";
             if (fromGameToSections)
             {
                 sectionPanel.SetActive(value: true);
             }
             errorText2.text = "Error: 121";
             SetVersionText();
             Input.multiTouchEnabled = false;
             errorText2.text         = "Error: 122";
             Screen.sleepTimeout     = -1;
             errorText2.text         = "Error: 123";
             if (SectionController.setCompleted || SectionController.hiddenSetCompleted != -1)
             {
                 sectionPanel.SetActive(value: true);
             }
             errorText2.text = "Error: 124";
             errorText2.text = "Error: 125";
             if (PlayerPrefsManager.IsFirstRun() == 0)
             {
                 PlayerPrefsManager.SetFirstRun();
                 GameController.levelToOpen = -1;
                 StartCoroutine(GoToGameScreenDelayed());
             }
             errorText2.text = "Error: 126";
             if (FugoAdManager.instance == null)
             {
                 UnityEngine.Object.Instantiate(admanagerPrefab).name = "AdManager";
                 errorText.text = "Error: 127";
                 FugoAdManager.instance.coinHolder = animBG;
                 errorText.text = "Error: 128";
                 NotificationSystem.CreateDailyNotification();
                 errorText.text = "Error: 129";
             }
         }
     }
     catch (Exception exception)
     {
         errorText2.gameObject.SetActive(value: true);
         UnityEngine.Debug.LogException(exception);
     }
 }
Пример #59
0
 //private string ConfigListenerAction;
 void Awake()
 {
     MenuController = GameObject.Find("MenuController").GetComponent<MenuController>();
 }
Пример #60
0
        /// <summary>
        /// Creates all the submenus depending on the permissions of the user.
        /// </summary>
        private void CreateSubmenus()
        {
            // Add the online players menu.
            if (IsAllowed(Permission.OPMenu))
            {
                OnlinePlayersMenu = new OnlinePlayers();
                Menu     menu   = OnlinePlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Online Players", "All currently connected players.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        OnlinePlayersMenu.UpdatePlayerlist();
                        menu.RefreshIndex();
                    }
                };
            }
            if (IsAllowed(Permission.OPUnban) || IsAllowed(Permission.OPViewBannedPlayers))
            {
                BannedPlayersMenu = new BannedPlayers();
                Menu     menu   = BannedPlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Banned Players", "View and manage all banned players in this menu.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle);
                        menu.RefreshIndex();
                    }
                };
            }

            MenuItem playerSubmenuBtn = new MenuItem("Player Related Options", "Open this submenu for player related subcategories.")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(playerSubmenuBtn);

            // Add the player options menu.
            if (IsAllowed(Permission.POMenu))
            {
                PlayerOptionsMenu = new PlayerOptions();
                Menu     menu   = PlayerOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Player Options", "Common player options can be accessed here.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            MenuItem vehicleSubmenuBtn = new MenuItem("Vehicle Related Options", "Open this submenu for vehicle related subcategories.")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(vehicleSubmenuBtn);
            // Add the vehicle options Menu.
            if (IsAllowed(Permission.VOMenu))
            {
                VehicleOptionsMenu = new VehicleOptions();
                Menu     menu   = VehicleOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Vehicle Options", "Here you can change common vehicle options, as well as tune & style your vehicle.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add the vehicle spawner menu.
            if (IsAllowed(Permission.VSMenu))
            {
                VehicleSpawnerMenu = new VehicleSpawner();
                Menu     menu   = VehicleSpawnerMenu.GetMenu();
                MenuItem button = new MenuItem("Vehicle Spawner", "Spawn a vehicle by name or choose one from a specific category.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add Saved Vehicles menu.
            if (IsAllowed(Permission.SVMenu))
            {
                SavedVehiclesMenu = new SavedVehicles();
                Menu     menu   = SavedVehiclesMenu.GetMenu();
                MenuItem button = new MenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
                VehicleSubmenu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        SavedVehiclesMenu.UpdateMenuAvailableCategories();
                    }
                };
            }

            // Add the Personal Vehicle menu.
            if (IsAllowed(Permission.PVMenu))
            {
                PersonalVehicleMenu = new PersonalVehicle();
                Menu     menu   = PersonalVehicleMenu.GetMenu();
                MenuItem button = new MenuItem("Personal Vehicle", "Set a vehicle as your personal vehicle, and control some things about that vehicle when you're not inside.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add the player appearance menu.
            if (IsAllowed(Permission.PAMenu))
            {
                PlayerAppearanceMenu = new PlayerAppearance();
                Menu     menu   = PlayerAppearanceMenu.GetMenu();
                MenuItem button = new MenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);

                MpPedCustomizationMenu = new MpPedCustomization();
                Menu     menu2   = MpPedCustomizationMenu.GetMenu();
                MenuItem button2 = new MenuItem("MP Ped Customization", "Create, edit, save and load multiplayer peds. ~r~Note, you can only save peds created in this submenu. vMenu can NOT detect peds created outside of this submenu. Simply due to GTA limitations.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu2, button2);
            }


            MenuItem worldSubmenuBtn = new MenuItem("World Related Options", "Open this submenu for world related subcategories.")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(worldSubmenuBtn);

            // Add the time options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync))
            {
                TimeOptionsMenu = new TimeOptions();
                Menu     menu   = TimeOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Time Options", "Change the time, and edit other time related options.")
                {
                    Label = "→→→"
                };
                AddMenu(WorldSubmenu, menu, button);
            }

            // Add the weather options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync))
            {
                WeatherOptionsMenu = new WeatherOptions();
                Menu     menu   = WeatherOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Weather Options", "Change all weather related options here.")
                {
                    Label = "→→→"
                };
                AddMenu(WorldSubmenu, menu, button);
            }

            // Add the weapons menu.
            if (IsAllowed(Permission.WPMenu))
            {
                WeaponOptionsMenu = new WeaponOptions();
                Menu     menu   = WeaponOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Weapon Options", "Add/remove weapons, modify weapons and set ammo options.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            // Add Weapon Loadouts menu.
            if (IsAllowed(Permission.WLMenu))
            {
                WeaponLoadoutsMenu = new WeaponLoadouts();
                Menu     menu   = WeaponLoadoutsMenu.GetMenu();
                MenuItem button = new MenuItem("Weapon Loadouts", "Mange, and spawn saved weapon loadouts.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            // Add Voice Chat Menu.
            if (IsAllowed(Permission.VCMenu))
            {
                VoiceChatSettingsMenu = new VoiceChat();
                Menu     menu   = VoiceChatSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Voice Chat Settings", "Change Voice Chat options here.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            {
                RecordingMenu = new Recording();
                Menu     menu   = RecordingMenu.GetMenu();
                MenuItem button = new MenuItem("Recording Options", "In-game recording options.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            // Add misc settings menu.
            {
                MiscSettingsMenu = new MiscSettings();
                Menu     menu   = MiscSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Misc Settings", "Miscellaneous vMenu options/settings can be configured here. You can also save your settings in this menu.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            // Add About Menu.
            AboutMenu = new About();
            Menu     sub = AboutMenu.GetMenu();
            MenuItem btn = new MenuItem("About vMenu", "Information about vMenu.")
            {
                Label = "→→→"
            };

            AddMenu(Menu, sub, btn);

            // Refresh everything.
            MenuController.Menus.ForEach((m) => m.RefreshIndex());

            if (!GetSettingsBool(Setting.vmenu_use_permissions))
            {
                Notify.Alert("vMenu is set up to ignore permissions, default permissions will be used.");
            }

            if (PlayerSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, PlayerSubmenu, playerSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(playerSubmenuBtn);
            }

            if (VehicleSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, VehicleSubmenu, vehicleSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(vehicleSubmenuBtn);
            }

            if (WorldSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, WorldSubmenu, worldSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(worldSubmenuBtn);
            }

            if (MiscSettingsMenu != null)
            {
                MenuController.EnableMenuToggleKeyOnController = !MiscSettingsMenu.MiscDisableControllerSupport;
            }
        }