本文整理汇总了C#中TEditXNA.Terraria.World.FixSunflowers方法的典型用法代码示例。如果您正苦于以下问题:C# World.FixSunflowers方法的具体用法?C# World.FixSunflowers怎么用?C# World.FixSunflowers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEditXNA.Terraria.World
的用法示例。
在下文中一共展示了World.FixSunflowers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadV1
//.........这里部分代码省略.........
for (int x = 0; x < w.TilesWide; ++x)
{
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);
示例2: LoadWorld
//.........这里部分代码省略.........
for (int x = 0; x < w.TilesWide; ++x)
{
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:
示例3: LoadWorld
//.........这里部分代码省略.........
}
}
if (w.Version >= 42)
{
tile.Actuator = b.ReadBoolean();
tile.InActive = b.ReadBoolean();
}
// read complete, start compression
w.Tiles[x, y] = tile;
if (w.Version >= 25)
{
int rle = b.ReadInt16();
if (rle < 0)
throw new ApplicationException("Invalid Tile Data!");
DebugLog(string.Format("RLE {0}", rle));
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 (w.Version < 67)
w.FixSunflowers();
int chestSize = Chest.MaxItems;
if (w.Version < 58)
chestSize = 20;
w.Chests.Clear();
OnProgressChanged(null, new ProgressChangedEventArgs(100, "Loading Chests..."));
for (int i = 0; i < 1000; i++)
{
if (b.ReadBoolean())
{
var chest = new Chest(b.ReadInt32(), b.ReadInt32());
for (int slot = 0; slot < Chest.MaxItems; slot++)
{
if (slot < chestSize)
{
int stackSize = w.Version < 59 ? b.ReadByte() : (int)b.ReadInt16();
chest.Items[slot].StackSize = stackSize;
if (chest.Items[slot].StackSize > 0)
{
if (w.Version >= 38)
chest.Items[slot].NetId = b.ReadInt32();
else
chest.Items[slot].SetFromName(b.ReadString());
chest.Items[slot].StackSize = stackSize;
// Read prefix
if (w.Version >= 36)
chest.Items[slot].Prefix = b.ReadByte();
}
}
}