示例#1
0
        private void button23_Click(object sender, EventArgs e)
        {
            //all ships
            StringBuilder strResult = new StringBuilder(5000);

            int nCities = BUSCity.Count();

            for (int i = 0; i < nCities; i++)
            {
                strResult.Append("---Town: " +
                                 BUSCity.GetCity(i).Name
                                 + "---\r\n");
                BUSTroops.ForceUpdateShips(i);
                int nTroops = BUSTroops.CountShips(BUSCity.GetCurrentCity());
                for (int j = 0; j < nTroops; j++)
                {
                    DTOTroops troop = BUSTroops.GetShipsInCity(i, j);

                    strResult.Append("  " + troop.Type);
                    strResult.Append(" " + troop.Quality);
                    strResult.Append(" is unit: " + troop.IsUnits);
                    strResult.Append("\r\n");
                }
            }

            tbResult.Text = strResult.ToString();
        }
示例#2
0
        private void button21_Click(object sender, EventArgs e)
        {
            //get building all town
            StringBuilder strResult = new StringBuilder(5000);

            int nCities = BUSCity.Count();

            for (int i = 0; i < nCities; i++)
            {
                strResult.Append("---Town: " +
                                 BUSCity.GetCity(i).Name
                                 + "---\r\n");

                BUSBuilding.ForceUpdate(i);
                int nBuildings = BUSBuilding.Count(i);
                for (int j = 0; j < nBuildings; j++)
                {
                    DTOBuilding building = BUSBuilding.GetHouseInfomationInCity(i, j);

                    strResult.Append("  Building " + (j + 1).ToString() + ": " + building.Type);
                    strResult.Append(" " + building.Lvl);

                    if (building.IsBuilding)
                    {
                        strResult.Append(" " + building.IsBuilding);
                        strResult.Append(" " + building.Time);
                    }

                    strResult.Append("\r\n");
                }
            }

            tbResult.Text = strResult.ToString();
        }
示例#3
0
        private void button19_Click(object sender, EventArgs e)
        {
            string strResult = "";

            int nCities = BUSCity.Count();

            for (int i = 0; i < nCities; i++)
            {
                DTOCity city = BUSCity.GetResourceCity(i, true);
                strResult += " X: " + city.X;
                strResult += " Y: " + city.Y;
                strResult += " ID: " + city.ID;
                strResult += " Name: " + city.Name;
                strResult += " Type: " + city.TypeTradeGood;

                strResult += " po: " + city.Population;
                strResult += "(" + city.PopulationLimit + ")";
                strResult += " action: " + city.ActionPoint;

                strResult += " wood: " + city.Wood;
                strResult += "+" + city.WoodPerHour;
                strResult += " wine: " + city.Wine;
                strResult += "+" + city.WinePerHour;
                strResult += " mar: " + city.Marble;
                strResult += "+" + city.MarblePerHour;
                strResult += " crys: " + city.Crystal;
                strResult += "+" + city.CrystalPerHour;
                strResult += " sul: " + city.Sulphur;
                strResult += "+" + city.SulphurPerHour;
                strResult += "\r\n";
            }

            tbResult.Text = strResult;
        }
        public static string toEmpireOverviewUnitJSON()
        {
            //kiem tra co moi hay ko, ko moi thi khong lay



            StringBuilder sb = new StringBuilder(5000);

            sb.Append("{EmpireOverviewUnit:[");
            int nCities = BUSCity.Count();

            for (int i = 0; i < nCities; i++)
            {
                sb.Append('{');
                DTOCity ct = BUSCity.GetResourceCity(i);
                sb.Append(string.Format("Name:{0},", ct.Name));
                sb.Append(string.Format("ID:{0},", ct.ID));
                sb.Append(string.Format("X:{0},", ct.X));
                sb.Append(string.Format("Y:{0},", ct.Y));
                sb.Append(string.Format("ActionPoint:{0},", ct.ActionPoint));

                sb.Append(string.Format("FreePopulation:{0},", ct.FreePopulation));
                //sb.Append(string.Format("Population:{0},", ct.Population));
                sb.Append(string.Format("PopulationLimit:{0},", ct.PopulationLimit));

                sb.Append(string.Format("Wood:{0},", ct.Wood));
                sb.Append(string.Format("WoodPerHour:{0},", ct.WoodPerHour));
                sb.Append(string.Format("WoodLimit:{0},", ct.WoodLimit));

                sb.Append(string.Format("Wine:{0},", ct.Wine));
                sb.Append(string.Format("WinePerHour:{0},", ct.WinePerHour));
                sb.Append(string.Format("WineLimit:{0},", ct.WineLimit));

                sb.Append(string.Format("Marble:{0},", ct.Marble));
                sb.Append(string.Format("MarblePerHour:{0},", ct.MarblePerHour));
                sb.Append(string.Format("MarbleLimit:{0},", ct.MarbleLimit));

                sb.Append(string.Format("Crystal:{0},", ct.Crystal));
                sb.Append(string.Format("CrystalPerHour:{0},", ct.CrystalPerHour));
                sb.Append(string.Format("CrystalLimit:{0},", ct.CrystalLimit));

                sb.Append(string.Format("Sulphur:{0},", ct.Sulphur));
                sb.Append(string.Format("SulphurPerHour:{0},", ct.SulphurPerHour));
                sb.Append(string.Format("SulphurLimit:{0},", ct.SulphurLimit));

                sb.Append(string.Format("ResearchPointPerHour:{0},", ct.ResearchPointPerHour));
                sb.Append(string.Format("GoldPerHour:{0}", ct.GoldPerHour));
                sb.Append('}');

                if (i != nCities - 1)
                {//dau phay giua moi bien trong mang
                    sb.Append(',');
                }
            }
            sb.Append("]}");
            return(sb.ToString());
        }
示例#5
0
        private void button2_Click(object sender, EventArgs e)
        {//get list city
            string strResult = "";
            int    nCities   = BUSCity.Count();

            for (int i = 0; i < nCities; i++)
            {
                DTOCity city = BUSCity.GetCity(i);
                strResult += " X: " + city.X;
                strResult += " Y: " + city.Y;
                strResult += " ID: " + city.ID;
                strResult += " Name: " + city.Name;
                strResult += " Type: " + city.TypeTradeGood;
                strResult += "\r\n";
            }

            DTOCity cityFF = BUSCity.GetCity(0);


            tbResult.Text = strResult;
        }
示例#6
0
        private void button29_Click(object sender, EventArgs e)
        {
            StringBuilder strResult = new StringBuilder(5000);

            int nCities = BUSCity.Count();

            for (int i = 0; i < nCities; i++)
            {
                DTOCity ct = BUSCity.GetTownHallInfomationInCity(i, true);

                strResult.Append("---Town: " +
                                 BUSCity.GetCity(i).Name
                                 + "---\r\n");

                strResult.Append("polimit: " + ct.PopulationLimit);
                strResult.Append(" pogrow: " + ct.PopulationGrow.ToString());
                strResult.Append(" net gold: " + ct.GoldPerHour);
                strResult.Append(" scientist point per hour: " + ct.ResearchPointPerHour.ToString());

                strResult.Append("\r\n");
            }

            tbResult.Text = strResult.ToString();
        }