bool cellContainsResource(CellResourcesData contained_resources, string resource) { Dictionary<Resource, ResourceCellData> data = contained_resources.getData (); foreach (KeyValuePair<Resource, ResourceCellData> entry in data) { if(entry.Key.Name == resource) { return true; } } return false; }
public void updateUIData(CellResourcesData contained_resources) { Dictionary<Resource, ResourceCellData> data = contained_resources.getData (); //remove old resources foreach (KeyValuePair<string, CellUITextPanelHandler> entry in resource_panels) { if (!cellContainsResource(contained_resources, entry.Key)) { removeResource (entry.Key); } } //update resource values foreach (KeyValuePair<Resource, ResourceCellData> entry in data) { setResourceQty(entry.Key.Name, entry.Value.Quantity.ToString("F2")); setResourceROC(entry.Key.Name, entry.Value.RateOfChange.ToString("F2")); } }
public void updateUIData(CellResourcesData contained_resources) { UIHandler.updateUIData (contained_resources); }
Dictionary<Resource, ResourceCellData> data; // has one entry for every resource contained in the cell #endregion Fields #region Methods // Class instantiator (replaces the class constructor) public static CellResourcesData GetNew() { CellResourcesData temp = new CellResourcesData (); // instantiate temp.Init (); // initialize return temp; }