当前位置: 首页>>代码示例>>C#>>正文


C# GameData.Query方法代码示例

本文整理汇总了C#中GameData.Query方法的典型用法代码示例。如果您正苦于以下问题:C# GameData.Query方法的具体用法?C# GameData.Query怎么用?C# GameData.Query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameData的用法示例。


在下文中一共展示了GameData.Query方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: create

        /// <summary>
        /// Erzeugt eine neue Stationsklasse
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="data">GameData</param>
        /// <returns></returns>
        public static StationClass create(int ID, GameData data)
        {
            MySqlDataReader Reader = data.Query("SELECT * FROM `PX_stations` WHERE `ID` = '" + ID + "'");
            Reader.Read();

            string name = (string)Reader["Name"];

            string buildres = (string)Reader["buildres"];
            string res = (string)Reader["res"];

            string buildshipS = (string)Reader["buildship"];
            string buildtroopS = (string)Reader["buildtroop"];

            int power = (int)Reader["Power"];
            int health = (int)Reader["health"];
            int power2 = (int)Reader["Power2"];
            int power3 = (int)Reader["Power3"];
            int power4 = (int)Reader["Power4"];
            int resistend1 = (int)Reader["Resistend1"];
            int resistend2 = (int)Reader["Resistend2"];
            int resistend3 = (int)Reader["Resistend3"];
            int resistend4 = (int)Reader["Resistend4"];

            string need_temp = (string)Reader["need"];
            string need_count_temp = (string)Reader["needcount"];
            int updateto = (int)Reader["updateto"];
            int population = (int)Reader["population"];

            string names = (string)Reader["names"];
            int limit = (int)Reader["limit"];
            int globallimit = (int)Reader["globallimit"];
            int time = (int)Reader["time"];

            string need_techS = (string)Reader["need_tech"];
            string skillsS = (string)Reader["skills"];
            string raceS = (string)Reader["race"];

            byte[] picture = (byte[])Reader["picture"];

            StationClass station = new StationClass(ID, name);

            station.names = names;
            station.globallimit = globallimit;
            station.time = time;

            station.need_tech_temp = need_techS;
            station.skills_temp = skillsS;
            station.race_temp = raceS;

               // station.buildtroop_temp = buildtroopS;
            station.buildship_temp = buildshipS;
            station.limit = limit;
            station.need_count_temp = need_count_temp;
            station.need_tech_temp = need_techS;
            station.need_temp = need_temp;
            station.population = population;

            station.skills_temp = skillsS;
            station.updateto_temp = updateto;

            string costs = (string)Reader["costs"];
            string[] costs_A1 = costs.Split(new string[] { "&" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string value in costs_A1)
            {
                try
                {
                    string[] costs_A2 = value.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);

                    ResType type = (ResType)Enum.Parse(typeof(ResType), costs_A2[0]);
                    double cost = double.Parse(costs_A2[1]);

                    station.price[type] = cost;

                }
                catch
                {
                    // Unsinnige Mysql Daten
                }
            }

            station.create_res = Static.ResHelper.getResAdd(buildres, res);

            station.health = health;
            station.power = power;
            station.power2 = power2;
            station.power3 = power3;
            station.power4 = power4;
            station.resistend1 = resistend1;
            station.resistend2 = resistend2;
            station.resistend3 = resistend3;
            station.resistend4 = resistend4;

            try
//.........这里部分代码省略.........
开发者ID:MRH4287,项目名称:GameShare,代码行数:101,代码来源:StationClass.cs

示例2: create

        /// <summary>
        /// Erzeugt einen neuen Trupp
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="data">GameData</param>
        /// <returns></returns>
        public static Troop create(int ID, GameData data)
        {
            MySqlDataReader Reader = data.Query("SELECT * FROM `PX_mom-troops` WHERE `ID` = '" + ID + "'");
            Reader.Read();

            int type = (int)Reader["Class"];
            string name = (string)Reader["Name"];
            User UID = data.getUser((int)Reader["UID"]);
            int power = (int)Reader["Power"];
            int health = (int)Reader["health"];
            int team = (int)Reader["team"];
            WorldPoint position = new WorldPoint((string)(Reader["worldpos"]));
            string states = (string)Reader["states"];
            int power2 = (int)Reader["Power2"];
            int power3 = (int)Reader["Power3"];
            int power4 = (int)Reader["Power4"];
            int resistend1 = (int)Reader["Resistend1"];
            int resistend2 = (int)Reader["Resistend2"];
            int resistend3 = (int)Reader["Resistend3"];
            int resistend4 = (int)Reader["Resistend4"];

            int hide = (int)Reader["hide"];
            string verhalten = (string)Reader["verhalten"];

            TroopClass typeClass = data.getTroopType(type);

            Troop troop = new Troop(ID, typeClass, UID, name, team, states);
            troop.position = position;
            troop.health = health;
            troop.power = power;
            troop.power2 = power2;
            troop.power3 = power3;
            troop.power4 = power4;
            troop.resistend1 = resistend1;
            troop.resistend2 = resistend2;
            troop.resistend3 = resistend3;
            troop.resistend4 = resistend4;
            troop.hide = hide;
            troop.verhalten = verhalten;

            troop.fighterTyp = FighterType.TROOP;

            Reader.Close();
            return troop;
        }
开发者ID:MRH4287,项目名称:GameShare,代码行数:51,代码来源:Troop.cs

示例3: create

        /// <summary>
        /// Erzeugt eine neue SchiffsKlasse
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="data">GameData</param>
        /// <returns>ShipClass</returns>
        public static ShipClass create(int ID, GameData data)
        {
            MySqlDataReader Reader = data.Query("SELECT * FROM `PX_ships` WHERE `ID` = '" + ID + "'");
            Reader.Read();

            string name = (string)Reader["Name"];

            int power = (int)Reader["Power"];
            int health = (int)Reader["health"];
            int power2 = (int)Reader["Power2"];
            int power3 = (int)Reader["Power3"];
            int power4 = (int)Reader["Power4"];
            int resistend1 = (int)Reader["Resistend1"];
            int resistend2 = (int)Reader["Resistend2"];
            int resistend3 = (int)Reader["Resistend3"];
            int resistend4 = (int)Reader["Resistend4"];

            string names = (string)Reader["names"];
            int speed = (int)Reader["speed"];
            int globallimit = (int)Reader["globallimit"];
            int time = (int)Reader["time"];

            string need_techS = (string)Reader["need_tech"];
            string skillsS = (string)Reader["skills"];
            string raceS = (string)Reader["race"];

            byte[] picture = (byte[])Reader["picture"];

            ShipClass ship = new ShipClass(ID, name);

            ship.names = names;
            ship.speed = speed;
            ship.globallimit = globallimit;
            ship.time = time;

            ship.need_tech_temp = need_techS;
            ship.skills_temp = skillsS;
            ship.race_temp = raceS;

            ship.health = health;
            ship.power = power;
            ship.power2 = power2;
            ship.power3 = power3;
            ship.power4 = power4;
            ship.resistend1 = resistend1;
            ship.resistend2 = resistend2;
            ship.resistend3 = resistend3;
            ship.resistend4 = resistend4;

            string costs = (string)Reader["costs"];
            string[] costs_A1 = costs.Split(new string[] { "&" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string value in costs_A1)
            {
                try
                {
                    string[] costs_A2 = value.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);

                    ResType type = (ResType)Enum.Parse(typeof(ResType), costs_A2[0]);
                    double cost = double.Parse(costs_A2[1]);

                    ship.price[type] = cost;

                }
                catch
                {
                    // Unsinnige Mysql Daten
                }
            }

            try
            {
                ship.picture = GraphicLibary.GraphicHelper.getPicture(picture);
            }
            catch
            {
                ship.picture = new System.Drawing.Bitmap(1, 1);
            }

            Reader.Close();
            return ship;
        }
开发者ID:MRH4287,项目名称:GameShare,代码行数:88,代码来源:ShipClass.cs

示例4: create

        /// <summary>
        /// Erezeugt eine neue Technologie
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="data">GameData</param>
        /// <returns>Tech</returns>
        public static Tech create(int ID, GameData data)
        {
            MySqlDataReader Reader = data.Query("SELECT * FROM `PX_tech` WHERE `ID` = '" + ID + "'");
            Reader.Read();

            string name = (string)Reader["Name"];
            string beschreibung = (string)Reader["beschreibung"];

            int water = (int)Reader["water"];
            int metal = (int)Reader["metal"];
            int food = (int)Reader["food"];
            int naquadah = (int)Reader["naquadah"];

            int time = (int)Reader["time"];

            string need_techS = (string)Reader["need"];
            string updateS = (string)Reader["update"];
            string raceS = (string)Reader["race"];

            int group = (int)Reader["group"];

            Tech tech = new Tech(ID, name, beschreibung);

            string costs = (string)Reader["costs"];
            string[] costs_A1 = costs.Split(new string[] { "&" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string value in costs_A1)
            {
                try
                {
                    string[] costs_A2 = value.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);

                    ResType type = (ResType)Enum.Parse(typeof(ResType), costs_A2[0]);
                    double cost = double.Parse(costs_A2[1]);

                    tech.price[type] = cost;

                }
                catch
                {
                    // Unsinnige Mysql Daten
                }
            }

            tech.time = time;
            tech.need_tech_temp = need_techS;
            tech.update_temp = updateS;
            tech.race_temp = raceS;
            tech.group = group;

            Reader.Close();

            return tech;
        }
开发者ID:MRH4287,项目名称:GameShare,代码行数:60,代码来源:Tech.cs

示例5: create

        /// <summary>
        /// Erzeugt einen neuen TruppenTyp
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="data">GameData</param>
        /// <returns>TroopClass</returns>
        public static TroopClass create(int ID, GameData data)
        {
            MySqlDataReader Reader = data.Query("SELECT * FROM `PX_troops` WHERE `ID` = '" + ID + "'");
            Reader.Read();

            string name = (string)Reader["Name"];

            int power = (int)Reader["Power"];
            int health = (int)Reader["health"];
            int power2 = (int)Reader["Power2"];
            int power3 = (int)Reader["Power3"];
            int power4 = (int)Reader["Power4"];
            int resistend1 = (int)Reader["Resistend1"];
            int resistend2 = (int)Reader["Resistend2"];
            int resistend3 = (int)Reader["Resistend3"];
            int resistend4 = (int)Reader["Resistend4"];

            int hide = (int)Reader["hide"];

            int water = (int)Reader["water"];
            int metal = (int)Reader["metal"];
            int food = (int)Reader["food"];
            int naquadah = (int)Reader["naquadah"];

            int globallimit = (int)Reader["globallimit"];
            int time = (int)Reader["time"];

            string need_techS = (string)Reader["need_tech"];
            string skillsS = (string)Reader["skills"];
            string raceS = (string)Reader["race"];

            TroopClass troop = new TroopClass(ID, name);

            troop.globallimit = globallimit;
            troop.time = time;

            troop.need_tech_temp = need_techS;
            troop.skills_temp = skillsS;
            troop.race_temp = raceS;

            troop.health = health;
            troop.power = power;
            troop.power2 = power2;
            troop.power3 = power3;
            troop.power4 = power4;
            troop.resistend1 = resistend1;
            troop.resistend2 = resistend2;
            troop.resistend3 = resistend3;
            troop.resistend4 = resistend4;
            troop.hide = hide;

            troop.metal = metal;
            troop.naquadah = naquadah;
            troop.food = food;
            troop.water = water;

            Reader.Close();
            return troop;
        }
开发者ID:MRH4287,项目名称:GameShare,代码行数:65,代码来源:TroopClass.cs

示例6: create

        /// <summary>
        /// Erstellt eine neue PlanetenKlasse
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="data">GameData</param>
        /// <returns>PlanetClass</returns>
        public static PlanetClass create(int ID, GameData data)
        {
            MySqlDataReader Reader = data.Query("SELECT * FROM `PX_planeten` WHERE `ID` = '" + ID + "'");
            Reader.Read();

            string name = (string)Reader["Name"];

            string buildres = (string)Reader["buildres"];
            string res = (string)Reader["res"];

            string buildshipS = (string)Reader["buildship"];
            string buildtroopS = (string)Reader["buildtroop"];
            int bewohnbar = (int)Reader["bewohnbar"];

            string names = (string)Reader["names"];

            byte[] picture = (byte[])Reader["bild"];

            PlanetClass planet = new PlanetClass(ID, name);

            planet.names = names;

            planet.create_res = Static.ResHelper.getResAdd(buildres, res);

            // planet.buildtroop_temp = buildtroopS;
            try
            {
                planet.picture = GraphicLibary.GraphicHelper.getPicture(picture);
            }
            catch
            {
                planet.picture = new System.Drawing.Bitmap(1, 1);
            }
            planet.buildship_temp = buildshipS;
            planet.bewohnbar = (bewohnbar == 1);

            Reader.Close();
            return planet;
        }
开发者ID:MRH4287,项目名称:GameShare,代码行数:45,代码来源:PlanetClass.cs

示例7: create

        /// <summary>
        /// Erzeugt eine neue Fähigkeit
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="data">GameData</param>
        /// <returns>Skill</returns>
        public static Skill create(int ID, GameData data)
        {
            MySqlDataReader Reader = data.Query("SELECT * FROM `PX_skills` WHERE `ID` = '" + ID + "'");
            Reader.Read();

            string name = (string)Reader["Name"];
            string beschreibung = (string)Reader["beschreibung"];

            int time = (int)Reader["time"];

            string need = (string)Reader["need"];

            string states = (string)Reader["states"];
            string skillS = (string)Reader["skill"];

            bool passiv = ((int)Reader["passiv"] ==1);
            bool ship = ((int)Reader["ship"] == 1);
            bool stat = ((int)Reader["stat"] == 1);
            bool troop = ((int)Reader["troop"] == 1);

            Skill skill = new Skill(ID, name, beschreibung);

            skill.time = time;
            skill.need = need;
            skill.passiv = passiv;
            skill.stat = stat;
            skill.ship = ship;
            skill.skill = skillS;
            skill.states = states;
            skill.troop = troop;

            Reader.Close();

            return skill;
        }
开发者ID:MRH4287,项目名称:GameShare,代码行数:41,代码来源:Skill.cs


注:本文中的GameData.Query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。