示例#1
0
        private void CreateMenu()
        {
            // Create the menu.
            menu = new Menu(Game.Player.Name, "Enhanced Camera");

            #region checkbox items

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

            #endregion

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

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

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

            #endregion

            #region handling menu changes

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

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

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

                    if (!_checked)
                    {
                        ResetCameras();
                    }
                }
            };
            #endregion
        }
        /// <summary>
        /// Creates all the submenus of main menu
        /// </summary>
        /// <returns></returns>
        private void CreateSubmenus()
        {
            // Create the menu.
            Menu = new Menu(_t("MAIN_MENU_TITLE"), _t("MAIN_MENU_DESC"));
            MenuController.AddMenu(Menu);

            #region checkbox items

            // Enabling angular drift cam
            leadCam = new MenuCheckboxItem(_t("MAIN_MENU_ENABLE_LEAD"), _t("MAIN_MENU_ENABLE_LEAD_DESC"), false);
            // Enabling chase cam
            chaseCam = new MenuCheckboxItem(_t("MAIN_MENU_ENABLE_CHASE"), _t("MAIN_MENU_ENABLE_CHASE"), false);
            // Enabling chase cam
            droneCam = new MenuCheckboxItem(_t("MAIN_MENU_ENABLE_DRONE"), _t("MAIN_MENU_ENABLE_DRONE"), false);

            #endregion

            #region adding menu items
            // Checkboxes
            Menu.AddMenuItem(leadCam);
            if (chaseCameraConfigEnabled)
            {
                Menu.AddMenuItem(chaseCam);
            }
            if (droneCameraConfigEnabled)
            {
                Menu.AddMenuItem(droneCam);
            }

            // Custom cam parameters menu
            CustomCamMenu = new CustomCam();
            Menu     customCamMenu = CustomCamMenu.GetMenu();
            MenuItem buttonCustom  = new MenuItem(_t("MAIN_MENU_LEAD_CHASE_CONF"), _t("MAIN_MENU_LEAD_CHASE_CONF_DESC"))
            {
                Label = "→→→"
            };
            AddMenu(Menu, customCamMenu, buttonCustom);

            // Drone cam parameters menu
            DroneCamMenu = new DroneCam();
            Menu     droneCamMenu = DroneCamMenu.GetMenu();
            MenuItem buttonDrone  = new MenuItem(_t("MAIN_MENU_DRONE_CONF"), _t("MAIN_MENU_DRONE_CONF_DESC"))
            {
                Label = "→→→"
            };

            if (droneCameraConfigEnabled)
            {
                AddMenu(Menu, droneCamMenu, buttonDrone);
            }

            // Credits
            MenuItem credits = new MenuItem(_t("MAIN_MENU_CREDITS"), _t("MAIN_MENU_CREDITS_DESC"))
            {
            };
            Menu.AddMenuItem(credits);

            #endregion

            #region handling menu changes

            // Handle checkbox changes
            Menu.OnCheckboxChange += (_menu, _item, _index, _checked) => {
                if (_item == leadCam)
                {
                    CustomCam.LeadCam    = _checked;
                    chaseCam.Checked     = false;
                    droneCam.Checked     = false;
                    CustomCam.ChaseCam   = false;
                    DroneCam.DroneCamVar = false;

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

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

                    if (!_checked)
                    {
                        ResetCameras();
                    }
                }
            };
            #endregion
        }
示例#3
0
        /// <summary>
        /// Creates all the submenus of main menu
        /// </summary>
        /// <returns></returns>
        private void CreateSubmenus()
        {
            // Create the menu.
            Menu = new Menu("Enhanced camera", "Lead, chase and drone camera options");
            MenuController.AddMenu(Menu);

            #region checkbox items

            // Enabling angular drift cam
            leadCam = new MenuCheckboxItem("Enable lead camera", "Main camera, behaviour dependant on angular velocity of the car.", false);
            // Enabling chase cam
            chaseCam = new MenuCheckboxItem("Enable chase camera", "Locks to a target in front, switches to regular cam if target not in range.", false);
            // Enabling chase cam
            droneCam = new MenuCheckboxItem("Enable drone camera", "Free drone camera to spectate/fly around. Different modes available.", false);

            #endregion

            #region adding menu items
            // Checkboxes
            Menu.AddMenuItem(leadCam);
            if (chaseCameraConfigEnabled)
            {
                Menu.AddMenuItem(chaseCam);
            }
            if (droneCameraConfigEnabled)
            {
                Menu.AddMenuItem(droneCam);
            }

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

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

            if (droneCameraConfigEnabled)
            {
                AddMenu(Menu, droneCamMenu, buttonDrone);
            }

            // Credits
            MenuItem credits = new MenuItem("Credits", "~g~Shrimp~s~ - idea and execution\n" +
                                            "~g~Tom Grobbe~s~ - MenuAPI used for GUI, code snippets for saving/loading\n" +
                                            "~g~QuadrupleTurbo~s~ - Help with ideas and testing\n" +
                                            "~y~No Name Drift~s~ and ~y~Velocity~s~ drift servers - playtesting and feedback\n")
            {
            };
            Menu.AddMenuItem(credits);

            #endregion

            #region handling menu changes

            // Handle checkbox changes
            Menu.OnCheckboxChange += (_menu, _item, _index, _checked) => {
                if (_item == leadCam)
                {
                    CustomCam.LeadCam    = _checked;
                    chaseCam.Checked     = false;
                    droneCam.Checked     = false;
                    CustomCam.ChaseCam   = false;
                    DroneCam.DroneCamVar = false;

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

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

                    if (!_checked)
                    {
                        ResetCameras();
                    }
                }
            };
            #endregion
        }