public static void CalculateFromLocalData() { DateTime dtnew = DateTime.Now; int nCities = BUSCity.Count(); for (int i = 0; i < nCities; i++) { DTOCity ct = BUSCity.GetResourceCity(i); TimeSpan tp = new TimeSpan(dtnew.Ticks - ct.DTResourceCity.Ticks); //cap nhat dan - townhall ct.FreePopulation += updateValue(ct.PopulationGrow, (float)tp.TotalSeconds); ct.Population = updateValueHaveLimit(ct.Population, ct.PopulationLimit, ct.PopulationGrow, (float)tp.TotalSeconds); //cap nhat res ct.Wood = updateValueHaveLimit(ct.Wood, ct.WoodLimit, ct.WoodPerHour, (float)tp.TotalSeconds); ct.Wine = updateValueHaveLimit(ct.Wine, ct.WineLimit, ct.WinePerHour, (float)tp.TotalSeconds); ct.Marble = updateValueHaveLimit(ct.Marble, ct.MarbleLimit, ct.MarblePerHour, (float)tp.TotalSeconds); ct.Crystal = updateValueHaveLimit(ct.Crystal, ct.CrystalLimit, ct.CrystalPerHour, (float)tp.TotalSeconds); ct.Sulphur = updateValueHaveLimit(ct.Sulphur, ct.SulphurLimit, ct.SulphurPerHour, (float)tp.TotalSeconds); //cap nhat cooldown cac building //cap nhat lai thoi gian ct.DTResourceCity = dtnew; ct.DTTownHall = dtnew; Gloval.Database.Account.Cities[i] = ct; } }
public static void AutoRequestBuildings() { //force update building int nCities = BUSCity.Count(); for (int i = 0; i < nCities; i++) { BUSBuilding.ForceUpdate(i); } Gloval.bBuildingsOverviewIsNewData = true; }
public static void AutoRequestTroops() { //force unit int nCities = BUSCity.Count(); for (int i = 0; i < nCities; i++) { BUSTroops.ForceUpdateUnits(i); } //force update ships for (int i = 0; i < nCities; i++) { BUSTroops.ForceUpdateShips(i); } Gloval.bTroopsOverviewIsNewData = true; }
public static void AutoRequestEmpireOverview() { //get res all city int nCities = BUSCity.Count(); for (int i = 0; i < nCities; i++) { BUSCity.GetResourceCity(i, true); } //get townhall inf all city for (int i = 0; i < nCities; i++) { BUSCity.GetTownHallInfomationInCity(i, true); } //event BUSEvent.ForceUpdate(); Gloval.bEmpireOverviewIsNewData = true; }