상속: UIMenuItem
예제 #1
2
파일: Trainer.cs 프로젝트: YossiBz/YTrainer
        public GTA()
        {
            Tick += OnTick;
            KeyDown += OnKeyDown;
            _menuPool = new MenuPool();
            #region TrainerMenu
            mainMenu = new UIMenu("YTrainer", "~b~YTrainer v0.1");
            _menuPool.Add(mainMenu);

            var GOptions = new UIMenuItem("World & Game Options");
            mainMenu.AddItem(GOptions);
            var COptions = new UIMenuItem("Vehicle Options");
            mainMenu.AddItem(COptions);
            var POptions = new UIMenuItem("Player Options");
            mainMenu.AddItem(POptions);
            var SpawnOptions = new UIMenuItem("Car Spawning");
            mainMenu.AddItem(SpawnOptions);
            var TOptions = new UIMenuItem("Time Options");
            mainMenu.AddItem(TOptions);
            var WeOptions = new UIMenuItem("Weather Options");
            mainMenu.AddItem(WeOptions);
            var WOptions = new UIMenuItem("Weapons Options");
            mainMenu.AddItem(WOptions);
            var TeOptions = new UIMenuItem("Teleports Options");
            mainMenu.AddItem(TeOptions);
            mainMenu.RefreshIndex();
            #endregion
            #region GeneralMenu
            generalMenu = new UIMenu("World & Game Options", "");
            _menuPool.Add(generalMenu);
            generalMenu.AddItem(HUD = new UIMenuCheckboxItem("Hide Hud and Radar", false));
            generalMenu.AddItem(new UIMenuItem("Save Game"));
            generalMenu.AddItem(nVision = new UIMenuCheckboxItem("Night Vision", false));
            generalMenu.RefreshIndex();
            generalMenu.OnCheckboxChange += OnCheckboxChange;
            generalMenu.OnItemSelect += OnItemSelect;
            #endregion
            #region VehicleMenu
            carMenu = new UIMenu("Vehicle Options", "");
            _menuPool.Add(carMenu);
            carMenu.AddItem(CGM = new UIMenuCheckboxItem("Car GodMode", false));
            carMenu.AddItem(new UIMenuItem("Flip Car"));
            carMenu.AddItem(new UIMenuItem("Clean Car"));
            carMenu.AddItem(DS = new UIMenuCheckboxItem("Default Station", false));
            carMenu.AddItem(new UIMenuItem("Drive to Waypoint"));
            carMenu.AddItem(new UIMenuItem("Stop Drive to Waypoint"));
            carMenu.AddItem(VisibleC = new UIMenuCheckboxItem("Visible Car", false));
            carMenu.AddItem(new UIMenuItem("Repair Car"));
            carMenu.AddItem(new UIMenuItem("Open Left Front Door"));
            carMenu.AddItem(new UIMenuItem("Open Right Front Door"));
            carMenu.AddItem(new UIMenuItem("Open Left Rear Door"));
            carMenu.AddItem(new UIMenuItem("Open Right Rear Door"));
            carMenu.AddItem(new UIMenuItem("Open Hood"));
            carMenu.AddItem(new UIMenuItem("Open Trunk"));
            carMenu.AddItem(new UIMenuItem("Open All Car Doors"));
            carMenu.AddItem(new UIMenuItem("Close Left Front Door"));
            carMenu.AddItem(new UIMenuItem("Close Right Front Door"));
            carMenu.AddItem(new UIMenuItem("Close Left Rear Door"));
            carMenu.AddItem(new UIMenuItem("Close Right Rear Door"));
            carMenu.AddItem(new UIMenuItem("Close Hood"));
            carMenu.AddItem(new UIMenuItem("Close Trunk"));
            carMenu.AddItem(new UIMenuItem("Close All Car Doors"));
            var Colors = new List<dynamic>
            {
                "Red","Blue","Black","Green","White","Yellow"
            };
            carMenu.AddItem(CarColors = new UIMenuListItem("Change Car Color", Colors, 0));
            carMenu.RefreshIndex();
            carMenu.OnCheckboxChange += OnCheckboxChange;
            carMenu.OnItemSelect += OnItemSelect;
            carMenu.OnListChange += OnListChange;
            #endregion
            #region PlayerMenu
            playerMenu = new UIMenu("Player Options", "");
            _menuPool.Add(playerMenu);
            playerMenu.AddItem(GM = new UIMenuCheckboxItem("God Mode", false));
            playerMenu.AddItem(UA = new UIMenuCheckboxItem("Unlimited Ammo", false));
            playerMenu.AddItem(uAbility = new UIMenuCheckboxItem("Unlimited Ability", false));
            var Wanted = new List<dynamic>
            {
                "0",
                "1",
                "2",
                "3",
                "4",
                "5",
            };
            playerMenu.AddItem(WantedLevel = new UIMenuListItem("Wanted Level", Wanted, 0));
            playerMenu.AddItem(new UIMenuItem("Give Money"));
            playerMenu.AddItem(VisibleP = new UIMenuCheckboxItem("Player Visible", false));
            playerMenu.AddItem(NW = new UIMenuCheckboxItem("Never Wanted", false));
            playerMenu.AddItem(new UIMenuItem("Add Health"));
            playerMenu.AddItem(new UIMenuItem("Add Armour"));
            playerMenu.AddItem(mRadio = new UIMenuCheckboxItem("Radio Menu", false));
            playerMenu.AddItem(fastRun = new UIMenuCheckboxItem("Fast Run", false));
            playerMenu.AddItem(fastSwim = new UIMenuCheckboxItem("Fast Swim", false));
            playerMenu.RefreshIndex();
            playerMenu.OnCheckboxChange += OnCheckboxChange;
            playerMenu.OnItemSelect += OnItemSelect;
            playerMenu.OnListChange += OnListChange;
            #endregion
            #region TimeMenu
            timeMenu = new UIMenu("Time Options", "");
            _menuPool.Add(timeMenu);
            timeMenu.AddItem(new UIMenuItem("Slow Motion 25%"));
            timeMenu.AddItem(new UIMenuItem("Slow Motion 50%"));
            timeMenu.AddItem(new UIMenuItem("Slow Motion 75%"));
            timeMenu.AddItem(new UIMenuItem("Normal Game Speed"));
            timeMenu.AddItem(new UIMenuItem("Fast Motion"));
            timeMenu.AddItem(new UIMenuItem("Noon (12)"));
            timeMenu.AddItem(new UIMenuItem("AfterNoon (18)"));
            timeMenu.AddItem(new UIMenuItem("Evening (23)"));
            timeMenu.AddItem(new UIMenuItem("Night (5)"));
            timeMenu.AddItem(new UIMenuItem("Ahead One Hour"));
            timeMenu.AddItem(new UIMenuItem("Back One Hour"));
            timeMenu.AddItem(SyncTime = new UIMenuCheckboxItem("Real Time", false));
            var Days = new List<dynamic>
            {
                "Sunday", //2
                "Monday",//3
                "Tuesday", //4
                "Thursday", //6
                "Wednesday", //5
                "Friday", //7
                "Saturday" //1
            };
            timeMenu.AddItem(DOH = new UIMenuListItem("Choose Day", Days, 0));
            timeMenu.RefreshIndex();
            timeMenu.OnItemSelect += OnItemSelect;
            timeMenu.OnListChange += OnListChange;
            #endregion
            #region WeatherMenu
            weatherMenu = new UIMenu("Weather Options", "");
            _menuPool.Add(weatherMenu);
            weatherMenu.AddItem(new UIMenuItem("Blizzard"));
            weatherMenu.AddItem(new UIMenuItem("Christmas"));
            weatherMenu.AddItem(new UIMenuItem("Clear"));
            weatherMenu.AddItem(new UIMenuItem("Clearing"));
            weatherMenu.AddItem(new UIMenuItem("Clouds"));
            weatherMenu.AddItem(new UIMenuItem("Extra Sunny"));
            weatherMenu.AddItem(new UIMenuItem("Foggy"));
            weatherMenu.AddItem(new UIMenuItem("Neutral"));
            weatherMenu.AddItem(new UIMenuItem("Overcast"));
            weatherMenu.AddItem(new UIMenuItem("Raining"));
            weatherMenu.AddItem(new UIMenuItem("Smog"));
            weatherMenu.AddItem(new UIMenuItem("Snowing"));
            weatherMenu.AddItem(new UIMenuItem("Snowlight"));
            weatherMenu.AddItem(new UIMenuItem("Thunder Storm"));
            weatherMenu.RefreshIndex();
            weatherMenu.OnItemSelect += OnItemSelect;
            #endregion
            #region WeaponMenu
            weaponMenu = new UIMenu("Weapons Options", "");
            _menuPool.Add(weaponMenu);
            weaponMenu.AddItem(new UIMenuItem("Baseball Bat"));
            weaponMenu.AddItem(new UIMenuItem("Knife"));
            weaponMenu.AddItem(new UIMenuItem("Nightstick"));
            weaponMenu.AddItem(new UIMenuItem("Crowbar"));
            weaponMenu.AddItem(new UIMenuItem("Golf Club"));
            weaponMenu.AddItem(new UIMenuItem("Hammer"));
            weaponMenu.AddItem(new UIMenuItem("Broken Bottle"));
            weaponMenu.AddItem(new UIMenuItem("Antique Cavalry Dagger"));
            weaponMenu.AddItem(new UIMenuItem("Hatchet"));
            weaponMenu.AddItem(new UIMenuItem("Knuckledusters"));
            weaponMenu.AddItem(new UIMenuItem("Machete"));
            weaponMenu.AddItem(new UIMenuItem("Flashlight"));
            weaponMenu.AddItem(new UIMenuItem("Pistol"));
            weaponMenu.AddItem(new UIMenuItem("Combat Pistol"));
            weaponMenu.AddItem(new UIMenuItem("AP Pistol"));
            weaponMenu.AddItem(new UIMenuItem("Stun Gun"));
            weaponMenu.AddItem(new UIMenuItem("Pistol .50"));
            weaponMenu.AddItem(new UIMenuItem("SNS Pistol"));
            weaponMenu.AddItem(new UIMenuItem("Heavy Pistol"));
            weaponMenu.AddItem(new UIMenuItem("Vintage Pistol"));
            weaponMenu.AddItem(new UIMenuItem("Flare Gun"));
            weaponMenu.AddItem(new UIMenuItem("Marksman Pistol"));
            weaponMenu.AddItem(new UIMenuItem("Micro SMG"));
            weaponMenu.AddItem(new UIMenuItem("SMG"));
            weaponMenu.AddItem(new UIMenuItem("Assault SMG"));
            weaponMenu.AddItem(new UIMenuItem("Combat PDW"));
            weaponMenu.AddItem(new UIMenuItem("Machine Pistol"));
            weaponMenu.AddItem(new UIMenuItem("Pump Shotgun"));
            weaponMenu.AddItem(new UIMenuItem("Sawed-Off Shotgun"));
            weaponMenu.AddItem(new UIMenuItem("Assault Shotgun"));
            weaponMenu.AddItem(new UIMenuItem("Bullpup Shotgun"));
            weaponMenu.AddItem(new UIMenuItem("Musket"));
            weaponMenu.AddItem(new UIMenuItem("Heavy Shotgun"));
            weaponMenu.AddItem(new UIMenuItem("Assault Rifle"));
            weaponMenu.AddItem(new UIMenuItem("Carbine Rifle"));
            weaponMenu.AddItem(new UIMenuItem("Advanced Rifle"));
            weaponMenu.AddItem(new UIMenuItem("Special Carbine"));
            weaponMenu.AddItem(new UIMenuItem("Bullpup Rifle"));
            weaponMenu.AddItem(new UIMenuItem("MG"));
            weaponMenu.AddItem(new UIMenuItem("Combat MG"));
            weaponMenu.AddItem(new UIMenuItem("Gusenberg Sweeper"));
            weaponMenu.AddItem(new UIMenuItem("Sniper Rifle"));
            weaponMenu.AddItem(new UIMenuItem("Heavy Sniper"));
            weaponMenu.AddItem(new UIMenuItem("Marksman Rifle"));
            weaponMenu.AddItem(new UIMenuItem("RPG"));
            weaponMenu.AddItem(new UIMenuItem("Grenade Launcher"));
            weaponMenu.AddItem(new UIMenuItem("Grenade Launcher Smoke"));
            weaponMenu.AddItem(new UIMenuItem("Minigun"));
            weaponMenu.AddItem(new UIMenuItem("Firework Launcher"));
            weaponMenu.AddItem(new UIMenuItem("Rail Gun"));
            weaponMenu.AddItem(new UIMenuItem("Homing Launcher"));
            weaponMenu.AddItem(new UIMenuItem("Grenade"));
            weaponMenu.AddItem(new UIMenuItem("Sticky Bomb"));
            weaponMenu.AddItem(new UIMenuItem("Tear Gas"));
            weaponMenu.AddItem(new UIMenuItem("Molotov Cocktail"));
            weaponMenu.AddItem(new UIMenuItem("Proximity Mine"));
            weaponMenu.AddItem(new UIMenuItem("Snowball"));
            weaponMenu.AddItem(new UIMenuItem("BZ Gas"));
            weaponMenu.AddItem(new UIMenuItem("Fire Extinguisher"));
            weaponMenu.AddItem(new UIMenuItem("Jerry Can"));
            weaponMenu.AddItem(new UIMenuItem("Digiscanner"));
            weaponMenu.AddItem(new UIMenuItem("Parachute"));
            weaponMenu.RefreshIndex();
            weaponMenu.OnItemSelect += OnItemSelect;
            #endregion
            #region TeleportMenu
            teleportMenu = new UIMenu("Teleports Options", "");
            _menuPool.Add(teleportMenu);
            var TSpaceship = new List<dynamic>
            {
                "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20",
                "21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40",
                "41","42","43","44","45","46","47","48","49","50",
            };
            var TLetter = new List<dynamic>
            {
                "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20",
                "21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40",
                "41","42","43","44","45","46","47","48","49","50",
            };
            teleportMenu.AddItem(Spaceship = new UIMenuListItem("Spaceship", TSpaceship, 0));
            teleportMenu.AddItem(LetterScraps = new UIMenuListItem("Letter Scraps", TLetter, 0));
            teleportMenu.AddItem(new UIMenuItem("Teleport to WayPoint"));
            teleportMenu.AddItem(new UIMenuItem("Teleport to Safehouse"));
            teleportMenu.AddItem(new UIMenuItem("Teleport to AmmuNation"));
            teleportMenu.AddItem(new UIMenuItem("Teleport to AmmuNation with shooting range"));
            teleportMenu.AddItem(new UIMenuItem("Teleport to Garage"));
            teleportMenu.AddItem(new UIMenuItem("Teleport to Barber Shop"));
            teleportMenu.RefreshIndex();
            teleportMenu.OnListChange += OnListChange;
            teleportMenu.OnItemSelect += OnItemSelect;
            #endregion
            #region SpawnVehicleMenu
            spawnMenu = new UIMenu("Car Spawning", "");
            _menuPool.Add(spawnMenu);
            spawnMenu.AddItem(new UIMenuItem("Adder"));
            spawnMenu.AddItem(new UIMenuItem("Airbus"));
            spawnMenu.AddItem(new UIMenuItem("Airtug"));
            spawnMenu.AddItem(new UIMenuItem("Akuma"));
            spawnMenu.AddItem(new UIMenuItem("Ambulance"));
            spawnMenu.AddItem(new UIMenuItem("Annihilator"));
            spawnMenu.AddItem(new UIMenuItem("Aseat"));
            spawnMenu.AddItem(new UIMenuItem("Aseat2 "));
            spawnMenu.AddItem(new UIMenuItem("Asterope"));
            spawnMenu.AddItem(new UIMenuItem("Bagger"));
            spawnMenu.AddItem(new UIMenuItem("Baller"));
            spawnMenu.AddItem(new UIMenuItem("Baller2"));
            spawnMenu.AddItem(new UIMenuItem("Banshee"));
            spawnMenu.AddItem(new UIMenuItem("Barracks"));
            spawnMenu.AddItem(new UIMenuItem("Barracks2"));
            spawnMenu.AddItem(new UIMenuItem("Bati"));
            spawnMenu.AddItem(new UIMenuItem("Bati2"));
            spawnMenu.AddItem(new UIMenuItem("Benson"));
            spawnMenu.AddItem(new UIMenuItem("Bfinjection"));
            spawnMenu.AddItem(new UIMenuItem("Biff"));
            spawnMenu.AddItem(new UIMenuItem("Bison"));
            spawnMenu.AddItem(new UIMenuItem("Bison2"));
            spawnMenu.AddItem(new UIMenuItem("Bison3"));
            spawnMenu.AddItem(new UIMenuItem("Bjkl "));
            spawnMenu.AddItem(new UIMenuItem("Blazer"));
            spawnMenu.AddItem(new UIMenuItem("Blazer2"));
            spawnMenu.AddItem(new UIMenuItem("Blazer3"));
            spawnMenu.AddItem(new UIMenuItem("Blimp"));
            spawnMenu.AddItem(new UIMenuItem("Blista"));
            spawnMenu.AddItem(new UIMenuItem("Bmx"));
            spawnMenu.AddItem(new UIMenuItem("Bobcatxl"));
            spawnMenu.AddItem(new UIMenuItem("Bodhi2"));
            spawnMenu.AddItem(new UIMenuItem("Boxvillet"));
            spawnMenu.AddItem(new UIMenuItem("Boxvillet2"));
            spawnMenu.AddItem(new UIMenuItem("Boxvillet3"));
            spawnMenu.AddItem(new UIMenuItem("Buccaner"));
            spawnMenu.AddItem(new UIMenuItem("Buffalo"));
            spawnMenu.AddItem(new UIMenuItem("Buffalo2"));
            spawnMenu.AddItem(new UIMenuItem("Bulldozer"));
            spawnMenu.AddItem(new UIMenuItem("Bullet "));
            spawnMenu.AddItem(new UIMenuItem("Burrito"));
            spawnMenu.AddItem(new UIMenuItem("Burrito2"));
            spawnMenu.AddItem(new UIMenuItem("Burrito3"));
            spawnMenu.AddItem(new UIMenuItem("Burrito4"));
            spawnMenu.AddItem(new UIMenuItem("Burrito5"));
            spawnMenu.AddItem(new UIMenuItem("Bus"));
            spawnMenu.AddItem(new UIMenuItem("Buzzard"));
            spawnMenu.AddItem(new UIMenuItem("Buzzard2"));
            spawnMenu.AddItem(new UIMenuItem("Caddy"));
            spawnMenu.AddItem(new UIMenuItem("Caddy2"));
            spawnMenu.AddItem(new UIMenuItem("Camper"));
            spawnMenu.AddItem(new UIMenuItem("Carbonizzare"));
            spawnMenu.AddItem(new UIMenuItem("Carbonrs"));
            spawnMenu.AddItem(new UIMenuItem("Cargobob"));
            spawnMenu.AddItem(new UIMenuItem("Cargobob2"));
            spawnMenu.AddItem(new UIMenuItem("Cargobob3 "));
            spawnMenu.AddItem(new UIMenuItem("Cargoplane"));
            spawnMenu.AddItem(new UIMenuItem("Cavalcade"));
            spawnMenu.AddItem(new UIMenuItem("Cavalcade2"));
            spawnMenu.AddItem(new UIMenuItem("Cheetah"));
            spawnMenu.AddItem(new UIMenuItem("Coach"));
            spawnMenu.AddItem(new UIMenuItem("Cogcabrio"));
            spawnMenu.AddItem(new UIMenuItem("Comet2"));
            spawnMenu.AddItem(new UIMenuItem("Coquette"));
            spawnMenu.AddItem(new UIMenuItem("Cruiser"));
            spawnMenu.AddItem(new UIMenuItem("Crusade"));
            spawnMenu.AddItem(new UIMenuItem("Cuban800"));
            spawnMenu.AddItem(new UIMenuItem("Cutter"));
            spawnMenu.AddItem(new UIMenuItem("Daemon"));
            spawnMenu.AddItem(new UIMenuItem("Dilettante"));
            spawnMenu.AddItem(new UIMenuItem("Dilettante2"));
            spawnMenu.AddItem(new UIMenuItem("Dinghy"));
            spawnMenu.AddItem(new UIMenuItem("Dinghy2"));
            spawnMenu.AddItem(new UIMenuItem("Dloader"));
            spawnMenu.AddItem(new UIMenuItem("Docktug"));
            spawnMenu.AddItem(new UIMenuItem("Dominator"));
            spawnMenu.AddItem(new UIMenuItem("Double"));
            spawnMenu.AddItem(new UIMenuItem("Dubsta"));
            spawnMenu.AddItem(new UIMenuItem("Dubsta2"));
            spawnMenu.AddItem(new UIMenuItem("Dump"));
            spawnMenu.AddItem(new UIMenuItem("Dune"));
            spawnMenu.AddItem(new UIMenuItem("Dune2"));
            spawnMenu.AddItem(new UIMenuItem("Duster"));
            spawnMenu.AddItem(new UIMenuItem("Elegy2"));
            spawnMenu.AddItem(new UIMenuItem("Emperor"));
            spawnMenu.AddItem(new UIMenuItem("Emperor2"));
            spawnMenu.AddItem(new UIMenuItem("Emperor3"));
            spawnMenu.AddItem(new UIMenuItem("Entityxf"));
            spawnMenu.AddItem(new UIMenuItem("Exemplar"));
            spawnMenu.AddItem(new UIMenuItem("F620"));
            spawnMenu.AddItem(new UIMenuItem("Faggio2"));
            spawnMenu.AddItem(new UIMenuItem("Fbi"));
            spawnMenu.AddItem(new UIMenuItem("Fbi2"));
            spawnMenu.AddItem(new UIMenuItem("Felon"));
            spawnMenu.AddItem(new UIMenuItem("Felon2"));
            spawnMenu.AddItem(new UIMenuItem("Feltzer2"));
            spawnMenu.AddItem(new UIMenuItem("Firetruk"));
            spawnMenu.AddItem(new UIMenuItem("Fixter"));
            spawnMenu.AddItem(new UIMenuItem("Flatbed"));
            spawnMenu.AddItem(new UIMenuItem("Forklift"));
            spawnMenu.AddItem(new UIMenuItem("Fq2"));
            spawnMenu.AddItem(new UIMenuItem("Frogger"));
            spawnMenu.AddItem(new UIMenuItem("Frogger2"));
            spawnMenu.AddItem(new UIMenuItem("Fugitive"));
            spawnMenu.AddItem(new UIMenuItem("Fusilade"));
            spawnMenu.AddItem(new UIMenuItem("Futo"));
            spawnMenu.AddItem(new UIMenuItem("Gauntlet"));
            spawnMenu.AddItem(new UIMenuItem("Gburrito"));
            spawnMenu.AddItem(new UIMenuItem("Granger"));
            spawnMenu.AddItem(new UIMenuItem("Gresley"));
            spawnMenu.AddItem(new UIMenuItem("Habanero"));
            spawnMenu.AddItem(new UIMenuItem("Handler"));
            spawnMenu.AddItem(new UIMenuItem("Hauler"));
            spawnMenu.AddItem(new UIMenuItem("Hexer"));
            spawnMenu.AddItem(new UIMenuItem("Hotknife"));
            spawnMenu.AddItem(new UIMenuItem("Infernus"));
            spawnMenu.AddItem(new UIMenuItem("Ingot"));
            spawnMenu.AddItem(new UIMenuItem("Intruder"));
            spawnMenu.AddItem(new UIMenuItem("Issi2"));
            spawnMenu.AddItem(new UIMenuItem("Jackal"));
            spawnMenu.AddItem(new UIMenuItem("Jb700"));
            spawnMenu.AddItem(new UIMenuItem("Jet"));
            spawnMenu.AddItem(new UIMenuItem("Jetmax"));
            spawnMenu.AddItem(new UIMenuItem("Journey"));
            spawnMenu.AddItem(new UIMenuItem("Khamelion"));
            spawnMenu.AddItem(new UIMenuItem("Ladstalker"));
            spawnMenu.AddItem(new UIMenuItem("Lazer"));
            spawnMenu.AddItem(new UIMenuItem("Lguard"));
            spawnMenu.AddItem(new UIMenuItem("Luxor"));
            spawnMenu.AddItem(new UIMenuItem("Mammatus"));
            spawnMenu.AddItem(new UIMenuItem("Manana"));
            spawnMenu.AddItem(new UIMenuItem("Marquis"));
            spawnMenu.AddItem(new UIMenuItem("Maverick"));
            spawnMenu.AddItem(new UIMenuItem("Mesa"));
            spawnMenu.AddItem(new UIMenuItem("Mesa2"));
            spawnMenu.AddItem(new UIMenuItem("Mesa3"));
            spawnMenu.AddItem(new UIMenuItem("Minivan"));
            spawnMenu.AddItem(new UIMenuItem("Mixer"));
            spawnMenu.AddItem(new UIMenuItem("Mixer2"));
            spawnMenu.AddItem(new UIMenuItem("Monroe"));
            spawnMenu.AddItem(new UIMenuItem("Mower"));
            spawnMenu.AddItem(new UIMenuItem("Mule"));
            spawnMenu.AddItem(new UIMenuItem("Mule2"));
            spawnMenu.AddItem(new UIMenuItem("Nemesis"));
            spawnMenu.AddItem(new UIMenuItem("Ninef"));
            spawnMenu.AddItem(new UIMenuItem("Ninef2"));
            spawnMenu.AddItem(new UIMenuItem("Oracle"));
            spawnMenu.AddItem(new UIMenuItem("Oracle2"));
            spawnMenu.AddItem(new UIMenuItem("Packer"));
            spawnMenu.AddItem(new UIMenuItem("Patriot"));
            spawnMenu.AddItem(new UIMenuItem("Pbus"));
            spawnMenu.AddItem(new UIMenuItem("Pcj"));
            spawnMenu.AddItem(new UIMenuItem("Penumbra"));
            spawnMenu.AddItem(new UIMenuItem("Peyote"));
            spawnMenu.AddItem(new UIMenuItem("Phantom"));
            spawnMenu.AddItem(new UIMenuItem("Phoenix"));
            spawnMenu.AddItem(new UIMenuItem("Picador"));
            spawnMenu.AddItem(new UIMenuItem("Police"));
            spawnMenu.AddItem(new UIMenuItem("Police2"));
            spawnMenu.AddItem(new UIMenuItem("Police3"));
            spawnMenu.AddItem(new UIMenuItem("Police4"));
            spawnMenu.AddItem(new UIMenuItem("Policeb"));
            spawnMenu.AddItem(new UIMenuItem("Policeold1"));
            spawnMenu.AddItem(new UIMenuItem("Policeold2"));
            spawnMenu.AddItem(new UIMenuItem("Policet"));
            spawnMenu.AddItem(new UIMenuItem("Polmav"));
            spawnMenu.AddItem(new UIMenuItem("Pony"));
            spawnMenu.AddItem(new UIMenuItem("Pony2"));
            spawnMenu.AddItem(new UIMenuItem("Pounder"));
            spawnMenu.AddItem(new UIMenuItem("Praire"));
            spawnMenu.AddItem(new UIMenuItem("Pranger"));
            spawnMenu.AddItem(new UIMenuItem("Predator"));
            spawnMenu.AddItem(new UIMenuItem("Premier"));
            spawnMenu.AddItem(new UIMenuItem("Primo"));
            spawnMenu.AddItem(new UIMenuItem("Radi"));
            spawnMenu.AddItem(new UIMenuItem("Rancherxl"));
            spawnMenu.AddItem(new UIMenuItem("Rancherxl2"));
            spawnMenu.AddItem(new UIMenuItem("Rapidgt"));
            spawnMenu.AddItem(new UIMenuItem("Rapidgt2"));
            spawnMenu.AddItem(new UIMenuItem("Ratloader"));
            spawnMenu.AddItem(new UIMenuItem("Rebel"));
            spawnMenu.AddItem(new UIMenuItem("Rebel2"));
            spawnMenu.AddItem(new UIMenuItem("Regina"));
            spawnMenu.AddItem(new UIMenuItem("Rentalbus"));
            spawnMenu.AddItem(new UIMenuItem("Rhino"));
            spawnMenu.AddItem(new UIMenuItem("Riot"));
            spawnMenu.AddItem(new UIMenuItem("Ripley"));
            spawnMenu.AddItem(new UIMenuItem("Rocoto"));
            spawnMenu.AddItem(new UIMenuItem("Romero"));
            spawnMenu.AddItem(new UIMenuItem("Rubble"));
            spawnMenu.AddItem(new UIMenuItem("Ruffian"));
            spawnMenu.AddItem(new UIMenuItem("Ruiner"));
            spawnMenu.AddItem(new UIMenuItem("Rumpo"));
            spawnMenu.AddItem(new UIMenuItem("Rumpo2"));
            spawnMenu.AddItem(new UIMenuItem("Sabregt"));
            spawnMenu.AddItem(new UIMenuItem("Sadler"));
            spawnMenu.AddItem(new UIMenuItem("Sadler2"));
            spawnMenu.AddItem(new UIMenuItem("Sanchez"));
            spawnMenu.AddItem(new UIMenuItem("Sanchez2"));
            spawnMenu.AddItem(new UIMenuItem("Sandking"));
            spawnMenu.AddItem(new UIMenuItem("Sandking2"));
            spawnMenu.AddItem(new UIMenuItem("Schafter2"));
            spawnMenu.AddItem(new UIMenuItem("Schwarzer"));
            spawnMenu.AddItem(new UIMenuItem("Scorcher"));
            spawnMenu.AddItem(new UIMenuItem("Scrap"));
            spawnMenu.AddItem(new UIMenuItem("Seashark"));
            spawnMenu.AddItem(new UIMenuItem("Seashark2"));
            spawnMenu.AddItem(new UIMenuItem("Seminole"));
            spawnMenu.AddItem(new UIMenuItem("Sentinel"));
            spawnMenu.AddItem(new UIMenuItem("Sentinel2"));
            spawnMenu.AddItem(new UIMenuItem("Serrano"));
            spawnMenu.AddItem(new UIMenuItem("Shamal"));
            spawnMenu.AddItem(new UIMenuItem("Sheriff"));
            spawnMenu.AddItem(new UIMenuItem("Sheriff2"));
            spawnMenu.AddItem(new UIMenuItem("Skylift"));
            spawnMenu.AddItem(new UIMenuItem("Speedo"));
            spawnMenu.AddItem(new UIMenuItem("Speedo2"));
            spawnMenu.AddItem(new UIMenuItem("Squalo"));
            spawnMenu.AddItem(new UIMenuItem("Stanier"));
            spawnMenu.AddItem(new UIMenuItem("Stinger"));
            spawnMenu.AddItem(new UIMenuItem("Stingergt"));
            spawnMenu.AddItem(new UIMenuItem("Stockade"));
            spawnMenu.AddItem(new UIMenuItem("Stockade3"));
            spawnMenu.AddItem(new UIMenuItem("Stratum"));
            spawnMenu.AddItem(new UIMenuItem("Stretch"));
            spawnMenu.AddItem(new UIMenuItem("Stunt"));
            spawnMenu.AddItem(new UIMenuItem("Submersible"));
            spawnMenu.AddItem(new UIMenuItem("Sultan"));
            spawnMenu.AddItem(new UIMenuItem("Suntrap"));
            spawnMenu.AddItem(new UIMenuItem("Superd"));
            spawnMenu.AddItem(new UIMenuItem("Surano"));
            spawnMenu.AddItem(new UIMenuItem("Surfer"));
            spawnMenu.AddItem(new UIMenuItem("Surfer2"));
            spawnMenu.AddItem(new UIMenuItem("Surge"));
            spawnMenu.AddItem(new UIMenuItem("Taco"));
            spawnMenu.AddItem(new UIMenuItem("Tailgater"));
            spawnMenu.AddItem(new UIMenuItem("Tankercar"));
            spawnMenu.AddItem(new UIMenuItem("Taxi"));
            spawnMenu.AddItem(new UIMenuItem("Tiptruck"));
            spawnMenu.AddItem(new UIMenuItem("Tiptruck2"));
            spawnMenu.AddItem(new UIMenuItem("Titan"));
            spawnMenu.AddItem(new UIMenuItem("Tornado"));
            spawnMenu.AddItem(new UIMenuItem("Tornado2"));
            spawnMenu.AddItem(new UIMenuItem("Tornado3"));
            spawnMenu.AddItem(new UIMenuItem("Tornado4"));
            spawnMenu.AddItem(new UIMenuItem("Tourbus"));
            spawnMenu.AddItem(new UIMenuItem("Towtruck"));
            spawnMenu.AddItem(new UIMenuItem("Towtruck2"));
            spawnMenu.AddItem(new UIMenuItem("Tractor"));
            spawnMenu.AddItem(new UIMenuItem("Tractor2"));
            spawnMenu.AddItem(new UIMenuItem("Tractor3"));
            spawnMenu.AddItem(new UIMenuItem("Trash"));
            spawnMenu.AddItem(new UIMenuItem("Tropic"));
            spawnMenu.AddItem(new UIMenuItem("Utilitruck"));
            spawnMenu.AddItem(new UIMenuItem("Utilitruck2"));
            spawnMenu.AddItem(new UIMenuItem("Utilitruck3"));
            spawnMenu.AddItem(new UIMenuItem("Vacca"));
            spawnMenu.AddItem(new UIMenuItem("Vader"));
            spawnMenu.AddItem(new UIMenuItem("Velum"));
            spawnMenu.AddItem(new UIMenuItem("Vigero"));
            spawnMenu.AddItem(new UIMenuItem("Voltic"));
            spawnMenu.AddItem(new UIMenuItem("Voodoo2"));
            spawnMenu.AddItem(new UIMenuItem("Washington"));
            spawnMenu.AddItem(new UIMenuItem("Youga"));
            spawnMenu.AddItem(new UIMenuItem("Zion"));
            spawnMenu.AddItem(new UIMenuItem("Zion2"));
            spawnMenu.AddItem(new UIMenuItem("Ztype"));
            spawnMenu.AddItem(new UIMenuItem("Bifta DLC Beach Bum"));
            spawnMenu.AddItem(new UIMenuItem("Kalahari DLC Beach Bum"));
            spawnMenu.AddItem(new UIMenuItem("Paradise DLC Beach Bum"));
            spawnMenu.AddItem(new UIMenuItem("Speeder DLC Beach Bum"));
            spawnMenu.AddItem(new UIMenuItem("Alpha DLC The Business"));
            spawnMenu.AddItem(new UIMenuItem("Jester DLC The Business"));
            spawnMenu.AddItem(new UIMenuItem("TurismoR DLC The Business"));
            spawnMenu.AddItem(new UIMenuItem("Vestra DLC The Business"));
            spawnMenu.AddItem(new UIMenuItem("Huntley DLC The High Life"));
            spawnMenu.AddItem(new UIMenuItem("Massacro DLC The High Life"));
            spawnMenu.AddItem(new UIMenuItem("Thrust DLC The High Life"));
            spawnMenu.AddItem(new UIMenuItem("Zentorno DLC The High Life"));
            spawnMenu.AddItem(new UIMenuItem("Blade DLC I'm Not a Hipster"));
            spawnMenu.AddItem(new UIMenuItem("Dubsta3 DLC I'm Not a Hipster"));
            spawnMenu.AddItem(new UIMenuItem("Glendale DLC I'm Not a Hipster"));
            spawnMenu.AddItem(new UIMenuItem("Panto DLC I'm Not a Hipster"));
            spawnMenu.AddItem(new UIMenuItem("Pigalle DLC I'm Not a Hipster"));
            spawnMenu.AddItem(new UIMenuItem("Rhapsody DLC I'm Not a Hipster"));
            spawnMenu.AddItem(new UIMenuItem("Warrener DLC I'm Not a Hipster"));
            spawnMenu.AddItem(new UIMenuItem("Monster DLC Indipendence Day"));
            spawnMenu.AddItem(new UIMenuItem("Sovereign DLC Indipendence Day"));
            spawnMenu.AddItem(new UIMenuItem("Furoregt DLC Last Team Standing"));
            spawnMenu.AddItem(new UIMenuItem("Hakuchou DLC Last Team Standing"));
            spawnMenu.AddItem(new UIMenuItem("Innovation DLC Last Team Standing"));
            spawnMenu.AddItem(new UIMenuItem("Besra DLC The San Andreas Flight School"));
            spawnMenu.AddItem(new UIMenuItem("Coquette2 DLC The San Andreas Flight School"));
            spawnMenu.AddItem(new UIMenuItem("Miljet DLC The San Andreas Flight School"));
            spawnMenu.AddItem(new UIMenuItem("Swift DLC The San Andreas Flight School"));
            spawnMenu.AddItem(new UIMenuItem("Btype DLC The Valentine Day Massacre"));
            spawnMenu.AddItem(new UIMenuItem("Blimp2"));
            spawnMenu.AddItem(new UIMenuItem("Blista2"));
            spawnMenu.AddItem(new UIMenuItem("Blista3"));
            spawnMenu.AddItem(new UIMenuItem("Buffalo3"));
            spawnMenu.AddItem(new UIMenuItem("Dodo"));
            spawnMenu.AddItem(new UIMenuItem("Dominator2"));
            spawnMenu.AddItem(new UIMenuItem("Dukes"));
            spawnMenu.AddItem(new UIMenuItem("Dukes2"));
            spawnMenu.AddItem(new UIMenuItem("Gauntlet2"));
            spawnMenu.AddItem(new UIMenuItem("Marshall"));
            spawnMenu.AddItem(new UIMenuItem("Stallion"));
            spawnMenu.AddItem(new UIMenuItem("Stallion2"));
            spawnMenu.AddItem(new UIMenuItem("Submersible2"));
            spawnMenu.AddItem(new UIMenuItem("Jester2 DLC Festive Surprise"));
            spawnMenu.AddItem(new UIMenuItem("Massacro2 DLC Festive Surprise"));
            spawnMenu.AddItem(new UIMenuItem("Ratloader2 DLC Festive Surprise"));
            spawnMenu.AddItem(new UIMenuItem("Slamvan DLC Festive Surprise"));
            spawnMenu.AddItem(new UIMenuItem("Btype2 DLC Halloween"));
            spawnMenu.AddItem(new UIMenuItem("Lurcher DLC Halloween"));
            spawnMenu.AddItem(new UIMenuItem("Barracks3 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Boxville4 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Casco DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Dinghy3 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Enduro DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Gburrito2 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Guardian DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Hydra DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Insurgent DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Insurgent2 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Kuruma DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Kuruma2 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Lectro DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Mule3 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Savage DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Slamvan2 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Technical DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Trash2 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Valkyrie DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Velum2 DLC Heists"));
            spawnMenu.AddItem(new UIMenuItem("Buccaner2 DLC Lowrider"));
            spawnMenu.AddItem(new UIMenuItem("Chino2 DLC Lowrider"));
            spawnMenu.AddItem(new UIMenuItem("Faction DLC Lowrider"));
            spawnMenu.AddItem(new UIMenuItem("Faction2 DLC Lowrider"));
            spawnMenu.AddItem(new UIMenuItem("Moonbeam DLC Lowrider"));
            spawnMenu.AddItem(new UIMenuItem("Moonbeam2 DLC Lowrider"));
            spawnMenu.AddItem(new UIMenuItem("Primo2 DLC Lowrider"));
            spawnMenu.AddItem(new UIMenuItem("Voodoo DLC Lowrider"));
            spawnMenu.AddItem(new UIMenuItem("Feltzer3 DLC Ill Gotten Gains Part 1"));
            spawnMenu.AddItem(new UIMenuItem("Luxor2 DLC Ill Gotten Gains Part 1"));
            spawnMenu.AddItem(new UIMenuItem("Osiris DLC Ill Gotten Gains Part 1"));
            spawnMenu.AddItem(new UIMenuItem("Swift2 DLC Ill Gotten Gains Part 1"));
            spawnMenu.AddItem(new UIMenuItem("Virgo DLC Ill Gotten Gains Part 1"));
            spawnMenu.AddItem(new UIMenuItem("Windsor DLC Ill Gotten Gains Part 1"));
            spawnMenu.AddItem(new UIMenuItem("Brawler DLC Ill Gotten Gains Part 2"));
            spawnMenu.AddItem(new UIMenuItem("Chino DLC Ill Gotten Gains Part 2"));
            spawnMenu.AddItem(new UIMenuItem("Coquette3 DLC Ill Gotten Gains Part 2"));
            spawnMenu.AddItem(new UIMenuItem("T20 DLC Ill Gotten Gains Part 2"));
            spawnMenu.AddItem(new UIMenuItem("Toro DLC Ill Gotten Gains Part 2"));
            spawnMenu.AddItem(new UIMenuItem("Vindicator DLC Ill Gotten Gains Part 2"));
            spawnMenu.OnItemSelect += OnItemSelect;
            spawnMenu.RefreshIndex();
            #endregion
            mainMenu.BindMenuToItem(generalMenu, GOptions);
            mainMenu.BindMenuToItem(carMenu, COptions);
            mainMenu.BindMenuToItem(playerMenu, POptions);
            mainMenu.BindMenuToItem(timeMenu, TOptions);
            mainMenu.BindMenuToItem(weatherMenu, WeOptions);
            mainMenu.BindMenuToItem(weaponMenu, WOptions);
            mainMenu.BindMenuToItem(teleportMenu, TeOptions);
            mainMenu.BindMenuToItem(spawnMenu, SpawnOptions);
        }
예제 #2
1
    public PIMenu()
    {
        Tick += OnTick;
        KeyDown += OnKeyDown;

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

        MenuColor = Color.Blue;

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

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

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

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

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

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

        MainMenu.AddItem(InventoryMenuItem);

        MainMenu.BindMenuToItem(InventoryMenu, InventoryMenuItem);

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

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

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

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

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

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

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

        MainMenu.AddItem(PassiveModeItem);

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

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

        MainMenu.AddItem(MenuOptionsMenuItem);

        MainMenu.BindMenuToItem(MenuOptionsMenu, MenuOptionsMenuItem);

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

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

        MenuOptionsMenu.BindMenuToItem(AboutMenu, AboutOptionsMenuItem);

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

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

        MenuOptionsMenu.AddItem(AboutOptionsMenuItem);

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

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

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

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

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

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

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

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

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

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

        MainMenu.RefreshIndex();
        InventoryMenu.RefreshIndex();
    }
예제 #3
0
    public MenuExample()
    {
        Tick += OnTick;
        KeyDown += OnKeyDown;
        _menuPool = new MenuPool();

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

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

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

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

        newMenu = new UIMenu("Native UI", "~r~NATIVEUI SHOWCASE");
        _menuPool.Add(newMenu);
        for (int i = 0; i < 20; i++)
        {
            newMenu.AddItem(new UIMenuItem("PageFiller", "Sample description that takes more than one line. Moreso, it takes way more than two lines since it's so long. Wow, check out this length!"));
        }
        newMenu.RefreshIndex();
        mainMenu.BindMenuToItem(newMenu, menuItem);
    }
예제 #4
0
    public void AddMenuFoods(UIMenu menu)
    {
        var foods = new List<dynamic>
        {
            "Banana",
            "Apple",
            "Pizza",
            "Quartilicious",
            0xF00D, // Dynamic!
        };
        var newitem = new UIMenuListItem("Food", foods, 0);
        menu.AddItem(newitem);
        menu.OnListChange += (sender, item, index) =>
        {
            if (item == newitem)
            {
                dish = item.IndexToItem(index).ToString();
                UI.Notify("Preparing ~b~" + dish + "~w~...");
            }

        };
    }
예제 #5
0
파일: MapEditor.cs 프로젝트: Guad/MapEditor
        private void RedrawObjectInfoMenu(Entity ent, bool refreshIndex)
        {
            if(ent == null) return;
            string name = "";

            if (Function.Call<bool>(Hash.IS_ENTITY_AN_OBJECT, ent.Handle))
            {
                name = ObjectDatabase.MainDb.ContainsValue(ent.Model.Hash) ? ObjectDatabase.MainDb.First(x => x.Value == ent.Model.Hash).Key.ToUpper() : "Unknown Prop";
            }
            if (Function.Call<bool>(Hash.IS_ENTITY_A_VEHICLE, ent.Handle))
                name = ObjectDatabase.VehicleDb.ContainsValue(ent.Model.Hash) ? ObjectDatabase.VehicleDb.First(x => x.Value == ent.Model.Hash).Key.ToUpper() : "Unknown Vehicle";
            if (Function.Call<bool>(Hash.IS_ENTITY_A_PED, ent.Handle))
                name = ObjectDatabase.PedDb.ContainsValue(ent.Model.Hash) ? ObjectDatabase.PedDb.First(x => x.Value == ent.Model.Hash).Key.ToUpper() : "Unknown Ped";

            _objectInfoMenu.Subtitle.Caption = "~b~" + name;
            _objectInfoMenu.Clear();

            var posXitem = new UIMenuListItem(Translation.Translate("Position X"), _possiblePositions, (int)(Math.Round((ent.Position.X * 100) + _possibleRange)));
            var posYitem = new UIMenuListItem(Translation.Translate("Position Y"), _possiblePositions, (int)(Math.Round((ent.Position.Y * 100) + _possibleRange)));
            var posZitem = new UIMenuListItem(Translation.Translate("Position Z"), _possiblePositions, (int)(Math.Round((ent.Position.Z * 100) + _possibleRange)));

            var itemRot = ent.Quaternion.ToEuler();

            var rotXitem = new UIMenuListItem(Translation.Translate("Pitch"), _possibleRoll, (int)Math.Round((itemRot.Y * 100 * -1) + 36000));
            var rotYitem = new UIMenuListItem(Translation.Translate("Roll"), _possibleRoll, (int)Math.Round((itemRot.X * 100) + 36000));
            var rotZitem = new UIMenuListItem(Translation.Translate("Yaw"), _possibleRoll, (int)Math.Round((itemRot.Z * 100) + 36000));

            var dynamic = new UIMenuCheckboxItem(Translation.Translate("Dynamic"), !PropStreamer.StaticProps.Contains(ent.Handle));
            dynamic.CheckboxEvent += (ite, checkd) =>
            {
                if (checkd && PropStreamer.StaticProps.Contains(ent.Handle)) { PropStreamer.StaticProps.Remove(ent.Handle);}
                else if (!checkd && !PropStreamer.StaticProps.Contains(ent.Handle)) PropStreamer.StaticProps.Add(ent.Handle);

                ent.FreezePosition = PropStreamer.StaticProps.Contains(ent.Handle);
            };

            var ident = new UIMenuItem("Identification", "Optional identification for easier access during scripting.");
            if (PropStreamer.Identifications.ContainsKey(ent.Handle))
                ident.SetRightLabel(PropStreamer.Identifications[ent.Handle]);

            ident.Activated += (sender, item) =>
            {
                if (PropStreamer.Identifications.ContainsKey(ent.Handle))
                {
                    var newLabel = Game.GetUserInput(PropStreamer.Identifications[ent.Handle], 20);
                    if (PropStreamer.Identifications.ContainsValue(newLabel))
                    {
                        UI.Notify(Translation.Translate("~r~~h~Map Editor~h~~w~~n~The identification must be unique!"));
                        return;
                    }

                    if (newLabel.Length > 0 && (Regex.IsMatch(newLabel, @"^\d") || newLabel.StartsWith(".") || newLabel.StartsWith(",") || newLabel.StartsWith("\\")))
                    {
                        UI.Notify(Translation.Translate("~r~~h~Map Editor~h~~w~~n~This identification is invalid!"));
                        return;
                    }

                    PropStreamer.Identifications[ent.Handle] = newLabel;
                    ident.SetRightLabel(newLabel);
                }
                else
                {
                    var newLabel = Game.GetUserInput(20);
                    if (PropStreamer.Identifications.ContainsValue(newLabel))
                    {
                        UI.Notify(Translation.Translate("~r~~h~Map Editor~h~~w~~n~The identification must be unique!"));
                        return;
                    }
                    if (newLabel.Length > 0 && (Regex.IsMatch(newLabel, @"^\d") || newLabel.StartsWith(".") || newLabel.StartsWith(",") || newLabel.StartsWith("\\")))
                    {
                        UI.Notify(Translation.Translate("~r~~h~Map Editor~h~~w~~n~This identification is invalid!"));
                        return;
                    }
                    PropStreamer.Identifications.Add(ent.Handle, newLabel);
                    ident.SetRightLabel(newLabel);
                }
            };

            _objectInfoMenu.AddItem(posXitem);
            _objectInfoMenu.AddItem(posYitem);
            _objectInfoMenu.AddItem(posZitem);
            _objectInfoMenu.AddItem(rotXitem);
            _objectInfoMenu.AddItem(rotYitem);
            _objectInfoMenu.AddItem(rotZitem);
            _objectInfoMenu.AddItem(dynamic);
            _objectInfoMenu.AddItem(ident);

            if (Function.Call<bool>(Hash.IS_ENTITY_AN_OBJECT, ent.Handle))
            {
                var doorItem = new UIMenuCheckboxItem("Door", PropStreamer.Doors.Contains(ent.Handle), Translation.Translate("This option overrides the \"Dynamic\" setting."));
                doorItem.CheckboxEvent += (sender, @checked) =>
                {
                    if (@checked)
                    {
                        PropStreamer.Doors.Add(ent.Handle);
                        Function.Call(Hash.SET_ENTITY_DYNAMIC, ent.Handle, false);
                        ent.FreezePosition = false;
                    }
                    else
                    {
                        PropStreamer.Doors.Remove(ent.Handle);
                        var isDynamic = !PropStreamer.StaticProps.Contains(ent.Handle);
                        Function.Call(Hash.SET_ENTITY_DYNAMIC, ent.Handle, isDynamic);
                        ent.FreezePosition = !isDynamic;
                    }
                };
                _objectInfoMenu.AddItem(doorItem);
            }

            if (Function.Call<bool>(Hash.IS_ENTITY_A_PED, ent.Handle))
            {
                List<dynamic> actions = new List<dynamic> {"None", "Any - Walk", "Any - Warp", "Wander"};
                actions.AddRange(ObjectDatabase.ScrenarioDatabase.Keys);
                var scenarioItem = new UIMenuListItem(Translation.Translate("Idle Action"), actions, actions.IndexOf(PropStreamer.ActiveScenarios[ent.Handle]));
                scenarioItem.OnListChanged += (item, index) =>
                {
                    PropStreamer.ActiveScenarios[ent.Handle] = item.IndexToItem(index).ToString();
                    _changesMade++;
                };
                scenarioItem.Activated += (item, index) =>
                {
                    if (PropStreamer.ActiveScenarios[ent.Handle] == "None")
                    {
                        ((Ped)ent).Task.ClearAll();
                        return;
                    }
                    if (PropStreamer.ActiveScenarios[ent.Handle] == "Any - Walk" || PropStreamer.ActiveScenarios[ent.Handle] == "Any")
                    {
                        Function.Call(Hash.TASK_USE_NEAREST_SCENARIO_TO_COORD, ent.Handle, ent.Position.X, ent.Position.Y, ent.Position.Z, 100f, -1);
                        return;
                    }
                    if (PropStreamer.ActiveScenarios[ent.Handle] == "Any - Warp")
                    {
                        Function.Call(Hash.TASK_USE_NEAREST_SCENARIO_TO_COORD_WARP, ent.Handle, ent.Position.X, ent.Position.Y, ent.Position.Z, 100f, -1);
                        return;
                    }
                    if (PropStreamer.ActiveScenarios[ent.Handle] == "Wander")
                    {
                        Function.Call(Hash.TASK_WANDER_STANDARD, ent.Handle, 0, 0);
                        return;
                    }
                    string scenario = ObjectDatabase.ScrenarioDatabase[PropStreamer.ActiveScenarios[ent.Handle]];
                    if (Function.Call<bool>(Hash.IS_PED_USING_SCENARIO, ent.Handle, scenario))
                        ((Ped) ent).Task.ClearAll();
                    else
                    {
                        Function.Call(Hash.TASK_START_SCENARIO_IN_PLACE, ent.Handle, scenario, 0, 0);
                    }
                };
                _objectInfoMenu.AddItem(scenarioItem);

                List<dynamic> rels = new List<dynamic> { "Ballas", "Grove"};
                Enum.GetNames(typeof(Relationship)).ToList().ForEach(rel => rels.Add(rel));
                var relItem = new UIMenuListItem(Translation.Translate("Relationship"), rels, rels.IndexOf(PropStreamer.ActiveRelationships[ent.Handle]));
                relItem.OnListChanged += (item, index) =>
                {
                    PropStreamer.ActiveRelationships[ent.Handle] = item.IndexToItem(index).ToString();
                    _changesMade++;
                };
                relItem.Activated += (item, index) =>
                {
                    ObjectDatabase.SetPedRelationshipGroup((Ped) ent, PropStreamer.ActiveRelationships[ent.Handle]);
                };
                _objectInfoMenu.AddItem(relItem);

                List<dynamic> weps = new List<dynamic>();
                Enum.GetNames(typeof(WeaponHash)).ToList().ForEach(rel => weps.Add(rel));
                var wepItem = new UIMenuListItem(Translation.Translate("Weapon"), weps, weps.IndexOf(PropStreamer.ActiveWeapons[ent.Handle].ToString()));
                wepItem.OnListChanged += (item, index) =>
                {
                    PropStreamer.ActiveWeapons[ent.Handle] = Enum.Parse(typeof(WeaponHash), item.IndexToItem(index).ToString());
                    _changesMade++;
                };
                wepItem.Activated += (item, index) =>
                {
                    ((Ped)ent).Weapons.RemoveAll();
                    if(PropStreamer.ActiveWeapons[ent.Handle] == WeaponHash.Unarmed) return;
                    ((Ped) ent).Weapons.Give(PropStreamer.ActiveWeapons[ent.Handle], 999, true, true);
                };
                _objectInfoMenu.AddItem(wepItem);
            }

            if (Function.Call<bool>(Hash.IS_ENTITY_A_VEHICLE, ent.Handle))
            {
                var sirentBool = new UIMenuCheckboxItem(Translation.Translate("Siren"), PropStreamer.ActiveSirens.Contains(ent.Handle));
                sirentBool.CheckboxEvent += (item, check) =>
                {
                    if (check && !PropStreamer.ActiveSirens.Contains(ent.Handle)) PropStreamer.ActiveSirens.Add(ent.Handle);
                    else if (!check && PropStreamer.ActiveSirens.Contains(ent.Handle)) PropStreamer.ActiveSirens.Remove(ent.Handle);
                    ((Vehicle) ent).SirenActive = check;
                    _changesMade++;
                };
                _objectInfoMenu.AddItem(sirentBool);
            }

            if (PropStreamer.IsPickup(ent.Handle))
            {
                var pickup = PropStreamer.GetPickup(ent.Handle);
                var amountList = new UIMenuItem(Translation.Translate("Amount"));
                amountList.SetRightLabel(pickup.Amount.ToString());
                amountList.Activated += (sender, item) =>
                {
                    string playerInput = Game.GetUserInput(10);
                    int newValue;
                    if (!int.TryParse(playerInput, out newValue) || newValue < -1)
                    {
                        UI.Notify("~r~~h~Map Editor~h~~n~~w~" +
                                  Translation.Translate("Input was not in the correct format."));
                        return;
                    }
                    pickup.SetAmount(newValue);
                    amountList.SetRightLabel(pickup.Amount.ToString());
                    _selectedProp = new Prop(pickup.ObjectHandle);
                    if (_settings.SnapCameraToSelectedObject)
                        _mainCamera.PointAt(_selectedProp);
                };
                _objectInfoMenu.AddItem(amountList);

                var pickupTypesList =
                    Enum.GetValues(typeof (ObjectDatabase.PickupHash)).Cast<ObjectDatabase.PickupHash>().ToList();
                var itemIndex = pickupTypesList.IndexOf((ObjectDatabase.PickupHash) pickup.PickupHash);

                var pickupTypeItem = new UIMenuListItem("Type", pickupTypesList.Select(s => (dynamic)(s.ToString())).ToList(), itemIndex);
                pickupTypeItem.OnListChanged += (sender, index) =>
                {
                    pickup.SetPickupHash((int)pickupTypesList[index]);
                    _selectedProp = new Prop(pickup.ObjectHandle);
                    if (_settings.SnapCameraToSelectedObject)
                        _mainCamera.PointAt(_selectedProp);
                };
                _objectInfoMenu.AddItem(pickupTypeItem);

                var timeoutTime = new UIMenuItem("Regeneration Time");
                timeoutTime.SetRightLabel(pickup.Timeout.ToString());

                timeoutTime.Activated += (sender, item) =>
                {
                    string playerInput = Game.GetUserInput(10);
                    int newValue;
                    if (!int.TryParse(playerInput, out newValue) || newValue < 0)
                    {
                        UI.Notify("~r~~h~Map Editor~h~~n~~w~" +
                                  Translation.Translate("Input was not in the correct format."));
                        return;
                    }
                    pickup.Timeout = newValue;
                    timeoutTime.SetRightLabel((newValue).ToString());
                };

                _objectInfoMenu.AddItem(timeoutTime);
            }

            posXitem.Activated +=
                (sender, item) =>
                    SetObjectVector(ent, posXitem, GetSafeFloat(Game.GetUserInput(ent.Position.X.ToString(CultureInfo.InvariantCulture), 10), ent.Position.X), ent.Position.Y, ent.Position.Z);
            posYitem.Activated +=
                (sender, item) =>
                    SetObjectVector(ent, posYitem, ent.Position.X, GetSafeFloat(Game.GetUserInput(ent.Position.Y.ToString(CultureInfo.InvariantCulture), 10), ent.Position.Y), ent.Position.Z);
            posZitem.Activated +=
                (sender, item) =>
                    SetObjectVector(ent, posZitem, ent.Position.X, ent.Position.Y, GetSafeFloat(Game.GetUserInput(ent.Position.Z.ToString(CultureInfo.InvariantCulture), 10), ent.Position.Z));

            posXitem.OnListChanged += (item, index) =>
            {
                if (!IsProp(ent) )
                    ent.Position = new Vector3((float) item.IndexToItem(index), ent.Position.Y, ent.Position.Z);
                else
                    ent.PositionNoOffset = new Vector3((float)item.IndexToItem(index), ent.Position.Y, ent.Position.Z);

                if (PropStreamer.IsPickup(ent.Handle))
                {
                    PropStreamer.GetPickup(ent.Handle).UpdatePos();
                }

                _changesMade++;
            };
            posYitem.OnListChanged += (item, index) =>
            {
                if (!IsProp(ent))
                    ent.Position = new Vector3(ent.Position.X, (float) item.IndexToItem(index), ent.Position.Z);
                else
                    ent.PositionNoOffset = new Vector3(ent.Position.X, (float)item.IndexToItem(index), ent.Position.Z);

                if (PropStreamer.IsPickup(ent.Handle))
                {
                    PropStreamer.GetPickup(ent.Handle).UpdatePos();
                }
                _changesMade++;
            };
            posZitem.OnListChanged += (item, index) =>
            {
                if (!IsProp(ent) )
                    ent.Position = new Vector3(ent.Position.X, ent.Position.Y, (float)item.IndexToItem(index));
                else
                    ent.PositionNoOffset = new Vector3(ent.Position.X, ent.Position.Y, (float)item.IndexToItem(index));

                if (PropStreamer.IsPickup(ent.Handle))
                {
                    PropStreamer.GetPickup(ent.Handle).UpdatePos();
                }
                _changesMade++;
            };

            rotXitem.Activated +=
                (sender, item) =>
                {
                    var rot = ent.Quaternion.ToEuler();
                    SetObjectRotation(ent,
                        GetSafeFloat(Game.GetUserInput(rot.X.ToString(CultureInfo.InvariantCulture).Limit(10), 10),
                            rot.X), rot.Y, rot.Z);
                };
            rotYitem.Activated +=
                (sender, item) =>
                {
                    var rot = ent.Quaternion.ToEuler();
                    SetObjectRotation(ent, rot.X,
                        GetSafeFloat(Game.GetUserInput(rot.Y.ToString(CultureInfo.InvariantCulture).Limit(10), 10),
                            rot.Y), rot.Z);
                };
            rotZitem.Activated +=
                (sender, item) =>
                {
                    var rot = ent.Quaternion.ToEuler();
                    SetObjectRotation(ent, rot.X, rot.Y,
                        GetSafeFloat(Game.GetUserInput(rot.Z.ToString(CultureInfo.InvariantCulture).Limit(10), 10),
                            rot.Z));
                };

            rotYitem.OnListChanged += (item, index) =>
            {
                var change = (float)item.IndexToItem(index);
                ent.Quaternion = new Vector3(change, ent.Rotation.Y, ent.Rotation.Z).ToQuaternion();
                _changesMade++;
            };

            rotZitem.OnListChanged += (item, index) =>
            {
                var change = (float) item.IndexToItem(index);
                ent.Quaternion = new Vector3(ent.Rotation.X, ent.Rotation.Y, change).ToQuaternion();
                _changesMade++;
            };

            rotXitem.OnListChanged += (item, index) =>
            {
                var change = (float)item.IndexToItem(index);
                ent.Quaternion = new Vector3(ent.Rotation.X, change, ent.Rotation.Z).ToQuaternion();
                _changesMade++;
            };

            if (refreshIndex)
                _objectInfoMenu.RefreshIndex();
        }
예제 #6
0
파일: Trainer.cs 프로젝트: YossiBz/YTrainer
 private void OnListChange(UIMenu sender, UIMenuListItem listItem, int newIndex)
 {
     #region SenderPlayer
     if (sender == playerMenu)
     {
         Game.Player.WantedLevel = listItem.Index;
     }
     #endregion
     #region SenderVehicle
     if (sender == carMenu)
     {
         if (listItem == CarColors)
         {
             Vehicle veh = Game.Player.Character.CurrentVehicle;
             if (listItem.Index == 0) { ChangeColor(VehicleColor.MetallicRed); }
             if (listItem.Index == 1) { ChangeColor(VehicleColor.MetallicBlue); }
             if (listItem.Index == 2) { ChangeColor(VehicleColor.MetallicBlack); }
             if (listItem.Index == 3) { ChangeColor(VehicleColor.MetallicGreen); }
             if (listItem.Index == 4) { ChangeColor(VehicleColor.MetallicWhite); }
             if (listItem.Index == 5) { ChangeColor(VehicleColor.MetallicRaceYellow); }
         }
     }
     #endregion
     #region SenderTime
     if (sender == timeMenu)
     {
         if (listItem == DOH)
         {
             if (listItem.Index == 0) Function.Call(Hash.SET_CLOCK_DATE, 1, World.CurrentDate.Month, World.CurrentDate.Year);
             if (listItem.Index == 1) Function.Call(Hash.SET_CLOCK_DATE, 2, World.CurrentDate.Month, World.CurrentDate.Year);
             if (listItem.Index == 2) Function.Call(Hash.SET_CLOCK_DATE, 3, World.CurrentDate.Month, World.CurrentDate.Year);
             if (listItem.Index == 3) Function.Call(Hash.SET_CLOCK_DATE, 4, World.CurrentDate.Month, World.CurrentDate.Year);
             if (listItem.Index == 4) Function.Call(Hash.SET_CLOCK_DATE, 5, World.CurrentDate.Month, World.CurrentDate.Year);
             if (listItem.Index == 5) Function.Call(Hash.SET_CLOCK_DATE, 6, World.CurrentDate.Month, World.CurrentDate.Year);
             if (listItem.Index == 6) Function.Call(Hash.SET_CLOCK_DATE, 7, World.CurrentDate.Month, World.CurrentDate.Year);
         }
     }
     #endregion
     #region SenderTeleport
     if (sender == teleportMenu)
     {
         if (listItem == Spaceship)
         {
             if (listItem.Index == 0) Game.Player.Character.Position = new Vector3(428.9633f, 6468.706f, 28.7793f);
             if (listItem.Index == 1) Game.Player.Character.Position = new Vector3(-377.6008f, 6085.317f, 39.6054f);
             if (listItem.Index == 2) Game.Player.Character.Position = new Vector3(-511.4319f, 5665.392f, 47.18425f);
             if (listItem.Index == 3) Game.Player.Character.Position = new Vector3(2196.858f, 5605.221f, 53.46579f);
             if (listItem.Index == 4) Game.Player.Character.Position = new Vector3(-1440.44f, 5408.934f, 24.91879f);
             if (listItem.Index == 5) Game.Player.Character.Position = new Vector3(2426.09f, 4781.363f, 34.53447f);
             if (listItem.Index == 6) Game.Player.Character.Position = new Vector3(-1949.748f, 4579.819f, 48.60158f);
             if (listItem.Index == 7) Game.Player.Character.Position = new Vector3(3830.587f, 4444.813f, 2.741449f);
             if (listItem.Index == 8) Game.Player.Character.Position = new Vector3(-523.1528f, 4437.72f, 31.19645f);
             if (listItem.Index == 9) Game.Player.Character.Position = new Vector3(1493.419f, 3841.722f, 25.35632f);
             if (listItem.Index == 10) Game.Player.Character.Position = new Vector3(2515.396f, 3783.656f, 53.00525f);
             if (listItem.Index == 11) Game.Player.Character.Position = new Vector3(-584.2244f, 3583.952f, 268.1571f);
             if (listItem.Index == 12) Game.Player.Character.Position = new Vector3(1923.4f, 3466.915f, 51.53664f);
             if (listItem.Index == 13) Game.Player.Character.Position = new Vector3(77.28337f, 3278.656f, 31.13165f);
             if (listItem.Index == 14) Game.Player.Character.Position = new Vector3(-387.5963f, 2956.099f, 20.28623f);
             if (listItem.Index == 15) Game.Player.Character.Position = new Vector3(1964.487f, 2919.821f, 57.10085f);
             if (listItem.Index == 16) Game.Player.Character.Position = new Vector3(891.7535f, 2861.718f, 56.29594f);
             if (listItem.Index == 17) Game.Player.Character.Position = new Vector3(171.3739f, 2214.534f, 90.55803f);
             if (listItem.Index == 18) Game.Player.Character.Position = new Vector3(3132.028f, 2205.297f, -5.922436f);
             if (listItem.Index == 19) Game.Player.Character.Position = new Vector3(1371.199f, 2186.829f, 97.91506f);
             if (listItem.Index == 20) Game.Player.Character.Position = new Vector3(-1443.997f, 2136.469f, 30.47571f);
             if (listItem.Index == 21) Game.Player.Character.Position = new Vector3(-1939.431f, 1953.672f, 156.9697f);
             if (listItem.Index == 22) Game.Player.Character.Position = new Vector3(796.1694f, 1841.498f, 123.736f);
             if (listItem.Index == 23) Game.Player.Character.Position = new Vector3(-2807.29f, 1451.316f, 100.8354f);
             if (listItem.Index == 24) Game.Player.Character.Position = new Vector3(-1903.989f, 1388.988f, 218.8167f);
             if (listItem.Index == 25) Game.Player.Character.Position = new Vector3(-411.1031f, 1100.412f, 332.5343f);
             if (listItem.Index == 26) Game.Player.Character.Position = new Vector3(-1533.125f, 869.5099f, 181.8977f);
             if (listItem.Index == 27) Game.Player.Character.Position = new Vector3(85.95246f, 812.373f, 214.2908f);
             if (listItem.Index == 28) Game.Player.Character.Position = new Vector3(2908.929f, 804.3307f, 2.923146f);
             if (listItem.Index == 29) Game.Player.Character.Position = new Vector3(22.86215f, 639.6559f, 190.6649f);
             if (listItem.Index == 30) Game.Player.Character.Position = new Vector3(1965.278f, 551.0641f, 161.405f);
             if (listItem.Index == 31) Game.Player.Character.Position = new Vector3(1683.04f, 36.84582f, 156.6593f);
             if (listItem.Index == 32) Game.Player.Character.Position = new Vector3(-1175.974f, -63.66705f, 45.80711f);
             if (listItem.Index == 33) Game.Player.Character.Position = new Vector3(-416.1761f, -139.9122f, 64.41656f);
             if (listItem.Index == 34) Game.Player.Character.Position = new Vector3(-233.4292f, -244.759f, 49.90495f);
             if (listItem.Index == 35) Game.Player.Character.Position = new Vector3(-1182.393f, -521.6902f, 40.84121f);
             if (listItem.Index == 36) Game.Player.Character.Position = new Vector3(161.4487f, -560.5097f, 21.99138f);
             if (listItem.Index == 37) Game.Player.Character.Position = new Vector3(195.8474f, -566.9279f, 129.09f);
             if (listItem.Index == 38) Game.Player.Character.Position = new Vector3(465.8565f, -730.8796f, 27.36073f);
             if (listItem.Index == 39) Game.Player.Character.Position = new Vector3(1236.186f, -1105.222f, 35.68897f);
             if (listItem.Index == 40) Game.Player.Character.Position = new Vector3(-901.9235f, -1162.494f, 32.74917f);
             if (listItem.Index == 41) Game.Player.Character.Position = new Vector3(14.27985f, -1214.412f, 29.35767f);
             if (listItem.Index == 42) Game.Player.Character.Position = new Vector3(293.9202f, -1447.16f, 46.50953f);
             if (listItem.Index == 43) Game.Player.Character.Position = new Vector3(1742.733f, -1626.818f, 112.4214f);
             if (listItem.Index == 44) Game.Player.Character.Position = new Vector3(375.8281f, -2118.732f, 16.63311f);
             if (listItem.Index == 45) Game.Player.Character.Position = new Vector3(1134.959f, -2612.322f, 15.01656f);
             if (listItem.Index == 46) Game.Player.Character.Position = new Vector3(338.3029f, -2776.947f, 43.63181f);
             if (listItem.Index == 47) Game.Player.Character.Position = new Vector3(1590.83f, -2808.073f, 4.886177f);
             if (listItem.Index == 48) Game.Player.Character.Position = new Vector3(640.5842f, -3234.545f, -6.723347f);
             if (listItem.Index == 49) Game.Player.Character.Position = new Vector3(-1221.659f, -3500.85f, 13.94022f);
         }
         else if (listItem == LetterScraps)
         {
             if (listItem.Index == 0) Game.Player.Character.Position = new Vector3(65.34869f, 6666.156f, 31.78671f);
             if (listItem.Index == 1) Game.Player.Character.Position = new Vector3(1466.263f, 6553.133f, 14.00003f);
             if (listItem.Index == 2) Game.Player.Character.Position = new Vector3(1439.065f, 6339.318f, 23.97289f);
             if (listItem.Index == 3) Game.Player.Character.Position = new Vector3(-407.6179f, 6317.704f, 32.22429f);
             if (listItem.Index == 4) Game.Player.Character.Position = new Vector3(448.968f, 5571.466f, 781.1895f);
             if (listItem.Index == 5) Game.Player.Character.Position = new Vector3(-577.3812f, 5475.307f, 59.59092f);
             if (listItem.Index == 6) Game.Player.Character.Position = new Vector3(3439.125f, 5171.243f, 7.382134f);
             if (listItem.Index == 7) Game.Player.Character.Position = new Vector3(1885.61f, 5072.688f, 49.91392f);
             if (listItem.Index == 8) Game.Player.Character.Position = new Vector3(-998.3422f, 4851.768f, 274.6058f);
             if (listItem.Index == 9) Game.Player.Character.Position = new Vector3(-6.790287f, 4333.423f, 30.95481f);
             if (listItem.Index == 10) Game.Player.Character.Position = new Vector3(1340.616f, 4310.821f, 38.05003f);
             if (listItem.Index == 11) Game.Player.Character.Position = new Vector3(-1615.989f, 4254.568f, 104.6422f);
             if (listItem.Index == 12) Game.Player.Character.Position = new Vector3(1560.667f, 3570.773f, 34.21519f);
             if (listItem.Index == 13) Game.Player.Character.Position = new Vector3(1296.115f, 2999.824f, 57.45974f);
             if (listItem.Index == 14) Game.Player.Character.Position = new Vector3(270.2968f, 2864.539f, 74.17455f);
             if (listItem.Index == 15) Game.Player.Character.Position = new Vector3(-289.0979f, 2845.869f, 54.49178f);
             if (listItem.Index == 16) Game.Player.Character.Position = new Vector3(-863.0441f, 2764.57f, 12.18814f);
             if (listItem.Index == 17) Game.Player.Character.Position = new Vector3(-2375.308f, 2653.895f, 1.945716f);
             if (listItem.Index == 18) Game.Player.Character.Position = new Vector3(927.8638f, 2443.79f, 49.96547f);
             if (listItem.Index == 19) Game.Player.Character.Position = new Vector3(181.7735f, 2260.24f, 91.67735f);
             if (listItem.Index == 20) Game.Player.Character.Position = new Vector3(3072.118f, 2209.815f, 2.095346f);
             if (listItem.Index == 21) Game.Player.Character.Position = new Vector3(-598.6772f, 2095.236f, 131.0359f);
             if (listItem.Index == 22) Game.Player.Character.Position = new Vector3(3086.63f, 1650.125f, 2.997782f);
             if (listItem.Index == 23) Game.Player.Character.Position = new Vector3(-424.2659f, 1593.65f, 356.0899f);
             if (listItem.Index == 24) Game.Player.Character.Position = new Vector3(-1552.149f, 1379.944f, 126.3862f);
             if (listItem.Index == 25) Game.Player.Character.Position = new Vector3(683.9818f, 1204.636f, 345.3259f);
             if (listItem.Index == 26) Game.Player.Character.Position = new Vector3(-142.4939f, 865.4499f, 232.6988f);
             if (listItem.Index == 27) Game.Player.Character.Position = new Vector3(-2301.925f, 214.8605f, 167.6018f);
             if (listItem.Index == 28) Game.Player.Character.Position = new Vector3(1054.501f, 172.1009f, 88.7405f);
             if (listItem.Index == 29) Game.Player.Character.Position = new Vector3(-348.2878f, 53.02789f, 53.97811f);
             if (listItem.Index == 30) Game.Player.Character.Position = new Vector3(-3019.106f, 38.84162f, 10.11778f);
             if (listItem.Index == 31) Game.Player.Character.Position = new Vector3(265.6096f, -196.0606f, 61.78744f);
             if (listItem.Index == 32) Game.Player.Character.Position = new Vector3(-1724.862f, -199.2318f, 57.67747f);
             if (listItem.Index == 33) Game.Player.Character.Position = new Vector3(1093.903f, -212.4823f, 56.64005f);
             if (listItem.Index == 34) Game.Player.Character.Position = new Vector3(84.11265f, -437.2677f, 38.28443f);
             if (listItem.Index == 35) Game.Player.Character.Position = new Vector3(-1241.847f, -509.9374f, 38.60191f);
             if (listItem.Index == 36) Game.Player.Character.Position = new Vector3(-120.4983f, -977.9604f, 304.2492f);
             if (listItem.Index == 37) Game.Player.Character.Position = new Vector3(641.1895f, -1034.883f, 36.88861f);
             if (listItem.Index == 38) Game.Player.Character.Position = new Vector3(-1817.849f, -1200.371f, 19.16463f);
             if (listItem.Index == 39) Game.Player.Character.Position = new Vector3(-1031.167f, -1281.027f, 1.886165f);
             if (listItem.Index == 40) Game.Player.Character.Position = new Vector3(2864.857f, -1377.007f, 2.462856f);
             if (listItem.Index == 41) Game.Player.Character.Position = new Vector3(-1385.745f, -1406.125f, 3.223899f);
             if (listItem.Index == 42) Game.Player.Character.Position = new Vector3(1.632038f, -1732.346f, 31.42474f);
             if (listItem.Index == 43) Game.Player.Character.Position = new Vector3(66.54893f, -1963.919f, 20.91306f);
             if (listItem.Index == 44) Game.Player.Character.Position = new Vector3(1509.555f, -2125.469f, 76.20045f);
             if (listItem.Index == 45) Game.Player.Character.Position = new Vector3(751.3604f, -2298.847f, 19.30667f);
             if (listItem.Index == 46) Game.Player.Character.Position = new Vector3(-918.9688f, -2530.136f, 23.32149f);
             if (listItem.Index == 47) Game.Player.Character.Position = new Vector3(-79.09715f, -2726.035f, 8.7402f);
             if (listItem.Index == 48) Game.Player.Character.Position = new Vector3(-1047.428f, -2733.717f, 13.82589f);
             if (listItem.Index == 49) Game.Player.Character.Position = new Vector3(1022.074f, -3026.501f, 14.32748f);
         }
     }
     #endregion
 }
예제 #7
0
        private void CreateMenu()
        {
            _mainMenu = new UIMenu("Tobii Eye Tracking", "~b~SETTINGS");
            _mainMenu.SetMenuWidthOffset(50);
            //_mainMenu.ControlDisablingEnabled = false;
            _menuPool.Add(_mainMenu);

            var values0To1 = new List<dynamic>();
            for (var i = 0; i <= 10; i++)
            {
                values0To1.Add(i * 0.1);
            }
            var valuesMinus1To1 = new List<dynamic>();
            for (var i = -10; i <= 10; i++)
            {
                valuesMinus1To1.Add(i * 0.1);
            }

            var values0To70 = new List<dynamic>();
            for (var i = 0; i <= 70; i++)
            {
                values0To70.Add((double)i);
            }

            var valuesMinus70To0 = new List<dynamic>();
            for (var i = -70; i <= 0; i++)
            {
                valuesMinus70To0.Add((double)i);
            }

            var freelookDevices = new List<dynamic>
            {
                "Gamepad",
                "Mouse"
            };

            _freelookDevice = new UIMenuListItem("Freelook device", freelookDevices, (int)_settings.FreelookDevice, "Device to use for freelook");
            _freelookDevice.OnListChanged += (sender, args) => { _settings.FreelookDevice = (FeeelookDevice)_freelookDevice.Index; };
            _mainMenu.AddItem(_freelookDevice);

            var thirdPersonFreelook = new UIMenuCheckboxItem("TPS Freelook", _settings.ThirdPersonFreelookEnabled, "Control camera with gaze");
            thirdPersonFreelook.CheckboxEvent += (sender, args) => { _settings.ThirdPersonFreelookEnabled = thirdPersonFreelook.Checked; };
            _mainMenu.AddItem(thirdPersonFreelook);

            var thirdPersonSensitivitySlider = new UIMenuListItem("TPS Freelook Sensitivity", values0To1, (int)Math.Round(_settings.ThirdPersonSensitivity / 0.1), "Freelook sensitivity");
            thirdPersonSensitivitySlider.OnListChanged += (sender, args) => { _settings.ThirdPersonSensitivity = thirdPersonSensitivitySlider.IndexToItem(thirdPersonSensitivitySlider.Index); };
            _mainMenu.AddItem(thirdPersonSensitivitySlider);

            {
                var thirdPersonYOffsetSlider = new UIMenuListItem("TPS Freelook Vertical Offset", valuesMinus1To1, (int)Math.Round((_settings.ThirdPersonYOffset + 1) / 0.1), "Freelook vertical offset");
                thirdPersonYOffsetSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonYOffset = thirdPersonYOffsetSlider.IndexToItem(thirdPersonYOffsetSlider.Index); };
                _mainMenu.AddItem(thirdPersonYOffsetSlider);

                var thirdPersonDeadZoneWidthSlider = new UIMenuListItem("TPS Freelook Deadzone Width", values0To1, (int)Math.Round(_settings.ThirdPersonDeadZoneWidth / 0.1), "Freelook deadzone");
                thirdPersonDeadZoneWidthSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonDeadZoneWidth = thirdPersonDeadZoneWidthSlider.IndexToItem(thirdPersonDeadZoneWidthSlider.Index); };
                _mainMenu.AddItem(thirdPersonDeadZoneWidthSlider);

                var thirdPersonDeadZoneHeightSlider = new UIMenuListItem("TPS Freelook Deadzone Height", values0To1, (int)Math.Round(_settings.ThirdPersonDeadZoneHeight / 0.1), "Freelook deadzone");
                thirdPersonDeadZoneHeightSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonDeadZoneHeight = thirdPersonDeadZoneHeightSlider.IndexToItem(thirdPersonDeadZoneHeightSlider.Index); };
                _mainMenu.AddItem(thirdPersonDeadZoneHeightSlider);

                var thirdPersonMinPitchSlider = new UIMenuListItem("TPS Min Pitch", valuesMinus70To0, (int)Math.Round((_settings.ThirdPersonMinPitchDeg + 70) / 1), "Freelook min pitch angle");
                thirdPersonMinPitchSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonMinPitchDeg = thirdPersonMinPitchSlider.IndexToItem(thirdPersonMinPitchSlider.Index); };
                _mainMenu.AddItem(thirdPersonMinPitchSlider);

                var thirdPersonMaxPitchSlider = new UIMenuListItem("TPS Max Pitch", values0To70, (int)Math.Round((_settings.ThirdPersonMaxPitchDeg) / 1), "Freelook max pitch angle");
                thirdPersonMaxPitchSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonMaxPitchDeg = thirdPersonMaxPitchSlider.IndexToItem(thirdPersonMaxPitchSlider.Index); };
                _mainMenu.AddItem(thirdPersonMaxPitchSlider);
            }

            {
                var thirdPersonYOffsetDrivingSlider = new UIMenuListItem("TPS Freelook Vertical Offset Driving", valuesMinus1To1, (int)Math.Round((_settings.ThirdPersonYOffsetDriving + 1) / 0.1), "Freelook vertical offset");
                thirdPersonYOffsetDrivingSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonYOffsetDriving = thirdPersonYOffsetDrivingSlider.IndexToItem(thirdPersonYOffsetDrivingSlider.Index); };
                _mainMenu.AddItem(thirdPersonYOffsetDrivingSlider);

                var thirdPersonDeadZoneWidthDrivingSlider = new UIMenuListItem("TPS Freelook Deadzone Width Driving", values0To1, (int)Math.Round(_settings.ThirdPersonDeadZoneWidthDriving / 0.1), "Freelook deadzone");
                thirdPersonDeadZoneWidthDrivingSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonDeadZoneWidthDriving = thirdPersonDeadZoneWidthDrivingSlider.IndexToItem(thirdPersonDeadZoneWidthDrivingSlider.Index); };
                _mainMenu.AddItem(thirdPersonDeadZoneWidthDrivingSlider);

                var thirdPersonDeadZoneHeightDrivingSlider = new UIMenuListItem("TPS Freelook Deadzone Height Driving", values0To1, (int)Math.Round(_settings.ThirdPersonDeadZoneHeightDriving / 0.1), "Freelook deadzone");
                thirdPersonDeadZoneHeightDrivingSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonDeadZoneHeightDriving = thirdPersonDeadZoneHeightDrivingSlider.IndexToItem(thirdPersonDeadZoneHeightDrivingSlider.Index); };
                _mainMenu.AddItem(thirdPersonDeadZoneHeightDrivingSlider);

                var thirdPersonMinPitchDrivingSlider = new UIMenuListItem("TPS Min Pitch Driving", valuesMinus70To0, (int)Math.Round((_settings.ThirdPersonMinPitchDrivingDeg + 70) / 1), "Freelook min pitch angle");
                thirdPersonMinPitchDrivingSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonMinPitchDrivingDeg = thirdPersonMinPitchDrivingSlider.IndexToItem(thirdPersonMinPitchDrivingSlider.Index); };
                _mainMenu.AddItem(thirdPersonMinPitchDrivingSlider);

                var thirdPersonMaxPitchDrivingSlider = new UIMenuListItem("TPS Max Pitch Driving", values0To70, (int)Math.Round((_settings.ThirdPersonMaxPitchDeg) / 1), "Freelook max pitch angle");
                thirdPersonMaxPitchDrivingSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonMaxPitchDrivingDeg = thirdPersonMaxPitchDrivingSlider.IndexToItem(thirdPersonMaxPitchDrivingSlider.Index); };
                _mainMenu.AddItem(thirdPersonMaxPitchDrivingSlider);
            }

            {
                var thirdPersonYOffsetPlaneSlider = new UIMenuListItem("TPS Freelook Vertical Offset Plane", valuesMinus1To1, (int)Math.Round((_settings.ThirdPersonYOffsetPlane + 1) / 0.1), "Freelook vertical offset");
                thirdPersonYOffsetPlaneSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonYOffsetPlane = thirdPersonYOffsetPlaneSlider.IndexToItem(thirdPersonYOffsetPlaneSlider.Index); };
                _mainMenu.AddItem(thirdPersonYOffsetPlaneSlider);

                var thirdPersonDeadZoneWidthPlaneSlider = new UIMenuListItem("TPS Freelook Deadzone Width Plane", values0To1, (int)Math.Round(_settings.ThirdPersonDeadZoneWidthPlane / 0.1), "Freelook deadzone");
                thirdPersonDeadZoneWidthPlaneSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonDeadZoneWidthPlane = thirdPersonDeadZoneWidthPlaneSlider.IndexToItem(thirdPersonDeadZoneWidthPlaneSlider.Index); };
                _mainMenu.AddItem(thirdPersonDeadZoneWidthPlaneSlider);

                var thirdPersonDeadZoneHeightPlaneSlider = new UIMenuListItem("TPS Freelook Deadzone Height Plane", values0To1, (int)Math.Round(_settings.ThirdPersonDeadZoneHeightPlane / 0.1), "Freelook deadzone");
                thirdPersonDeadZoneHeightPlaneSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonDeadZoneHeightPlane = thirdPersonDeadZoneHeightPlaneSlider.IndexToItem(thirdPersonDeadZoneHeightPlaneSlider.Index); };
                _mainMenu.AddItem(thirdPersonDeadZoneHeightPlaneSlider);

                var thirdPersonMinPitchPlaneSlider = new UIMenuListItem("TPS Min Pitch Plane", valuesMinus70To0, (int)Math.Round((_settings.ThirdPersonMinPitchPlaneDeg + 70) / 1), "Freelook min pitch angle");
                thirdPersonMinPitchPlaneSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonMinPitchPlaneDeg = thirdPersonMinPitchPlaneSlider.IndexToItem(thirdPersonMinPitchPlaneSlider.Index); };
                _mainMenu.AddItem(thirdPersonMinPitchPlaneSlider);

                var thirdPersonMaxPitchPlaneSlider = new UIMenuListItem("TPS Max Pitch Plane", values0To70, (int)Math.Round((_settings.ThirdPersonMaxPitchPlaneDeg) / 1), "Freelook max pitch angle");
                thirdPersonMaxPitchPlaneSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonMaxPitchPlaneDeg = thirdPersonMaxPitchPlaneSlider.IndexToItem(thirdPersonMaxPitchPlaneSlider.Index); };
                _mainMenu.AddItem(thirdPersonMaxPitchPlaneSlider);
            }

            {
                var thirdPersonYOffsetHeliSlider = new UIMenuListItem("TPS Freelook Vertical Offset Heli", valuesMinus1To1, (int)Math.Round((_settings.ThirdPersonYOffsetHeli + 1) / 0.1), "Freelook vertical offset");
                thirdPersonYOffsetHeliSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonYOffsetHeli = thirdPersonYOffsetHeliSlider.IndexToItem(thirdPersonYOffsetHeliSlider.Index); };
                _mainMenu.AddItem(thirdPersonYOffsetHeliSlider);

                var thirdPersonDeadZoneWidthHeliSlider = new UIMenuListItem("TPS Freelook Deadzone Width Heli", values0To1, (int)Math.Round(_settings.ThirdPersonDeadZoneWidthHeli / 0.1), "Freelook deadzone");
                thirdPersonDeadZoneWidthHeliSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonDeadZoneWidthHeli = thirdPersonDeadZoneWidthHeliSlider.IndexToItem(thirdPersonDeadZoneWidthHeliSlider.Index); };
                _mainMenu.AddItem(thirdPersonDeadZoneWidthHeliSlider);

                var thirdPersonDeadZoneHeightHeliSlider = new UIMenuListItem("TPS Freelook Deadzone Height Heli", values0To1, (int)Math.Round(_settings.ThirdPersonDeadZoneHeightHeli / 0.1), "Freelook deadzone");
                thirdPersonDeadZoneHeightHeliSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonDeadZoneHeightHeli = thirdPersonDeadZoneHeightHeliSlider.IndexToItem(thirdPersonDeadZoneHeightHeliSlider.Index); };
                _mainMenu.AddItem(thirdPersonDeadZoneHeightHeliSlider);

                var thirdPersonMinPitchHeliSlider = new UIMenuListItem("TPS Min Pitch Heli", valuesMinus70To0, (int)Math.Round((_settings.ThirdPersonMinPitchHeliDeg + 70) / 1), "Freelook min pitch angle");
                thirdPersonMinPitchHeliSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonMinPitchHeliDeg = thirdPersonMinPitchHeliSlider.IndexToItem(thirdPersonMinPitchHeliSlider.Index); };
                _mainMenu.AddItem(thirdPersonMinPitchHeliSlider);

                var thirdPersonMaxPitchHeliSlider = new UIMenuListItem("TPS Max Pitch Heli", values0To70, (int)Math.Round((_settings.ThirdPersonMaxPitchDeg) / 1), "Freelook max pitch angle");
                thirdPersonMaxPitchHeliSlider.OnListChanged += (sender, args) => { _settings.ThirdPersonMaxPitchHeliDeg = thirdPersonMaxPitchHeliSlider.IndexToItem(thirdPersonMaxPitchHeliSlider.Index); };
                _mainMenu.AddItem(thirdPersonMaxPitchHeliSlider);
            }

            var firstPersonFreelook = new UIMenuCheckboxItem("FPS Freelook", _settings.FirstPersonFreelookEnabled, "Control camera with gaze");
            firstPersonFreelook.CheckboxEvent += (sender, args) => { _settings.FirstPersonFreelookEnabled = firstPersonFreelook.Checked; };
            _mainMenu.AddItem(firstPersonFreelook);

            var firstPersonSensitivitySlider = new UIMenuListItem("FPS Freelook Sensitivity", values0To1, (int)Math.Round(_settings.FirstPersonSensitivity / 0.1), "Freelook sensitivity");
            firstPersonSensitivitySlider.OnListChanged += (sender, args) => { _settings.FirstPersonSensitivity = firstPersonSensitivitySlider.IndexToItem(firstPersonSensitivitySlider.Index); };
            _mainMenu.AddItem(firstPersonSensitivitySlider);

            {
                var firstPersonDeadZoneWidthSlider = new UIMenuListItem("FPS Freelook Deadzone Width", values0To1, (int)Math.Round(_settings.FirstPersonDeadZoneWidth / 0.1), "Freelook deadzone");
                firstPersonDeadZoneWidthSlider.OnListChanged += (sender, args) => { _settings.FirstPersonDeadZoneWidth = firstPersonDeadZoneWidthSlider.IndexToItem(firstPersonDeadZoneWidthSlider.Index); };
                _mainMenu.AddItem(firstPersonDeadZoneWidthSlider);

                var firstPersonDeadZoneHeightSlider = new UIMenuListItem("FPS Freelook Deadzone Height", values0To1, (int)Math.Round(_settings.FirstPersonDeadZoneHeight / 0.1), "Freelook deadzone");
                firstPersonDeadZoneHeightSlider.OnListChanged += (sender, args) => { _settings.FirstPersonDeadZoneHeight = firstPersonDeadZoneHeightSlider.IndexToItem(firstPersonDeadZoneHeightSlider.Index); };
                _mainMenu.AddItem(firstPersonDeadZoneHeightSlider);

                var firstPersonMinPitchSlider = new UIMenuListItem("FPS Min Pitch", valuesMinus70To0, (int)Math.Round((_settings.FirstPersonMinPitchDeg + 70) / 1), "Freelook min pitch angle");
                firstPersonMinPitchSlider.OnListChanged += (sender, args) => { _settings.FirstPersonMinPitchDeg = firstPersonMinPitchSlider.IndexToItem(firstPersonMinPitchSlider.Index); };
                _mainMenu.AddItem(firstPersonMinPitchSlider);

                var firstPersonMaxPitchSlider = new UIMenuListItem("FPS Max Pitch", values0To70, (int)Math.Round((_settings.FirstPersonMaxPitchDeg) / 1), "Freelook max pitch angle");
                firstPersonMaxPitchSlider.OnListChanged += (sender, args) => { _settings.FirstPersonMaxPitchDeg = firstPersonMaxPitchSlider.IndexToItem(firstPersonMaxPitchSlider.Index); };
                _mainMenu.AddItem(firstPersonMaxPitchSlider);
            }

            var aimingSensitivitySlider = new UIMenuListItem("Aiming Sensitivity", values0To1, (int)Math.Round(_settings.AimingSensitivity / 0.1), "Freelok sensitivity while aiming");
            aimingSensitivitySlider.OnListChanged += (sender, args) => { _settings.AimingSensitivity = aimingSensitivitySlider.IndexToItem(aimingSensitivitySlider.Index); };
            _mainMenu.AddItem(aimingSensitivitySlider);

            var aimWithGaze = new UIMenuCheckboxItem("Aim With Gaze", _settings.AimWithGazeEnabled, "Aim with gaze");
            aimWithGaze.CheckboxEvent += (sender, args) => { _settings.AimWithGazeEnabled = aimWithGaze.Checked; };
            _mainMenu.AddItem(aimWithGaze);

            var snapAtPedestrians = new UIMenuCheckboxItem("Snap At Pedestrians", _settings.SnapAtPedestriansEnabled, "Snap aim at pedestrians");
            snapAtPedestrians.CheckboxEvent += (sender, args) => { _settings.SnapAtPedestriansEnabled = snapAtPedestrians.Checked; };
            _mainMenu.AddItem(snapAtPedestrians);

            var gazeFilteringSlider = new UIMenuListItem("Gaze Filter", values0To1, (int)Math.Round(_settings.GazeFiltering / 0.1), "Filter gaze data");
            gazeFilteringSlider.OnListChanged += (sender, args) => { _settings.GazeFiltering = gazeFilteringSlider.IndexToItem(gazeFilteringSlider.Index); };
            _mainMenu.AddItem(gazeFilteringSlider);

            var incinerateAtGaze = new UIMenuCheckboxItem("Incinerate At Gaze", _settings.IncinerateAtGazeEnabled, "Incinerate at gaze");
            incinerateAtGaze.CheckboxEvent += (sender, args) => { _settings.IncinerateAtGazeEnabled = incinerateAtGaze.Checked; };
            _mainMenu.AddItem(incinerateAtGaze);

            var taseAtGaze = new UIMenuCheckboxItem("Tase At Gaze", _settings.TaseAtGazeEnabled, "Tase at gaze");
            taseAtGaze.CheckboxEvent += (sender, args) => { _settings.TaseAtGazeEnabled = taseAtGaze.Checked; };
            _mainMenu.AddItem(taseAtGaze);

            var missilesAtGaze = new UIMenuCheckboxItem("Launch Missiles At Gaze", _settings.MissilesAtGazeEnabled, "Launch missiles at gaze");
            missilesAtGaze.CheckboxEvent += (sender, args) => { _settings.MissilesAtGazeEnabled = missilesAtGaze.Checked; };
            _mainMenu.AddItem(missilesAtGaze);

            var pedestrianIntreraction = new UIMenuCheckboxItem("Pedestrian Interaction", _settings.PedestrianInteractionEnabled, "Pedestrians talk to you");
            pedestrianIntreraction.CheckboxEvent += (sender, args) => { _settings.PedestrianInteractionEnabled = pedestrianIntreraction.Checked; };
            _mainMenu.AddItem(pedestrianIntreraction);

            var dontFallFromBikes = new UIMenuCheckboxItem("Don't Fall From Bikes", _settings.DontFallFromBikesEnabled, "Never fall from bikes");
            dontFallFromBikes.CheckboxEvent += (sender, args) => { _settings.DontFallFromBikesEnabled = dontFallFromBikes.Checked; };
            _mainMenu.AddItem(dontFallFromBikes);

            var dedzns = new UIMenuItem("Deadzones");
            _mainMenu.AddItem(dedzns);

            _mainMenu.RefreshIndex();
            {
                DeadzoneMenu = new UIMenu("Tobii Eye Tracking", "~b~DEADZONES");
                DeadzoneMenu.SetMenuWidthOffset(50);
                _mainMenu.BindMenuToItem(DeadzoneMenu, dedzns);
                DeadzoneMenu.AddItem(new UIMenuItem("Add Deadzone", "Deadzones prevent camera movement when you are looking inside the zone, for example, the minimap."));
                DeadzoneMenu.RefreshIndex();
                _menuPool.Add(DeadzoneMenu);
            }
        }
예제 #8
0
        public void OnListChange(UIMenu sender, UIMenuListItem list, int index)
        {
            if (list == carSel)
            {
                switch(index)
                {
                    case 0:
                        _selectedCar = 0;
                        UI.Notify("~b~Buffalo");
                        break;
                    case 1:
                        _selectedCar = 1;
                        UI.Notify("~b~Bullet");

                        break;
                    case 2:
                        _selectedCar = 2;
                        UI.Notify("~b~Adder");

                        break;
                    case 3:
                        _selectedCar = 3;
                        UI.Notify("~b~Zentorno");
                        break;
                    case 4:
                        _selectedCar = 4;
                        UI.Notify("~b~Banshee");
                        break;
                    case 5:
                        _selectedCar = 5;
                        UI.Notify("~b~B-Type");
                        break;
                    case 6:
                        _selectedCar = 6;
                        UI.Notify("~b~BATI");
                        break;
                    case 7:
                        _selectedCar = 7;
                        UI.Notify("~o~ENTITY XF");
                        break;
                }
            }
        }
예제 #9
0
파일: UIMenu.cs 프로젝트: frodzet/NativeUI
 protected virtual void ListChange(UIMenuListItem sender, int newindex)
 {
     OnListChange?.Invoke(this, sender, newindex);
 }
예제 #10
0
        private void RedrawLists(string type)
        {
            Clear();
            var typeList = _database.Select(pair => pair.Key).Cast<dynamic>().ToList();
            var typeItem = new UIMenuListItem("Ammo Type", typeList, typeList.FindIndex(n => n.ToString() == type), "Select an ammo type to purchase.");
            AddItem(typeItem);

            typeItem.OnListChanged += (list, newindex) =>
            {
                string newType = ((UIMenuListItem)MenuItems[0]).IndexToItem(((UIMenuListItem)MenuItems[0]).Index).ToString();
                RedrawLists(newType);
            };

            var weaponItem = new UIMenuListItem("Weapon", GetListForType(type), 0);
            AddItem(weaponItem);

            var buyRounds = new UIMenuItem("Rounds x 24");
            buyRounds.SetRightLabel("113$");
            var buyAllRounds = new UIMenuItem("Full Ammo");
            buyRounds.SetRightLabel("113$");

            buyRounds.Activated += (menu, item) =>
            {
                Game.Player.Character.Weapons.Give((WeaponHash)Enum.Parse(typeof(WeaponHash), ((UIMenuListItem)MenuItems[1]).IndexToItem(((UIMenuListItem)MenuItems[1]).Index).ToString()), 24, false, false);
            };

            buyAllRounds.Activated += (menu, item) =>
            {
                Game.Player.Character.Weapons.Give((WeaponHash)Enum.Parse(typeof(WeaponHash), ((UIMenuListItem)MenuItems[1]).IndexToItem(((UIMenuListItem)MenuItems[1]).Index).ToString()), 9999, false, false);
            };

            AddItem(buyRounds);
            AddItem(buyAllRounds);
        }
예제 #11
0
        private UIMenu route_menu()
        {
            rm = new UIMenu("", "GTAV BUS MOD");
            menu_p.Add(rm);
            List<dynamic> route_names = _get_routes_name();
            var start_but = new UIMenuItem("Start", "Click to start route.");
            rm.AddItem(start_but);
            var _routes_list = new UIMenuListItem("Routes List", route_names, 0, "Choose route");
            rm.AddItem(_routes_list);
            var _cancel = new UIMenuItem("Cancel", "Cancel current route");
            _cancel.Enabled = false;
            rm.AddItem(_cancel);

            if(__lock)
            {
                start_but.Enabled = false;
                _routes_list.Enabled = false;
                _cancel.Enabled = true;

            }
            rm.SetBannerType("scripts\\bus_mod.png");
            rm.OnItemSelect += OnItemSelect;
            rm.OnListChange += OnListChange;
            rm.RefreshIndex();
            return rm;
        }
예제 #12
0
        //menu
        private UIMenu mis_menu()
        {
            mi_menu = new UIMenu("", "GTAV BUS MOD");
            menu_p.Add(mi_menu);
            List<dynamic> mission_name = _get_mission_name();
            var start_but = new UIMenuItem("Start", "Click to start mission.");
            mi_menu.AddItem(start_but);
            var _mission_list = new UIMenuListItem("Missions List", mission_name, 0, "Choose mission");
            mi_menu.AddItem(_mission_list);
            var _cancel = new UIMenuItem("Cancel", "Cancel current mission");
            _cancel.Enabled = false;
            mi_menu.AddItem(_cancel);

            if (_lock)
            {
                start_but.Enabled = false;
                _mission_list.Enabled = false;
                _cancel.Enabled = true;

            }
            mi_menu.SetBannerType("scripts\\bus_mod.png");
            mi_menu.OnItemSelect += OnItemSelect;
            mi_menu.OnListChange += OnListChange;
            mi_menu.RefreshIndex();
            return mi_menu;
        }
예제 #13
0
 public void OnListChange(UIMenu sender, UIMenuListItem list, int index)
 {
     if (sender != mainMenu || list != dishesListItem) return; // We only want to detect changes from our menu.
     string dish = list.IndexToItem(index).ToString();
     UI.Notify("Preparing ~b~" + dish +"~w~...");
 }
예제 #14
0
파일: MapEditor.cs 프로젝트: Guad/MapEditor
        public void SetObjectVector(Entity ent, UIMenuListItem item, float x, float y, float z)
        {
            var vect = new Vector3(x, y, z);

            if (!IsProp(ent))
                ent.Position = vect;
            else
                ent.PositionNoOffset = vect;

            if (PropStreamer.IsPickup(ent.Handle))
            {
                PropStreamer.GetPickup(ent.Handle).UpdatePos();
            }
            _changesMade++;
            RedrawObjectInfoMenu(ent, false);
            //return vect;
        }
예제 #15
0
 // main function
 public Drag_Race()
 {
     var cars = new List<dynamic>
     {
         "Buffalo",
         "Bullet",
         "Adder",
         "Zentorno",
         "Banshee",
         "B-Type",
         "BATI",
         "Entity XF",
     };
     ParseSettings();
     Tick += OnTick;
     KeyDown += OnKeyDown;
     Interval = 1;
     mainMenu = new UIMenu("Drag Race", "~g~Main Menu");
     startOne = new UIMenuItem("Start Race: One!", "Starts race 1, the coordinates are changeable in the ini. \nX: " + custom1x + "\nY: " + custom1y + "\nZ: " + custom1z);
     startTwo = new UIMenuItem("Start Race: Two!", "Starts race 2, the coordinates are changeable in the ini. \nX: " + custom2x + "\nY: " + custom2y + "\nZ: " + custom2z);
     startThree = new UIMenuItem("Start Race: Custom Race!", "Starts race 3, ONLY USE IF YOU'VE CHANGED THE INI");
     startFour = new UIMenuItem("Start Race: Waypoint", "Starts waypoint race, will only start if you have a waypoint set.");
     carSel = new UIMenuListItem("Car", cars, 0, "Select your car.");
     mainMenu.AddItem(startOne);
     mainMenu.AddItem(startTwo);
     mainMenu.AddItem(startThree);
     mainMenu.AddItem(startFour);
     mainMenu.AddItem(carSel);
     mainMenu.RefreshIndex();
     menuPool.Add(mainMenu);
     mainMenu.OnItemSelect += ItemSelectHandler;
     mainMenu.OnListChange += OnListChange;
 }
예제 #16
0
 /// <summary>
 /// Add list to menu.
 /// </summary>
 /// <param name="menu">Parent menu.</param>
 /// <param name="listitem">The list.</param>
 /// <param name="OnSelect">What to do when list is selected.</param>
 /// <param name="OnHover">What to do when list is hovered.</param>
 /// <param name="OnChange">What to do when list selection is changed.</param>
 public void AddListItem(
     UIMenu menu, UIMenuListItem listitem,
     Action OnSelect = null, Action OnHover = null, Action<int> OnChange = null)
 {
     AddItem(menu, listitem, OnSelect: OnSelect, OnHover: OnHover);
     if (OnChange != null)
         menu.OnListChange += (sender, item, index) =>
         {
             if (item == listitem) OnChange(index);
         };
 }
예제 #17
0
        private void CreateMenu()
        {
            _mainMenu = new UIMenu("Tobii Eye Tracking", "~b~SETTINGS");
            _mainMenu.SetMenuWidthOffset(50);
            //_mainMenu.ControlDisablingEnabled = false;
            _menuPool.Add(_mainMenu);

            InitLists();

            var firstPersonFreelook = new UIMenuCheckboxItem("Extended View", _settings.ExtendedViewEnabled, "Extend your view by looking at the edges of the screen");
            firstPersonFreelook.CheckboxEvent += (sender, args) => { _settings.ExtendedViewEnabled = firstPersonFreelook.Checked; };
            _mainMenu.AddItem(firstPersonFreelook);

            var extendedViewSensitivitySlider = new UIMenuListItem("Extended View Sensitivity", _values0To1, (int)Math.Round(_settings.ExtendedViewSensitivity / 0.1), "Extended View sensitivity");
            extendedViewSensitivitySlider.OnListChanged +=
                (sender, args) =>
                {
                    _settings.ExtendedViewSensitivity =
                        (float)extendedViewSensitivitySlider.IndexToItem(extendedViewSensitivitySlider.Index);
                };
            _mainMenu.AddItem(extendedViewSensitivitySlider);

            var fireAtGaze = new UIMenuCheckboxItem("Shoot At Gaze", _settings.FireAtGazeEnabled, "Your gun will shoot where you look. Move the RIGHT JOYSTICK while HOLDING LEFT THUMB to fine adjust the crosshair around your gaze point while shooting.");
            fireAtGaze.CheckboxEvent += (sender, args) => { _settings.FireAtGazeEnabled = fireAtGaze.Checked; };
            _mainMenu.AddItem(fireAtGaze);

            var aimAtGaze = new UIMenuCheckboxItem("Aim At Gaze", _settings.AimAtGazeEnabled, "You camera will turn towards the target when you press aim button.");
            aimAtGaze.CheckboxEvent += (sender, args) => { _settings.AimAtGazeEnabled = aimAtGaze.Checked; };
            _mainMenu.AddItem(aimAtGaze);

            var snapAtTargets = new UIMenuCheckboxItem("Snap At Targets", _settings.SnapAtTargetsEnabled, "Snap crosshair at targets. Makes it less challenging to use Aim At Gaze and Shoot At Gaze features.");
            snapAtTargets.CheckboxEvent += (sender, args) => { _settings.SnapAtTargetsEnabled = snapAtTargets.Checked; };
            _mainMenu.AddItem(snapAtTargets);

            var gazeFilteringSlider = new UIMenuListItem("Gaze Filter", _values0To1, (int)Math.Round(_settings.GazeFiltering / 0.1), "Filter gaze data. Higher values will make crosshair movements smoother, but will increase the latency.");
            gazeFilteringSlider.OnListChanged += (sender, args) => { _settings.GazeFiltering = (float)gazeFilteringSlider.IndexToItem(gazeFilteringSlider.Index); };
            _mainMenu.AddItem(gazeFilteringSlider);

            var incinerateAtGaze = new UIMenuCheckboxItem("Incinerate At Gaze", _settings.IncinerateAtGazeEnabled, "Push A button to burn things where you look. This feature replaces the default command for A button.");
            incinerateAtGaze.CheckboxEvent += (sender, args) => { _settings.IncinerateAtGazeEnabled = incinerateAtGaze.Checked; };
            _mainMenu.AddItem(incinerateAtGaze);

            var taseAtGaze = new UIMenuCheckboxItem("Tase At Gaze", _settings.TaseAtGazeEnabled, "Push RB to tase people remotely with your eyes. Doesn't work in aircrafts. This feature replaces the default command for RB.");
            taseAtGaze.CheckboxEvent += (sender, args) => { _settings.TaseAtGazeEnabled = taseAtGaze.Checked; };
            _mainMenu.AddItem(taseAtGaze);

            var missilesAtGaze = new UIMenuCheckboxItem("Launch Missiles At Gaze", _settings.MissilesAtGazeEnabled, "Push B button to launch missiles at gaze. This feature replaces the default command for B button.");
            missilesAtGaze.CheckboxEvent += (sender, args) => { _settings.MissilesAtGazeEnabled = missilesAtGaze.Checked; };
            _mainMenu.AddItem(missilesAtGaze);

            var alwaysShowCrosshair = new UIMenuCheckboxItem("Always Show Crosshair", _settings.AlwaysShowCrosshairEnabled, "Show crosshair even when you are not aiming or shooting");
            alwaysShowCrosshair.CheckboxEvent += (sender, args) => { _settings.AlwaysShowCrosshairEnabled = alwaysShowCrosshair.Checked; };
            _mainMenu.AddItem(alwaysShowCrosshair);

            var dontFallFromBikes = new UIMenuCheckboxItem("Don't Fall From Bikes", _settings.DontFallFromBikesEnabled, "You won't fall from a bike when you crash into something");
            dontFallFromBikes.CheckboxEvent += (sender, args) => { _settings.DontFallFromBikesEnabled = dontFallFromBikes.Checked; };
            _mainMenu.AddItem(dontFallFromBikes);

            const string privacyPolicyText = "By selecting to send usage statistics you agree that your usage statistics, such as a game session time, " +
                                             "mod settings and mod features you use will be collected by the developer. The data will be collected " +
                                             "anonymously, processed on Google Analytics and used solely to enhance user experience.";

            _sendUsageStatistics = new UIMenuCheckboxItem("Send Usage Statistics", _settings.SendUsageStatistics, privacyPolicyText);
            _sendUsageStatistics.CheckboxEvent += (sender, args) => { _settings.SendUsageStatistics = _sendUsageStatistics.Checked; };
            _mainMenu.AddItem(_sendUsageStatistics);

            _mainMenu.RefreshIndex();
        }
예제 #18
0
파일: MapEditor.cs 프로젝트: Guad/MapEditor
        private void RedrawObjectInfoMenu(Marker ent, bool refreshIndex)
        {
            if (ent == null) return;
            string name = ent.Type.ToString() + " #" + ent.Id;

            _objectInfoMenu.Subtitle.Caption = "~b~" + name;
            _objectInfoMenu.Clear();

            List<dynamic> possbileScale = new List<dynamic>();
            for (int i = 0; i <= 1000; i++)
            {
                possbileScale.Add(i * 0.01);
            }

            List<dynamic> possibleColors = new List<dynamic>();
            for (int i = 0; i <= 255; i++)
            {
                possibleColors.Add(i);
            }

            var posXitem = new UIMenuListItem(Translation.Translate("Position X"), _possiblePositions, (int)(Math.Round((ent.Position.X * 100) + _possibleRange)));
            var posYitem = new UIMenuListItem(Translation.Translate("Position Y"), _possiblePositions, (int)(Math.Round((ent.Position.Y * 100) + _possibleRange)));
            var posZitem = new UIMenuListItem(Translation.Translate("Position Z"), _possiblePositions, (int)(Math.Round((ent.Position.Z * 100) + _possibleRange)));

            var rotXitem = new UIMenuListItem(Translation.Translate("Rotation X"), _possiblePositions, (int)(Math.Round((ent.Rotation.X * 100) + _possibleRange)));
            var rotYitem = new UIMenuListItem(Translation.Translate("Rotation Y"), _possiblePositions, (int)(Math.Round((ent.Rotation.Y * 100) + _possibleRange)));
            var rotZitem = new UIMenuListItem(Translation.Translate("Rotation Z"), _possiblePositions, (int)(Math.Round((ent.Rotation.Z * 100) + _possibleRange)));

            var dynamic = new UIMenuCheckboxItem(Translation.Translate("Bop Up And Down"), ent.BobUpAndDown);
            dynamic.CheckboxEvent += (ite, checkd) =>
            {
                ent.BobUpAndDown = checkd;
            };

            var faceCam = new UIMenuCheckboxItem(Translation.Translate("Face Camera"), ent.RotateToCamera);
            dynamic.CheckboxEvent += (ite, checkd) =>
            {
                ent.RotateToCamera = checkd;
            };

            var type = new UIMenuListItem(Translation.Translate("Type"), new List<dynamic>(_markersTypes), _markersTypes.ToList().IndexOf(ent.Type.ToString()));
            type.OnListChanged += (ite, index) =>
            {
                MarkerType hash;
                Enum.TryParse(ite.IndexToItem(index), out hash);
                ent.Type = hash;
            };

            var scaleXitem = new UIMenuListItem(Translation.Translate("Scale X"), possbileScale, (int)(Math.Round((ent.Scale.X * 100))));
            var scaleYitem = new UIMenuListItem(Translation.Translate("Scale Y"), possbileScale, (int)(Math.Round((ent.Scale.Y * 100))));
            var scaleZitem = new UIMenuListItem(Translation.Translate("Scale Z"), possbileScale, (int)(Math.Round((ent.Scale.Z * 100))));

            var colorR = new UIMenuListItem(Translation.Translate("Red Color"), possibleColors, ent.Red);
            var colorG = new UIMenuListItem(Translation.Translate("Green Color"), possibleColors, ent.Green);
            var colorB = new UIMenuListItem(Translation.Translate("Blue Color"), possibleColors, ent.Blue);
            var colorA = new UIMenuListItem(Translation.Translate("Transparency"), possibleColors, ent.Alpha);

            var targetId = 0;

            if (ent.TeleportTarget.HasValue)
            {
                var ourMarkers =
                    PropStreamer.Markers.Where(m => (m.Position - ent.TeleportTarget.Value).Length() < 1f)
                        .OrderBy(m => (m.Position - ent.TeleportTarget.Value).Length());
                if (ourMarkers.Any())
                    targetId = ourMarkers.First().Id + 1;
            }

            var targetPos = new UIMenuListItem(Translation.Translate("Teleport Marker Target"),
                Enumerable.Range(-1, _markerCounter + 1).Select(n => (dynamic) n).ToList(), targetId);
            targetPos.OnListChanged += (sender, index) =>
            {
                if (index == 0)
                {
                    ent.TeleportTarget = null;
                    return;
                }

                ent.TeleportTarget = PropStreamer.Markers.FirstOrDefault(n => n.Id == index-1)?.Position;
            };

            var loadPointItem = new UIMenuCheckboxItem(Translation.Translate("Mark as Loading Point"),
                PropStreamer.CurrentMapMetadata.LoadingPoint.HasValue &&
                (PropStreamer.CurrentMapMetadata.LoadingPoint.Value - ent.Position).Length() < 1f, Translation.Translate("Player will be teleported here BEFORE starting to load the map."));
            loadPointItem.CheckboxEvent += (sender, @checked) =>
            {
                if (@checked)
                {
                    PropStreamer.CurrentMapMetadata.LoadingPoint = ent.Position;
                }
                else
                {
                    PropStreamer.CurrentMapMetadata.LoadingPoint = null;
                }
            };

            var loadTeleportItem = new UIMenuCheckboxItem(Translation.Translate("Mark as Starting Point"),
                PropStreamer.CurrentMapMetadata.TeleportPoint.HasValue &&
                (PropStreamer.CurrentMapMetadata.TeleportPoint.Value - ent.Position).Length() < 1f, Translation.Translate("Player will be teleported here AFTER starting to load the map."));
            loadTeleportItem.CheckboxEvent += (sender, @checked) =>
            {
                if (@checked)
                {
                    PropStreamer.CurrentMapMetadata.TeleportPoint = ent.Position;
                }
                else
                {
                    PropStreamer.CurrentMapMetadata.TeleportPoint = null;
                }
            };

            var visiblityItem = new UIMenuCheckboxItem(Translation.Translate("Only Visible In Editor"), ent.OnlyVisibleInEditor);
            visiblityItem.CheckboxEvent += (sender, @checked) =>
            {
                ent.OnlyVisibleInEditor = @checked;
            };

            _objectInfoMenu.AddItem(type);
            _objectInfoMenu.AddItem(posXitem);
            _objectInfoMenu.AddItem(posYitem);
            _objectInfoMenu.AddItem(posZitem);
            _objectInfoMenu.AddItem(rotXitem);
            _objectInfoMenu.AddItem(rotYitem);
            _objectInfoMenu.AddItem(rotZitem);
            _objectInfoMenu.AddItem(scaleXitem);
            _objectInfoMenu.AddItem(scaleYitem);
            _objectInfoMenu.AddItem(scaleZitem);
            _objectInfoMenu.AddItem(colorR);
            _objectInfoMenu.AddItem(colorG);
            _objectInfoMenu.AddItem(colorB);
            _objectInfoMenu.AddItem(colorA);
            _objectInfoMenu.AddItem(dynamic);
            _objectInfoMenu.AddItem(faceCam);
            _objectInfoMenu.AddItem(targetPos);
            _objectInfoMenu.AddItem(loadPointItem);
            _objectInfoMenu.AddItem(loadTeleportItem);
            _objectInfoMenu.AddItem(visiblityItem);

            posXitem.OnListChanged += (item, index) => ent.Position = new Vector3((float)item.IndexToItem(index), ent.Position.Y, ent.Position.Z);
            posYitem.OnListChanged += (item, index) => ent.Position = new Vector3(ent.Position.X, (float)item.IndexToItem(index), ent.Position.Z);
            posZitem.OnListChanged += (item, index) => ent.Position = new Vector3(ent.Position.X, ent.Position.Y, (float)item.IndexToItem(index));

            posXitem.Activated +=
                (sender, item) =>
                    SetMarkerVector(ent, GetSafeFloat(Game.GetUserInput(ent.Position.X.ToString(CultureInfo.InvariantCulture), 10), ent.Position.X), ent.Position.Y, ent.Position.Z);
            posYitem.Activated +=
                (sender, item) =>
                    SetMarkerVector(ent, ent.Position.X, GetSafeFloat(Game.GetUserInput(ent.Position.Y.ToString(CultureInfo.InvariantCulture), 10), ent.Position.Y), ent.Position.Z);
            posZitem.Activated +=
                (sender, item) =>
                    SetMarkerVector(ent, ent.Position.X, ent.Position.Y, GetSafeFloat(Game.GetUserInput(ent.Position.Z.ToString(CultureInfo.InvariantCulture), 10), ent.Position.Z));

            rotXitem.OnListChanged += (item, index) => ent.Rotation = new Vector3((float)item.IndexToItem(index), ent.Rotation.Y, ent.Rotation.Z);
            rotYitem.OnListChanged += (item, index) => ent.Rotation = new Vector3(ent.Rotation.X, (float)item.IndexToItem(index), ent.Rotation.Z);
            rotZitem.OnListChanged += (item, index) => ent.Rotation = new Vector3(ent.Rotation.X, ent.Rotation.Y, (float)item.IndexToItem(index));

            rotXitem.Activated +=
                (sender, item) =>
                    SetMarkerRotation(ent, GetSafeFloat(Game.GetUserInput(ent.Rotation.X.ToString(CultureInfo.InvariantCulture), 10), ent.Rotation.X), ent.Rotation.Y, ent.Rotation.Z);
            rotYitem.Activated +=
                (sender, item) =>
                    SetMarkerRotation(ent, ent.Rotation.X, GetSafeFloat(Game.GetUserInput(ent.Rotation.Y.ToString(CultureInfo.InvariantCulture), 10), ent.Rotation.Y), ent.Rotation.Z);
            rotZitem.Activated +=
                (sender, item) =>
                    SetMarkerRotation(ent, ent.Rotation.X, ent.Rotation.Y, GetSafeFloat(Game.GetUserInput(ent.Rotation.Z.ToString(CultureInfo.InvariantCulture), 10), ent.Rotation.Z));

            scaleXitem.OnListChanged += (item, index) => ent.Scale = new Vector3((float)item.IndexToItem(index), ent.Scale.Y, ent.Scale.Z);
            scaleYitem.OnListChanged += (item, index) => ent.Scale = new Vector3(ent.Scale.X, (float)item.IndexToItem(index), ent.Scale.Z);
            scaleZitem.OnListChanged += (item, index) => ent.Scale = new Vector3(ent.Scale.X, ent.Scale.Y, (float)item.IndexToItem(index));

            scaleXitem.Activated +=
                (sender, item) =>
                    SetMarkerScale(ent, GetSafeFloat(Game.GetUserInput(ent.Scale.X.ToString(CultureInfo.InvariantCulture), 10), ent.Scale.X), ent.Scale.Y, ent.Scale.Z);
            scaleYitem.Activated +=
                (sender, item) =>
                    SetMarkerScale(ent, ent.Scale.X, GetSafeFloat(Game.GetUserInput(ent.Scale.Y.ToString(CultureInfo.InvariantCulture), 10), ent.Scale.Y), ent.Scale.Z);
            scaleZitem.Activated +=
                (sender, item) =>
                    SetMarkerScale(ent, ent.Scale.X, ent.Scale.Y, GetSafeFloat(Game.GetUserInput(ent.Scale.Z.ToString(CultureInfo.InvariantCulture), 10), ent.Scale.Z));

            colorR.OnListChanged += (item, index) => ent.Red = index;
            colorG.OnListChanged += (item, index) => ent.Green = index;
            colorB.OnListChanged += (item, index) => ent.Blue = index;
            colorA.OnListChanged += (item, index) => ent.Alpha = index;

            if (refreshIndex)
                _objectInfoMenu.RefreshIndex();
        }
예제 #19
0
파일: MapEditor.cs 프로젝트: Guad/MapEditor
        public MapEditor()
        {
            Tick += OnTick;
            KeyDown += OnKeyDown;

            if (!Directory.Exists("scripts\\MapEditor"))
                Directory.CreateDirectory("scripts\\MapEditor");

            ObjectDatabase.SetupRelationships();
            LoadSettings();

            try
            {
                Translation.Load("scripts\\MapEditor", _settings.Translation);
            }
            catch (Exception e)
            {
                UI.Notify("~b~~h~Map Editor~h~~w~~n~Failed to load translations. Falling back to English.");
                UI.Notify(e.Message);
            }

            _scaleform = new Scaleform(0);
            _scaleform.Load("instructional_buttons");

            _objectInfoMenu = new UIMenu("", "~b~" + Translation.Translate("PROPERTIES"), new Point(0, -107));
            _objectInfoMenu.ResetKey(UIMenu.MenuControls.Back);
            _objectInfoMenu.DisableInstructionalButtons(true);
            _objectInfoMenu.SetBannerType(new UIResRectangle(new Point(), new Size()));
            _menuPool.Add(_objectInfoMenu);

            ModManager.InitMenu();

            _objectsMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("PLACE OBJECT"));

            ObjectDatabase.LoadFromFile("scripts\\ObjectList.ini", ref ObjectDatabase.MainDb);
            ObjectDatabase.LoadInvalidHashes();
            ObjectDatabase.LoadFromFile("scripts\\PedList.ini", ref ObjectDatabase.PedDb);
            ObjectDatabase.LoadFromFile("scripts\\VehicleList.ini", ref ObjectDatabase.VehicleDb);

            _crosshairPath = Path.GetFullPath("scripts\\MapEditor\\crosshair.png");
            _crosshairBluePath = Path.GetFullPath("scripts\\MapEditor\\crosshair_blue.png");
            _crosshairYellowPath = Path.GetFullPath("scripts\\MapEditor\\crosshair_yellow.png");

            if (!File.Exists("scripts\\MapEditor\\crosshair.png"))
                _crosshairPath = Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "MapEditor.crosshair.png", "scripts\\MapEditor\\crosshair.png");
            if (!File.Exists("scripts\\MapEditor\\crosshair_blue.png"))
                _crosshairBluePath = Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "MapEditor.crosshair_blue.png", "scripts\\MapEditor\\crosshair_blue.png");
            if (!File.Exists("scripts\\MapEditor\\crosshair_yellow.png"))
                _crosshairYellowPath = Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "MapEditor.crosshair_yellow.png", "scripts\\MapEditor\\crosshair_yellow.png");

            RedrawObjectsMenu();
            _objectsMenu.OnItemSelect += OnObjectSelect;
            _objectsMenu.OnIndexChange += OnIndexChange;
            _menuPool.Add(_objectsMenu);

            _objectsMenu.ResetKey(UIMenu.MenuControls.Back);
            _objectsMenu.AddInstructionalButton(new InstructionalButton(Control.SelectWeapon, Translation.Translate("Change Axis")));
            _objectsMenu.AddInstructionalButton(new InstructionalButton(Control.MoveUpDown, Translation.Translate("Zoom")));
            _objectsMenu.AddInstructionalButton(new InstructionalButton(Control.Jump, Translation.Translate("Search")));

            _searchMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("PLACE OBJECT"));
            _searchMenu.OnItemSelect += OnObjectSelect;
            _searchMenu.OnIndexChange += OnIndexChange;
            _menuPool.Add(_searchMenu);

            _searchMenu.ResetKey(UIMenu.MenuControls.Back);
            _searchMenu.AddInstructionalButton(new InstructionalButton(Control.SelectWeapon, Translation.Translate("Change Axis")));
            _searchMenu.AddInstructionalButton(new InstructionalButton(Control.MoveUpDown, Translation.Translate("Zoom")));
            _searchMenu.AddInstructionalButton(new InstructionalButton(Control.Jump, Translation.Translate("Search")));

            _mainMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("MAIN MENU"));
            _mainMenu.AddItem(new UIMenuItem(Translation.Translate("Enter/Exit Map Editor")));
            _mainMenu.AddItem(new UIMenuItem(Translation.Translate("New Map"), Translation.Translate("Remove all current objects and start a new map.")));
            _mainMenu.AddItem(new UIMenuItem(Translation.Translate("Save Map"), Translation.Translate("Save all current objects to a file.")));
            _mainMenu.AddItem(new UIMenuItem(Translation.Translate("Load Map"), Translation.Translate("Load objects from a file and add them to the world.")));
            _mainMenu.RefreshIndex();
            _mainMenu.DisableInstructionalButtons(true);
            _menuPool.Add(_mainMenu);

            _formatMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("SELECT FORMAT"));
            _formatMenu.DisableInstructionalButtons(true);
            _formatMenu.ParentMenu = _mainMenu;
            RedrawFormatMenu();
            _menuPool.Add(_formatMenu);

            _metadataMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("SAVE MAP"));
            _metadataMenu.DisableInstructionalButtons(true);
            _metadataMenu.ParentMenu = _formatMenu;
            RedrawMetadataMenu();
            _menuPool.Add(_metadataMenu);

            _filepicker = new UIMenu("Map Editor", "~b~" + Translation.Translate("PICK FILE"));
            _filepicker.DisableInstructionalButtons(true);
            _filepicker.ParentMenu = _formatMenu;
            _menuPool.Add(_filepicker);

            _mainMenu.OnItemSelect += (m, it, i) =>
            {
                switch (i)
                {
                    case 0: // Enter/Exit Map Editor
                        IsInFreecam = !IsInFreecam;
                        Game.Player.Character.FreezePosition = IsInFreecam;
                        Game.Player.Character.IsVisible = !IsInFreecam;
                        World.RenderingCamera = null;
                        if (!IsInFreecam)
                        {
                            Game.Player.Character.Position -= new Vector3(0f, 0f, Game.Player.Character.HeightAboveGround - 1f);
                            return;
                        }
                        World.DestroyAllCameras();
                        _mainCamera = World.CreateCamera(GameplayCamera.Position, GameplayCamera.Rotation, 60f);
                        _objectPreviewCamera = World.CreateCamera(new Vector3(1200.016f, 3980.998f, 86.05062f), new Vector3(0f, 0f, 0f), 60f);
                        World.RenderingCamera = _mainCamera;
                        break;
                    case 1: // New Map
                        JavascriptHook.StopAllScripts();
                        PropStreamer.RemoveAll();
                        PropStreamer.Markers.Clear();
                        _currentObjectsMenu.Clear();
                        PropStreamer.Identifications.Clear();
                        PropStreamer.ActiveScenarios.Clear();
                        PropStreamer.ActiveRelationships.Clear();
                        PropStreamer.ActiveWeapons.Clear();
                        PropStreamer.Doors.Clear();
                        PropStreamer.CurrentMapMetadata = new MapMetadata();
                        ModManager.CurrentMod?.ModDisconnectInvoker();
                        ModManager.CurrentMod = null;
                        foreach (MapObject o in PropStreamer.RemovedObjects)
                        {
                            var t = World.CreateProp(o.Hash, o.Position, o.Rotation, true, false);
                            t.PositionNoOffset = o.Position;
                        }
                        PropStreamer.RemovedObjects.Clear();
                        _loadedEntities = 0;
                        _changesMade = 0;
                        _lastAutosave = DateTime.Now;
                        UI.Notify("~b~~h~Map Editor~h~~w~~n~" + Translation.Translate("Loaded new map."));
                        break;
                    case 2:
                        if (ModManager.CurrentMod != null)
                        {
                            string filename = Game.GetUserInput(255);
                            if (String.IsNullOrWhiteSpace(filename))
                            {
                                UI.Notify("~r~~h~Map Editor~h~~n~~w~" + Translation.Translate("The filename was empty."));
                                return;
                            }
                            Map tmpMap = new Map();
                            tmpMap.Objects.AddRange(PropStreamer.GetAllEntities());
                            tmpMap.RemoveFromWorld.AddRange(PropStreamer.RemovedObjects);
                            tmpMap.Markers.AddRange(PropStreamer.Markers);
                            UI.Notify("~b~~h~Map Editor~h~~n~~w~" + Translation.Translate("Map sent to external mod for saving."));
                            ModManager.CurrentMod.MapSavedInvoker(tmpMap, filename);
                            return;
                        }
                        _savingMap = true;
                        _mainMenu.Visible = false;
                        RedrawFormatMenu();
                        _formatMenu.Visible = true;
                        break;
                    case 3:
                        _savingMap = false;
                        _mainMenu.Visible = false;
                        RedrawFormatMenu();
                        _formatMenu.Visible = true;
                        break;
                }
            };

            _formatMenu.OnItemSelect += (m, item, indx) =>
            {
                if (_savingMap)
                {
                    string filename = "";
                    if (indx != 0)
                        filename = Game.GetUserInput(255);

                    switch (indx)
                    {
                        case 0: // XML
                            // TODO: Send to another menu
                            _formatMenu.Visible = false;
                            RedrawMetadataMenu();
                            _metadataMenu.Visible = true;
                            break;
                        case 1: // Objects.ini
                            if (!filename.EndsWith(".ini")) filename += ".ini";
                            SaveMap(filename, MapSerializer.Format.SimpleTrainer);
                            break;
                        case 2: // C#
                            if (!filename.EndsWith(".cs")) filename += ".cs";
                            SaveMap(filename, MapSerializer.Format.CSharpCode);
                            break;
                        case 3: // Raw
                            if (!filename.EndsWith(".txt")) filename += ".txt";
                            SaveMap(filename, MapSerializer.Format.Raw);
                            break;
                        case 4: // SpoonerLegacy
                            if (!filename.EndsWith(".SP00N")) filename += ".SP00N";
                            SaveMap(filename, MapSerializer.Format.SpoonerLegacy);
                            break;
                        case 5: // Menyoo
                            if (!filename.EndsWith(".xml")) filename += ".xml";
                            SaveMap(filename, MapSerializer.Format.Menyoo);
                            break;
                    }
                }
                else
                {
                    string filename = "";
                    if (indx != 4)
                        filename = Game.GetUserInput(255);

                    MapSerializer.Format tmpFor = MapSerializer.Format.NormalXml;
                    switch (indx)
                    {
                        case 0: // XML
                            tmpFor = MapSerializer.Format.NormalXml;
                            break;
                        case 1: // Objects.ini
                            tmpFor = MapSerializer.Format.SimpleTrainer;
                            break;
                        case 2: // Spooner
                            tmpFor = MapSerializer.Format.SpoonerLegacy;
                            break;
                        case 3: // Spooner
                            tmpFor = MapSerializer.Format.Menyoo;
                            break;
                        case 4: // File picker
                            _formatMenu.Visible = false;
                            RedrawFilepickerMenu();
                            _filepicker.Visible = true;
                            return;
                    }
                    LoadMap(filename, tmpFor);
                }
                _formatMenu.Visible = false;
            };

            _settingsMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("SETTINGS"));

            for (int i = -_possibleRange; i <= _possibleRange; i++)
            {
                _possiblePositions.Add(i * 0.01);
            }

            for (int i = -36000; i <= 36000; i++)
            {
                _possibleRoll.Add(i * 0.01);
            }

            var possibleLangauges = new List<string>
            {
                "Auto"
            };
            possibleLangauges.AddRange(Translation.Translations.Select(t => t.Language).ToList());

            var language = new UIMenuListItem(Translation.Translate("Language"),
                possibleLangauges.Select(t => (dynamic) t).ToList(), possibleLangauges.IndexOf(_settings.Translation));

            language.OnListChanged += (sender, index) =>
            {
                var newLanguage = sender.IndexToItem(index).ToString();
                Translation.SetLanguage(newLanguage);
                _settings.Translation = newLanguage;
                SaveSettings();
                if (newLanguage == "Auto")
                {
                    language.Description = "Use your game's language settings.";
                    return;
                }
                var descFile = Translation.Translations.FirstOrDefault(t => t.Language == newLanguage);
                if (descFile == null) return;
                language.Description = "~h~" + Translation.Translate("Translator") + ":~h~ " + descFile.Translator;
            };

            var checkem = new UIMenuListItem(Translation.Translate("Marker"), new List<dynamic>(Enum.GetNames(typeof(CrosshairType))), Enum.GetNames(typeof(CrosshairType)).ToList().FindIndex(x => x == _settings.CrosshairType.ToString()));
            checkem.OnListChanged += (i, indx) =>
            {
                CrosshairType outHash;
                Enum.TryParse(i.IndexToItem(indx).ToString(), out outHash);
                _settings.CrosshairType = outHash;
                SaveSettings();
            };

            List<dynamic> autosaveList = new List<dynamic> {Translation.Translate("Disable")};
            for (int i = 5; i <= 60; i += 5)
            {
                autosaveList.Add(i);
            }
            int aIndex = autosaveList.IndexOf(_settings.AutosaveInterval);
            if (aIndex == -1)
                aIndex = 0;

            var autosaveItem = new UIMenuListItem(Translation.Translate("Autosave Interval"), autosaveList, aIndex, Translation.Translate("Interval in minutes between automatic autosaves."));
            autosaveItem.OnListChanged += (item, index) =>
            {
                var sel = item.IndexToItem(index);
                _settings.AutosaveInterval = (sel as string) == Translation.Translate("Disable") ? -1 : Convert.ToInt32(item.IndexToItem(index), CultureInfo.InvariantCulture);
                SaveSettings();
            };

            List<dynamic> possibleDrawDistances = new List<dynamic> {Translation.Translate("Default"), 50, 75};
            for (int i = 100; i <= 3000; i += 100)
            {
                possibleDrawDistances.Add(i);
            }
            int dIndex = possibleDrawDistances.IndexOf(_settings.DrawDistance);
            if (dIndex == -1)
                dIndex = 0;
            var drawDistanceItem = new UIMenuListItem(Translation.Translate("Draw Distance"), possibleDrawDistances, dIndex, Translation.Translate("Draw distance for props, vehicles and peds. Reload the map for changes to take effect."));
            drawDistanceItem.OnListChanged += (item, index) =>
            {
                var sel = item.IndexToItem(index);
                _settings.DrawDistance = (sel as string) == Translation.Translate("Default") ? -1 : Convert.ToInt32(item.IndexToItem(index), CultureInfo.InvariantCulture);
                SaveSettings();
            };

            List<dynamic> senslist = new List<dynamic>();
            for (int i = 1; i < 60; i++)
            {
                senslist.Add(i);
            }
            var gamboy = new UIMenuListItem(Translation.Translate("Mouse Camera Sensitivity"), senslist, _settings.CameraSensivity - 1);
            gamboy.OnListChanged += (item, index) =>
            {
                _settings.CameraSensivity = index + 1;
                SaveSettings();
            };
            var gampadSens = new UIMenuListItem(Translation.Translate("Gamepad Camera Sensitivity"), senslist, _settings.GamepadCameraSensitivity - 1);
            gampadSens.OnListChanged += (item, index) =>
            {
                _settings.GamepadCameraSensitivity = index + 1;
                SaveSettings();
            };

            var keymovesens = new UIMenuListItem(Translation.Translate("Keyboard Movement Sensitivity"), senslist, _settings.KeyboardMovementSensitivity - 1);
            keymovesens.OnListChanged += (item, index) =>
            {
                _settings.KeyboardMovementSensitivity = index + 1;
                SaveSettings();
            };

            var gammovesens = new UIMenuListItem(Translation.Translate("Gamepad Movement Sensitivity"), senslist, _settings.GamepadMovementSensitivity - 1);
            gammovesens.OnListChanged += (item, index) =>
            {
                _settings.GamepadMovementSensitivity = index + 1;
                SaveSettings();
            };

            var butts = new UIMenuCheckboxItem(Translation.Translate("Instructional Buttons"), _settings.InstructionalButtons);
            butts.CheckboxEvent += (i, checkd) =>
            {
                _settings.InstructionalButtons = checkd;
                SaveSettings();
            };
            var gamepadItem = new UIMenuCheckboxItem(Translation.Translate("Enable Gamepad Shortcut"), _settings.Gamepad);
            gamepadItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.Gamepad = checkd;
                SaveSettings();
            };

            var counterItem = new UIMenuCheckboxItem(Translation.Translate("Entity Counter"), _settings.PropCounterDisplay);
            counterItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.PropCounterDisplay = checkd;
                SaveSettings();
            };

            var snapper = new UIMenuCheckboxItem(Translation.Translate("Follow Object With Camera"), _settings.SnapCameraToSelectedObject);
            snapper.CheckboxEvent += (i, checkd) =>
            {
                _settings.SnapCameraToSelectedObject = checkd;
                SaveSettings();
            };

            var boundItem = new UIMenuCheckboxItem(Translation.Translate("Bounding Box"), _settings.BoundingBox.GetValueOrDefault(false));
            boundItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.BoundingBox = checkd;
                SaveSettings();
            };

            var scriptItem = new UIMenuCheckboxItem(Translation.Translate("Execute Scripts"), _settings.LoadScripts);
            scriptItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.LoadScripts = checkd;
                SaveSettings();
            };

            var validate = new UIMenuItem(Translation.Translate("Validate Object Database"),Translation.Translate(
                "This will update the current object database, removing any invalid objects. The changes will take effect after you restart the script." +
                " It will take a couple of minutes."));
            validate.Activated += (men, item) => ValidateDatabase();

            var resetGrps = new UIMenuItem(Translation.Translate("Reset Active Relationship Groups"),
                Translation.Translate("This will set all ped's relationship groups to Companion."));
            resetGrps.Activated += (men, item) =>
            {
                PropStreamer.Peds.ForEach(ped => ObjectDatabase.SetPedRelationshipGroup(new Ped(ped), "Companion"));
            };

            var objectValidationItem = new UIMenuCheckboxItem(Translation.Translate("Skip Invalid Objects"), _settings.OmitInvalidObjects);
            objectValidationItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.OmitInvalidObjects = checkd;
                SaveSettings();
            };

            #if DEBUG

            var testItem = new UIMenuItem("Load Terrain");
            testItem.Activated += (sender, item) =>
            {
                if (!Game.IsWaypointActive)
                {
                    Function.Call(Hash.CLEAR_HD_AREA);
                    return;
                }
                var wpyPos = World.GetWaypointPosition();

                Function.Call(Hash.SET_HD_AREA, wpyPos.X, wpyPos.Y, wpyPos.Z, 400f);
            };
            _settingsMenu.AddItem(testItem);

            #endif

            _settingsMenu.AddItem(language);
            _settingsMenu.AddItem(gamepadItem);
            _settingsMenu.AddItem(drawDistanceItem);
            _settingsMenu.AddItem(autosaveItem);
            _settingsMenu.AddItem(checkem);
            _settingsMenu.AddItem(boundItem);
            _settingsMenu.AddItem(gamboy);
            _settingsMenu.AddItem(gampadSens);
            _settingsMenu.AddItem(keymovesens);
            _settingsMenu.AddItem(gammovesens);
            _settingsMenu.AddItem(butts);
            _settingsMenu.AddItem(counterItem);
            _settingsMenu.AddItem(snapper);
            _settingsMenu.AddItem(scriptItem);
            _settingsMenu.AddItem(objectValidationItem);
            _settingsMenu.AddItem(validate);
            _settingsMenu.AddItem(resetGrps);
            _settingsMenu.RefreshIndex();
            _settingsMenu.DisableInstructionalButtons(true);
            _menuPool.Add(_settingsMenu);

            _currentObjectsMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("CURRENT ENTITES"));
            _currentObjectsMenu.OnItemSelect += OnEntityTeleport;
            _currentObjectsMenu.DisableInstructionalButtons(true);
            _menuPool.Add(_currentObjectsMenu);

            var binder = new UIMenuItem(Translation.Translate("Settings"));
            _currentEntitiesItem = new UIMenuItem(Translation.Translate("Current Entities"));

            var binder2 = new UIMenuItem(Translation.Translate("Create Map for External Mod"));

            _mainMenu.AddItem(_currentEntitiesItem);
            _mainMenu.AddItem(binder);
            _mainMenu.AddItem(binder2);

            _mainMenu.BindMenuToItem(_settingsMenu, binder);
            _mainMenu.BindMenuToItem(_currentObjectsMenu, _currentEntitiesItem);
            _mainMenu.BindMenuToItem(ModManager.ModMenu, binder2);
            _mainMenu.RefreshIndex();
            _menuPool.Add(ModManager.ModMenu);
        }
예제 #20
0
 //when user change mission list
 private void OnListChange(UIMenu sender, UIMenuListItem listitem, int index)
 {
     if (sender == mi_menu)
     {
         mission = listitem.IndexToItem(index);
     }
 }
예제 #21
0
	    private void CreateFirstPersonFreelookMenu()
	    {
            FirstPersonFreelookMenu = new UIMenu("Tobii Eye Tracking", "~b~FIRST PERSON FREELOOK SETTINGS");
            FirstPersonFreelookMenu.SetMenuWidthOffset(50);
	        {
	            var firstPersonFreelook = new UIMenuCheckboxItem("FPS Freelook", _settings.FirstPersonFreelookEnabled,
	                "Control camera with gaze");
	            firstPersonFreelook.CheckboxEvent +=
	                (sender, args) => { _settings.FirstPersonFreelookEnabled = firstPersonFreelook.Checked; };
                FirstPersonFreelookMenu.AddItem(firstPersonFreelook);

	            var firstPersonSensitivitySlider = new UIMenuListItem("FPS Freelook Sensitivity", _values0To1,
	                (int) Math.Round(_settings.FirstPersonSensitivity/0.1), "Freelook sensitivity");
	            firstPersonSensitivitySlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonSensitivity =
	                        firstPersonSensitivitySlider.IndexToItem(firstPersonSensitivitySlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonSensitivitySlider);

	            var firstPersonDeadZoneWidthSlider = new UIMenuListItem("FPS Freelook Deadzone Width", _values0To1,
	                (int) Math.Round(_settings.FirstPersonDeadZoneWidth/0.1), "Freelook deadzone");
	            firstPersonDeadZoneWidthSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonDeadZoneWidth =
	                        firstPersonDeadZoneWidthSlider.IndexToItem(firstPersonDeadZoneWidthSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonDeadZoneWidthSlider);

	            var firstPersonDeadZoneHeightSlider = new UIMenuListItem("FPS Freelook Deadzone Height", _values0To1,
	                (int) Math.Round(_settings.FirstPersonDeadZoneHeight/0.1), "Freelook deadzone");
	            firstPersonDeadZoneHeightSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonDeadZoneHeight =
	                        firstPersonDeadZoneHeightSlider.IndexToItem(firstPersonDeadZoneHeightSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonDeadZoneHeightSlider);

	            var firstPersonMinPitchSlider = new UIMenuListItem("FPS Min Pitch", _valuesMinus70To0,
	                (int) Math.Round((_settings.FirstPersonMinPitchDeg + 70)/1), "Freelook min pitch angle");
	            firstPersonMinPitchSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonMinPitchDeg = firstPersonMinPitchSlider.IndexToItem(firstPersonMinPitchSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonMinPitchSlider);

	            var firstPersonMaxPitchSlider = new UIMenuListItem("FPS Max Pitch", _values0To70,
	                (int) Math.Round((_settings.FirstPersonMaxPitchDeg)/1), "Freelook max pitch angle");
	            firstPersonMaxPitchSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonMaxPitchDeg = firstPersonMaxPitchSlider.IndexToItem(firstPersonMaxPitchSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonMaxPitchSlider);
	        }

	        {
	            var firstPersonFreelookDriving = new UIMenuCheckboxItem("FPS Freelook Driving",
	                _settings.FirstPersonFreelookDrivingEnabled, "Control camera with gaze");
	            firstPersonFreelookDriving.CheckboxEvent +=
	                (sender, args) => { _settings.FirstPersonFreelookDrivingEnabled = firstPersonFreelookDriving.Checked; };
                FirstPersonFreelookMenu.AddItem(firstPersonFreelookDriving);

	            var firstPersonSensitivityDrivingSlider = new UIMenuListItem("FPS Freelook Sensitivity Driving", _values0To1,
	                (int) Math.Round(_settings.FirstPersonSensitivityDriving/0.1), "Freelook sensitivity");
	            firstPersonSensitivityDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonSensitivityDriving =
	                        firstPersonSensitivityDrivingSlider.IndexToItem(firstPersonSensitivityDrivingSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonSensitivityDrivingSlider);

	            var firstPersonDeadZoneWidthDrivingSlider = new UIMenuListItem("FPS Freelook Deadzone Width Driving",
	                _values0To1, (int) Math.Round(_settings.FirstPersonDeadZoneWidthDriving/0.1), "Freelook deadzone");
	            firstPersonDeadZoneWidthDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonDeadZoneWidthDriving =
	                        firstPersonDeadZoneWidthDrivingSlider.IndexToItem(firstPersonDeadZoneWidthDrivingSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonDeadZoneWidthDrivingSlider);

	            var firstPersonDeadZoneHeightDrivingSlider = new UIMenuListItem("FPS Freelook Deadzone Height Driving",
	                _values0To1, (int) Math.Round(_settings.FirstPersonDeadZoneHeightDriving/0.1), "Freelook deadzone");
	            firstPersonDeadZoneHeightDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonDeadZoneHeightDriving =
	                        firstPersonDeadZoneHeightDrivingSlider.IndexToItem(firstPersonDeadZoneHeightDrivingSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonDeadZoneHeightDrivingSlider);

	            var firstPersonMinPitchDrivingSlider = new UIMenuListItem("FPS Min Pitch Driving", _valuesMinus70To0,
	                (int) Math.Round((_settings.FirstPersonMinPitchDegDriving + 70)/1), "Freelook min pitch angle");
	            firstPersonMinPitchDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonMinPitchDegDriving =
	                        firstPersonMinPitchDrivingSlider.IndexToItem(firstPersonMinPitchDrivingSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonMinPitchDrivingSlider);

	            var firstPersonMaxPitchDrivingSlider = new UIMenuListItem("FPS Max Pitch Driving", _values0To70,
	                (int) Math.Round((_settings.FirstPersonMaxPitchDegDriving)/1), "Freelook max pitch angle");
	            firstPersonMaxPitchDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.FirstPersonMaxPitchDegDriving =
	                        firstPersonMaxPitchDrivingSlider.IndexToItem(firstPersonMaxPitchDrivingSlider.Index);
	                };
                FirstPersonFreelookMenu.AddItem(firstPersonMaxPitchDrivingSlider);
	        }
            FirstPersonFreelookMenu.RefreshIndex();
            _menuPool.Add(FirstPersonFreelookMenu);
	    }
예제 #22
0
		public void BuildMenu(Race race)
		{
			GUI.MainMenu.Clear();
			GUI.MainMenu.SetBannerType(new UIResRectangle());
			_raceSettings.Clear();

			_raceSettings["TOD"] = "Current";
			_raceSettings["Weather"] = "Current";
			_raceSettings["Wanted"] = false;
			_raceSettings["Opponents"] = "Random";
			_raceSettings["Traffic"] = true;
			_raceSettings["Laps"] = 1;

			_previewVehicle = World.CreateVehicle(Helpers.RequestModel((int)race.AvailableVehicles[0]), race.Trigger);
			_previewVehicle.IsPersistent = false;

			List<dynamic> timeList = new List<dynamic> { "Current", "Sunrise", "Day", "Sunset", "Night" };
			var timeItem = new UIMenuListItem("Time of Day", timeList, 0);
			timeItem.OnListChanged += (item, index) =>
			{
				_raceSettings["TOD"] = item.IndexToItem(index);
			};

			var weatherList = new List<dynamic> { "Current" };
			Enum.GetNames(typeof(Weather)).ToList().ForEach(w => weatherList.Add(w));
			var weatherItem = new UIMenuListItem("Weather", weatherList, 0);
			weatherItem.OnListChanged += (item, index) =>
			{
				_raceSettings["Weather"] = item.IndexToItem(index);
			};

			var copItem = new UIMenuCheckboxItem("Wanted Levels", false);
			copItem.CheckboxEvent += (i, checkd) =>
			{
				_raceSettings["Wanted"] = checkd;
			};

			var opponentsList = new List<dynamic> { "Random" };
			Enumerable.Range(1, race.SpawnPoints.Length - 1).ToList().ForEach(n => opponentsList.Add(n));
			var opponentsItem = new UIMenuListItem("Number of Opponents", opponentsList, 0);
			opponentsItem.OnListChanged += (item, index) =>
			{
				_raceSettings["Opponents"] = item.IndexToItem(index);
			};

			var trafficItem = new UIMenuCheckboxItem("Traffic", true);
			trafficItem.CheckboxEvent += (i, checkd) =>
			{
				_raceSettings["Traffic"] = checkd;
			};

			List<dynamic> tmpList = new List<dynamic>();
			race.AvailableVehicles.ToList().ForEach(x => tmpList.Add(x));
			var carItem = new UIMenuListItem("Vehicle", tmpList, 0);
			carItem.OnListChanged += (item, index) =>
			{
				VehicleHash outHash;
				Enum.TryParse(item.IndexToItem(index).ToString(), out outHash);
				var oldC = _previewVehicle.PrimaryColor;
				_previewVehicle?.Delete();
				_previewVehicle = World.CreateVehicle(Helpers.RequestModel((int) outHash), race.Trigger);
				if(_previewVehicle == null) return;
				_previewVehicle.PrimaryColor = oldC;
				_previewVehicle.SecondaryColor = oldC;
				_previewVehicle.IsPersistent = false;
			};
			
			List<dynamic> colors = new List<dynamic>
			{
				VehicleColor.MatteYellow,
                VehicleColor.Orange,
                VehicleColor.MatteRed,
                VehicleColor.HotPink,
                VehicleColor.MattePurple,
                VehicleColor.MatteDarkBlue,
                VehicleColor.Blue,
                VehicleColor.EpsilonBlue,
                VehicleColor.MatteLimeGreen,
                VehicleColor.Green,
            };
			var colorItem = new UIMenuListItem("Color", colors, 0);
			colorItem.OnListChanged += (ite, index) =>
			{
				VehicleColor outHash;
				Enum.TryParse(ite.IndexToItem(index).ToString(), out outHash);
				_previewVehicle.PrimaryColor = outHash;
				_previewVehicle.SecondaryColor = outHash;
			};

			var confimItem = new UIMenuItem("Start Race");
			confimItem.Activated += (item, index) =>
			{
				GUI.MainMenu.Visible = false;
				GUI.IsInMenu = false;
				Game.Player.CanControlCharacter = true;
				World.RenderingCamera = null;
				StartRace(race);
			};

			GUI.MainMenu.OnMenuClose += menu =>
			{
				World.RenderingCamera = null;
				GUI.IsInMenu = false;
				Game.Player.CanControlCharacter = true;
				_previewVehicle?.Delete();
			};

			GUI.MainMenu.AddItem(timeItem);
			GUI.MainMenu.AddItem(weatherItem);
			GUI.MainMenu.AddItem(copItem);
			GUI.MainMenu.AddItem(carItem);
			GUI.MainMenu.AddItem(colorItem);
			GUI.MainMenu.AddItem(opponentsItem);
			GUI.MainMenu.AddItem(trafficItem);
			if (race.LapsAvailable)
			{
				var lapList = new List<dynamic>();
				Enumerable.Range(1, 20).ToList().ForEach(n => lapList.Add(n));
				var lapItem = new UIMenuListItem("Laps", lapList, 0);
				lapItem.OnListChanged += (item, index) =>
				{
					_raceSettings["Laps"] = item.IndexToItem(index);
				};
				GUI.MainMenu.AddItem(lapItem);
			}
			GUI.MainMenu.AddItem(confimItem);
			GUI.MainMenu.RefreshIndex();
		}
예제 #23
0
	    private void CreateThirdPersonFreelookMenu()
	    {
            ThirdPersonFreelookMenu = new UIMenu("Tobii Eye Tracking", "~b~THIRD PERSON FREELOOK SETTINGS");
            ThirdPersonFreelookMenu.SetMenuWidthOffset(50);
	        {
	            var thirdPersonFreelook = new UIMenuCheckboxItem("TPS Freelook", _settings.ThirdPersonFreelookEnabled,
	                "Control camera with gaze");
	            thirdPersonFreelook.CheckboxEvent +=
	                (sender, args) => { _settings.ThirdPersonFreelookEnabled = thirdPersonFreelook.Checked; };
                ThirdPersonFreelookMenu.AddItem(thirdPersonFreelook);

	            var thirdPersonSensitivitySlider = new UIMenuListItem("TPS Freelook Sensitivity", _values0To1,
	                (int) Math.Round(_settings.ThirdPersonSensitivity/0.1), "Freelook sensitivity");
	            thirdPersonSensitivitySlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonSensitivity =
	                        thirdPersonSensitivitySlider.IndexToItem(thirdPersonSensitivitySlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonSensitivitySlider);

	            var thirdPersonYOffsetSlider = new UIMenuListItem("TPS Freelook Vertical Offset", _valuesMinus1To1,
	                (int) Math.Round((_settings.ThirdPersonYOffset + 1)/0.1), "Freelook vertical offset");
	            thirdPersonYOffsetSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonYOffset = thirdPersonYOffsetSlider.IndexToItem(thirdPersonYOffsetSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonYOffsetSlider);

	            var thirdPersonDeadZoneWidthSlider = new UIMenuListItem("TPS Freelook Deadzone Width", _values0To1,
	                (int) Math.Round(_settings.ThirdPersonDeadZoneWidth/0.1), "Freelook deadzone");
	            thirdPersonDeadZoneWidthSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonDeadZoneWidth =
	                        thirdPersonDeadZoneWidthSlider.IndexToItem(thirdPersonDeadZoneWidthSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonDeadZoneWidthSlider);

	            var thirdPersonDeadZoneHeightSlider = new UIMenuListItem("TPS Freelook Deadzone Height", _values0To1,
	                (int) Math.Round(_settings.ThirdPersonDeadZoneHeight/0.1), "Freelook deadzone");
	            thirdPersonDeadZoneHeightSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonDeadZoneHeight =
	                        thirdPersonDeadZoneHeightSlider.IndexToItem(thirdPersonDeadZoneHeightSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonDeadZoneHeightSlider);

	            var thirdPersonMinPitchSlider = new UIMenuListItem("TPS Min Pitch", _valuesMinus70To0,
	                (int) Math.Round((_settings.ThirdPersonMinPitchDeg + 70)/1), "Freelook min pitch angle");
	            thirdPersonMinPitchSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonMinPitchDeg = thirdPersonMinPitchSlider.IndexToItem(thirdPersonMinPitchSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonMinPitchSlider);

	            var thirdPersonMaxPitchSlider = new UIMenuListItem("TPS Max Pitch", _values0To70,
	                (int) Math.Round((_settings.ThirdPersonMaxPitchDeg)/1), "Freelook max pitch angle");
	            thirdPersonMaxPitchSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonMaxPitchDeg = thirdPersonMaxPitchSlider.IndexToItem(thirdPersonMaxPitchSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonMaxPitchSlider);
	        }

	        {
	            var thirdPersonYOffsetDrivingSlider = new UIMenuListItem("TPS Freelook Vertical Offset Driving",
	                _valuesMinus1To1, (int) Math.Round((_settings.ThirdPersonYOffsetDriving + 1)/0.1),
	                "Freelook vertical offset");
	            thirdPersonYOffsetDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonYOffsetDriving =
	                        thirdPersonYOffsetDrivingSlider.IndexToItem(thirdPersonYOffsetDrivingSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonYOffsetDrivingSlider);

	            var thirdPersonDeadZoneWidthDrivingSlider = new UIMenuListItem("TPS Freelook Deadzone Width Driving",
	                _values0To1, (int) Math.Round(_settings.ThirdPersonDeadZoneWidthDriving/0.1), "Freelook deadzone");
	            thirdPersonDeadZoneWidthDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonDeadZoneWidthDriving =
	                        thirdPersonDeadZoneWidthDrivingSlider.IndexToItem(thirdPersonDeadZoneWidthDrivingSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonDeadZoneWidthDrivingSlider);

	            var thirdPersonDeadZoneHeightDrivingSlider = new UIMenuListItem("TPS Freelook Deadzone Height Driving",
	                _values0To1, (int) Math.Round(_settings.ThirdPersonDeadZoneHeightDriving/0.1), "Freelook deadzone");
	            thirdPersonDeadZoneHeightDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonDeadZoneHeightDriving =
	                        thirdPersonDeadZoneHeightDrivingSlider.IndexToItem(thirdPersonDeadZoneHeightDrivingSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonDeadZoneHeightDrivingSlider);

	            var thirdPersonMinPitchDrivingSlider = new UIMenuListItem("TPS Min Pitch Driving", _valuesMinus70To0,
	                (int) Math.Round((_settings.ThirdPersonMinPitchDrivingDeg + 70)/1), "Freelook min pitch angle");
	            thirdPersonMinPitchDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonMinPitchDrivingDeg =
	                        thirdPersonMinPitchDrivingSlider.IndexToItem(thirdPersonMinPitchDrivingSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonMinPitchDrivingSlider);

	            var thirdPersonMaxPitchDrivingSlider = new UIMenuListItem("TPS Max Pitch Driving", _values0To70,
	                (int) Math.Round((_settings.ThirdPersonMaxPitchDeg)/1), "Freelook max pitch angle");
	            thirdPersonMaxPitchDrivingSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonMaxPitchDrivingDeg =
	                        thirdPersonMaxPitchDrivingSlider.IndexToItem(thirdPersonMaxPitchDrivingSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonMaxPitchDrivingSlider);
	        }

	        {
	            var thirdPersonYOffsetPlaneSlider = new UIMenuListItem("TPS Freelook Vertical Offset Plane", _valuesMinus1To1,
	                (int) Math.Round((_settings.ThirdPersonYOffsetPlane + 1)/0.1), "Freelook vertical offset");
	            thirdPersonYOffsetPlaneSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonYOffsetPlane =
	                        thirdPersonYOffsetPlaneSlider.IndexToItem(thirdPersonYOffsetPlaneSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonYOffsetPlaneSlider);

	            var thirdPersonDeadZoneWidthPlaneSlider = new UIMenuListItem("TPS Freelook Deadzone Width Plane", _values0To1,
	                (int) Math.Round(_settings.ThirdPersonDeadZoneWidthPlane/0.1), "Freelook deadzone");
	            thirdPersonDeadZoneWidthPlaneSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonDeadZoneWidthPlane =
	                        thirdPersonDeadZoneWidthPlaneSlider.IndexToItem(thirdPersonDeadZoneWidthPlaneSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonDeadZoneWidthPlaneSlider);

	            var thirdPersonDeadZoneHeightPlaneSlider = new UIMenuListItem("TPS Freelook Deadzone Height Plane", _values0To1,
	                (int) Math.Round(_settings.ThirdPersonDeadZoneHeightPlane/0.1), "Freelook deadzone");
	            thirdPersonDeadZoneHeightPlaneSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonDeadZoneHeightPlane =
	                        thirdPersonDeadZoneHeightPlaneSlider.IndexToItem(thirdPersonDeadZoneHeightPlaneSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonDeadZoneHeightPlaneSlider);

	            var thirdPersonMinPitchPlaneSlider = new UIMenuListItem("TPS Min Pitch Plane", _valuesMinus70To0,
	                (int) Math.Round((_settings.ThirdPersonMinPitchPlaneDeg + 70)/1), "Freelook min pitch angle");
	            thirdPersonMinPitchPlaneSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonMinPitchPlaneDeg =
	                        thirdPersonMinPitchPlaneSlider.IndexToItem(thirdPersonMinPitchPlaneSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonMinPitchPlaneSlider);

	            var thirdPersonMaxPitchPlaneSlider = new UIMenuListItem("TPS Max Pitch Plane", _values0To70,
	                (int) Math.Round((_settings.ThirdPersonMaxPitchPlaneDeg)/1), "Freelook max pitch angle");
	            thirdPersonMaxPitchPlaneSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonMaxPitchPlaneDeg =
	                        thirdPersonMaxPitchPlaneSlider.IndexToItem(thirdPersonMaxPitchPlaneSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonMaxPitchPlaneSlider);
	        }


	        {
	            var thirdPersonYOffsetHeliSlider = new UIMenuListItem("TPS Freelook Vertical Offset Heli", _valuesMinus1To1,
	                (int) Math.Round((_settings.ThirdPersonYOffsetHeli + 1)/0.1), "Freelook vertical offset");
	            thirdPersonYOffsetHeliSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonYOffsetHeli =
	                        thirdPersonYOffsetHeliSlider.IndexToItem(thirdPersonYOffsetHeliSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonYOffsetHeliSlider);

	            var thirdPersonDeadZoneWidthHeliSlider = new UIMenuListItem("TPS Freelook Deadzone Width Heli", _values0To1,
	                (int) Math.Round(_settings.ThirdPersonDeadZoneWidthHeli/0.1), "Freelook deadzone");
	            thirdPersonDeadZoneWidthHeliSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonDeadZoneWidthHeli =
	                        thirdPersonDeadZoneWidthHeliSlider.IndexToItem(thirdPersonDeadZoneWidthHeliSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonDeadZoneWidthHeliSlider);

	            var thirdPersonDeadZoneHeightHeliSlider = new UIMenuListItem("TPS Freelook Deadzone Height Heli", _values0To1,
	                (int) Math.Round(_settings.ThirdPersonDeadZoneHeightHeli/0.1), "Freelook deadzone");
	            thirdPersonDeadZoneHeightHeliSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonDeadZoneHeightHeli =
	                        thirdPersonDeadZoneHeightHeliSlider.IndexToItem(thirdPersonDeadZoneHeightHeliSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonDeadZoneHeightHeliSlider);

	            var thirdPersonMinPitchHeliSlider = new UIMenuListItem("TPS Min Pitch Heli", _valuesMinus70To0,
	                (int) Math.Round((_settings.ThirdPersonMinPitchHeliDeg + 70)/1), "Freelook min pitch angle");
	            thirdPersonMinPitchHeliSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonMinPitchHeliDeg =
	                        thirdPersonMinPitchHeliSlider.IndexToItem(thirdPersonMinPitchHeliSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonMinPitchHeliSlider);

	            var thirdPersonMaxPitchHeliSlider = new UIMenuListItem("TPS Max Pitch Heli", _values0To70,
	                (int) Math.Round((_settings.ThirdPersonMaxPitchDeg)/1), "Freelook max pitch angle");
	            thirdPersonMaxPitchHeliSlider.OnListChanged +=
	                (sender, args) =>
	                {
	                    _settings.ThirdPersonMaxPitchHeliDeg =
	                        thirdPersonMaxPitchHeliSlider.IndexToItem(thirdPersonMaxPitchHeliSlider.Index);
	                };
                ThirdPersonFreelookMenu.AddItem(thirdPersonMaxPitchHeliSlider);
	        }
            ThirdPersonFreelookMenu.RefreshIndex();
            _menuPool.Add(ThirdPersonFreelookMenu);
	    }
예제 #24
0
 public void AddSlotToMenu(UIMenu menu, string text, SlotKey slot_key)
 {
     var submenu = AddSubMenu(menu, text);
     var index_names = PedData.GetIndexNames(slot_key.typ);
     var listitem1 = new UIMenuListItem(index_names[0], UI_LIST, 0);
     var listitem2 = new UIMenuListItem(index_names[1], UI_LIST, 0);
     var listitem3 = new UIMenuListItem(index_names[2], UI_LIST, 0);
     var listitem4 = new UIMenuListItem(index_names[3], UI_LIST, 0);
     var randomitem = new UIMenuItem("Random");
     var clearitem = new UIMenuItem("Clear");
     submenu.AddItem(listitem1);
     submenu.AddItem(listitem2);
     submenu.AddItem(listitem3);
     submenu.AddItem(listitem4);
     submenu.AddItem(randomitem);
     submenu.AddItem(clearitem);
     // when the menu is selected, we only want submenu to be
     // enabled if its model and/or texture can be changed
     menu.ParentMenu.OnItemSelect += (sender, item, index) =>
     {
         if (item == menu.ParentItem)
         {
             var ped = Game.Player.Character;
             submenu.ParentItem.Enabled = (
                 (PedData.GetNumIndex1(ped, slot_key) >= 2) ||
                 (PedData.GetNumIndex2(ped, slot_key, 0) >= 2) ||
                 (PedData.GetNumIndex3(ped, slot_key, 0, 0) >= 2) ||
                 (PedData.GetNumIndex4(ped, slot_key, 0, 0, 0) >= 2));
         }
     };
     // when submenu is selected, display correct indices for model and texture
     // and enable those entries of this submenu
     // (model, texture, ...) where something can be changed
     submenu.ParentMenu.OnItemSelect += (sender, item, index) =>
     {
         if (item == submenu.ParentItem)
         {
             var ped = Game.Player.Character;
             var slot_value = ped_data.GetSlotValue(slot_key);
             listitem1.Index = slot_value.index1;
             listitem1.Enabled = (PedData.GetNumIndex1(ped, slot_key) >= 2);
             listitem2.Index = slot_value.index2;
             listitem2.Enabled = (ped_data.GetNumIndex2(ped, slot_key) >= 2);
             listitem3.Index = slot_value.index3;
             listitem3.Enabled = (ped_data.GetNumIndex3(ped, slot_key) >= 2);
             listitem4.Index = slot_value.index4;
             listitem4.Enabled = (ped_data.GetNumIndex4(ped, slot_key) >= 2);
         }
     };
     submenu.OnListChange += (sender, item, index) =>
     {
         if (item == listitem1 || item == listitem2 || item == listitem3 || item == listitem4)
         {
             var ped = Game.Player.Character;
             var slot_value = ped_data.GetSlotValue(slot_key);
             var numIndex1 = PedData.GetNumIndex1(ped, slot_key);
             var numIndex2 = ped_data.GetNumIndex2(ped, slot_key);
             var numIndex3 = ped_data.GetNumIndex3(ped, slot_key);
             var numIndex4 = ped_data.GetNumIndex4(ped, slot_key);
             // we need to ensure that the new id is valid as the menu has more items than number of ids supported by the game
             int maxid;
             if (item == listitem1)
                 maxid = numIndex1;
             else if (item == listitem2)
                 maxid = numIndex2;
             else if (item == listitem3)
                 maxid = numIndex3;
             else // if (item == listitem4)
                 maxid = numIndex4;
             maxid = Math.Min(maxid - 1, UI_LIST_MAX);
             System.Diagnostics.Debug.Assert(maxid >= 0);
             System.Diagnostics.Debug.Assert(maxid <= UI_LIST_MAX - 1);
             if (index > maxid)
             {
                 // wrap the index depending on whether user scrolled forward or backward
                 index = (index == UI_LIST_MAX - 1) ? maxid : 0;
                 item.Index = index;
             }
             if (item == listitem1)
                 slot_value.index1 = index;
             else if (item == listitem2)
                 slot_value.index2 = index;
             else if (item == listitem3)
                 slot_value.index3 = index;
             else // if (item == listitem4)
                 slot_value.index4 = index;
             // correct listitem2 if index2 is out of range
             var newNumIndex2 = PedData.GetNumIndex2(ped, slot_key, slot_value.index1);
             if (slot_value.index2 >= newNumIndex2) slot_value.index2 = newNumIndex2 - 1;
             listitem2.Index = slot_value.index2;
             listitem2.Enabled = (newNumIndex2 >= 2);
             // correct listitem3 if index3 is out of range
             var newNumIndex3 = PedData.GetNumIndex3(ped, slot_key, slot_value.index1, slot_value.index2);
             if (slot_value.index3 >= newNumIndex3) slot_value.index3 = newNumIndex3 - 1;
             listitem3.Index = slot_value.index3;
             listitem3.Enabled = (newNumIndex3 >= 2);
             // correct listitem3 if index3 is out of range
             var newNumIndex4 = PedData.GetNumIndex4(ped, slot_key, slot_value.index1, slot_value.index2, slot_value.index3);
             if (slot_value.index4 >= newNumIndex4) slot_value.index4 = newNumIndex4 - 1;
             listitem4.Index = slot_value.index4;
             listitem4.Enabled = (newNumIndex4 >= 2);
             // set slot value
             ped_data.SetSlotValue(ped, slot_key, slot_value);
         }
     };
     submenu.OnItemSelect += (sender, item, index) =>
     {
         if (item == clearitem)
         {
             var ped = Game.Player.Character;
             ped_data.ClearSlot(ped, slot_key);
             // update menu items
             var slot_value = ped_data.GetSlotValue(slot_key);
             listitem1.Index = slot_value.index1;
             listitem2.Index = slot_value.index2;
             listitem3.Index = slot_value.index3;
             listitem4.Index = slot_value.index4;
             listitem1.Enabled = (PedData.GetNumIndex1(ped, slot_key) >= 2);
             listitem2.Enabled = (ped_data.GetNumIndex2(ped, slot_key) >= 2);
             listitem3.Enabled = (ped_data.GetNumIndex3(ped, slot_key) >= 2);
             listitem4.Enabled = (ped_data.GetNumIndex4(ped, slot_key) >= 2);
         }
         else if (item == randomitem)
         {
             var ped = Game.Player.Character;
             var slot_value = ped_data.GetSlotValue(slot_key);
             slot_value.index1 = rnd.Next(PedData.GetNumIndex1(ped, slot_key));
             slot_value.index2 = rnd.Next(PedData.GetNumIndex2(ped, slot_key, slot_value.index1));
             slot_value.index3 = rnd.Next(PedData.GetNumIndex3(ped, slot_key, slot_value.index1, slot_value.index2));
             slot_value.index4 = rnd.Next(PedData.GetNumIndex4(ped, slot_key, slot_value.index1, slot_value.index2, slot_value.index3));
             ped_data.SetSlotValue(ped, slot_key, slot_value);
             listitem1.Index = slot_value.index1;
             listitem2.Index = slot_value.index2;
             listitem3.Index = slot_value.index3;
             listitem4.Index = slot_value.index4;
             listitem1.Enabled = (PedData.GetNumIndex1(ped, slot_key) >= 2);
             listitem2.Enabled = (ped_data.GetNumIndex2(ped, slot_key) >= 2);
             listitem3.Enabled = (ped_data.GetNumIndex3(ped, slot_key) >= 2);
             listitem4.Enabled = (ped_data.GetNumIndex4(ped, slot_key) >= 2);
         }
     };
 }
예제 #25
0
		private void CreateMenu()
		{
			_mainMenu = new UIMenu("Tobii Eye Tracking", "~b~SETTINGS");
			_mainMenu.SetMenuWidthOffset(50);
			//_mainMenu.ControlDisablingEnabled = false;
			_menuPool.Add(_mainMenu);

		    InitLists();
            CreateThirdPersonFreelookMenu();
            CreateFirstPersonFreelookMenu();
            CreateDeadzoneMenu();
		    _freelookDevice = new UIMenuListItem("Freelook Device", _freelookDevices, (int)_settings.FreelookDevice, "Device to use for freelook");
			_freelookDevice.OnListChanged += (sender, args) => { _settings.FreelookDevice = (FeeelookDevice)_freelookDevice.Index; };
			_mainMenu.AddItem(_freelookDevice);

            var firstPersonFreelookSettings = new UIMenuItem("First Person Freelook Settings", "Look around with gaze in first person");
            _mainMenu.AddItem(firstPersonFreelookSettings);
            _mainMenu.BindMenuToItem(FirstPersonFreelookMenu, firstPersonFreelookSettings);

            var thirdPersonFreelookSettings = new UIMenuItem("Third Person Freelook Settings", "Look around with gaze in third person");
            _mainMenu.AddItem(thirdPersonFreelookSettings);
            _mainMenu.BindMenuToItem(ThirdPersonFreelookMenu, thirdPersonFreelookSettings);

            var deadzoneSettings = new UIMenuItem("Freelook Deadzones", "Deadzones prevent camera movement when you are looking inside the zone, for example, the minimap");
            _mainMenu.AddItem(deadzoneSettings);
            _mainMenu.BindMenuToItem(DeadzoneMenu, deadzoneSettings);

		    var aimingSensitivitySlider = new UIMenuListItem("Aiming Sensitivity", _values0To1, (int)Math.Round(_settings.AimingSensitivity / 0.1), "Freelok sensitivity while aiming");
			aimingSensitivitySlider.OnListChanged += (sender, args) => { _settings.AimingSensitivity = aimingSensitivitySlider.IndexToItem(aimingSensitivitySlider.Index); };
			_mainMenu.AddItem(aimingSensitivitySlider);

			var aimWithGaze = new UIMenuCheckboxItem("Aim With Gaze", _settings.AimWithGazeEnabled, "Aim with gaze");
			aimWithGaze.CheckboxEvent += (sender, args) => { _settings.AimWithGazeEnabled = aimWithGaze.Checked; };
			_mainMenu.AddItem(aimWithGaze);

			var snapAtPedestrians = new UIMenuCheckboxItem("Snap At Pedestrians", _settings.SnapAtPedestriansEnabled, "Snap aim at pedestrians");
			snapAtPedestrians.CheckboxEvent += (sender, args) => { _settings.SnapAtPedestriansEnabled = snapAtPedestrians.Checked; };
			_mainMenu.AddItem(snapAtPedestrians);

			var gazeFilteringSlider = new UIMenuListItem("Gaze Filter", _values0To1, (int)Math.Round(_settings.GazeFiltering / 0.1), "Filter gaze data");
			gazeFilteringSlider.OnListChanged += (sender, args) => { _settings.GazeFiltering = gazeFilteringSlider.IndexToItem(gazeFilteringSlider.Index); };
			_mainMenu.AddItem(gazeFilteringSlider);

			var incinerateAtGaze = new UIMenuCheckboxItem("Incinerate At Gaze", _settings.IncinerateAtGazeEnabled, "Incinerate at gaze");
			incinerateAtGaze.CheckboxEvent += (sender, args) => { _settings.IncinerateAtGazeEnabled = incinerateAtGaze.Checked; };
			_mainMenu.AddItem(incinerateAtGaze);

			var taseAtGaze = new UIMenuCheckboxItem("Tase At Gaze", _settings.TaseAtGazeEnabled, "Tase at gaze");
			taseAtGaze.CheckboxEvent += (sender, args) => { _settings.TaseAtGazeEnabled = taseAtGaze.Checked; };
			_mainMenu.AddItem(taseAtGaze);

			var missilesAtGaze = new UIMenuCheckboxItem("Launch Missiles At Gaze", _settings.MissilesAtGazeEnabled, "Launch missiles at gaze");
			missilesAtGaze.CheckboxEvent += (sender, args) => { _settings.MissilesAtGazeEnabled = missilesAtGaze.Checked; };
			_mainMenu.AddItem(missilesAtGaze);

			var pedestrianIntreraction = new UIMenuCheckboxItem("Pedestrian Interaction", _settings.PedestrianInteractionEnabled, "Pedestrians talk to you");
			pedestrianIntreraction.CheckboxEvent += (sender, args) => { _settings.PedestrianInteractionEnabled = pedestrianIntreraction.Checked; };
			_mainMenu.AddItem(pedestrianIntreraction);

			var dontFallFromBikes = new UIMenuCheckboxItem("Don't Fall From Bikes", _settings.DontFallFromBikesEnabled, "Never fall from bikes");
			dontFallFromBikes.CheckboxEvent += (sender, args) => { _settings.DontFallFromBikesEnabled = dontFallFromBikes.Checked; };
			_mainMenu.AddItem(dontFallFromBikes);

            var shutDown = new UIMenuItem("Shut Down", "Unload the mod");
		    shutDown.Activated += (sender, item) =>
		    {
		        ShutDownRequested(this, new EventArgs());
		    };
            
            _mainMenu.AddItem(shutDown);

			_mainMenu.RefreshIndex();
		}
예제 #26
0
파일: UIMenu.cs 프로젝트: frodzet/NativeUI
        /// <summary>
        /// Function to get whether the cursor is in an arrow space, or in label of an UIMenuListItem.
        /// </summary>
        /// <param name="item">What item to check</param>
        /// <param name="topLeft">top left point of the item.</param>
        /// <param name="safezone">safezone size.</param>
        /// <returns>0 - Not in item at all, 1 - In label, 2 - In arrow space.</returns>
        public int IsMouseInListItemArrows(UIMenuListItem item, Point topLeft, Point safezone)
        {
            Function.Call((Hash)0x54CE8AC98E120CAB, "jamyfafi");
            UIResText.AddLongString(item.Text);
            var res = GetScreenResolutionMantainRatio();
            var screenw = res.Width;
            var screenh = res.Height;
            const float height = 1080f;
            float ratio = screenw / screenh;
            var width = height * ratio;
            int labelSize = Convert.ToInt32(Function.Call<float>((Hash)0x85F061DA64ED2F67, 0) * width * 0.35f);

            int labelSizeX = 5 + labelSize + 10;
            int arrowSizeX = 431 - labelSizeX;
            return IsMouseInBounds(topLeft, new Size(labelSizeX, 38))
                ? 1
                : IsMouseInBounds(new Point(topLeft.X + labelSizeX, topLeft.Y), new Size(arrowSizeX, 38)) ? 2 : 0;
        }
예제 #27
0
 public void SetParentItem(UIMenuListItem item)
 {
     ParentItem = item;
 }