private List <MenuAction> getBEraActions() { List <MenuAction> actions = new List <MenuAction> (); Building_Era building = (Building_Era)BuildingsManager.GetInstance().getBuilding(BUILDINGS.ERA); Building_Silo buildingSilo = (Building_Silo)BuildingsManager.GetInstance().getBuilding(BUILDINGS.SILO); MenuAction actSendRice = new MenuAction(); actSendRice.title = Dictionary.getString("SEND_RICE_TO_SILO"); uint riceToSend = Math.Min(buildingSilo.getCurrentFreeCapacity(), building.getRicePrepared()); actSendRice.info = Dictionary.getString("SEND") + " " + riceToSend + " " + Dictionary.getString("KG_RICE_SILO"); actSendRice.enabled = (building.getRicePrepared() > 0); actSendRice.doMenuAction = new DoMenuAction(ActSendRiceToSilo); actions.Add(actSendRice); return(actions); }
private void ActSendRiceToSilo() { Building_Era era = (Building_Era)BuildingsManager.GetInstance().getBuilding(BUILDINGS.ERA); Building_Silo silo = (Building_Silo)BuildingsManager.GetInstance().getBuilding(BUILDINGS.SILO); //uint ricePrepared = era.getAndEraseRicePrepared (); uint riceToSend = Math.Min(silo.getCurrentFreeCapacity(), era.getRicePrepared()); era.takeRicePrepared(riceToSend); silo.sendRice(riceToSend); }
public void save(BuildingManagerData buildingManagerData) { foreach (KeyValuePair <BUILDINGS, bool> builded in IsBuilded) { if (builded.Value) { BuildingData buildingData = new BuildingData(); buildingData.ID = builded.Key; switch (builded.Key) { case BUILDINGS.CASA: { Building_Home b = (Building_Home)getBuilding(builded.Key); buildingData.i = b.getRow(); buildingData.j = b.getCol(); buildingData.Level = b.getCurrentLevel(); } break; case BUILDINGS.ESTABLO: { Building_Stable b = (Building_Stable)getBuilding(builded.Key); buildingData.i = b.getRow(); buildingData.j = b.getCol(); buildingData.Level = b.getCurrentLevel(); } break; //case BUILDINGS.GARAJE: { // Building_Garage b = (Building_Garage)getBuilding(builded.Key); // buildingData.i = b.getRow(); // buildingData.j = b.getCol(); // buildingData.Level = b.getCurrentLevel(); // } // break; case BUILDINGS.PLANTER: { Building_Planter b = (Building_Planter)getBuilding(builded.Key); buildingData.i = b.getRow(); buildingData.j = b.getCol(); buildingData.Level = b.getCurrentLevel(); buildingData.SpecialSlot1 = b.estaSembrat() ? 1 : 0; buildingData.SpecialSlot2 = (int)b.DiesSembrat; buildingData.SpecialSlot3 = (int)b.Plantes; } break; case BUILDINGS.TRILL: { Building_Trill b = (Building_Trill)getBuilding(builded.Key); buildingData.i = b.getRow(); buildingData.j = b.getCol(); buildingData.Level = b.getCurrentLevel(); buildingData.SpecialSlot1 = (int)b.getRiceUnprepared(); buildingData.SpecialSlot2 = (int)b.getRicePrepared(); } break; case BUILDINGS.ERA: { Building_Era b = (Building_Era)getBuilding(builded.Key); buildingData.i = b.getRow(); buildingData.j = b.getCol(); buildingData.Level = b.getCurrentLevel(); buildingData.SpecialSlot1 = (int)b.getRiceUnprepared(); buildingData.SpecialSlot2 = (int)b.getRicePrepared(); } break; case BUILDINGS.SILO: { Building_Silo b = (Building_Silo)getBuilding(builded.Key); buildingData.i = b.getRow(); buildingData.j = b.getCol(); buildingData.Level = b.getCurrentLevel(); buildingData.SpecialSlot1 = (int)b.getAllTheRice(); } break; case BUILDINGS.PLANTA: { Building_Planta b = (Building_Planta)getBuilding(builded.Key); buildingData.i = b.getRow(); buildingData.j = b.getCol(); buildingData.Level = b.getCurrentLevel(); buildingData.SpecialSlot1 = (int)b.getRiceUnprepared(); } break; } buildingManagerData.BuildingsBuilded.Add(buildingData); } } }