Exemplo n.º 1
0
        /// <summary>
        /// Updates the settings column (left one).
        /// </summary>
        /// <param name="update"></param>
        /// <param name="row"></param>
        public void UpdateSettings(bool update = false, int row = -1)
        {
            //SetSettingsSlot(0, "Selectable Option #0", "Right Text", true, 0);
            //SetSettingsSlot(1, "Selectable Option #1", "Right Text", true, 1);
            //SetSettingsSlot(2, "Selectable Option #2", "Right Text", true, 5);
            //SetSettingsSlot(3, "Selectable Option #3", "Right Text", true, 6);
            //SetSettingsSlot(4, "Selectable Option #4", "Right Text", true, 7);
            //SetSettingsSlot(5, "info #1", "", false, 5);
            //SetSettingsSlot(6, "info #2", "", false, 6);
            //SetSettingsSlot(7, "info #3", "", false, 7);
            //SetSettingsSlot(8, "info #4", "", false, 8);
            //SetSettingsSlot(9, "info #5", "", false, 9);
            //SetSettingsSlot(10, "info #6", "", false, 10);

            //SetSettingsCurrentDescription("This is a description for an option. It does not live update so you have to do this yourself somehow.", false);
            //if (update && row == 1)
            //{
            //    if (settingsList[1].SelectedIndex)
            //}
            if (update && row != -1)
            {
                var s = settingsList[row];
                SetSettingsSlot(s.RowIndex, s.Title, s.SelectionItems[s.SelectedIndex], s.Selectable, s.Type, s.RowColor);
                if (row == 1)
                {
                    if (s.SelectedIndex == 0)
                    {
                        SoundController.TriggerSuspenseMusicEvent();
                    }
                    else
                    {
                        SoundController.ResetMusicEvents();
                    }
                }
                if (row == 0)
                {
                    SetSettingsSlotVehicleInfo(settingsList.Count - 4, "Speed", GetStatFromSelectedVehicle(0, (uint)GetHashKey(GetSelectedVehicle())));
                    SetSettingsSlotVehicleInfo(settingsList.Count - 3, "Acceleration", GetStatFromSelectedVehicle(1, (uint)GetHashKey(GetSelectedVehicle())));
                    SetSettingsSlotVehicleInfo(settingsList.Count - 2, "Traction", GetStatFromSelectedVehicle(2, (uint)GetHashKey(GetSelectedVehicle())));
                    SetSettingsSlotVehicleInfo(settingsList.Count - 1, "Breaking", GetStatFromSelectedVehicle(3, (uint)GetHashKey(GetSelectedVehicle())));
                }
            }
            else
            {
                foreach (var s in settingsList)
                {
                    SetSettingsSlot(s.RowIndex, s.Title, s.SelectionItems[s.SelectedIndex], s.Selectable, s.Type, s.RowColor);
                }
                SetSettingsSlotVehicleInfo(settingsList.Count - 4, "Speed", GetStatFromSelectedVehicle(0, (uint)GetHashKey(GetSelectedVehicle())));
                SetSettingsSlotVehicleInfo(settingsList.Count - 3, "Acceleration", GetStatFromSelectedVehicle(1, (uint)GetHashKey(GetSelectedVehicle())));
                SetSettingsSlotVehicleInfo(settingsList.Count - 2, "Traction", GetStatFromSelectedVehicle(2, (uint)GetHashKey(GetSelectedVehicle())));
                SetSettingsSlotVehicleInfo(settingsList.Count - 1, "Breaking", GetStatFromSelectedVehicle(3, (uint)GetHashKey(GetSelectedVehicle())));
            }


            PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
            PushScaleformMovieFunctionParameterInt(0);
            PopScaleformMovieFunctionVoid();
            SetSettingsCurrentDescription(settingsList[GameController.FeCurrentSelection].Description, false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Toggles the menu visibility and sets up all the necessary data for the menu.
        /// </summary>
        /// <returns></returns>
        public async Task ToggleMenu()
        {
            if (!IsVisible)
            {
                if (IsPauseMenuActive() || IsPauseMenuRestarting() || IsFrontendFading())
                {
                    SetFrontendActive(false);
                }

                while (IsPauseMenuActive() || IsPauseMenuRestarting() || IsFrontendFading())
                {
                    SetFrontendActive(false);
                    await BaseScript.Delay(0);
                }

                RestartFrontendMenu((uint)GetHashKey(menuType.ToString()), -1);
                ActivateFrontendMenu((uint)GetHashKey(menuType.ToString()), false, -1);

                // wait for it to start.
                while (!IsPauseMenuActive() || IsPauseMenuRestarting())
                {
                    await BaseScript.Delay(0);
                }

                // don't use this: you'll regret it. It disables the navigation keys on keyboard. Not sure about controller.
                // N_0xec9264727eec0f28(); this disables the key.s
                // N_0x14621bb1df14e2b2(); this enables the keys again.

                BeginScaleformMovieMethodV("SHOW_HEADING_DETAILS"); // stops ped info from showing up (top right of the screen)
                PushScaleformMovieMethodParameterBool(false);       // also fixes the subtitle of the frontend menu from line-breaking really early.
                PopScaleformMovieFunctionVoid();


                /// some weird stuff that needs more research
                //BeginScaleformMovieMethodV("SET_ALL_HIGHLIGHTS");
                //PushScaleformMovieMethodParameterBool(true);
                //PushScaleformMovieMethodParameterInt(123);
                //PopScaleformMovieFunctionVoid();


                // move the header down and stuff.
                BeginScaleformMovieMethodV("SHIFT_CORONA_DESC");        // start call function - BeginScaleformMovieMethodV
                PushScaleformMovieFunctionParameterBool(true);          // push frontend title menu up.
                PushScaleformMovieFunctionParameterBool(false);         // show extra top border line
                PopScaleformMovieFunction();                            // end call function


                // Set header title.
                BeginScaleformMovieMethodV("SET_HEADER_TITLE");         // Call set header function
                PushScaleformMovieMethodParameterButtonName(name);      // Set the title
                PushScaleformMovieFunctionParameterBool(false);         // purpose unknown, is always 0 in decompiled scripts.
                PushScaleformMovieFunctionParameterString(subtitle);    // set the subtitle.
                PushScaleformMovieFunctionParameterBool(true);          // purpose unknown, is always 1 in decompiled scripts.
                PopScaleformMovieFunctionVoid();                        // finish the set header function



                // column 0 (settings)
                await BaseScript.Delay(100);

                UpdateSettings();
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(0);
                PopScaleformMovieFunctionVoid();


                // column 1 (right side mission details)
                await SetDetailsMissionName("Hunters VS Runners", null, null);

                await BaseScript.Delay(100);

                UpdateDetails();
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(1);
                PopScaleformMovieFunctionVoid();

                // column 3 (middle column: players list)
                await BaseScript.Delay(100);
                await UpdateList();

                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(3);
                PopScaleformMovieFunctionVoid();


                // ACTIVATE THE FIRST COLUMN (FOCUS).
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("SET_COLUMN_FOCUS");
                PushScaleformMovieFunctionParameterInt(0);     // column index // _loc7_
                PushScaleformMovieFunctionParameterBool(true); // highlightIndex // _loc6_
                PushScaleformMovieFunctionParameterBool(true); // scriptSetUniqID // _loc4_
                PushScaleformMovieFunctionParameterBool(true); // scriptSetMenuState // _loc5_
                PopScaleformMovieFunctionVoid();

                // Trigger the frontend music. Can be disabled using the option in the menu.
                SoundController.TriggerSuspenseMusicEvent();
            }
            else
            {
                SetFrontendActive(false);
            }
        }
Exemplo n.º 3
0
        private async void FirstPlayerSpawn()
        {
            if (!IsScreenFadedOut())
            {
                DoScreenFadeOut(0);
            }
            SwitchOutPlayer(PlayerPedId(), 0, 1);
            while (GetPlayerSwitchState() < 5)
            {
                await Delay(0);

                HideHudAndRadarThisFrame();
            }
            while (!IsScreenFadedOut())
            {
                HideHudAndRadarThisFrame();
                await Delay(0);
            }
            ShutdownLoadingScreen();
            ShutdownLoadingScreenNui();
            DoScreenFadeIn(100);
            while (!IsScreenFadedIn())
            {
                HideHudAndRadarThisFrame();
                await Delay(0);
            }

            if (GameState == 0)
            {
                AddTextEntry("hvr_loading_game", "Waiting for players.");
                SetLoadingPromptTextEntry("hvr_loading_game");
            }
            else if (GameState == 1)
            {
                AddTextEntry("hvr_loading_game", "Loading new round.");
                SetLoadingPromptTextEntry("hvr_loading_game");
            }
            else
            {
                AddTextEntry("hvr_loading_game", "Loading.");
                SetLoadingPromptTextEntry("hvr_loading_game");
            }


            StopAudioScene("MP_LEADERBOARD_SCENE");

            SoundController.TriggerSuspenseMusicEvent();

            fe.SetSubtitle("There are 2 teams. The ~r~HUNTERS~s~ and the ~b~RUNNERS~s~. The ~b~RUNNERS~s~ will have to race to the finish line, while the ~r~HUNTERS~s~ try to take them out.");

            fe.settingsList.Add(new SettingsItem(0, new List <string>()
            {
                "Wastelander", "Rat-Truck", "Bison", "Blazer"
            }, "Vehicle", "Choose a vehicle. This vehicle will be used for when you are on the runners team.", 0, true, 0, 0));
            fe.settingsList.Add(new SettingsItem(1, new List <string>()
            {
                "On", "Off"
            }, "Menu Music", "Tired of the music yet?", 0, true, 0, 0));
            fe.settingsList.Add(new SettingsItem(2, new List <string>()
            {
                ""
            }, "Ready", "Mark yourself ready to play.", 0, true, 2, 116));
            fe.settingsList.Add(new SettingsItem(3, new List <string>()
            {
                ""
            }, "Speed", "", 0, false, 3, 60));
            fe.settingsList.Add(new SettingsItem(4, new List <string>()
            {
                ""
            }, "Acceleration", "", 0, false, 3, 40));
            fe.settingsList.Add(new SettingsItem(5, new List <string>()
            {
                ""
            }, "Breaking", "", 0, false, 3, 20));
            fe.settingsList.Add(new SettingsItem(5, new List <string>()
            {
                ""
            }, "Traction", "", 0, false, 3, 20));
            fe.UpdateSettings();


            if (GameState == 0 || GameState == 1)
            {
                SetFrontendActive(false);
                while (IsFrontendFading() || IsPauseMenuActive() || IsPauseMenuRestarting())
                {
                    await Delay(0);
                }

                await fe.ToggleMenu();

                //frontendActive = true;

                int updateTimer = GetGameTimer();

                while (!AreWeReadyToStart())
                {
                    if (GetGameTimer() - updateTimer > 500)
                    {
                        fe.UpdatePlayers();
                        updateTimer = GetGameTimer();
                    }
                    SetCloudHatOpacity(0.002f);
                    ShowLoadingPrompt(1);

                    await Delay(0);
                }

                await fe.ToggleMenu();

                //frontendActive = false;
            }
        }