public int changeCommodityValue(Resource r, int change) { foreach (Commodity com in commodities) { if (com.Good.Name == r.Name) { // System.Console.WriteLine("Changing " + r.Name + " by " + change + " "); com.TablePosition -= change; if (com.TablePosition >= marketTable.Length) com.TablePosition = marketTable.Length-1; if (com.TablePosition < 0) com.TablePosition = 0; return com.Value = marketTable[com.TablePosition]; } } return 0; }
public void addResource(Resource a) { resources.Add(a); }
public void init() { /* Make Our Connection!*/ Glade.XML gxml = new Glade.XML (SupportFileLoader.locateGameFile("gpremacy_gui/gpremacy_gui.glade"), "DeckDealerWindow", null); gxml.Autoconnect (this); cardsFlipped = 0; costPerCard = 200; targetResource = null; targetUnit = null; DeckDealerWindow.DeleteEvent += on_DeckDealer_delete_event; DeckDealerWindow.ExposeEvent += on_DeckDealer_exposed; DeckDealerOkay.Clicked += on_DeckDealerOkay_clicked; DeckDealerFlip.Clicked += on_DeckDealerFlip_clicked; }
public int getCommodityCost(Resource r) { foreach (Commodity com in commodities) { if (com.Good.Name == r.Name) { return com.Value; } } return 0; }
public Commodity(Resource i, int pos, int v) { good = i; tablePosition = pos; val = v; }
public void setCommodityCost(Resource r, int cost) { foreach (Commodity com in commodities) { if (com.Good.Name == r.Name) { com.Value = cost; return; } } return; }
public void initResource( Resource a, int slot ) { commodities.Add( new Commodity(a, slot, marketTable[slot]) ); }