Esempio n. 1
0
        //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);
        }
Esempio n. 2
0
        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;
        }
Esempio n. 4
0
        public static int GetCurrentCity()
        {
            if (Gloval.Database.Account.Cities == null)
            {
                DAOCity.GetCities();
            }

            return(Gloval.Database.CurrentCity);
        }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
        public static int Count()
        {
            if (Gloval.Database.Account.Cities == null)
            {
                return(DAOCity.GetCities().Count());
            }

            return(Gloval.Database.Account.Cities.Count());
        }
Esempio n. 7
0
 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]);
     }
 }
Esempio n. 8
0
        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;
                }
            }
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        //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);
        }
Esempio n. 11
0
        //--------------------------------------------------------
        //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);
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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);
            }
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        //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);
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        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);
        }
Esempio n. 18
0
 public static void GoToCity()
 {
     DAOCity.GoToCity();
     Gloval.Database.CurrentView = Data.SITE_VIEW.CITY;
 }
Esempio n. 19
0
 public static void GoToIsland()
 {
     DAOCity.GoToIsland();
     Gloval.Database.CurrentView = Data.SITE_VIEW.ISLAND;
 }
Esempio n. 20
0
 public static void GoToWorld()
 {
     DAOCity.GoToWorld();
     Gloval.Database.CurrentView = Data.SITE_VIEW.WORLD;
 }
Esempio n. 21
0
 public static void GoToTownHall()
 {
     DAOCity.GoToTownHall();
     Gloval.Database.CurrentView = Data.SITE_VIEW.TOWN_HALL;
 }