本文整理匯總了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();
}
}
}