コード例 #1
0
ファイル: ObjectLoader.cs プロジェクト: jayands/tAPI-SDK
        /// <summary>
        /// Adds a Tile to the game
        /// </summary>
        /// <param name="Tparam">The Tile data to add to the game</param>
        /// <param name="param">Common object loading parameters</param>
        public static void AddToGame(TileParameters Tparam, LoadParameters param)
        {
            int type = Defs.tileNextType++;

            TileDef.ResizeTiles(Defs.tileNextType);

            if (!Main.dedServ)
            {
                Main.tileTexture[type] = Tparam.Texture;
            }

            if (!String.IsNullOrEmpty(param.SubClassTypeName))
            {
                TileDef.codeClass[type] = (ModTile)param.Assembly.CreateInstance(param.SubClassTypeName, false, BindingFlags.Public | BindingFlags.Instance, null,
                                                                                 new object[] { param.ModBase }, CultureInfo.CurrentCulture, new object[] { });

                if (TileDef.codeClass[type] != null)
                {
                    Defs.FillCallPriorities(TileDef.codeClass[type].GetType());
                }
            }

            TileDef.name[type]        = param.ModBase.modName + ":" + param.Name;
            TileDef.displayName[type] = param.Name;

            TileDef.width[type]        = Tparam.Width;
            TileDef.height[type]       = Tparam.Height;
            TileDef.frameWidth[type]   = Tparam.FrameWidth;
            TileDef.frameHeight[type]  = Tparam.FrameHeight;
            TileDef.sheetColumns[type] = Tparam.SheetColumns;
            TileDef.sheetLines[type]   = Tparam.SheetLines;

            TileDef.solid[type]          = Tparam.Solid;
            TileDef.solidTop[type]       = Tparam.SolidTop;
            TileDef.frameImportant[type] = Tparam.FrameImportant;

            TileDef.breaksFast[type]     = Tparam.BreaksFast;
            TileDef.breaksByPick[type]   = Tparam.BreaksByPic;
            TileDef.breaksByAxe[type]    = Tparam.BreaksByAxe;
            TileDef.breaksByHammer[type] = Tparam.BreaksByHammer;
            TileDef.breaksByCut[type]    = Tparam.BreaksByCut;
            TileDef.breaksByWater[type]  = Tparam.BreaksByWater;
            TileDef.breaksByLava[type]   = Tparam.BreaksByLava;

            TileDef.table[type]       = Tparam.Table;
            TileDef.rope[type]        = Tparam.Rope;
            TileDef.noAttach[type]    = Tparam.NoAttach;
            TileDef.tileDungeon[type] = Tparam.Dungeon;

            TileDef.blocksLight[type]  = Tparam.BlocksAnyLight;
            TileDef.blocksSun[type]    = Tparam.BlocksSunlight;
            TileDef.glows[type]        = Tparam.Glows;
            TileDef.shines[type]       = Tparam.Shines;
            TileDef.shineChance[type]  = Tparam.ShineChance;
            TileDef.frame[type]        = Tparam.Frame;
            TileDef.frameCounter[type] = Tparam.FrameCounter;

            TileDef.brick[type]     = Tparam.Brick;
            TileDef.moss[type]      = Tparam.Moss;
            TileDef.stone[type]     = Tparam.Stone;
            TileDef.mergeDirt[type] = Tparam.Dirt;

            TileDef.tileSand[type]      = Tparam.Sand;
            TileDef.tileFlame[type]     = Tparam.Flame;
            TileDef.alchemyflower[type] = Tparam.AlchemyFlower;
        }
コード例 #2
0
ファイル: ObjectLoader.cs プロジェクト: jayands/tAPI-SDK
        /// <summary>
        /// Adds a Tile to the game
        /// </summary>
        /// <param name="Tparam">The Tile data to add to the game</param>
        /// <param name="param">Common object loading parameters</param>
        public static void AddToGame(TileParameters Tparam, LoadParameters param)
        {
            int type = Defs.tileNextType++;
            TileDef.ResizeTiles(Defs.tileNextType);

            if (!Main.dedServ)
                Main.tileTexture[type] = Tparam.Texture;

            if (!String.IsNullOrEmpty(param.SubClassTypeName))
            {
                TileDef.codeClass[type] = (ModTile)param.Assembly.CreateInstance(param.SubClassTypeName, false, BindingFlags.Public | BindingFlags.Instance, null,
                    new object[] { param.ModBase }, CultureInfo.CurrentCulture, new object[] { });

                if (TileDef.codeClass[type] != null)
                    Defs.FillCallPriorities(TileDef.codeClass[type].GetType());
            }

            TileDef.name[type] = param.ModBase.modName + ":" + param.Name;
            TileDef.displayName[type] = param.Name;

            TileDef.width[type] = Tparam.Width;
            TileDef.height[type] = Tparam.Height;
            TileDef.frameWidth[type] = Tparam.FrameWidth;
            TileDef.frameHeight[type] = Tparam.FrameHeight;
            TileDef.sheetColumns[type] = Tparam.SheetColumns;
            TileDef.sheetLines[type] = Tparam.SheetLines;

            TileDef.solid[type] = Tparam.Solid;
            TileDef.solidTop[type] = Tparam.SolidTop;
            TileDef.frameImportant[type] = Tparam.FrameImportant;

            TileDef.breaksFast[type] = Tparam.BreaksFast;
            TileDef.breaksByPick[type] = Tparam.BreaksByPic;
            TileDef.breaksByAxe[type] = Tparam.BreaksByAxe;
            TileDef.breaksByHammer[type] = Tparam.BreaksByHammer;
            TileDef.breaksByCut[type] = Tparam.BreaksByCut;
            TileDef.breaksByWater[type] = Tparam.BreaksByWater;
            TileDef.breaksByLava[type] = Tparam.BreaksByLava;

            TileDef.table[type] = Tparam.Table;
            TileDef.rope[type] = Tparam.Rope;
            TileDef.noAttach[type] = Tparam.NoAttach;
            TileDef.tileDungeon[type] = Tparam.Dungeon;

            TileDef.blocksLight[type] = Tparam.BlocksAnyLight;
            TileDef.blocksSun[type] = Tparam.BlocksSunlight;
            TileDef.glows[type] = Tparam.Glows;
            TileDef.shines[type] = Tparam.Shines;
            TileDef.shineChance[type] = Tparam.ShineChance;
            TileDef.frame[type] = Tparam.Frame;
            TileDef.frameCounter[type] = Tparam.FrameCounter;

            TileDef.brick[type] = Tparam.Brick;
            TileDef.moss[type] = Tparam.Moss;
            TileDef.stone[type] = Tparam.Stone;
            TileDef.mergeDirt[type] = Tparam.Dirt;

            TileDef.tileSand[type] = Tparam.Sand;
            TileDef.tileFlame[type] = Tparam.Flame;
            TileDef.alchemyflower[type] = Tparam.AlchemyFlower;
        }