コード例 #1
0
ファイル: Block.cs プロジェクト: Herocane/Hypercube
        public void LoadBlocks()
        {
            Blocks.Clear();
            var dt = ServerCore.Database.GetDataTable("SELECT * FROM BlockDB");

            foreach (DataRow c in dt.Rows)
            {
                var newBlock = new Block();
                newBlock.ID            = Convert.ToInt32(c["Number"]);
                newBlock.Name          = (string)c["Name"];
                newBlock.OnClient      = (byte)Convert.ToInt32(c["OnClient"]);
                newBlock.RanksPlace    = RankContainer.SplitRanks(ServerCore, (string)c["PlaceRank"]);
                newBlock.RanksDelete   = RankContainer.SplitRanks(ServerCore, (string)c["DeleteRank"]);
                newBlock.Physics       = Convert.ToInt32(c["Physics"]);
                newBlock.PhysicsPlugin = (string)c["PhysicsPlugin"];
                newBlock.Kills         = ((long)c["Kills"] > 0);
                newBlock.Color         = Convert.ToInt32(c["Color"]);
                newBlock.CPELevel      = Convert.ToInt32(c["CPELevel"]);
                newBlock.CPEReplace    = Convert.ToInt32(c["CPEReplace"]);
                newBlock.Special       = ((long)c["Special"] > 0);
                newBlock.ReplaceOnLoad = Convert.ToInt32(c["ReplaceOnLoad"]);

                Blocks.Add(newBlock);
            }

            Blocks.OrderBy(o => o.ID);
        }
コード例 #2
0
ファイル: Block.cs プロジェクト: Herocane/Hypercube
        public void AddBlock(string Name, byte OnClient, string PlaceRanks, string DeleteRanks, int Physics, string PhysicsPlugin, bool Kills, int Color, int CPELevel, int CPEReplace, bool Special, int ReplaceOnLoad)
        {
            if (ServerCore.Database.ContainsBlock(Name))
            {
                return;
            }

            var newBlock = new Block();

            newBlock.Name          = Name;
            newBlock.OnClient      = OnClient;
            newBlock.RanksPlace    = RankContainer.SplitRanks(ServerCore, PlaceRanks);
            newBlock.RanksDelete   = RankContainer.SplitRanks(ServerCore, DeleteRanks);
            newBlock.Physics       = Physics;
            newBlock.PhysicsPlugin = PhysicsPlugin;
            newBlock.Kills         = Kills;
            newBlock.Color         = Color;
            newBlock.CPELevel      = CPELevel;
            newBlock.CPEReplace    = CPEReplace;
            newBlock.Special       = Special;
            newBlock.ReplaceOnLoad = ReplaceOnLoad;

            Blocks.Add(newBlock);

            ServerCore.Database.CreateBlock(Name, OnClient, PlaceRanks, DeleteRanks, Physics, PhysicsPlugin, Kills, Color, CPELevel, CPEReplace, Special, ReplaceOnLoad);

            newBlock.ID = ServerCore.Database.GetDatabaseInt(Name, "BlockDB", "Number");
        }