/*public void Activate() * { * SelectionList.LoadEntries(PlayerManager.GetSavedGames()); * }*/ private void StartNewGame(string name, Races race, EmpireController.govType gov)//Attempt to start a new game { //string newLevel = SelectionList.GetCurrentEntry(); /*if (newLevel != "") * { * ResourceManager.LevelName = newLevel; * if (Application.loadedLevelName != "BlankMap1") Application.LoadLevel("BlankMap1"); * else if (Application.loadedLevelName != "BlankMap2") Application.LoadLevel("BlankMap2"); * //makes sure that the loaded level runs at normal speed * Time.timeScale = 1.0f; * }*/ playerInstance.GetComponent <EmpireController>().name = "Player"; playerInstance.GetComponent <EmpireController>().EmpireName = name; playerInstance.GetComponent <EmpireController>().Race = race; playerInstance.GetComponent <EmpireController>().Gov = gov; DontDestroyOnLoad(playerInstance);//prevent this player object from disappearing when scene changes SceneManager.LoadScene("SolarSystemTest"); //playerInstance. }
void OnGUI() { /*if (SelectionList.MouseDoubleClick()) * { * PlayClick(); * StartLoad(); * }*/ GUI.skin = mainSkin; float menuHeight = GetMenuHeight(); float groupLeft = Screen.width / 2 - ResourceManager.MenuWidth / 2; float groupTop = Screen.height / 2 - menuHeight / 2; Rect groupRect = new Rect(groupLeft, groupTop, ResourceManager.MenuWidth, menuHeight); GUI.BeginGroup(groupRect); //background box GUI.Box(new Rect(0, 0, ResourceManager.MenuWidth, menuHeight), ""); //menu buttons float leftPos = ResourceManager.Padding; float topPos = menuHeight - ResourceManager.Padding - ResourceManager.ButtonHeight; if (GUI.Button(new Rect(leftPos, topPos, ResourceManager.ButtonWidth, ResourceManager.ButtonHeight), "Create New Game")) { PlayClick(); if (text != "" && selectedRace != null && gov == EmpireController.govType.EMPIRE || gov == EmpireController.govType.REPUBLIC || gov == EmpireController.govType.FEDERATION) { StartNewGame(text, selectedRace, gov); } } leftPos += ResourceManager.ButtonWidth + ResourceManager.Padding; if (GUI.Button(new Rect(leftPos, topPos, ResourceManager.ButtonWidth, ResourceManager.ButtonHeight), "Cancel")) { PlayClick(); CancelNewGame(); } GUI.Label(new Rect(ResourceManager.Padding, 5, 120, 40), "Set Name of game government: "); text = GUI.TextField(new Rect(ResourceManager.Padding + 125, 5, 135, 40), text);//Empire name GUI.Label(new Rect(ResourceManager.Padding, 55, 120, 40), "Set Main Race: "); //comboBoxControl = new ComboBox(new Rect(ResourceManager.Padding + 125, 65, 100, 20), comboBoxList[0], comboBoxList, "button", "box", listStyle); //int selectedItemIndex = comboBoxControl.Show(); //selectedRace = ObjectList.racesList[selectedItemIndex];//empire race if (GUI.Button(new Rect(ResourceManager.Padding + 125, 65, 100, 20), "Human")) { selectedRace = ObjectList.human; } GUI.Label(new Rect(ResourceManager.Padding, 110, 120, 40), "Set Govement Type: ");//set kind of government if (GUI.Button(new Rect(ResourceManager.Padding + 125, 100, 100, 20), "Empire")) { gov = EmpireController.govType.EMPIRE; } if (GUI.Button(new Rect(ResourceManager.Padding + 125, 125, 100, 20), "Republic")) { gov = EmpireController.govType.REPUBLIC; } if (GUI.Button(new Rect(ResourceManager.Padding + 125, 150, 100, 20), "Federation")) { gov = EmpireController.govType.FEDERATION; } GUI.Label(new Rect(ResourceManager.Padding, 85, 250, 250), description);//update description GUI.EndGroup(); //selection list, needs to be called outside of the group for the menu float selectionLeft = groupRect.x + ResourceManager.Padding; float selectionTop = groupRect.y + ResourceManager.Padding; float selectionWidth = groupRect.width - 2 * ResourceManager.Padding; float selectionHeight = groupRect.height - GetMenuItemsHeight() - ResourceManager.Padding; //SelectionList.Draw(selectionLeft, selectionTop, selectionWidth, selectionHeight, selectionSkin); }