示例#1
0
        public override void MouseOver(int i, int j)
        {
            var tile = Main.tile[i, j];

            if (tile != null && tile.type == Type)
            {
                var frame = new MysteryTileFrame(tile.frameX, tile.frameY);
                var info  = ModContent.GetInstance <MysteryTilesWorld>().infos[frame.FrameID];

                if (info != null)
                {
                    Main.LocalPlayer.cursorItemIconEnabled = true;
                    Main.LocalPlayer.cursorItemIconID      = -1;
                    Main.LocalPlayer.cursorItemIconText    = $"{info.modName}: {info.name}";
                }
            }
        }
示例#2
0
        public override void MouseOver(int i, int j)
        {
            var tile = Main.tile[i, j];

            if (tile != null && tile.type == Type)
            {
                var frame   = new MysteryTileFrame(tile.frameX, tile.frameY);
                var infos   = ModContent.GetInstance <MysteryTilesWorld>().infos;
                int frameID = frame.FrameID;
                if (frameID >= 0 && frameID < infos.Count)                   // This only works in SP
                {
                    var info = infos[frameID];

                    if (info != null)
                    {
                        Main.LocalPlayer.showItemIcon     = true;
                        Main.LocalPlayer.showItemIcon2    = -1;
                        Main.LocalPlayer.showItemIconText = $"{info.modName}: {info.name}";
                    }
                }
            }
        }
示例#3
0
        internal static void ReadModTile(ref int i, ref int j, TileTables tables, BinaryReader reader, ref bool nextModTile)
        {
            byte flags;

            flags = reader.ReadByte();
            Tile tile = Main.tile[i, j];

            if ((flags & 1) == 1)
            {
                tile.active(true);
                ushort saveType = reader.ReadUInt16();
                tile.type = tables.tiles[saveType];
                if (tables.frameImportant[saveType])
                {
                    if ((flags & 2) == 2)
                    {
                        tile.frameX = reader.ReadInt16();
                    }
                    else
                    {
                        tile.frameX = reader.ReadByte();
                    }
                    if ((flags & 4) == 4)
                    {
                        tile.frameY = reader.ReadInt16();
                    }
                    else
                    {
                        tile.frameY = reader.ReadByte();
                    }
                }
                else
                {
                    tile.frameX = -1;
                    tile.frameY = -1;
                }
                if (tile.type == ModContent.GetInstance <ModLoaderMod>().TileType("PendingMysteryTile") &&
                    tables.tileNames.ContainsKey(saveType))
                {
                    MysteryTileInfo info;
                    if (tables.frameImportant[saveType])
                    {
                        info = new MysteryTileInfo(tables.tileModNames[saveType], tables.tileNames[saveType],
                                                   tile.frameX, tile.frameY);
                    }
                    else
                    {
                        info = new MysteryTileInfo(tables.tileModNames[saveType], tables.tileNames[saveType]);
                    }
                    MysteryTilesWorld modWorld = ModContent.GetInstance <MysteryTilesWorld>();
                    int pendingFrameID         = modWorld.pendingInfos.IndexOf(info);
                    if (pendingFrameID < 0)
                    {
                        pendingFrameID = modWorld.pendingInfos.Count;
                        modWorld.pendingInfos.Add(info);
                    }
                    MysteryTileFrame pendingFrame = new MysteryTileFrame(pendingFrameID);
                    tile.frameX = pendingFrame.FrameX;
                    tile.frameY = pendingFrame.FrameY;
                }
                if ((flags & 8) == 8)
                {
                    tile.color(reader.ReadByte());
                }
                WorldGen.tileCounts[tile.type] += j <= Main.worldSurface ? 5 : 1;
            }
            if ((flags & 16) == 16)
            {
                tile.wall = tables.walls[reader.ReadUInt16()];
                if ((flags & 32) == 32)
                {
                    tile.wallColor(reader.ReadByte());
                }
            }
            if ((flags & 64) == 64)
            {
                byte sameCount = reader.ReadByte();
                for (byte k = 0; k < sameCount; k++)
                {
                    NextTile(ref i, ref j);
                    Main.tile[i, j].CopyFrom(tile);
                    WorldGen.tileCounts[tile.type] += j <= Main.worldSurface ? 5 : 1;
                }
            }
            if ((flags & 128) == 128)
            {
                nextModTile = true;
            }
        }