Beispiel #1
0
 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;
 }
Beispiel #2
0
    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"));
        }
    }
Beispiel #3
0
 public void updateUIData(CellResourcesData contained_resources)
 {
     UIHandler.updateUIData (contained_resources);
 }
Beispiel #4
0
    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;
    }