//public static void UpdateCities(int iIndex) //{ // DAOCity.GetCities(); //} public static DTOCity ChangeCityTo(int iIndex, bool bForceUpdateSite) { if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); } if (0 <= iIndex && iIndex < Gloval.Database.Account.Cities.Count()) { if (Gloval.Database.CurrentCity == iIndex) { if (bForceUpdateSite) { DAOCity.ChangeCity(iIndex); } } else { DAOCity.ChangeCity(iIndex); } return(Gloval.Database.Account.Cities[Gloval.Database.CurrentCity]); } //thong bao loi~ return(null); }
public static void requestTownHall(int iIndexCity) { if (0 <= iIndexCity && iIndexCity < Gloval.Database.Account.Cities.Count()) { BUSCity.ChangeCityTo(iIndexCity); if (Gloval.Database.CurrentView != Data.SITE_VIEW.TOWN_HALL) { if (Gloval.Database.CurrentView != Data.SITE_VIEW.CITY) { BUSCity.GoToCity(); } BUSCity.GoToTownHall(); } Gloval.Database.Account.Cities[iIndexCity].DTTownHall = DateTime.Now; //lấy thông tin long PopulationLimit; float PopulationGrow; long GoldPerHour; int ResearchPointPerHour; DAOCity.GetTownHallInfomation(iIndexCity, out PopulationLimit, out PopulationGrow, out GoldPerHour, out ResearchPointPerHour); Gloval.Database.Account.Cities[iIndexCity].PopulationLimit = PopulationLimit; Gloval.Database.Account.Cities[iIndexCity].PopulationGrow = PopulationGrow; Gloval.Database.Account.Cities[iIndexCity].GoldPerHour = GoldPerHour; Gloval.Database.Account.Cities[iIndexCity].ResearchPointPerHour = ResearchPointPerHour; } }
private List <City> citiesSimulation;///<summary> /**------------------------------------------------------------------------------------------- * Métodos *-------------------------------------------------------------------------------------------- **/ public TourManager(String server, String userId, String password, String database) { sqlConnection = new SQLConnection(server, userId, password, database); cityDAO = new DAOCity(sqlConnection); cities = cityDAO.getCities(this); numberCitiesSimulation = CITIES_SIMULATION_NULL; citiesSimulation = null; }
public static int GetCurrentCity() { if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); } return(Gloval.Database.CurrentCity); }
public static void requestCities() { if (Gloval.Database.CurrentView != Data.SITE_VIEW.CITY) { DAOCity.GoToCity(); } //cap nhat thoi gian update tu ika server Gloval.Database.Account.Cities = DAOCity.ParseCity(Gloval.Database.DocumentNode); }
public static int Count() { if (Gloval.Database.Account.Cities == null) { return(DAOCity.GetCities().Count()); } return(Gloval.Database.Account.Cities.Count()); }
public static void requestResourceCity(int iIndex) { if (0 <= iIndex && iIndex < Gloval.Database.Account.Cities.Count()) { ChangeCityTo(iIndex); Gloval.Database.Account.Cities[iIndex].DTResourceCity = DateTime.Now; Gloval.Database.Account.Cities[iIndex] = DAOCity.ParseResources(Gloval.Database.Account.Cities[iIndex]); } }
public static void ChangeCityTo(int iIndex) { if (0 <= iIndex && iIndex < Gloval.Database.Account.Cities.Count()) { if (Gloval.Database.CurrentCity != iIndex) { DAOCity.requestChangeCityTo(Gloval.Database.Account.Cities[iIndex].ID); Gloval.Database.CurrentCity = iIndex; } } }
public static DTOCity GetCity(int iIndex) { //tu dong cap nhat danh sach neu chua co if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); } if (0 <= iIndex && iIndex < Gloval.Database.Account.Cities.Count()) { return(Gloval.Database.Account.Cities[iIndex]); } //thong bao loi~ return(null); }
//town hall info public static void ForceUpdateTownHall(int iIndexCity) { BUSCity.ChangeCityTo(iIndexCity, true); if (Gloval.Database.CurrentView != Data.SITE_VIEW.TOWN_HALL) { if (Gloval.Database.CurrentView != Data.SITE_VIEW.CITY) { DAOCity.GoToCity(); } DAOCity.GoToTownHall(); } Gloval.Database.Account.Cities[iIndexCity].DTTownHall = DateTime.Now; //lấy thông tin DAOCity.GetTownHallInfomation(iIndexCity); }
//-------------------------------------------------------- //ships public static int CountShips(int iIndexCity) { if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); } if (0 <= iIndexCity && iIndexCity < Gloval.Database.Account.Cities.Count()) { if (Gloval.Database.Account.Cities[iIndexCity].ListTroopsShips == null) { ForceUpdateShips(iIndexCity); } return(Gloval.Database.Account.Cities[iIndexCity].ListTroopsShips.Count()); } return(-1); }
public static void ForceUpdateUnits(int iIndexCity) { BUSCity.ChangeCityTo(iIndexCity, true); if (Gloval.Database.CurrentView != Data.SITE_VIEW.TROOPS) { if (Gloval.Database.CurrentView != Data.SITE_VIEW.CITY) { DAOCity.GoToCity(); } //nhảy vào trang troops DAOTroops.GoToTroops(); } Gloval.Database.Account.Cities[iIndexCity].DTTroopUnits = DateTime.Now; //lấy thông tin DAOTroops.GetUnits(iIndexCity); }
public static void ForceUpdate(int iIndexCity) { if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); } if (0 <= iIndexCity && iIndexCity < Gloval.Database.Account.Cities.Count()) { BUSCity.ChangeCityTo(iIndexCity); if (Gloval.Database.CurrentView != Data.SITE_VIEW.CITY) { DAOCity.GoToCity(); } //cap nhat thoi gian update tu ika server Gloval.Database.Account.Cities[iIndexCity].DTBuilding = DateTime.Now; DAOBuilding.GetBuildingCity(iIndexCity); } }
public static DTOCity GetTownHallInfomationInCity(int iIndexCity, bool bForceUpdate) { if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); bForceUpdate = true; } if (0 <= iIndexCity && iIndexCity < Gloval.Database.Account.Cities.Count()) { if (bForceUpdate) { ForceUpdateTownHall(iIndexCity); } return(Gloval.Database.Account.Cities[iIndexCity]); } //thong bao loi~ return(null); }
//nếu = true thì cập nhật lại site rùi mới lấy thông tin public static DTOCity GetResourceCity(int iIndex, bool bForceUpdateSite) { if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); } if (0 <= iIndex && iIndex < Gloval.Database.Account.Cities.Count()) { //dung them 1 bien bool dat trogn lop de kiem tra, //neu da update roi thi ko update nua //tru khi dung bien forceupdate if (!Gloval.Database.Account.Cities[iIndex].IsUpdatedResource) { if (Gloval.Database.CurrentCity == iIndex) {//chưa update, nhưng đang ở viewhiện tại nên lấy res ko request DAOCity.UpdateResourceCity(iIndex); Gloval.Database.Account.Cities[iIndex].DTResourceCity = DateTime.Now; return(Gloval.Database.Account.Cities[iIndex]); } //chưa update --> buôc request Gloval.Database.Account.Cities[iIndex].IsUpdatedResource = true; bForceUpdateSite = true; } if (bForceUpdateSite) {//buộc request ChangeCityTo(iIndex, bForceUpdateSite); Gloval.Database.Account.Cities[iIndex].DTResourceCity = DateTime.Now; DAOCity.UpdateResourceCity(iIndex); } return(Gloval.Database.Account.Cities[iIndex]); } //thong bao loi~ return(null); }
public static DTOTroops GetUnitsInCity(int iIndexCity, int iIndexTroops) { if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); } if (0 <= iIndexCity && iIndexCity < Gloval.Database.Account.Cities.Count()) { if (Gloval.Database.Account.Cities[iIndexCity].ListTroopsUnits == null) { ForceUpdateUnits(iIndexCity); } if (0 <= iIndexTroops && iIndexTroops < Gloval.Database.Account.Cities[iIndexCity].ListTroopsUnits.Count()) { return(Gloval.Database.Account.Cities[iIndexCity].ListTroopsUnits[iIndexTroops]); } } //thong bao loi~ return(null); }
public static int Count(int iIndexCity) { if (Gloval.Database.Account.Cities == null) { DAOCity.GetCities(); } if (0 <= iIndexCity && iIndexCity < Gloval.Database.Account.Cities.Count()) { if (Gloval.Database.Account.Cities[iIndexCity].ListBuilding == null) { BUSCity.ChangeCityTo(iIndexCity); if (Gloval.Database.CurrentView != Data.SITE_VIEW.CITY) { DAOCity.GoToCity(); } DAOBuilding.GetBuildingCity(iIndexCity); } return(Gloval.Database.Account.Cities[iIndexCity].ListBuilding.Count()); } return(-1); }
public static void GoToCity() { DAOCity.GoToCity(); Gloval.Database.CurrentView = Data.SITE_VIEW.CITY; }
public static void GoToIsland() { DAOCity.GoToIsland(); Gloval.Database.CurrentView = Data.SITE_VIEW.ISLAND; }
public static void GoToWorld() { DAOCity.GoToWorld(); Gloval.Database.CurrentView = Data.SITE_VIEW.WORLD; }
public static void GoToTownHall() { DAOCity.GoToTownHall(); Gloval.Database.CurrentView = Data.SITE_VIEW.TOWN_HALL; }