예제 #1
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);
            }
        }
예제 #2
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;
            }
        }