void Awake() { if (string.IsNullOrEmpty(PlanetName)) PlanetName = "PlanetNameNotSet"; //TODO remove after testing PlanetName = "Debug"; station = SaveManager.LoadStation(PlanetName); Instantiate(BackgroundDocked); ActiveDockedMode = DockedMode.MainMenu; }
private void BarGUI() { GUI.Label(new Rect(Screen.width / 2 - titleTextWidth / 2, Screen.height / 6, titleTextWidth, titleTextHeight), "Bar Screen", titleTextStyle); GUILayout.BeginArea( new Rect(Screen.width / 2 - buttonWidth / 2, Screen.height / 2 - 50, buttonWidth, buttonHeight * 9)); GUILayout.BeginVertical(); if (GUILayout.Button("Go Back", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) ActiveDockedMode = DockedMode.MainMenu; GUILayout.EndVertical(); GUILayout.EndArea(); }
private void MainMenuGUI() { GUI.Label(new Rect(Screen.width / 2 - titleTextWidth / 2, Screen.height / 6 - titleTextHeight, titleTextWidth, titleTextHeight), "Docked At Planet " + PlanetName, titleTextStyle); GUI.Label(new Rect(Screen.width / 2 - titleTextWidth / 2, Screen.height / 6 + titleTextHeight, titleTextWidth, titleTextHeight), "In The Test System", titleTextStyle); GUILayout.BeginArea( new Rect(Screen.width / 2 - buttonWidth / 2, Screen.height / 2 - 50, buttonWidth, buttonHeight * 9)); GUILayout.BeginVertical(); if (GUILayout.Button("Trade", buttonTextStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) ActiveDockedMode = DockedMode.Trade; if (GUILayout.Button("Store", buttonTextStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) ActiveDockedMode = DockedMode.Store; if (GUILayout.Button("Missions", buttonTextStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) ActiveDockedMode = DockedMode.Missions; if (GUILayout.Button("Bar", buttonTextStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) ActiveDockedMode = DockedMode.Bar; GUILayout.Label(string.Empty, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); if (GUILayout.Button("UNDOCK", buttonTextStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) { SaveManager.SaveGame(); SaveManager.SaveStation(station); Application.LoadLevel("SpaceScene"); } GUILayout.EndVertical(); GUILayout.EndArea(); }
private void TradeGUI() { GUI.Label(new Rect(Screen.width / 2 - titleTextWidth / 2, Screen.height / 6, titleTextWidth, titleTextHeight), "Trade Market", titleTextStyle); GUILayout.BeginArea( new Rect(Screen.width / 2 - ((buttonWidth / 2) * 3 ), Screen.height / 2 - (buttonHeight * 4), buttonWidth * 3, buttonHeight * 9)); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("BUY", tradeHeaderStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); GUILayout.Label(string.Format("CARGO ({0}/{1})", Player.Ship.CargoSizeUsed, Player.Ship.CargoSizeMax), tradeHeaderStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); GUILayout.Label("SELL", tradeHeaderStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); GUILayout.EndHorizontal(); foreach (TradeGood tradeGood in station.TradeGoods) { GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format("Buy -${0}", tradeGood.PriceBuy), tradeBuyStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) { station.SellTradeGood(tradeGood, 1); } var playerCargoInShip = Player.Ship.Cargo.Find(item => item.Name == tradeGood.Name); var cargoQuantityOnHand = playerCargoInShip != null ? playerCargoInShip.Quantity : 0; GUILayout.Label(string.Format("{0} ({1}/{2})", tradeGood.Name, cargoQuantityOnHand, tradeGood.Quantity), tradeCargoStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); if (GUILayout.Button(string.Format("Sell +${0}", tradeGood.PriceSell), tradeSellStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) { station.BuyTradeGood(tradeGood, 1); } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); GUILayout.Label(string.Empty, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); GUILayout.Label(string.Format("Account: ${0}", Player.Credits), titleTextStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); GUILayout.Label(string.Empty, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(string.Empty, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); if (GUILayout.Button("Go Back", buttonTextStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) ActiveDockedMode = DockedMode.MainMenu; GUILayout.Label(string.Empty, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); }