本文整理汇总了C#中TEditXNA.Terraria.World.FixChand方法的典型用法代码示例。如果您正苦于以下问题:C# World.FixChand方法的具体用法?C# World.FixChand怎么用?C# World.FixChand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEditXNA.Terraria.World
的用法示例。
在下文中一共展示了World.FixChand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadWorld
//.........这里部分代码省略.........
{
OnProgressChanged(null, new ProgressChangedEventArgs(x.ProgressPercentage(w.TilesWide), "Loading Tiles..."));
for (int y = 0; y < w.TilesHigh; y++)
{
var tile = ReadTileDataFromStream(b, version);
// read complete, start compression
w.Tiles[x, y] = tile;
if (version >= 25)
{
int rle = b.ReadInt16();
if (rle < 0)
throw new ApplicationException("Invalid Tile Data!");
if (rle > 0)
{
for (int k = y + 1; k < y + rle + 1; k++)
{
var tcopy = (Tile)tile.Clone();
w.Tiles[x, k] = tcopy;
}
y = y + rle;
}
}
}
}
if (version < 67)
w.FixSunflowers();
if (version < 72)
w.FixChand();
OnProgressChanged(null, new ProgressChangedEventArgs(100, "Loading Chests..."));
w.Chests.Clear();
w.Chests.AddRange(ReadChestDataFromStream(b, version));
OnProgressChanged(null, new ProgressChangedEventArgs(100, "Loading Signs..."));
w.Signs.Clear();
foreach (var sign in ReadSignDataFromStream(b))
{
if (w.Tiles[sign.X, sign.Y].IsActive && ((int)w.Tiles[sign.X, sign.Y].Type == 55 || (int)w.Tiles[sign.X, sign.Y].Type == 85))
w.Signs.Add(sign);
}
w.NPCs.Clear();
OnProgressChanged(null, new ProgressChangedEventArgs(100, "Loading NPC Data..."));
while (b.ReadBoolean())
{
var npc = new NPC();
npc.Name = b.ReadString();
npc.Position = new Vector2(b.ReadSingle(), b.ReadSingle());
npc.IsHomeless = b.ReadBoolean();
npc.Home = new Vector2Int32(b.ReadInt32(), b.ReadInt32());
npc.SpriteId = 0;
if (NpcIds.ContainsKey(npc.Name))
npc.SpriteId = NpcIds[npc.Name];
w.NPCs.Add(npc);
}
// if (version>=0x1f) read the names of the following npcs:
// merchant, nurse, arms dealer, dryad, guide, clothier, demolitionist,
// tinkerer and wizard
示例2: LoadV1
//.........这里部分代码省略.........
OnProgressChanged(null,
new ProgressChangedEventArgs(x.ProgressPercentage(w.TilesWide), "Loading UndoTiles..."));
for (int y = 0; y < w.TilesHigh; y++)
{
Tile tile = ReadTileDataFromStreamV1(reader, version);
// read complete, start compression
w.Tiles[x, y] = tile;
if (version >= 25)
{
int rle = reader.ReadInt16();
if (rle < 0)
throw new ApplicationException("Invalid Tile Data!");
if (rle > 0)
{
for (int k = y + 1; k < y + rle + 1; k++)
{
var tcopy = (Tile) tile.Clone();
w.Tiles[x, k] = tcopy;
}
y = y + rle;
}
}
}
}
if (version < 67)
w.FixSunflowers();
if (version < 72)
w.FixChand();
OnProgressChanged(null, new ProgressChangedEventArgs(100, "Loading Chests..."));
w.Chests.Clear();
((ObservableCollection<Chest>)w.Chests).AddRange(ReadChestDataFromStreamV1(reader, version));
OnProgressChanged(null, new ProgressChangedEventArgs(100, "Loading Signs..."));
w.Signs.Clear();
foreach (Sign sign in ReadSignDataFromStreamV1(reader))
{
if (w.Tiles[sign.X, sign.Y].IsActive && Tile.IsSign(w.Tiles[sign.X, sign.Y].Type))
{
w.Signs.Add(sign);
}
}
w.NPCs.Clear();
OnProgressChanged(null, new ProgressChangedEventArgs(100, "Loading NPC Data..."));
while (reader.ReadBoolean())
{
var npc = new NPC();
npc.Name = reader.ReadString();
npc.Position = new Vector2(reader.ReadSingle(), reader.ReadSingle());
npc.IsHomeless = reader.ReadBoolean();
npc.Home = new Vector2Int32(reader.ReadInt32(), reader.ReadInt32());
npc.SpriteId = 0;
if (NpcIds.ContainsKey(npc.Name))
npc.SpriteId = NpcIds[npc.Name];
w.NPCs.Add(npc);
}
// if (version>=0x1f) read the names of the following npcs: