private void Update_GUI() { Target_Text.text = target == null ? "None" : string.Format("{0} (#{1})", target.Name, target.Id); scroll_view.Clear(); foreach (Resource resource in Resource.All.Where(x => !x.Tags.Contains(Resource.ResourceTag.Non_Tradeable)).OrderBy(x => x.UI_Name).ToList()) { int?setting = settings[resource]; scroll_view.Add(resource.Type, new List <UIElementData>() { new UIElementData("IconImage", resource.Has_Sprite ? resource.Sprite_Name : "empty", resource.Has_Sprite ? resource.Sprite_Type : SpriteManager.SpriteType.UI), new UIElementData("NameText", resource.UI_Name), new UIElementData("SettingText", setting.HasValue ? string.Format(">{0}", setting.Value.ToString()) : "-"), new UIElementData("SelectRowButton", null, delegate() { Select_Resource(resource); }) }); } }
public void Update_GUI() { switch (location.Trade_Route_Type) { case ForeignCity.TradeRouteType.Both: Route_Type_Text.text = "Land/Water"; break; case ForeignCity.TradeRouteType.Land: Route_Type_Text.text = "Land"; break; case ForeignCity.TradeRouteType.Water: Route_Type_Text.text = "Water"; break; } Count_Text.text = string.Format("{0} / {1}", City.Instance.Colonies.Count, City.Instance.Max_Colonies); Count_Text.color = City.Instance.Colonies.Count >= City.Instance.Max_Colonies ? Color.red : default_text_color; exports_scroll_view.Clear(); foreach (Resource export in location.Cheap_Exports) { exports_scroll_view.Add(export.Type, new List <UIElementData>() { new UIElementData("IconImage", export.Has_Sprite ? export.Sprite_Name : "empty", export.Has_Sprite ? export.Sprite_Type : SpriteManager.SpriteType.UI), new UIElementData("ResourceNameText", export.UI_Name), new UIElementData("PriceText", "Cheap") }); } foreach (Resource export in location.Exports) { exports_scroll_view.Add(export.Type, new List <UIElementData>() { new UIElementData("IconImage", export.Has_Sprite ? export.Sprite_Name : "empty", export.Has_Sprite ? export.Sprite_Type : SpriteManager.SpriteType.UI), new UIElementData("ResourceNameText", export.UI_Name), new UIElementData("PriceText", "Normal") }); } foreach (Resource export in location.Expensive_Exports) { exports_scroll_view.Add(export.Type, new List <UIElementData>() { new UIElementData("IconImage", export.Has_Sprite ? export.Sprite_Name : "empty", export.Has_Sprite ? export.Sprite_Type : SpriteManager.SpriteType.UI), new UIElementData("ResourceNameText", export.UI_Name), new UIElementData("PriceText", "Expensive") }); } imports_scroll_view.Clear(); foreach (Resource import in location.Preferred_Imports) { imports_scroll_view.Add(import.Type, new List <UIElementData>() { new UIElementData("IconImage", import.Has_Sprite ? import.Sprite_Name : "empty", import.Has_Sprite ? import.Sprite_Type : SpriteManager.SpriteType.UI), new UIElementData("ResourceNameText", import.UI_Name), new UIElementData("PriceText", "High") }); } foreach (Resource import in location.Disliked_Imports) { imports_scroll_view.Add(import.Type, new List <UIElementData>() { new UIElementData("IconImage", import.Has_Sprite ? import.Sprite_Name : "empty", import.Has_Sprite ? import.Sprite_Type : SpriteManager.SpriteType.UI), new UIElementData("ResourceNameText", import.UI_Name), new UIElementData("PriceText", "Low") }); } foreach (Resource import in location.Unaccepted_Imports) { imports_scroll_view.Add(import.Type, new List <UIElementData>() { new UIElementData("IconImage", import.Has_Sprite ? import.Sprite_Name : "empty", import.Has_Sprite ? import.Sprite_Type : SpriteManager.SpriteType.UI), new UIElementData("ResourceNameText", import.UI_Name), new UIElementData("PriceText", "Unaccepted") }); } float cost = Expedition.COSTS[Expedition.ExpeditionGoal.Establish_Colony][Expedition.ExpeditionLenght.Long]; Cost_Text.text = Helper.Float_To_String(cost, 0); Cost_Text.color = City.Instance.Cash >= cost ? default_text_color : Color.red; Ok_Button.interactable = City.Instance.Cash >= cost && City.Instance.Max_Colonies > City.Instance.Colonies.Count; }