void Chooser_done(OxChooser sender, bool accepted) { if (sender == mapDirChooser) { if (accepted) { ApplicationPreferences.mapsDir = mapDirChooser.text + "/"; mapsLocationTextBox.text = ApplicationPreferences.mapsDir; PlayerPrefs.SetString(ApplicationPreferences.MAPS_LOC, ApplicationPreferences.mapsDir); } currentMenu = Menu.Settings; } if (sender == textureDirChooser) { if (accepted) { ApplicationPreferences.texturesDir = textureDirChooser.text + "/"; texturesLocationTextBox.text = ApplicationPreferences.texturesDir; PlayerPrefs.SetString(ApplicationPreferences.TEX_LOC, ApplicationPreferences.texturesDir); } currentMenu = Menu.Settings; } if (sender == modelDirChooser) { if (accepted) { ApplicationPreferences.modelsDir = modelDirChooser.text + "/"; modelsLocationTextBox.text = ApplicationPreferences.modelsDir; PlayerPrefs.SetString(ApplicationPreferences.MODELS_LOC, ApplicationPreferences.modelsDir); } currentMenu = Menu.Settings; } //if (sender == mapFileChooser) //{ // if (accepted) // { // Debug.Log("Displaying: " + mapFileChooser.text); // BSPMap loadedMap = new BSPMap(mapFileChooser.text.Substring(mapFileChooser.text.LastIndexOf("/") + 1)); // loadedMap.MakeMap(); // } //} }
private void MakeMenus() { backButton = new OxButton("Back", "MenuButton"); backButton.clicked += Button_clicked; #region Main Menu mainMenu = new OxMenu(false); viewLiveButton = new OxButton("Live", "MenuButton"); viewReplaysButton = new OxButton("Replays", "MenuButton"); viewMapsButton = new OxButton("Maps", "MenuButton"); settingsButton = new OxButton("Settings", "MenuButton"); exitButton = new OxButton("Exit", "MenuButton"); viewLiveButton.clicked += Button_clicked; viewReplaysButton.clicked += Button_clicked; viewMapsButton.clicked += Button_clicked; settingsButton.clicked += Button_clicked; exitButton.clicked += Button_clicked; mainMenu.AddItem(viewLiveButton, viewReplaysButton, viewMapsButton, settingsButton, exitButton); #endregion #region Live Menu liveMenu = new OxMenu(false); addressBox = new OxTextBox("127.0.0.1", ""); connectButton = new OxButton("Connect", "MenuButton"); connectButton.clicked += Button_clicked; liveMenu.AddItem(addressBox, connectButton, backButton); #endregion #region Replays Menu replaysMenu = new OxSplit(); replayChooserStatsSplitter = new OxSplit(); replayFilesChooserBackSplitter = new OxSplit(); replayStatsButtonsSplitter = new OxSplit(); replayFileList = new OxList(); loadedReplayList = new OxList(); loadedReplayButtonMenu = new OxMenu(true); importReplayButtonMenu = new OxMenu(false); importReplayButton = new OxButton("Import", "MenuButton"); watchReplayButton = new OxButton("Watch", "MenuButton"); removeReplayButton = new OxButton("Remove", "MenuButton"); importReplayButton.clicked += Button_clicked; watchReplayButton.clicked += Button_clicked; removeReplayButton.clicked += Button_clicked; replaysMenu.division = 0.7f; replaysMenu.westPercentSize = 0.9f; replaysMenu.westComponent = replayChooserStatsSplitter; replaysMenu.eastComponent = replayFilesChooserBackSplitter; replayFilesChooserBackSplitter.horizontal = false; replayFilesChooserBackSplitter.division = 0.75f; replayFilesChooserBackSplitter.eastPercentSize = 0.9f; replayFilesChooserBackSplitter.westComponent = replayFileList; replayFilesChooserBackSplitter.eastComponent = importReplayButtonMenu; importReplayButtonMenu.AddItem(importReplayButton, backButton); replayChooserStatsSplitter.horizontal = false; replayChooserStatsSplitter.division = 0.2f; replayChooserStatsSplitter.westComponent = loadedReplayList; replayChooserStatsSplitter.eastComponent = replayStatsButtonsSplitter; loadedReplayList.horizontal = true; replayStatsButtonsSplitter.horizontal = false; replayStatsButtonsSplitter.division = 0.8f; replayStatsButtonsSplitter.westComponent = new OxLabel(); replayStatsButtonsSplitter.eastComponent = loadedReplayButtonMenu; loadedReplayButtonMenu.AddItem(watchReplayButton, removeReplayButton); replayFileList.FillBrowserList("", true, "dem"); //replaysMenu = new OxMenu(false); //replaysMenu.AddItem(backButton); #endregion #region Replay Interface replayInterface = new OxSplit(); OxSplit lowerInterfaceSplit = new OxSplit(), lowerInterfaceSecondSplit = new OxSplit(); OxSplit playerListSplit = new OxSplit(), mediaControlsSplit = new OxSplit(), centerPlayButtonSplit = new OxSplit(), playButtonSplit = new OxSplit(); playerList = new OxList(); playerList.indexChanged += playerList_indexChanged; //interfaceControlWindow = new OxWindow(); playButton = new OxButton("Play"); playButton.clicked += Button_clicked; replaySeeker = new OxSlider(); replaySeeker.valueChanged += replaySeeker_valueChanged; //seekButton = new OxButton(""); replayInterface.horizontal = false; replayInterface.division = 0.6f; replayInterface.eastComponent = lowerInterfaceSplit; replayInterface.westComponent = new OxLabel(); lowerInterfaceSplit.division = 0.75f; lowerInterfaceSplit.eastPercentSize = 0.25f; lowerInterfaceSplit.eastComponent = backButton; lowerInterfaceSplit.westComponent = lowerInterfaceSecondSplit; lowerInterfaceSecondSplit.division = 0.33f; lowerInterfaceSecondSplit.eastComponent = playerListSplit; lowerInterfaceSecondSplit.westComponent = new OxLabel(); //interfaceControlWindow.showMinimizeButton = false; //interfaceControlWindow.showMaximizeButton = false; //interfaceControlWindow.showCloseButton = false; //interfaceControlWindow.layout = mediaControlsSplit; playerListSplit.horizontal = false; playerListSplit.division = 0.9f; playerListSplit.westComponent = mediaControlsSplit; playerListSplit.eastComponent = playerList; playerList.horizontal = true; mediaControlsSplit.horizontal = false; mediaControlsSplit.division = 0.1f; mediaControlsSplit.eastComponent = centerPlayButtonSplit; mediaControlsSplit.westComponent = replaySeeker; centerPlayButtonSplit.division = 0.3f; centerPlayButtonSplit.eastComponent = playButtonSplit; centerPlayButtonSplit.westComponent = new OxLabel(); playButtonSplit.division = 0.6f; playButtonSplit.westPercentSize = 0.5f; playButtonSplit.eastComponent = new OxLabel(); playButtonSplit.westComponent = playButton; #endregion #region Maps Menu //mapMenu, mapChooserSplit, mapButtonSplit mapMenu = new OxSplit(); mapChooserSplit = new OxSplit(); mapButtonSplit = new OxSplit(); navButtonSplit = new OxSplit(); OxSplit buttonSplitWithEmpty = new OxSplit(); OxSplit navGapSplit = new OxSplit(); mapFileChooser = new OxList(); loadMapButton = new OxButton("Import Map", "MenuButton"); nextMapButton = new OxButton("Next", "MenuButton"); prevMapButton = new OxButton("Previous", "MenuButton"); exploreMapButton = new OxButton("Explore", "MenuButton"); loadMapButton.clicked += Button_clicked; nextMapButton.clicked += Button_clicked; prevMapButton.clicked += Button_clicked; exploreMapButton.clicked += Button_clicked; //mapFileChooser.done += Chooser_done; string mapsLoc = ""; if (ApplicationPreferences.mapsDir != null && ApplicationPreferences.mapsDir.Length > 0) { mapsLoc = ApplicationPreferences.mapsDir.Substring(0, ApplicationPreferences.mapsDir.Length - 1); } mapFileChooser.FillBrowserList(mapsLoc, true, "bsp"); mapMenu.division = 0.8f; mapMenu.westPercentSize = 0.9f; mapMenu.eastComponent = mapChooserSplit; mapMenu.westComponent = buttonSplitWithEmpty; mapChooserSplit.division = 0.75f; mapChooserSplit.eastPercentSize = 0.9f; mapChooserSplit.horizontal = false; mapChooserSplit.westComponent = mapFileChooser; mapChooserSplit.eastComponent = mapButtonSplit; mapButtonSplit.horizontal = false; mapButtonSplit.westComponent = loadMapButton; mapButtonSplit.eastComponent = backButton; buttonSplitWithEmpty.division = 0.9f; buttonSplitWithEmpty.horizontal = false; buttonSplitWithEmpty.westComponent = new OxSplit(); buttonSplitWithEmpty.eastComponent = navButtonSplit; navButtonSplit.division = 0.75f; navButtonSplit.eastComponent = nextMapButton; navButtonSplit.westComponent = navGapSplit; navGapSplit.division = 0.33f; navGapSplit.eastComponent = exploreMapButton; navGapSplit.westComponent = prevMapButton; //mapMenu.AddItem(mapFileChooser, backButton); #endregion #region ExploreInterface exploreInterface = new OxSplit(); exploreInterface.horizontal = false; exploreInterface.division = 0.9f; OxSplit exploreInterfaceBackSplit = new OxSplit(); exploreInterface.westComponent = new OxLabel(); exploreInterface.eastComponent = exploreInterfaceBackSplit; exploreInterfaceBackSplit.division = 0.9f; exploreInterfaceBackSplit.westComponent = new OxLabel(); exploreInterfaceBackSplit.eastComponent = backButton; #endregion #region Settings Menu settingsMenu = new OxMenu(false); fullscreenCheckBox = new OxCheckBox(ApplicationPreferences.fullscreen, "Fullscreen"); fullscreenCheckBox.checkBoxSwitched += CheckBox_Switched; combineMeshesCheckBox = new OxCheckBox(ApplicationPreferences.combineMeshes, "Combine Map Meshes"); combineMeshesCheckBox.checkBoxSwitched += CheckBox_Switched; averageTexturesCheckBox = new OxCheckBox(ApplicationPreferences.averageTextures, "Average Textures"); averageTexturesCheckBox.checkBoxSwitched += CheckBox_Switched; decreaseTexturesCheckBox = new OxCheckBox(ApplicationPreferences.decreaseTextureSizes, "Decrease Texture Sizes"); decreaseTexturesCheckBox.checkBoxSwitched += CheckBox_Switched; maxTextureSizeLabel = new OxLabel("Max Size", Color.black, TextAnchor.LowerCenter); texturesLocationLabel = new OxLabel("Textures Location", Color.black, TextAnchor.LowerCenter); mapsLocationLabel = new OxLabel("Maps Location", Color.black, TextAnchor.LowerCenter); modelsLocationLabel = new OxLabel("Models Location", Color.black, TextAnchor.LowerCenter); sfxLocationLabel = new OxLabel("SFX Location", Color.black, TextAnchor.LowerCenter); maxTextureSizeTextBox = new OxTextBox(ApplicationPreferences.maxSizeAllowed.ToString(), ""); maxTextureSizeTextBox.textChanged += TextBox_textChanged; texturesLocationTextBox = new OxTextBox(ApplicationPreferences.texturesDir, ""); texturesLocationTextBox.textChanged += TextBox_textChanged; browseTexturesLocationButton = new OxButton("Browse", "MenuButton"); browseTexturesLocationButton.clicked += Button_clicked; mapsLocationTextBox = new OxTextBox(ApplicationPreferences.mapsDir, ""); mapsLocationTextBox.textChanged += TextBox_textChanged; browseMapsLocationButton = new OxButton("Browse", "MenuButton"); browseMapsLocationButton.clicked += Button_clicked; modelsLocationTextBox = new OxTextBox(ApplicationPreferences.modelsDir, ""); modelsLocationTextBox.textChanged += TextBox_textChanged; browseModelsLocationButton = new OxButton("Browse", "MenuButton"); browseModelsLocationButton.clicked += Button_clicked; sfxLocationTextBox = new OxTextBox("", ""); sfxLocationTextBox.textChanged += TextBox_textChanged; browseSFXLocationButton = new OxButton("Browse", "MenuButton"); browseSFXLocationButton.clicked += Button_clicked; settingsMenu.AddItem(fullscreenCheckBox, combineMeshesCheckBox, averageTexturesCheckBox, decreaseTexturesCheckBox, maxTextureSizeLabel, maxTextureSizeTextBox, texturesLocationLabel, texturesLocationTextBox, browseTexturesLocationButton, mapsLocationLabel, mapsLocationTextBox, browseMapsLocationButton, modelsLocationLabel, modelsLocationTextBox, browseModelsLocationButton, sfxLocationLabel, sfxLocationTextBox, browseSFXLocationButton, backButton); #endregion #region Texture Dir Browser textureDirChooser = new OxChooser(); textureDirChooser.done += Chooser_done; #endregion #region Map Dir Browser mapDirChooser = new OxChooser(); mapDirChooser.done += Chooser_done; #endregion #region Model Dir Browser modelDirChooser = new OxChooser(); modelDirChooser.done += Chooser_done; #endregion #region SFX Dir Browser sfxDirChooser = new OxChooser(); sfxDirChooser.done += Chooser_done; #endregion }