Пример #1
0
        private void OnCitationContinueClick(Gwen.Control.Base sender, Gwen.Control.ClickedEventArgs e)
        {
            Check();
            Game.LogTrivial("Citation page 1 submission begin...");
            using (StreamWriter Information = new StreamWriter("Plugins/LSPDFR/ComputerPlus/citations/completedcitations.txt", true))
            {
                Information.WriteLine(" ");
                Information.WriteLine(" ");
                Information.WriteLine("---INFORMATION---");
                Information.WriteLine("Citation Number: " + CitationNumberBox.Text);
                Information.WriteLine("Related Report Number: " + CitationRelatedBox.Text);
                Information.WriteLine("Date of incident: " + CitationDateBox.Text);
                Information.WriteLine("Time of incident: " + CitationTimeBox.Text);
                Information.WriteLine("Offender Full Name: " + SuspectFirstBox.Text + " " + SuspectLastBox.Text);
                Information.WriteLine("Offender DOB: " + CitationPerpDOBBox.Text);
                Information.WriteLine("Offender Residence: " + CitationPerpStreetBox.Text);
                Information.WriteLine("Issuing Officer #: " + CitationIssuedOfficerBox.Text);
                Information.WriteLine("Issuing Officer Name: " + CitationIssuedOfficerNameBox.Text);
            }
            Game.LogTrivial("Citation page 1 submission success!");
            Game.DisplayNotification("Citation page 1 of 2 complete...");

            this.Window.Close();
            form_citationviolation = new GameFiber(OpenCitationViolationForm);
            form_citationviolation.Start();
        }
Пример #2
0
 internal void OnFIContinueButtonClick(Gwen.Control.Base sender, Gwen.Control.ClickedEventArgs e)
 {
     GameFiber.StartNew(delegate
     {
         Check();
         Game.LogTrivial("FI personal info saving for: " + SuspectLastBox.Text.ToString() + " " + SuspectFirstBox.Text.ToString());
         Game.DisplayNotification("Page 2 of 3 saved. Continuing Field Interaction form...");
         using (StreamWriter Information = new StreamWriter("Plugins/LSPDFR/ComputerPlus/field interviews/" + SuspectLastBox.Text.ToLower() + SuspectFirstBox.Text.ToLower() + ".txt", true))
         {
             // 13 lines
             Information.WriteLine("---PERSONAL INFORMATION---");
             Information.WriteLine("DOB: " + SuspectDOBBox.Text);
             Information.WriteLine(SuspectSSNBox.Text);
             Information.WriteLine("Occupation: " + SuspectOccupationBox.Text);
             Information.WriteLine("Address: " + SuspectAddressBox.Text + " " + SuspectCityBox.Text);
             Information.WriteLine("Sex: " + SuspectSexBox.Text);
             Information.WriteLine("Race: " + SuspectRaceBox.Text);
             Information.WriteLine("Hair: " + SuspectHairBox.Text);
             Information.WriteLine("Eyes: " + SuspectEyesBox.Text);
             Information.WriteLine("Scars/Tattoos: " + SuspectMarkBox.Text);
             Information.WriteLine("License Status: " + SuspectLicenseBox.Text);
             Information.WriteLine("Vehicle Make, Model, Color: " + SuspectVehicleBox.Text);
             Information.WriteLine("Vehicle Plate: " + SuspectPlateBox.Text);
         }
         Game.LogTrivial("Successfully written to .txt");
     });
     state = SubmitCheck.submitted;
     FIComplete();
     this.Window.Close();
     form_firemarks = new GameFiber(OpenFIRemarksForm);
     form_firemarks.Start();
 }
Пример #3
0
 internal static void StartChecker()
 {
     _fiber = new GameFiber(CheckFiber);
     _fiber.Start();
     InitialStartup();
     Game.AddConsoleCommands();
 }
Пример #4
0
        public static void Main()
        {
            MenusProcessFiber = new GameFiber(ProcessLoop);
            Logger.DebugLog("ProcessFiber created");

            menuPool = new MenuPool();
            Logger.DebugLog("MenuPool created");

            mainMenu = new UIMenu("BVF", "~b~Basic Vehicle Functions");
            mainMenu.MouseControlsEnabled = false;
            mainMenu.AllowCameraMovement  = true;
            Logger.DebugLog("Main Menu created");

            menuPool.Add(mainMenu);
            Logger.DebugLog("Main Menu added to pool");

            DoorMainMenu = new UIMenu("BVF", "~b~Basic Vehicle Functions");
            DoorMainMenu.MouseControlsEnabled = false;
            DoorMainMenu.AllowCameraMovement  = true;
            Logger.DebugLog("Door Menu created");

            menuPool.Add(DoorMainMenu);
            Logger.DebugLog("Door Menu added to pool");

            //add items here
            toggleBoot   = new UIMenuItem("Boot");
            toggleBonnet = new UIMenuItem("Bonnet");
            togglelf     = new UIMenuItem("Rear Driver");
            togglerf     = new UIMenuItem("Rear Passenger");
            togglefd     = new UIMenuItem("Front Driver");
            togglefp     = new UIMenuItem("Front Passenger");
            toggleEngine = new UIMenuItem("Toggle Engine");



            mainMenu.AddItem(StartCalloutItem = new UIMenuItem("Open/Close Doors", " Open and close specific doors"));
            mainMenu.AddItem(toggleEngine);
            mainMenu.BindMenuToItem(DoorMainMenu, StartCalloutItem);

            DoorMainMenu.AddItem(togglefd);
            DoorMainMenu.AddItem(togglefp);
            DoorMainMenu.AddItem(togglelf);
            DoorMainMenu.AddItem(togglerf);
            DoorMainMenu.AddItem(toggleBoot);
            DoorMainMenu.AddItem(toggleBonnet);
            DoorMainMenu.RefreshIndex();
            DoorMainMenu.OnItemSelect  += BootOnItemSelect;
            DoorMainMenu.OnIndexChange += OnItemChange;
            Logger.DebugLog("Configured Door Menu");

            mainMenu.RefreshIndex();
            mainMenu.OnItemSelect  += OnItemSelect;
            mainMenu.OnIndexChange += OnItemChange;
            Logger.DebugLog("Configured Main Menu");

            MenusProcessFiber.Start();
            Logger.DebugLog("ProcessFiber started");
            GameFiber.Hibernate();
        }
Пример #5
0
 public Transport(Ped ped, Vector3 pickupPos, SpawnPoint dispatchFrom)
 {
     this.ped       = ped;
     policeCarSpawn = dispatchFrom;
     this.pickupPos = pickupPos;
     process        = new GameFiber(Process);
     process.Start();
 }
 internal static void StartAmbientEvents()
 {
     "Starting to load ambient events...".AddLog(true);
     _ambientList       = LoadAmbientEvents();
     _ambientController = new GameFiber(AmbientController);
     _ambientController.Start();
     $"{_ambientList.Count} ambient events loaded".AddLog(true);
 }
Пример #7
0
        public void Functions_OnOnDutyStateChanged(bool onDuty)
        {
            if (!onDuty)
            {
                return;
            }

            "Loading...".AddLog();
            var fiber = new GameFiber(StartDuty.StartDutyMethods);

            fiber.Start();
        }
        public static void CreateScene(Vector3 playerPosition, Vector3 mePosition)
        {
            "Starting Scene Creation -- Stopwatch Started".AddLog();
            Sw.Start();
            int id = 60418;

            NativeFunction.Natives.SET_INTERIOR_ACTIVE(id, true);
            NativeFunction.Natives.x2CA429C029CCF247(id);
            LoadXml();
            "XML Loaded".AddLog();
            AmbientFiber.Start();
        }
Пример #9
0
        private static void WaitForSuspect(Vehicle vehicle, Vector3 point)
        {
            "WaitForSuspect".AddLog();
            Stopwatch sw = new Stopwatch();

            sw.Start();

            _cameraMovementFiber = new GameFiber(CameraMove);
            _cameraMovementFiber.Start();

            while (vehicle.Position.DistanceTo(point) > 4f)
            {
                if (sw.Elapsed.Seconds >= 15)
                {
                    "Stopwatch elapsed, breaking loop".AddLog(true);
                    break;
                }

                GameFiber.Yield();
            }
            "Vehicle at position".AddLog(true);

            _sus.Tasks.PerformDrivingManeuver(vehicle, VehicleManeuver.Wait);

            _play = false;

            _secCam.Face(_veh);

            _pauseTime = World.TimeOfDay;

            var speedZone = World.AddSpeedZone(_targetPos, 60f, 0f);

            for (var i = _secCam.FOV; i >= GetFOVValue(Vector3.Distance(Game.LocalPlayer.Character.Position, _veh)); i += -0.2f)
            {
                _secCam.FOV = i;
                GameFiber.Sleep(0100);
            }

            GameFiber.Sleep(3000);

            FadeScreen(true);

            World.RemoveSpeedZone(speedZone);

            "Ending".AddLog(true);

            _cameraMovementFiber.Abort();

            Game.RawFrameRender -= OnRawFrameRender;

            EndCamera();
        }
Пример #10
0
        public static void Init()
        {
            Log.Info("SHVDN", "Loading SHVDN support...");
            Support.Instance.KeyboardManager.RegisterHandler(SendKeyboardMessage);

            initMethods.Clear();
            tickMethods.Clear();
            keyboardMethods.Clear();

            foreach (string filename in Directory.EnumerateFiles(Support.Instance.WorkingDirectory, "ScriptHookVDotNet-univ*.dll"))
            {
                Log.Info("File: " + filename);

                Assembly assembly;

                try
                {
                    // Unblock file if it was downloaded from a network location
                    if (File.Exists(filename + ":Zone.Identifier"))
                    {
                        File.Delete(filename + ":Zone.Identifier");
                    }

                    assembly = Assembly.LoadFrom(filename);
                }
                catch (Exception ex)
                {
                    Log.Error("SHVDN", "FATAL: Unable to load '" + filename + "' due to the following exception:\n\n" + ex);
                    continue;
                }

                Type main = assembly.GetType("ScriptHookVDotNet");

                if (main != null && main.IsAbstract)
                {
                    Func <bool> initMethod = (Func <bool>)main.GetMethod("Init", BindingFlags.Public | BindingFlags.Static).CreateDelegate(typeof(Func <bool>));
                    initMethods.Add(initMethod);
                    Action tickMethod = (Action)(main.GetMethod("Tick", BindingFlags.Public | BindingFlags.Static).CreateDelegate(typeof(Action)));
                    tickMethods.Add(tickMethod);
                    KeyboardMethodDelegate keyboardMessageMethod = (KeyboardMethodDelegate)(main.GetMethod("KeyboardMessage", BindingFlags.Public | BindingFlags.Static).CreateDelegate(typeof(KeyboardMethodDelegate)));
                    keyboardMethods.Add(keyboardMessageMethod);
                }
            }

            foreach (Func <bool> Init in initMethods)
            {
                Init();
            }

            fiber = new GameFiber(RunFiber);
            fiber.Start();
        }
Пример #11
0
        public void StartDialog()
        {
            IsRunning = true;

            AnimationAdd();

            ("Total lines: " + Lines.Length).AddLog();

            PedsFacePlayer();

            _lineFiber = new GameFiber(ShowLine);
            _lineFiber.Start();
        }
Пример #12
0
 private void ShowPoliceComputer()
 {
     Globals.CloseRequested = false;
     Globals.OpenRequested  = true;
     if (RunComputerPlusFiber.IsHibernating)
     {
         RunComputerPlusFiber.Wake();
     }
     else if (!RunComputerPlusFiber.IsAlive)
     {
         RunComputerPlusFiber.Start();
     }
 }
Пример #13
0
 internal static void Resume(this GameFiber fiber)
 {
     if (fiber != null && !fiber.IsAlive)
     {
         if (fiber.IsHibernating)
         {
             fiber.Wake();
         }
         else
         {
             fiber.Start();
         }
     }
 }
Пример #14
0
 private void Login()
 {
     if (this.input_user.Text == Configs.Username &&
         this.pass.Text == Configs.Password)
     {
         this.Window.Close();
         next_form = new GameFiber(OpenMainForm);
         next_form.Start();
     }
     else
     {
         this.label_invalid.Show();
     }
 }
        public void StartWeaponFireCheck(List <Ped> pedList)
        {
            if (pedList.Count < 1)
            {
                return;
            }

            StartedWeaponFireCheck = true;

            var fiber = new GameFiber(() => WeaponFireCheck(pedList.ToList()));

            fiber.Start();
            _activeFibers.Add(fiber);
        }
        public void CalloutFinished()
        {
            "CalloutFinished()".AddLog();
            if (_computerPlus)
            {
                ComputerPlusAPI.ConcludeCallout(_callId);
            }
            DisplayEndInformation();

            var fiber = new GameFiber(DetectiveFiber);

            fiber.Start();
            _activeFibers.Add(fiber);
        }
Пример #17
0
        internal void CheckCheckboxes()
        {
            if (cbPlayerInvincible.Checked == true)
            {
                Game.LocalPlayer.IsInvincible = true;
            }
            if (!cbPlayerInvincible.Checked)
            {
                Game.LocalPlayer.IsInvincible = false;
            }

            if (cbNeverWanted.Checked == true)
            {
                Game.LocalPlayer.WantedLevel = 0;
            }

            if (cbUnlimitedAmmo.Checked == true)
            {
                if (Game.LocalPlayer.Character.Inventory.EquippedWeapon != null)
                {
                    WeaponDescriptor equipWeapon = Game.LocalPlayer.Character.Inventory.EquippedWeapon;
                    equipWeapon.Ammo = 9999;
                }
            }

            if (cbNoRagdoll.Checked == true)
            {
                Game.LocalPlayer.Character.CanRagdoll = false;
            }
            else
            {
                Game.LocalPlayer.Character.CanRagdoll = true;
            }

            if (cbFreezeWeather.Checked && !cbFreezeWeatherChecked)
            {
                GameFiber freezeWeatherThread = new GameFiber(new ThreadStart(FreezeWeather), "LSPDE Thread");
                freezeWeatherThread.Start();
                cbFreezeWeatherChecked = true;
                GameFiber.Sleep(50);
            }
            if (!cbFreezeWeather.Checked && cbFreezeWeatherChecked)
            {
                FreezeWeatherEnabled   = false;
                cbFreezeWeatherChecked = false;
                GameFiber.Sleep(50);
            }
        }
Пример #18
0
        public static void Main()
        {
            // Create a fiber to process our menus
            menusProcessFiber = new GameFiber(ProcessLoop);

            // Create the MenuPool to easily process our menus
            menuPool = new MenuPool();

            // Create our menus
            menu1 = CreateMenu("First");
            menu2 = CreateMenu("Second");
            menu3 = CreateMenu("Third");
            menu4 = CreateMenu("Fourth");

            // Create the menu switcher
            menuSwitcher = new UIMenuSwitchMenusItem("Menu", "", new DisplayItem(menu1, "The First"),
                                                     new DisplayItem(menu2, "The Second"),
                                                     new DisplayItem(menu3, "The Third"),
                                                     new DisplayItem(menu4, "The Fourth"));

            // We use the DisplayItem class to specify the custom text that will appear in the menu switcher;
            // we can pass the menus directly too and it will use the menu title text instead:
            //
            // menuSwitcher = new UIMenuSwitchMenusItem("Menu", "", menu1, menu2, menu3, menu4);
            //

            // Add the menu switcher to the menus
            menu1.AddItem(menuSwitcher, 0);
            menu2.AddItem(menuSwitcher, 0);
            menu3.AddItem(menuSwitcher, 0);
            menu4.AddItem(menuSwitcher, 0);


            menu1.RefreshIndex();
            menu2.RefreshIndex();
            menu3.RefreshIndex();
            menu4.RefreshIndex();

            // Temporal fix to prevent some flickering that happens occasionally when switching menus
            menuSwitcher.OnListChanged += (s, i) => { menuSwitcher.CurrentMenu.Draw(); };

            // Start our process fiber
            menusProcessFiber.Start();


            // Continue with our plugin... in this example, hibernate to prevent it from being unloaded
            GameFiber.Hibernate();
        }
            /// <summary>
            /// Constructor for the main class, same as the class, do not rename.
            /// </summary>
            public Main()
            {
                Game.LogTrivial(plug_ver + " : Plugin loaded !");
                if (!CheckVersionsofAssemblies())
                {
                    return;
                }
                if (option_dev_mode == 35)
                {
                    Game.LogTrivial(plug_ver + " : Developer mode activated !");
                }
                ThreadStart dev_thread = new ThreadStart(YetAnotherPartnerModClass.PartnerThread);

                dthread = new GameFiber(YetAnotherPartnerModClass.PartnerThread, "yapm_dev_checks_thread");
                dthread.Start();
            }
Пример #20
0
        private static void DutyStateChangedHandler(bool on_duty)
        {
            Globals.IsPlayerOnDuty = on_duty;

            if (on_duty)
            {
                Game.FrameRender += Process;
                Game.LogTrivial("Successfully loaded LSPDFR Computer+.");

                Function.MonitorAICalls();
                fCheckIfCalloutActive = new GameFiber(CheckIfCalloutActive);
                fCheckIfCalloutActive.Start();

                Function.CheckForUpdates();
            }
        }
        /*
         * Animations:
         *      _firstOfficer.Ped.Tasks.PlayAnimation("amb@code_human_police_crowd_control@idle_b", "idle_d", 4, AnimationFlags.Loop);
         */
        /// <summary>
        /// Call this to begin scene creation using SceneData.xml
        /// </summary>
        /// <param name="playerPosition"></param>
        public static void CreateScene(Vector3 playerPosition)
        {
            "Starting Scene Creation -- Stopwatch Started".AddLog();
            Sw.Start();
            ObjectList.Clear();
            LoadXml();
            "XML Loaded".AddLog();
            var playerdist = Vector3.Distance(playerPosition, Victim.Position);

            ("Distance from Scene: " + playerdist).AddLog();
            SetAnimations();
            AmbientFiber = new GameFiber(AmbientRun);
            AmbientFiber.Start();
            CopFiber = new GameFiber(CopRun);
            CopFiber.Start();
            Completed = true;
        }
Пример #22
0
 public void StartEventMonitoring()
 {
     if (FiberCanRun)
     {
         if (KeyListenerFiber.IsHibernating)
         {
             KeyListenerFiber.Wake();
         }
         else
         {
             KeyListenerFiber.Start();
         }
     }
     else if (KeyListenerFiber != null)
     {
         StopEventMonitoring();
     }
 }
Пример #23
0
        internal static void Main()
        {
            GameFiber.StartNew(delegate
            {
                _menusProcessFiber = new GameFiber(ProcessLoop);

                _menuPool = new MenuPool();
                _mainMenu = new UIMenu("Detective/Supervisor Interaction", "");

                _menuPool.Add(_mainMenu);

                _mainMenu.RefreshIndex();

                _menusProcessFiber.Start();

                GameFiber.Hibernate();
            });
        }
Пример #24
0
        private static void Main()
        {
            while (Game.IsLoading)
            {
                GameFiber.Yield();
            }
            Game.LogTrivial("Enabling Player Loop...");
            var PlayerProcessFiber = new GameFiber(BackWeapon.PlayerLoop);

            PlayerProcessFiber.Start();
            if (enableAI)
            {
                Game.LogTrivial("Enabling AI Loop...");
                var AIProcessFiber = new GameFiber(BackWeapon.AIPedsLoop);
                AIProcessFiber.Start();
            }
            Game.LogTrivial("Stow That Weapon (BackWeapon.dll) by willpv23 has been loaded!");
            GameFiber.Hibernate();
        }
Пример #25
0
        public static void RunVanillaAlpr()
        {
            Function.LogDebug("RunVanillaAlpr");
            if (VanillaAlprGameFiber.IsHibernating)
            {
                Function.LogDebug("Wake RunVanillaAlpr");
                EventHandler handler = (EventHandler)OnStopAlprVanilla;
                if (handler != null)
                {
                    handler(null, null);
                }

                VanillaAlprGameFiber.Wake();
            }
            else if (!VanillaAlprGameFiber.IsAlive && !VanillaAlprGameFiber.IsSleeping)
            {
                Function.LogDebug("Start RunVanillaAlpr");
                VanillaAlprGameFiber.Start();
            }
        }
Пример #26
0
        public static void initMainMenu()
        {
            current_item = "Bolingbroke"; // The current item of the list of police stations is updated to Bolingbroke, this fixes a bug where upon first loading the plugin, a user
                                          // Would have to switch to a different location before being able to teleport back to Bolingbroke.

            GoMenu      = new UIMenu("GoThere", "~b~LET'S MOVE!");
            StationList = new UIMenuListItem("~g~List of Stations: ", "", "Bolingbroke", "Davis", "Downtown Vinewood", "La Mesa", "LSIA", "Mission Row",
                                             "Paleto Bay", "Rockford Hills", "Sandy Shores", "Vespucci", "Vinewood Hills");


            menu_pool = new MenuPool();

            MenuProcessFiber = new GameFiber(ProcessLoop);


            menu_pool.Add(GoMenu);       // Add our menu to the menu pool
            GoMenu.AddItem(StationList); // Add a list of destinations -- maybe we want to hold destination OBJECTS. We shall see.
            GoMenu.OnItemSelect += OnItemSelect;
            GoMenu.OnListChange += OnListChange;

            if (customLocationsEnabled) // If custom locations are enabled
            {
                navigateToLocMenu = new UIMenuItem("Custom Locations");
                LocMenu           = new UIMenu("Custom Locations", "Teleport to custom locations.");                             // Initialize the locations menu
                menu_pool.Add(LocMenu);                                                                                          // Add the locations menu to the menu pool

                GoMenu.AddItem(navigateToLocMenu);                                                                               // Add the ui item to the main menu
                GoMenu.BindMenuToItem(LocMenu, navigateToLocMenu);                                                               // Bind the locations menu to the ui item
                LocMenu.ParentMenu = GoMenu;                                                                                     // Set the parent menu of the locations menu to be the main menu
                InstructionalButton removeButtonKeyButton = new InstructionalButton(removeKey.ToString(), "Remove Destination"); // Add instructional button showing users how to remove a dest.
                LocMenu.AddInstructionalButton(removeButtonKeyButton);
                RefreshCustomLocationsMenu();
            }
            GoMenu.RefreshIndex();                                                                               // Set the index at 0 by using the RefreshIndex method

            MenuProcessFiber.Start();                                                                            // Start process fiber

            Game.DisplayNotification("~r~[GoThere] \nGoThere v1.0 ~w~by ~b~Cavasi ~w~has loaded successfully!"); // Display a notification above the radar that the plugin loaded successfully

            GameFiber.Hibernate();                                                                               // Continue with our plugin. Prevent it from being unloaded
        }
        public override bool OnCalloutAccepted()
        {
            "Callout has been accepted".AddLog();

            if (!string.IsNullOrWhiteSpace(AcceptScannerAudio))
            {
                var fiber = new GameFiber(StartSecondaryAudio);
                fiber.Start();
                _activeFibers.Add(fiber);
            }

            if (_computerPlus)
            {
                ComputerPlusAPI.SetCalloutStatusToUnitResponding(_callId);
            }

            //            if (FalseCall && Fiskey111Common.Rand.RandomNumber(1, 15) == 1)
            //            {
            //                "False Call".AddLog();
            //                _isFalseCall = true;
            //                FalseCallHandler.callState = FalseCallHandler.CallState.Start;
            //            }

            //CalloutName.DisplayNotification(ResponseInfo);

            var position = SpawnPoint.Around2D(5f, 20f);

            if (SpawnBlip)
            {
                AreaBlip       = CalloutStandardization.CreateStandardizedBlip(position, BlipType, BlipScale);
                AreaBlip.Alpha = BlipAlpha;
                AreaBlip.EnableRoute(AreaBlip.Color);
            }

            "Returning OnCalloutAccepted".AddLog();

            return(base.OnCalloutAccepted());
        }
Пример #28
0
        internal void OnFIContinueButtonClick(Gwen.Control.Base sender, Gwen.Control.ClickedEventArgs e)
        {
            GameFiber.StartNew(delegate
            {
                Game.DisplayNotification("Page 1 of 3 saved. Continuing Field Interaction form...");
                using (StreamWriter Information = new StreamWriter("Plugins/LSPDFR/ComputerPlus/field interviews/" + SuspectLastBox.Text.ToLower() + SuspectFirstBox.Text.ToLower() + ".txt", true))
                {
                    // 8 Lines
                    Information.WriteLine(" ");
                    Information.WriteLine(" ");
                    Information.WriteLine("---ENVIRONMENT---");
                    Information.WriteLine("Date: " + FIDateBox.Text);
                    Information.WriteLine("Time: " + FITimeBox.Text);
                    Information.WriteLine("Location: " + FILocation.Text);
                    Information.WriteLine("Officer Name and Number: " + FIOfficerNameBox.Text + " " + FIOfficerNumberBox.Text);
                    Information.WriteLine("Individual Full Name: " + SuspectFirstBox.Text + " " + SuspectLastBox.Text);
                }
                Game.LogTrivial("Successfully written to .txt");
            });

            this.Window.Close();
            form_fipersonal = new GameFiber(OpenFIPersonalForm);
            form_fipersonal.Start();
        }
 public void StartDialog()
 {
     _lineFiber = new GameFiber(ShowLine);
     _lineFiber.Start();
 }
Пример #30
0
        public static void Main()
        {
            // Create a fiber to process our menus
            MenusProcessFiber = new GameFiber(ProcessLoop);

            // Create the MenuPool to easily process our menus
            _menuPool = new MenuPool();

            // Create our main menu
            mainMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE");

            // Add our main menu to the MenuPool
            _menuPool.Add(mainMenu);

            // create our items and add them to our main menu
            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);

            var carsModel = new List<dynamic>
            {
                "Adder",
                "Bullet",
                "Police",
                "Police2",
                "Asea",
                "FBI",
                "FBI2",
                "Firetruk",
                "Ambulance",
                "Rhino",
            };
            carsList = new UIMenuListItem("Cars Models", carsModel, 0);
            mainMenu.AddItem(carsList);

            spawnCar = new UIMenuItem("Spawn Car");
            mainMenu.AddItem(spawnCar);

            coloredItem = new UIMenuColoredItem("Color!", System.Drawing.Color.Red, System.Drawing.Color.Blue);
            mainMenu.AddItem(coloredItem);

            mainMenu.RefreshIndex();

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

            // Create another menu
            newMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE");
            newMenu.CounterOverride = "Counter Override";
            _menuPool.Add(newMenu); // add it to the menu pool
            for (int i = 0; i < 35; i++) // add items
            {
                newMenu.AddItem(new UIMenuItem("PageFiller " + i.ToString(), "Sample description that takes more than one line. More so, it takes way more than two lines since it's so long. Wow, check out this length!"));
            }
            newMenu.RefreshIndex();
            mainMenu.BindMenuToItem(newMenu, menuItem); // and bind it to an item in our main menu

            // Start our process fiber
            MenusProcessFiber.Start();

            // Continue with our plugin... in this example, hibernate to prevent it from being unloaded
            GameFiber.Hibernate();
        }
Пример #31
0
        public void Display()
        {
            if (!cleanGameFibersRunning)
            {
                cleanGameFibers();
            }
            hasDisplayed       = false;
            IndexOfGivenAnswer = -1;
            popupQueue.Add(this);
            if (fiber != null && popupFibersToDelete.Contains(fiber))
            {
                popupFibersToDelete.Remove(fiber);
            }
            Game.LogTrivial("Adding " + PopupTitle + " popup to queue.");
            fiber = new GameFiber(delegate
            {
                while (!ForceDisplay)
                {
                    GameFiber.Yield();
                    if (!CommonVariables.DisplayTime && !Game.IsPaused)
                    {
                        if (popupQueue.Count > 0 && popupQueue[0] == this)
                        {
                            break;
                        }
                        else if (popupQueue.Count == 0)
                        {
                            break;
                        }
                    }
                }

                CommonVariables.DisplayTime = true;
                if (PauseGame)
                {
                    Game.IsPaused = true;
                }
                if (showEnterConfirmation)
                {
                    popupLines.AddRange(("Press Enter to close.").WrapText(720, "Arial Bold", 15.0f, out PopupTextLineHeight));
                }
                isDisplaying = true;
                GameFiber.Sleep(Delay);
                popupQueue.Remove(this);
                Game.RawFrameRender += DrawPopup;
                Game.LogTrivial("Drawing " + PopupTitle + " popup message");

                timer.Restart();
                if (showEnterConfirmation)
                {
                    while (isDisplaying)
                    {
                        if (PauseGame)
                        {
                            Game.IsPaused = true;
                        }
                        GameFiber.Yield();
                        if (Game.IsKeyDown(Keys.Enter))
                        {
                            Game.LogTrivial("ClosePopup is pressed");
                            Hide();
                            break;
                        }
                    }
                }

                else if (Answers != null && Answers.Count > 0)
                {
                    while (isDisplaying)
                    {
                        if (PauseGame)
                        {
                            Game.IsPaused = true;
                        }
                        GameFiber.Yield();
                        if (timer.ElapsedMilliseconds > 25000)
                        {
                            Game.DisplayNotification("A textbox is currently being shown in the centre of your screen. If you can't see it, RPH had an issue initializing with DirectX and your RPH console won't work either - ask for support on the RPH Discord (link at www.ragepluginhook.net");
                            timer.Restart();
                        }

                        if (Game.IsKeyDown(Keys.D1))
                        {
                            if (answersAsDisplayed.Count >= 1)
                            {
                                IndexOfGivenAnswer = Answers.IndexOf(answersAsDisplayed[0]);
                                Hide();
                            }
                        }
                        if (Game.IsKeyDown(Keys.D2))
                        {
                            if (answersAsDisplayed.Count >= 2)
                            {
                                IndexOfGivenAnswer = Answers.IndexOf(answersAsDisplayed[1]);
                                Hide();
                            }
                        }
                        if (Game.IsKeyDown(Keys.D3))
                        {
                            if (answersAsDisplayed.Count >= 3)
                            {
                                IndexOfGivenAnswer = Answers.IndexOf(answersAsDisplayed[2]);
                                Hide();
                            }
                        }
                        if (Game.IsKeyDown(Keys.D4))
                        {
                            if (answersAsDisplayed.Count >= 4)
                            {
                                IndexOfGivenAnswer = Answers.IndexOf(answersAsDisplayed[3]);
                                Hide();
                            }
                        }
                        if (Game.IsKeyDown(Keys.D5))
                        {
                            if (answersAsDisplayed.Count >= 5)
                            {
                                IndexOfGivenAnswer = Answers.IndexOf(answersAsDisplayed[4]);
                                Hide();
                            }
                        }
                        if (Game.IsKeyDown(Keys.D6))
                        {
                            if (answersAsDisplayed.Count >= 6)
                            {
                                IndexOfGivenAnswer = Answers.IndexOf(answersAsDisplayed[5]);
                                Hide();
                            }
                        }
                    }
                }
                timer.Stop();
            });
            fiber.Start();
        }