public void CreateSellTab() { TabSelector.Tab sellTab = Tabs.AddTab("Sell"); GridLayout sellBoxLayout = new GridLayout(GUI, sellTab, 10, 4); SellSelector = new ItemSelector(GUI, sellBoxLayout, "Items") { Columns = new List<ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.TotalPrice, ItemSelector.Column.ArrowRight }, NoItemsMessage = "No goods in our stockpiles", ToolTip = "Click items to put them in the sell order" }; sellBoxLayout.SetComponentPosition(SellSelector, 0, 0, 2, 10); SellSelector.Items.AddRange(GetResources(Faction.ListResources().Values.ToList())); SellSelector.ReCreateItems(); SellCart = new ItemSelector(GUI, sellBoxLayout, "Order") { Columns = new List<ItemSelector.Column>() { ItemSelector.Column.ArrowLeft, ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.TotalPrice }, NoItemsMessage = "No items selected", ToolTip = "Click items to remove them from the sell order" }; SellCart.ReCreateItems(); sellBoxLayout.SetComponentPosition(SellCart, 2, 0, 2, 9); SellSelector.OnItemRemoved += SellCart.AddItem; SellCart.OnItemRemoved += SellSelector.AddItem; Button sellButton = new Button(GUI, sellBoxLayout, "Sell", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Click to sell items in the order" }; sellBoxLayout.SetComponentPosition(sellButton, 3, 9, 1, 2); sellButton.OnClicked += sellButton_OnClicked; SellTotal = new Label(GUI, sellBoxLayout, "Order Total: $0.00", GUI.DefaultFont) { WordWrap = true, ToolTip = "Order total" }; sellBoxLayout.SetComponentPosition(SellTotal, 2, 9, 1, 2); SellCart.OnItemChanged += SellCart_OnItemChanged; }
public void CreateBuyTab() { TabSelector.Tab buyTab = Tabs.AddTab("Buy"); GridLayout buyBoxLayout = new GridLayout(GUI, buyTab, 10, 4); BuySelector = new ItemSelector(GUI, buyBoxLayout, "Items") { Columns = new List<ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.PricePerItem, ItemSelector.Column.ArrowRight }, NoItemsMessage = "Nothing to buy", ToolTip = "Click items to add them to the shopping cart" }; buyBoxLayout.SetComponentPosition(BuySelector, 0, 0, 2, 10); BuySelector.Items.AddRange(GetResources(1.0f)); BuySelector.ReCreateItems(); ShoppingCart = new ItemSelector(GUI, buyBoxLayout, "Order") { Columns = new List<ItemSelector.Column>() { ItemSelector.Column.ArrowLeft, ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.TotalPrice }, NoItemsMessage = "No items selected", ToolTip = "Click items to remove them from the shopping cart", PerItemCost = 1.00f }; ShoppingCart.ReCreateItems(); buyBoxLayout.SetComponentPosition(ShoppingCart, 2, 0, 2, 9); BuySelector.OnItemRemoved += ShoppingCart.AddItem; ShoppingCart.OnItemRemoved += BuySelector.AddItem; ShoppingCart.OnItemChanged += shoppingCart_OnItemChanged; Button buyButton = new Button(GUI, buyBoxLayout, "Buy", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Click to order items in the shopping cart" }; buyBoxLayout.SetComponentPosition(buyButton, 3, 9, 1, 2); BuyTotal = new Label(GUI, buyBoxLayout, "Order Total: $0.00", GUI.DefaultFont) { WordWrap = true, ToolTip = "Order total" }; buyBoxLayout.SetComponentPosition(BuyTotal, 2, 9, 1, 2); buyButton.OnClicked += buyButton_OnClicked; }
public void CreateBuyTab() { TabSelector.Tab buyTab = Tabs.AddTab("Buy"); GridLayout buyBoxLayout = new GridLayout(GUI, buyTab, 10, 4); BuySelector = new ItemSelector(GUI, buyBoxLayout, "Items", false, false) { Columns = new List <ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.PricePerItem, ItemSelector.Column.ArrowRight }, NoItemsMessage = "Nothing to buy", ToolTip = "Click items to add them to the shopping cart" }; buyBoxLayout.SetComponentPosition(BuySelector, 0, 0, 2, 10); BuySelector.Items.AddRange(GetResources(1.0f)); BuySelector.ReCreateItems(); ShoppingCart = new ItemSelector(GUI, buyBoxLayout, "Order", false, false) { Columns = new List <ItemSelector.Column>() { ItemSelector.Column.ArrowLeft, ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.TotalPrice }, NoItemsMessage = "Nothing", ToolTip = "Click items to remove them from the shopping cart", PerItemCost = 1.00f }; ShoppingCart.ReCreateItems(); buyBoxLayout.SetComponentPosition(ShoppingCart, 2, 0, 2, 9); BuySelector.OnItemRemoved += ShoppingCart.AddItem; ShoppingCart.OnItemRemoved += BuySelector.AddItem; ShoppingCart.OnItemChanged += shoppingCart_OnItemChanged; Button buyButton = new Button(GUI, buyBoxLayout, "Buy", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Click to order items in the shopping cart" }; buyBoxLayout.SetComponentPosition(buyButton, 3, 9, 1, 2); BuyTotal = new Label(GUI, buyBoxLayout, "Order Total: $0.00", GUI.DefaultFont) { WordWrap = true, ToolTip = "Order total" }; buyBoxLayout.SetComponentPosition(BuyTotal, 2, 9, 1, 2); buyButton.OnClicked += buyButton_OnClicked; }
public void CreateSelector() { TheirGoods = new ItemSelector(GUI, Layout, "Their Items", true, false) { Columns = new List <ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.PricePerItem }, NoItemsMessage = "Nothing to buy", ToolTip = "Click items to trade for them.", LikedThings = OtherFaction.Race.LikedResources, HatedThings = OtherFaction.Race.HatedResources }; TheirGoods.MoneyEdit.MaxMoney = OtherFaction.TradeMoney; TheirGoods.MoneyEdit.CurrentMoney = OtherFaction.TradeMoney; Layout.SetComponentPosition(TheirGoods, 0, 0, 1, 9); TheirGoods.Items.AddRange(GetResources(Resources)); TheirGoods.ReCreateItems(); TheirTrades = new ItemSelector(GUI, Layout, "They Offer", true, true) { Columns = new List <ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.PricePerItem }, NoItemsMessage = "Nothing", ToolTip = "Click items to cancel the trade", LikedThings = OtherFaction.Race.LikedResources, HatedThings = OtherFaction.Race.HatedResources }; TheirTrades.MoneyEdit.MaxMoney = OtherFaction.TradeMoney; TheirTrades.MoneyEdit.CurrentMoney = 0.0f; TheirTrades.MoneyEdit.OnMoneyChanged += MoneyEdit_OnMoneyChanged; TheirTrades.ReCreateItems(); Layout.SetComponentPosition(TheirTrades, 1, 0, 1, 9); MyTrades = new ItemSelector(GUI, Layout, "We Offer", true, true) { Columns = new List <ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.PricePerItem, }, NoItemsMessage = "Nothing", ToolTip = "Click to cancel trade", PerItemCost = 1.00f, LikedThings = OtherFaction.Race.LikedResources, HatedThings = OtherFaction.Race.HatedResources }; MyTrades.MoneyEdit.MaxMoney = Faction.Economy.CurrentMoney; MyTrades.MoneyEdit.CurrentMoney = 0.0f; MyTrades.MoneyEdit.OnMoneyChanged += MyTrades_MoneyEdit_Onchanged; MyTrades.ReCreateItems(); Layout.SetComponentPosition(MyTrades, 2, 0, 1, 9); MyGoods = new ItemSelector(GUI, Layout, "Our Items", true, false) { Columns = new List <ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.PricePerItem }, NoItemsMessage = "Nothing", ToolTip = "Click items to offer them for trade.", PerItemCost = 1.00f }; MyGoods.MoneyEdit.MaxMoney = Faction.Economy.CurrentMoney; MyGoods.MoneyEdit.CurrentMoney = Faction.Economy.CurrentMoney; MyGoods.Items.AddRange(GetResources(Faction.ListResources().Values.ToList())); MyGoods.ReCreateItems(); Layout.SetComponentPosition(MyGoods, 3, 0, 1, 9); TheirGoods.OnItemRemoved += TheirTrades.AddItem; MyGoods.OnItemRemoved += MyTrades.AddItem; TheirTrades.OnItemRemoved += TheirGoods.AddItem; MyTrades.OnItemRemoved += MyGoods.AddItem; MyTrades.OnItemChanged += (item) => RecomputeTrade(); TheirTrades.OnItemChanged += (item) => RecomputeTrade(); Button buyButton = new Button(GUI, Layout, "Offer Trade", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Click to offer up a trade." }; Layout.SetComponentPosition(buyButton, 3, 9, 1, 1); Button cancelButton = new Button(GUI, Layout, "Cancel", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Cancel trading" }; cancelButton.OnClicked += cancelButton_OnClicked; Layout.SetComponentPosition(cancelButton, 2, 9, 1, 1); BuyTotal = new Label(GUI, Layout, "Their Profit: $0.00", GUI.DefaultFont) { WordWrap = true, ToolTip = "Their profit from the trade." }; Layout.SetComponentPosition(BuyTotal, 0, 9, 1, 1); buyButton.OnClicked += buyButton_OnClicked; }
public void CreateSellTab() { TabSelector.Tab sellTab = Tabs.AddTab("Sell"); GridLayout sellBoxLayout = new GridLayout(GUI, sellTab, 10, 4); SellSelector = new ItemSelector(GUI, sellBoxLayout, "Items", false, false) { Columns = new List <ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.TotalPrice, ItemSelector.Column.ArrowRight }, NoItemsMessage = "No goods in our stockpiles", ToolTip = "Click items to put them in the sell order" }; sellBoxLayout.SetComponentPosition(SellSelector, 0, 0, 2, 10); SellSelector.Items.AddRange(GetResources(Faction.ListResources().Values.ToList())); SellSelector.ReCreateItems(); SellCart = new ItemSelector(GUI, sellBoxLayout, "Order", false, false) { Columns = new List <ItemSelector.Column>() { ItemSelector.Column.ArrowLeft, ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.TotalPrice }, NoItemsMessage = "No items selected", ToolTip = "Click items to remove them from the sell order" }; SellCart.ReCreateItems(); sellBoxLayout.SetComponentPosition(SellCart, 2, 0, 2, 9); SellSelector.OnItemRemoved += SellCart.AddItem; SellCart.OnItemRemoved += SellSelector.AddItem; Button sellButton = new Button(GUI, sellBoxLayout, "Sell", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Click to sell items in the order" }; sellBoxLayout.SetComponentPosition(sellButton, 3, 9, 1, 2); sellButton.OnClicked += sellButton_OnClicked; SellTotal = new Label(GUI, sellBoxLayout, "Order Total: $0.00", GUI.DefaultFont) { WordWrap = true, ToolTip = "Order total" }; sellBoxLayout.SetComponentPosition(SellTotal, 2, 9, 1, 2); SellCart.OnItemChanged += SellCart_OnItemChanged; }
public void CreateSelector() { TheirGoods = new ItemSelector(GUI, Layout, "Their Items") { Columns = new List<ItemSelector.Column>() { ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.PricePerItem, ItemSelector.Column.ArrowRight }, NoItemsMessage = "Nothing to buy", ToolTip = "Click items to trade for them." }; Layout.SetComponentPosition(TheirGoods, 0, 0, 2, 9); TheirGoods.Items.AddRange(GetResources(1.0f)); TheirGoods.ReCreateItems(); MyGoods = new ItemSelector(GUI, Layout, "Our Items") { Columns = new List<ItemSelector.Column>() { ItemSelector.Column.ArrowLeft, ItemSelector.Column.Image, ItemSelector.Column.Name, ItemSelector.Column.Amount, ItemSelector.Column.TotalPrice }, NoItemsMessage = "No items selected", ToolTip = "Click items to offer them for trade.", PerItemCost = 1.00f }; MyGoods.Items.AddRange(GetResources(PlayState.PlayerFaction.ListResources().Values.ToList())); MyGoods.ReCreateItems(); Layout.SetComponentPosition(MyGoods, 2, 0, 2, 9); TheirGoods.OnItemRemoved += MyGoods.AddItem; MyGoods.OnItemRemoved += TheirGoods.AddItem; MyGoods.OnItemChanged += shoppingCart_OnItemChanged; MyGoods.OnItemRemoved += TheirGoods_OnItemAdded; TheirGoods.OnItemRemoved += MyGoods_OnItemAdded; Button buyButton = new Button(GUI, Layout, "Offer Trade", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Click to offer up a trade." }; Layout.SetComponentPosition(buyButton, 3, 9, 1, 2); BuyTotal = new Label(GUI, Layout, "Profit: $0.00", GUI.DefaultFont) { WordWrap = true, ToolTip = "Their profit from the trade." }; Layout.SetComponentPosition(BuyTotal, 0, 9, 1, 2); buyButton.OnClicked += buyButton_OnClicked; }