Esempio n. 1
0
        public void CopyFrom(Building building)
        {
            this._id = building._id;
            this._raceId = building._raceId;
            this._name = building._name;
            this._description = building._description;

            this._wood = building._wood;
            this._mercury = building._mercury;
            this._ore = building._ore;
            this._sulfur = building._sulfur;
            this._crystal = building._crystal;
            this._gem = building._gem;
            this._gold = building._gold;

            this._isDwelling = building._isDwelling;
            this._armyQty = building._armyQty;
            this._growth = building._growth;
            this._hordeId = building._hordeId;

            this._woodGen = building._woodGen;
            this._mercuryGen = building._mercuryGen;
            this._oreGen = building._oreGen;
            this._sulfurGen = building._sulfurGen;
            this._crystalGen = building._crystalGen;
            this._gemGen = building._gemGen;
            this._goldGen = building._goldGen;

            this._imgFileName = building._imgFileName;
            this._point = new Point(building._point.X, building._point.Y);
            this._orderSeq = building._orderSeq;
        }
Esempio n. 2
0
        private static bool GetBuildings(out Hashtable lst)
        {
            lst = new Hashtable();

            using (StreamReader sr = new StreamReader(string.Format(@"{0}\Data\Building.txt", _appStartupPath)))
            {
                string strLine = "";
                strLine = sr.ReadLine();    // 1st line is column header

                while (!sr.EndOfStream)
                {
                    strLine = sr.ReadLine();

                    // Id,raceId,name,w,m,o,s,c,g,gold,isdwelling,growth,hordeId,gw,gm,go,gs,gc,gg,ggold,imgFileName,x,y,orderSeq,desc
                    string[] datas = strLine.Split(new char[] { ',' }, 25);

                    Building dr = new Building();
                    dr._id = System.Convert.ToInt32(datas[0]);
                    dr._raceId = System.Convert.ToInt32(datas[1]);
                    dr._name = datas[2];

                    dr._wood = System.Convert.ToInt32(datas[3]);
                    dr._mercury = System.Convert.ToInt32(datas[4]);
                    dr._ore = System.Convert.ToInt32(datas[5]);
                    dr._sulfur = System.Convert.ToInt32(datas[6]);
                    dr._crystal = System.Convert.ToInt32(datas[7]);
                    dr._gem = System.Convert.ToInt32(datas[8]);
                    dr._gold = System.Convert.ToInt32(datas[9]);

                    dr._isDwelling = System.Convert.ToBoolean(System.Convert.ToInt32(datas[10]));
                    dr._growth = System.Convert.ToInt32(datas[11]);
                    dr._hordeId = System.Convert.ToInt32(datas[12]);

                    dr._woodGen = System.Convert.ToInt32(datas[13]);
                    dr._mercuryGen = System.Convert.ToInt32(datas[14]);
                    dr._oreGen = System.Convert.ToInt32(datas[15]);
                    dr._sulfurGen = System.Convert.ToInt32(datas[16]);
                    dr._crystalGen = System.Convert.ToInt32(datas[17]);
                    dr._gemGen = System.Convert.ToInt32(datas[18]);
                    dr._goldGen = System.Convert.ToInt32(datas[19]);

                    dr._imgFileName = string.Format(@"{0}\Images\Castle\Buildings\{1}", _appStartupPath, datas[20]);
                    dr._point.X = System.Convert.ToInt32(datas[21]);
                    dr._point.Y = System.Convert.ToInt32(datas[22]);
                    dr._orderSeq = System.Convert.ToInt32(datas[23]);

                    dr._description = datas[24];

                    lst.Add(dr._id, dr);
                }
            }
            return true;
        }