public void ShowAboutScreen() { PlaySound(click); AboutScreen.SetActive(true); SettingsScreen.SetActive(false); }
public void HideSettingsScreen() { PlaySound(click); SettingsScreen.SetActive(false); LastScreen.SetActive(true); }
public void ShowSettingsScreen(GameObject obj) { PlaySound(click); LastScreen = obj; LastScreen.SetActive(false); SettingsScreen.SetActive(true); }
static void Main(string[] args) { Initialize(); bool playing = true; Game game = new Game(); CollectionScreen collectionScreen = new CollectionScreen(); SettingsScreen settingsScreen = new SettingsScreen(); Title title = new Title(); while (playing) { title.Setup(); title.Play(); title.Hide(); TitleOption option = title.SelectedOption; //Ends the loop if the user selects Exit if (option == TitleOption.Exit) { playing = false; } //Gets the screen that the player selected Screen screen = null; switch (option) { case TitleOption.Play: screen = game; break; case TitleOption.Collection: screen = collectionScreen; break; case TitleOption.Settings: screen = settingsScreen; break; } if (screen != null) { screen.Setup(); screen.Play(); screen.Hide(); } } //Saves the settings and collection files Collection.WriteToFile(COLLECTION_FILE); Settings.WriteToFile(SETTINGS_FILE); //Sets the console text color to white so that the output can be read. Console.ForegroundColor = ConsoleColor.White; }
private void OnSettingsButtonClick(object sender, EventArgs e) { settingsScreen = new SettingsScreen(configuration) { MinimizeBox = false }; settingsScreen.ConfigurationChanged += OnConfigurationChanged; settingsScreen.Show(); }
protected override void OnAccessorChanged(IAccessor accessor) { Title = accessor.FieldName; inputField.text = accessor.FieldValue.ToString(); originalText = inputField.text; Title = accessor.FieldName; rangeLimited = SettingsScreen.GetRangeOfNumberMember(accessor.MemberInfo, out lowerBound, out upperBound); base.OnAccessorChanged(accessor); }
/// <summary> /// Initalize a bunch of UI element templates: a dialog, a button, a dropdown menu, a slider, a toggle button and /// a label. /// </summary> /// <remarks> /// This method needs to be called before trying to instantiate any UI elements with <c>CreateCustomXXX</c> /// methods, otherwise those will throw unchecked NullPointerExceptions (I should probably handle those better). /// Currently, this is achieved by the <see cref="InitCustomUIElementsPatch"/>. Also, once it has been called, /// another call to this method has no effect. /// </remarks> /// <param name="settingsScreen">The settings screen. Using this to store the dialog template so that it doesn't /// get unloaded. There's probably a less hacky way to do this.</param> /// <param name="dialog">The dialog to be used as a template.</param> /// <param name="settingsDialog">The Settings Dialog, used to get a variety of UI elements.</param> public static void InitalizeTemplates(SettingsScreen settingsScreen, ScreenDialog dialog, SettingsDialog settingsDialog) { // This only needs to run once. if (!AreTemplatesInitalized()) { initalized = true; // Just store a bunch of UI elements from the settings screen as templates. They will always be loaded, // so we don't have to care about manipulating them in any way yet. buttonTemplate = Traverse.Create(settingsDialog).Field("keyMappingButton").GetValue <GameUISelectableButton>(); dropdownTemplate = Traverse.Create(settingsDialog).Field("gameSpeedDropdown").GetValue <GameUISelectableDropdown>();; toggleTemplate = Traverse.Create(settingsDialog).Field("googlyEyesToggle").GetValue <GameUISelectableToggle>(); sliderTemplate = Traverse.Create(Traverse.Create(settingsDialog).Field("scrollSensitivityControl").GetValue <ScrollSensitivityControl>()).Field("slider").GetValue <SelectableSliderHelper>(); // There don't seem to be any labels that are assigned to explicit fields, which kinda makes sense, so we'll have to search for one. // This unfortunately breaks pretty easily as shown by the latest update of the game, so I guess we need a long term solution. labelTemplate = settingsDialog.transform.Find("Content/Content/Audio Section/Global volume control").GetComponentInChildren <TextMeshProUGUI>(); // Print warnings if any initalization has been unsuccessful. if (buttonTemplate == null) { AdvancedRunHistory.Log("Button template is null.", LogLevel.Warning); } if (dropdownTemplate == null) { AdvancedRunHistory.Log("Dropdown template is null.", LogLevel.Warning); } if (toggleTemplate == null) { AdvancedRunHistory.Log("Toggle template is null.", LogLevel.Warning); } if (sliderTemplate == null) { AdvancedRunHistory.Log("Slider template is null.", LogLevel.Warning); } if (labelTemplate == null) { AdvancedRunHistory.Log("Label template is null.", LogLevel.Warning); } // We actually neeed to instantiate a copy of the dialog template right now, as the Patch Notes dialog will // unload as soon as you leave the Main Menu screen. Also, we can remove its contents while we're at it. dialogTemplate = GameObject.Instantiate(dialog, settingsScreen.transform); foreach (Transform child in dialogTemplate.transform.Find("Content")) { GameObject.Destroy(child.gameObject); } if (dialogTemplate == null) { AdvancedRunHistory.Log("Dialog template is null.", LogLevel.Warning); } } }
private void LoadSettings() { SpriteFont labelSpriteFont = Content.Load <SpriteFont>(@"Fonts/Input"); SpriteFont additionalFont = Content.Load <SpriteFont>(@"Fonts/AdditionalOptions"); List <Texture2D> buttonsTextures = new List <Texture2D>() { Content.Load <Texture2D>(@"Images/Settings/Arrows"), Content.Load <Texture2D>(@"Images/Settings/WSAD"), Content.Load <Texture2D>(@"Images/Settings/SpaceBomb"), Content.Load <Texture2D>(@"Images/Settings/PBomb") }; _settings = new SettingsScreen(labelSpriteFont, additionalFont, buttonsTextures, Content.Load <Texture2D>(@"Images/Game/white_block"), Content.Load <Texture2D>(@"Images/Settings/SaveChanges"), _back); }
public UiSystem() { mBriefingScreen = new BriefingScreen(); mIntroScreen = new IntroScreen(); mShopScreen = new ShopScreen(); mSettingsScreen = new SettingsScreen(); mAdsScreen = new AdsScreen(); mGameScreen = new GameScreen(); mDebriefingWinScreen = new DebriefingWinScreen(); mDebriefingDefeatScreen = new DebriefingDefeatScreen(); HideAllScreens(); mScreenMode = eMode.NO_SCREEN; mProgressBar = GameObject.Find("FilledZone").GetComponent <RectTransform>(); }
public HostileSpace() { LoadSettings(); LoadPlayerData(); ContextSettings contextSettings = new ContextSettings(); contextSettings.AntialiasingLevel = 16; window = new RenderWindow(new VideoMode(settings.ResolutionX, settings.ResolutionY), "Hostile Space", Styles.None, contextSettings); window.SetMouseCursorVisible(false); window.SetVerticalSyncEnabled(false); contentManager = new ContentManager(); fpsCounter = new FPSCounter(this); input = new Input(this); musicPlayer = new MusicPlayer(this); audioPlayer = new AudioPlayer(this); background = new Background(this); mainScreen = new MainScreen(this); mainScreen.NewGameBTN.ButtonPressed += NewGameBTN_ButtonPressed; mainScreen.SettingsBTN.ButtonPressed += SettingsBTN_ButtonPressed; mainScreen.CreditsBTN.ButtonPressed += CreditsBTN_ButtonPressed; gameScreen = new GameScreen(this); settingsScreen = new SettingsScreen(this); settingsScreen.Back.ButtonPressed += Back_ButtonPressed; creditsScreen = new CreditsScreen(this); creditsScreen.Back.ButtonPressed += Back_ButtonPressed; currentScreen = mainScreen; currentScreen.Activate(); camera = window.DefaultView; input.Keyboard.F12Pressed += Keyboard_F12Pressed; window.MouseWheelMoved += Window_MouseWheelMoved; }
public void Init(){ Instance = this; foreach (SettingSlider slider in Sliders) { slider.Init(); } Drop.options.Clear (); foreach(KeyValuePair<Settings.SettingsTypes, Settings.Setting> setting in Settings.Instance.SettingsDict){ Dropdown.OptionData item = new Dropdown.OptionData(); item.text = setting.Value.Title; Drop.options.Add(item); _settingsList.Add(setting.Value); } Drop.value = 1; Drop.value = 0; }
/// <summary> /// The constructor for the application, initialize all the components /// needed for the app /// </summary> public Application() { // Check if there is another instance, becuase there should never be one Debug.Assert(instance == null); // Set the instance to this class because it should // only be one instance instance = this; // Set the language to en_US as default LanguageManager.Instance.SetCurrentLanguage("en_US"); Styles windowStyle = Styles.Titlebar | Styles.Close; string windowTitle = LanguageManager.Instance.GetTranslation("window.title"); // Create a RenderWindow and setup the event callbacks window = new RenderWindow(new VideoMode(1280, 720), windowTitle, windowStyle); // Register some callbacks window.Closed += this.Window_Closed; window.KeyPressed += this.Window_KeyPressed; window.KeyReleased += this.Window_KeyReleased; window.MouseButtonPressed += this.Window_MouseButtonPressed; window.MouseButtonReleased += this.Window_MouseButtonReleased; // Create the screens used by this application mainMenuScreen = new MainMenuScreen(); customizeScreen = new CustomizeScreen(); gameScreen = new GameScreen(); settingsScreen = new SettingsScreen(); // Change the screen to the MainMenu ScreenManager.Instance.ChangeScreen(mainMenuScreen); // Register a language changed callback LanguageManager.Instance.RegisterOnLanguageChangedCallback(OnLanguageChanged); }
public static void Postfix(ref MainMenuScreen __instance) { // We only need to do this once. In fact, not checking this probably results in the game freezing due // to an infinite recursion. if (!CustomUIManager.AreTemplatesInitalized()) { // Find the current ScreenManager to access the Settigns Screen and Settings Dialog, as the Settings // Dialog contains a lot of UI elements and is helpful in creating templates. ScreenManager screenManager = Traverse.Create(Traverse.Create(__instance).Field("gameStateManager").GetValue <GameStateManager>()).Field("screenManager").GetValue <ScreenManager>(); SettingsScreen settingsScreen = (SettingsScreen)screenManager.GetScreen(ScreenName.Settings); SettingsDialog settingsDialog = Traverse.Create(settingsScreen).Field("settingsDialog").GetValue <SettingsDialog>(); // We need to actually open the Settings Dialog in order for the UI elements to initalize correctly. screenManager.ShowScreen(ScreenName.Settings); settingsDialog.Open(); settingsDialog.Close(); // Use the Patch Notes Dialog as a template for custom dialogs PatchNotesUI patch = Traverse.Create(__instance).Field("patchNotesDialog").GetValue <PatchNotesUI>(); ScreenDialog dialogTemplate = Traverse.Create(patch).Field("dialog").GetValue <ScreenDialog>(); CustomUIManager.InitalizeTemplates(settingsScreen, dialogTemplate, settingsDialog); // Pretend that nothing has happend and return to the main menu. screenManager.ReturnToMainMenu(); } }
public void onOpenSettingsScreen() { if(settingsScreen==null) { GameObject g = NGUITools.AddChild(GameObject.Find("UI Root"),settingsScreenPrefab); settingsScreen = g.GetComponent<SettingsScreen>(); } }
private void OpenSettings(object sender, RoutedEventArgs e) { SettingsScreen settingsScreen = new SettingsScreen(); settingsScreen.Show(); }
internal static void StartCheckIfInternet(Label lbl_NoInternet, SettingsScreen settingsScreen) { throw new NotImplementedException(); }
public void onCloseSettings() { settingsScreen = null; }