/// <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 }
/// <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 }