本文整理汇总了C#中Terraria_Server.Logging.ProgressLogger类的典型用法代码示例。如果您正苦于以下问题:C# ProgressLogger类的具体用法?C# ProgressLogger怎么用?C# ProgressLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressLogger类属于Terraria_Server.Logging命名空间,在下文中一共展示了ProgressLogger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: initBList
//pre-blends colors when loading plugin so making the image is faster
public void initBList()
{
//adds all the colors for walls/tiles/global
UInt32 waterColor = 0x093DBF;
UInt32 lavaColor = 0xFD2003;
//blends water and lava with UInt32Defs
using (var blendprog = new ProgressLogger(Main.maxTilesX - 1, "[map] Blending colors"))
for (int y = 0; y <= Main.maxTilesY + 331; y++)
{
if (UInt32Defs.ContainsKey(y))
{
UInt32 c = UInt32Defs[y];
//initialize DimColorDefs and DimUInt32Defs first
UInt32 dimblend = dimI(c);
Color dimresult = dimC(c);
DimUInt32Defs[y] = dimblend;
DimColorDefs[y] = dimresult;
UInt32 d = DimUInt32Defs[y];
blendprog.Value = y;
doBlendResult(c, waterColor, lavaColor, "regular");
doBlendResult(d, waterColor, lavaColor, "dim");
}
}
}
开发者ID:Enerdy,项目名称:TDSM_map,代码行数:28,代码来源:MapPlugin_Mapper2.cs
示例2: HideWaterTreasure
public static void HideWaterTreasure(Func<Int32, Int32, ITile> TileRefs)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
//Water Treasure
float num235 = (float)(Main.maxTilesX / 4200);
int num236 = 0;
int num237 = 0;
using (var prog = new ProgressLogger(100, Languages.Generation_HidingWaterTreasure))
{
while ((float)num237 < 10f * num235)
{
int contain2 = 0;
num236++;
if (num236 == 1)
{
contain2 = 186;
}
else if (num236 == 2)
{
contain2 = 277;
}
else
{
contain2 = 187;
num236 = 0;
}
bool flag16 = false;
while (!flag16)
{
int num238 = WorldModify.genRand.Next(1, Main.maxTilesX);
int num239 = WorldModify.genRand.Next(1, Main.maxTilesY - 200);
while (TileRefs(num238, num239).Liquid < 200 || TileRefs(num238, num239).Lava)
{
num238 = WorldModify.genRand.Next(1, Main.maxTilesX);
num239 = WorldModify.genRand.Next(1, Main.maxTilesY - 200);
}
flag16 = AddBuriedChest(TileRefs, num238, num239, contain2, true);
}
num237++;
}
}
}
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:44,代码来源:WorldGen.cs
示例3: EveryTileFrame
public static void EveryTileFrame()
{
using (var prog = new ProgressLogger (Main.maxTilesX, "Finding tile frames"))
{
WorldModify.noLiquidCheck = true;
WorldModify.noTileActions = true;
for (int i = 0; i < Main.maxTilesX; i++)
{
prog.Value = i;
for (int j = 0; j < Main.maxTilesY; j++)
{
WorldModify.TileFrame(i, j, true, false);
}
}
WorldModify.noLiquidCheck = false;
WorldModify.noTileActions = false;
}
}
开发者ID:Dyrian,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:19,代码来源:WorldModify.cs
示例4: AddProgressLogger
public static void AddProgressLogger(ProgressLogger prog)
{
Write (new LogEntry (prog, null));
}
开发者ID:CaptainMuscles,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:4,代码来源:ProgramLog.cs
示例5: clearWorld
public static void clearWorld()
{
Main.trashItem = new Item();
WorldModify.spawnEye = false;
WorldModify.spawnNPC = 0;
WorldModify.shadowOrbCount = 0;
Main.helpText = 0;
Main.dungeonX = 0;
Main.dungeonY = 0;
NPC.downedBoss1 = false;
NPC.downedBoss2 = false;
NPC.downedBoss3 = false;
WorldModify.shadowOrbSmashed = false;
WorldModify.spawnMeteor = false;
WorldModify.stopDrops = false;
Main.invasionDelay = 0;
Main.invasionType = 0;
Main.invasionSize = 0;
Main.invasionWarn = 0;
Main.invasionX = 0.0;
WorldModify.noLiquidCheck = false;
Liquid.numLiquid = 0;
LiquidBuffer.numLiquidBuffer = 0;
if (WorldModify.lastMaxTilesX > Main.maxTilesX || WorldModify.lastMaxTilesY > Main.maxTilesY)
{
using (var prog = new ProgressLogger(WorldModify.lastMaxTilesX - 1, "Freeing unused resources"))
for (int i = 0; i < WorldModify.lastMaxTilesX; i++)
{
prog.Value = i;
for (int j = 0; j < WorldModify.lastMaxTilesY; j++)
{
Main.tile.CreateTileAt(i, j);
}
}
}
WorldModify.lastMaxTilesX = Main.maxTilesX;
WorldModify.lastMaxTilesY = Main.maxTilesY;
Server.tile = new TileCollection(Main.maxTilesX, Main.maxTilesY);
using (var prog = new ProgressLogger(Main.maxTilesX - 1, "Resetting game objects"))
for (int k = 0; k < Main.maxTilesX; k++)
{
prog.Value = k;
for (int l = 0; l < Main.maxTilesY; l++)
{
Main.tile.CreateTileAt(k, l);
}
}
for (int num3 = 0; num3 < 200; num3++)
{
Main.item[num3] = new Item();
}
for (int num4 = 0; num4 < 1000; num4++)
{
Main.npcs[num4] = new NPC();
}
for (int num5 = 0; num5 < 1000; num5++)
{
Main.projectile[num5] = new Projectile();
}
for (int num6 = 0; num6 < 1000; num6++)
{
Main.chest[num6] = null;
}
for (int num7 = 0; num7 < 1000; num7++)
{
Main.sign[num7] = null;
}
for (int num8 = 0; num8 < Liquid.resLiquid; num8++)
{
Main.liquid[num8] = new Liquid();
}
for (int num9 = 0; num9 < 10000; num9++)
{
Main.liquidBuffer[num9] = new LiquidBuffer();
}
setWorldSize();
worldCleared = true;
}
开发者ID:CaptainMuscles,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:82,代码来源:WorldIO.cs
示例6: Main
//.........这里部分代码省略.........
ProgramLog.Log ("PID File Created, Process ID: " + ProcessUID);
}
}
ParseArgs(args);
try
{
if (UpdateManager.performProcess())
{
ProgramLog.Log ("Restarting into new update!");
return;
}
}
catch (UpdateCompleted)
{
throw;
}
catch (Exception e)
{
ProgramLog.Log (e, "Error updating");
}
LoadMonitor.Start ();
ProgramLog.Log ("Starting remote console server");
RemoteConsole.RConServer.Start ("rcon_logins.properties");
ProgramLog.Log("Starting permissions manager");
permissionManager = new PermissionManager();
ProgramLog.Log ("Preparing Server Data...");
using (var prog = new ProgressLogger (1, "Loading item definitions"))
Collections.Registries.Item.Load ();
using (var prog = new ProgressLogger (1, "Loading NPC definitions"))
Collections.Registries.NPC.Load (Collections.Registries.NPC_FILE);
using (var prog = new ProgressLogger (1, "Loading projectile definitions"))
Collections.Registries.Projectile.Load (Collections.Registries.PROJECTILE_FILE);
commandParser = new CommandParser();
commandParser.ReadPermissionNodes();
ProgramLog.Log("Loading plugins...");
Terraria_Server.Plugins.PluginManager.Initialize(Statics.PluginPath, Statics.LibrariesPath);
var ctx = new HookContext()
{
Sender = new ConsoleSender()
};
var eArgs = new HookArgs.ServerStateChange()
{
ServerChangeState = ServerState.INITIALIZING
};
HookPoints.ServerStateChange.Invoke(ref ctx, ref eArgs);
PluginManager.LoadPlugins ();
ProgramLog.Log("Plugins loaded: " + PluginManager.PluginCount);
string worldFile = properties.WorldPath;
FileInfo file = new FileInfo(worldFile);
if (!file.Exists)
{
try
开发者ID:rakiru,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:67,代码来源:Program.cs
示例7: EveryTileFrame
public static void EveryTileFrame(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
using (var prog = new ProgressLogger(Main.maxTilesX, "Finding tile frames"))
{
noLiquidCheck = true;
noTileActions = true;
for (int i = 0; i < Main.maxTilesX; i++)
{
prog.Value = i;
for (int j = 0; j < Main.maxTilesY; j++)
{
if (TileRefs(i, j).Active)
{
TileFrame(TileRefs, sandbox, i, j, true, false);
}
if (TileRefs(i, j).Wall > 0)
{
WallFrame(TileRefs, i, j, true);
}
}
}
noLiquidCheck = false;
noTileActions = false;
}
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:29,代码来源:WorldModify.cs
示例8: clearWorld
public static void clearWorld()
{
Statics.WorldLoaded = false;
Main.trashItem = new Item();
WorldModify.spawnEye = false;
WorldModify.spawnNPC = 0;
WorldModify.shadowOrbCount = 0;
Main.helpText = 0;
Main.dungeonX = 0;
Main.dungeonY = 0;
NPC.downedBoss1 = false;
NPC.downedBoss2 = false;
NPC.downedBoss3 = false;
WorldModify.shadowOrbSmashed = false;
WorldModify.spawnMeteor = false;
WorldModify.stopDrops = false;
Main.invasionDelay = 0;
Main.invasionType = 0;
Main.invasionSize = 0;
Main.invasionWarn = 0;
Main.invasionX = 0.0;
WorldModify.noLiquidCheck = false;
Liquid.numLiquid = 0;
LiquidBuffer.numLiquidBuffer = 0;
// if (WorldModify.lastMaxTilesX > Main.maxTilesX || WorldModify.lastMaxTilesY > Main.maxTilesY)
// {
// using (var prog = new ProgressLogger(WorldModify.lastMaxTilesX - 1, "Freeing unused resources"))
// for (int i = 0; i < WorldModify.lastMaxTilesX; i++)
// {
// prog.Value = i;
// for (int j = 0; j < WorldModify.lastMaxTilesY; j++)
// {
// Main.tile.CreateTileAt(i, j);
// }
// }
// }
WorldModify.lastMaxTilesX = Main.maxTilesX;
WorldModify.lastMaxTilesY = Main.maxTilesY;
if (Main.tile == null || Main.tile.SizeX != Main.maxTilesX || Main.tile.SizeY != Main.maxTilesY)
{
Main.tile = null;
GC.Collect ();
Main.tile = new TileCollection(Main.maxTilesX, Main.maxTilesY);
}
else
{
using (var prog = new ProgressLogger(Main.maxTilesX - 1, "Clearing world tiles"))
for (int k = 0; k < Main.maxTilesX; k++)
{
prog.Value = k;
for (int l = 0; l < Main.maxTilesY; l++)
{
Main.tile.CreateTileAt(k, l);
// for testing
// if ((l == 25 || l == 26) && k > 4000 && k < 5000)
// {
// Main.tile.At(k, l).SetLiquid (250);
// Liquid.AddWater (k, l);
// }
}
}
}
using (var prog = new ProgressLogger(12212 + Liquid.resLiquid - 1, "Resetting game objects"))
{
for (int num3 = 0; num3 < 200; num3++)
{
Main.item[num3] = null;
}
prog.Value++;
for (int num4 = 0; num4 < 1000; num4++)
{
Main.npcs[num4] = null;
Main.projectile[num4] = null;
Main.chest[num4] = null;
Main.sign[num4] = null;
}
prog.Value++;
// for (int num8 = 0; num8 < Liquid.resLiquid; num8++)
// {
// Main.liquid[num8] = null;
// }
// prog.Value++;
// for (int num9 = 0; num9 < 10000; num9++)
// {
// Main.liquidBuffer[num9] = null;
// }
// prog.Value += 10;
GC.Collect ();
prog.Value += 10;
for (int num3 = 0; num3 < 200; num3++)
{
//.........这里部分代码省略.........
开发者ID:rakiru,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:101,代码来源:WorldIO.cs
示例9: PlaceHellforges
public static void PlaceHellforges(Func<Int32, Int32, ITile> TileRefs)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
var max = Main.maxTilesX / 200;
using (var prog = new ProgressLogger(max - 1, Languages.Generation_PlacingHellForges))
{
for (int num294 = 0; num294 < Main.maxTilesX / 200; num294++)
{
float num295 = (float)(num294 / (Main.maxTilesX / 200));
bool flag21 = false;
int num296 = 0;
while (!flag21)
{
int num297 = WorldModify.genRand.Next(1, Main.maxTilesX);
int num298 = WorldModify.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 5);
try
{
if (TileRefs(num297, num298).Wall != 13 && TileRefs(num297, num298).Wall != 14)
continue;
while (!TileRefs(num297, num298).Active)
num298++;
num298--;
WorldModify.PlaceTile(TileRefs, null, num297, num298, 77, false, false, -1, 0);
if (TileRefs(num297, num298).Type == 77)
flag21 = true;
else
{
num296++;
if (num296 >= 10000)
flag21 = true;
}
}
catch
{ }
}
}
prog.Value++;
}
}
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:43,代码来源:WorldGen.cs
示例10: PlaceBreakables
public static void PlaceBreakables(Func<Int32, Int32, ITile> TileRefs)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
var num241max = (int)((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008);
using (var prog = new ProgressLogger(num241max - 1, Languages.Generation_PlacingBreakables))
{
for (int num241 = 0; num241 < num241max; num241++)
{
float num242 = (float)((double)num241 / ((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008));
prog.Value = num241;
bool flag17 = false;
int num243 = 0;
while (!flag17)
{
int num244 = WorldModify.genRand.Next((int)worldSurface, Main.maxTilesY - 10);
if ((double)num242 > 0.93)
{
num244 = Main.maxTilesY - 150;
}
else if ((double)num242 > 0.75)
{
num244 = (int)terrarainMaxY;
}
int num245 = WorldModify.genRand.Next(1, Main.maxTilesX);
bool flag18 = false;
for (int num246 = num244; num246 < Main.maxTilesY; num246++)
{
if (!flag18)
{
if (TileRefs(num245, num246).Active && Main.tileSolid[(int)TileRefs(num245, num246).Type] && !TileRefs(num245, num246 - 1).Lava)
{
flag18 = true;
}
}
else
{
if (WorldModify.PlacePot(TileRefs, num245, num246, 28))
{
flag17 = true;
break;
}
num243++;
if (num243 >= 10000)
{
flag17 = true;
break;
}
}
}
}
}
} // end breakables
}
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:57,代码来源:WorldGen.cs
示例11: AddClay
public static void AddClay(Func<Int32, Int32, ITile> TileRefs)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
var Max = (int)((double)(Main.maxTilesX * Main.maxTilesY) * 2E-05);
var Max2 = (int)((double)(Main.maxTilesX * Main.maxTilesY) * 5E-05);
var Max3 = (int)((double)(Main.maxTilesX * Main.maxTilesY) * 2E-05);
var Max4 = Main.maxTilesX - 5;
using (var clayProg = new ProgressLogger(Max + Max2 + Max3 + Max4, Languages.Generation_AddingClay))
{
for (int i = 0; i < Max; i++)
{
TileRunner(TileRefs, WorldModify.genRand.Next(0, Main.maxTilesX), WorldModify.genRand.Next(0, (int)terrarainMaxY), (double)WorldModify.genRand.Next(4, 14), WorldModify.genRand.Next(10, 50), 40, false, 0f, 0f, false, true);
clayProg.Value++;
}
for (int i = 0; i < Max2; i++)
{
TileRunner(TileRefs, WorldModify.genRand.Next(0, Main.maxTilesX), WorldModify.genRand.Next((int)terrarainMaxY, (int)worldSurface + 1), (double)WorldModify.genRand.Next(8, 14), WorldModify.genRand.Next(15, 45), 40, false, 0f, 0f, false, true);
clayProg.Value++;
}
for (int i = 0; i < Max3; i++)
{
TileRunner(TileRefs, WorldModify.genRand.Next(0, Main.maxTilesX), WorldModify.genRand.Next((int)worldSurface, (int)rockLayer + 1), (double)WorldModify.genRand.Next(8, 15), WorldModify.genRand.Next(5, 50), 40, false, 0f, 0f, false, true);
clayProg.Value++;
}
for (int posX = 5; posX < Max4; posX++)
{
int startY = 1;
while ((double)startY < Main.worldSurface - 1.0)
{
if (TileRefs(posX, startY).Active)
{
for (int posY = startY; posY < startY + 5; posY++)
{
if (TileRefs(posX, posY).Type == 40)
{
TileRefs(posX, posY).SetType(0);
}
}
break;
}
startY++;
}
clayProg.Value++;
}
}
}
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:48,代码来源:WorldGen.cs
示例12: PlaceAltars
public static void PlaceAltars(Func<Int32, Int32, ITile> TileRefs)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
var MaxAltar = (int)((double)(Main.maxTilesX * Main.maxTilesY) * 2E-05);
using (var prog = new ProgressLogger(MaxAltar - 1, Languages.Generation_PlacingAltars))
{
for (int i = 0; i < MaxAltar; i++)
{
prog.Value = i;
//bool flag11 = false;
int maxAltar = 0;
while (true)
{
int tileX = WorldModify.genRand.Next(1, Main.maxTilesX);
int tileY = (int)(worldSurface + 20.0);
WorldModify.Place3x2(TileRefs, tileX, tileY, 26);
if (TileRefs(tileX, tileY).Type == 26)
{
//flag11 = true;
break;
}
else
{
maxAltar++;
if (maxAltar >= 10000)
{
//flag11 = true;
break;
}
}
}
}
}
}
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:37,代码来源:WorldGen.cs
示例13: MakeWorldEvil
public static void MakeWorldEvil(Func<Int32, Int32, ITile> TileRefs)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
int evilSegment = 0;
using (var prog = new ProgressLogger(100, Languages.Generation_MakingTheWorldEvil))
{
while ((double)evilSegment < (double)Main.maxTilesX * 0.00045)
{
float num145 = (float)((double)evilSegment / ((double)Main.maxTilesX * 0.00045));
prog.Value = (int)(num145 * 100f);
bool flag8 = false;
int chasmX = 0;
int chasmStartX = 0;
int chasmEndX = 0;
while (!flag8)
{
int jungleLength = 0;
flag8 = true;
int MaxTileX_d2 = Main.maxTilesX / 2;
int cOutlier = 200;
chasmX = WorldModify.genRand.Next(320, Main.maxTilesX - 320);
chasmStartX = chasmX - WorldModify.genRand.Next(200) - 100;
chasmEndX = chasmX + WorldModify.genRand.Next(200) + 100;
if (chasmStartX < 285)
{
chasmStartX = 285;
}
if (chasmEndX > Main.maxTilesX - 285)
{
chasmEndX = Main.maxTilesX - 285;
}
if (chasmX > MaxTileX_d2 - cOutlier && chasmX < MaxTileX_d2 + cOutlier)
{
flag8 = false;
}
if (chasmStartX > MaxTileX_d2 - cOutlier && chasmStartX < MaxTileX_d2 + cOutlier)
{
flag8 = false;
}
if (chasmEndX > MaxTileX_d2 - cOutlier && chasmEndX < MaxTileX_d2 + cOutlier)
{
flag8 = false;
}
for (int tileX = chasmStartX; tileX < chasmEndX; tileX++)
{
for (int tileY = 0; tileY < (int)Main.worldSurface; tileY += 5)
{
if (TileRefs(tileX, tileY).Active && Main.tileDungeon[(int)TileRefs(tileX, tileY).Type])
{
flag8 = false;
break;
}
if (!flag8)
{
break;
}
}
}
if (jungleLength < 200 && JungleX > chasmStartX && JungleX < chasmEndX)
{
jungleLength++;
flag8 = false;
}
}
int tilePass = 0;
for (int tileX = chasmStartX; tileX < chasmEndX; tileX++)
{
if (tilePass > 0)
{
tilePass--;
}
if (tileX == chasmX || tilePass == 0)
{
int tileY = (int)terrarainMaxY;
while ((double)tileY < Main.worldSurface - 1.0)
{
if (TileRefs(tileX, tileY).Active || TileRefs(tileX, tileY).Wall > 0)
{
if (tileX == chasmX)
{
tilePass = 20;
ChasmRunner(TileRefs, tileX, tileY, WorldModify.genRand.Next(150) + 150, true);
}
if (WorldModify.genRand.Next(35) == 0 && tilePass == 0)
{
tilePass = 30;
ChasmRunner(TileRefs, tileX, tileY, WorldModify.genRand.Next(50) + 50, true);
}
break;
}
else
{
tileY++;
}
}
//.........这里部分代码省略.........
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:101,代码来源:WorldGen.cs
示例14: MakeRandomHoles
public static void MakeRandomHoles(Func<Int32, Int32, ITile> TileRefs)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
var MaxRandomHoles = (int)((double)(Main.maxTilesX * Main.maxTilesY) * 0.0015);
using (var prog = new ProgressLogger(MaxRandomHoles - 1, Languages.Generation_MakingRandomHoles))
{
for (int i = 0; i < MaxRandomHoles; i++)
{
prog.Value = i;
int type = -1;
if (WorldModify.genRand.Next(5) == 0)
{
type = -2;
}
TileRunner(TileRefs, WorldModify.genRand.Next(0, Main.maxTilesX), WorldModify.genRand.Next((int)worldSurface, Main.maxTilesY), (double)WorldModify.genRand.Next(2, 5), WorldModify.genRand.Next(2, 20), type, false, 0f, 0f, false, true);
TileRunner(TileRefs, WorldModify.genRand.Next(0, Main.maxTilesX), WorldModify.genRand.Next((int)worldSurface, Main.maxTilesY), (double)WorldModify.genRand.Next(8, 15), WorldModify.genRand.Next(7, 30), type, false, 0f, 0f, false, true);
}
}
}
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:23,代码来源:WorldGen.cs
示例15: MakeDungeon
public static void MakeDungeon(Func<Int32, Int32, ITile> TileRefs, int x, int y, int tileType = 41, int wallType = 7)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
using (var prog = new ProgressLogger(100, Languages.Generation_CreatingDungeons))
{
int num = WorldModify.genRand.Next(3);
int num2 = WorldModify.genRand.Next(3);
if (num == 1)
{
tileType = 43;
}
else if (num == 2)
{
tileType = 44;
}
if (num2 == 1)
{
wallType = 8;
}
else if (num2 == 2)
{
wallType = 9;
}
numDDoors = 0;
numDPlats = 0;
numDRooms = 0;
dungeonX = x;
dungeonY = y;
dMinX = x;
dMaxX = x;
dMinY = y;
dMaxY = y;
dxStrength1 = (double)WorldModify.genRand.Next(25, 30);
dyStrength1 = (double)WorldModify.genRand.Next(20, 25);
dxStrength2 = (double)WorldModify.genRand.Next(35, 50);
dyStrength2 = (double)WorldModify.genRand.Next(10, 15);
float num3 = (float)(Main.maxTilesX / 60);
num3 += (float)WorldModify.genRand.Next(0, (int)(num3 / 3f));
float num4 = num3;
int num5 = 5;
DungeonRoom(TileRefs, dungeonX, dungeonY, tileType, wallType);
while (num3 > 0f)
{
if (dungeonX < dMinX)
{
dMinX = dungeonX;
}
if (dungeonX > dMaxX)
{
dMaxX = dungeonX;
}
if (dungeonY > dMaxY)
{
dMaxY = dungeonY;
}
num3 -= 1f;
prog.Value = (int)((num4 - num3) / num4 * 60f);
if (num5 > 0)
{
num5--;
}
if (num5 == 0 & WorldModify.genRand.Next(3) == 0)
{
num5 = 5;
if (WorldModify.genRand.Next(2) == 0)
{
int num6 = dungeonX;
int num7 = dungeonY;
DungeonHalls(TileRefs, dungeonX, dungeonY, tileType, wallType, false);
if (WorldModify.genRand.Next(2) == 0)
{
DungeonHalls(TileRefs, dungeonX, dungeonY, tileType, wallType, false);
}
DungeonRoom(TileRefs, dungeonX, dungeonY, tileType, wallType);
dungeonX = num6;
dungeonY = num7;
}
else
{
DungeonRoom(TileRefs, dungeonX, dungeonY, tileType, wallType);
}
}
else
{
DungeonHalls(TileRefs, dungeonX, dungeonY, tileType, wallType, false);
}
}
DungeonRoom(TileRefs, dungeonX, dungeonY, tileType, wallType);
int num8 = dRoomX[0];
int num9 = dRoomY[0];
for (int i = 0; i < numDRooms; i++)
{
if (dRoomY[i] < num9)
{
num8 = dRoomX[i];
num9 = dRoomY[i];
//.........这里部分代码省略.........
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:101,代码来源:WorldGen.cs
示例16: LoadWorld
public static void LoadWorld(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, string LoadPath)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
Main.checkXmas();
using (FileStream fileStream = new FileStream(LoadPath, FileMode.Open))
{
using (BinaryReader binaryReader = new BinaryReader(fileStream))
{
try
{
WorldModify.loadFailed = false;
WorldModify.loadSuccess = false;
int Terraria_Release = binaryReader.ReadInt32();
if (Terraria_Release > Statics.CURRENT_TERRARIA_RELEASE)
{
WorldModify.loadFailed = true;
WorldModify.loadSuccess = false;
try
{
binaryReader.Close();
fileStream.Close();
}
catch
{
}
}
else
{
Main.worldName = binaryReader.ReadString();
Main.worldID = binaryReader.ReadInt32();
Main.leftWorld = (float)binaryReader.ReadInt32();
Main.rightWorld = (float)binaryReader.ReadInt32();
Main.topWorld = (float)binaryReader.ReadInt32();
Main.bottomWorld = (float)binaryReader.ReadInt32();
Main.maxTilesY = binaryReader.ReadInt32();
Main.maxTilesX = binaryReader.ReadInt32();
Main.maxSectionsX = Main.maxTilesX / 200;
Main.maxSectionsY = Main.maxTilesY / 150;
ClearWorld();
Main.spawnTileX = binaryReader.ReadInt32();
Main.spawnTileY = binaryReader.ReadInt32();
Main.worldSurface = binaryReader.ReadDouble();
Main.rockLayer = binaryReader.ReadDouble();
tempTime = binaryReader.ReadDouble();
tempDayTime = binaryReader.ReadBoolean();
tempMoonPhase = binaryReader.ReadInt32();
tempBloodMoon = binaryReader.ReadBoolean();
Main.dungeonX = binaryReader.ReadInt32();
Main.dungeonY = binaryReader.ReadInt32();
NPC.downedBoss1 = binaryReader.ReadBoolean();
NPC.downedBoss2 = binaryReader.ReadBoolean();
NPC.downedBoss3 = binaryReader.ReadBoolean();
if (Terraria_Release >= 29)
{
NPC.savedGoblin = binaryReader.ReadBoolean();
NPC.savedWizard = binaryReader.ReadBoolean();
if (Terraria_Release >= 34)
{
NPC.savedMech = binaryReader.ReadBoolean();
}
NPC.downedGoblins = binaryReader.ReadBoolean();
}
if (Terraria_Release >= 32)
{
NPC.downedClown = binaryReader.ReadBoolean();
}
if (Terraria_Release >= 37)
{
NPC.downedFrost = binaryReader.ReadBoolean();
}
WorldModify.shadowOrbSmashed = binaryReader.ReadBoolean();
WorldModify.spawnMeteor = binaryReader.ReadBoolean();
WorldModify.shadowOrbCount = (int)binaryReader.ReadByte();
if (Terraria_Release >= 23)
{
WorldModify.altarCount = binaryReader.ReadInt32();
Main.hardMode = binaryReader.ReadBoolean();
}
Main.invasionDelay = binaryReader.ReadInt32();
Main.invasionSize = binaryReader.ReadInt32();
Main.invasionType = (InvasionType)binaryReader.ReadInt32();
Main.invasionX = binaryReader.ReadDouble();
using (var prog = new ProgressLogger(Main.maxTilesX - 1, Languages.LoadingWorldTiles))
{
for (int j = 0; j < Main.maxTilesX; j++)
{
prog.Value = j;
for (int k = 0; k < Main.maxTilesY; k++)
{
Main.tile.At(j, k).SetActive(binaryReader.ReadBoolean());
if (Main.tile.At(j, k).Active)
{
Main.tile.At(j, k).SetType(binaryReader.ReadByte());
if (Main.tile.At(j, k).Type == 127)
//.........这里部分代码省略.........
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:101,代码来源:WorldIO.cs
示例17: SaveWorld
public static bool SaveWorld(string savePath, bool resetTime = false)
{
bool success = true;
if (savePath == null || WorldModify.saveLock)
return false;
try
{
WorldModify.saveLock = true;
//while (WorldIO.hardLock)
//{
// WorldModify.statusText = "Setting hard mode...";
// Thread.Sleep(100);
//}
lock (padlock)
{
bool value = Main.dayTime;
tempTime = Main.Time;
tempMoonPhase = Main.moonPhase;
tempBloodMoon = Main.bloodMoon;
if (resetTime)
{
value = true;
tempTime = 13500.0;
tempMoonPhase = 0;
tempBloodMoon = false;
}
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
string tempPath = savePath + ".sav";
using (FileStream fileStream = new FileStream(tempPath, FileMode.Create))
{
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
binaryWriter.Write(Statics.CURRENT_TERRARIA_RELEASE);
binaryWriter.Write(Main.worldName);
binaryWriter.Write(Main.worldID);
binaryWriter.Write((int)Main.leftWorld);
binaryWriter.Write((int)Main.rightWorld);
binaryWriter.Write((int)Main.topWorld);
binaryWriter.Write((int)Main.bottomWorld);
binaryWriter.Write(Main.maxTilesY);
binaryWriter.Write(Main.maxTilesX);
binaryWriter.Write(Main.spawnTileX);
binaryWriter.Write(Main.spawnTileY);
binaryWriter.Write(Main.worldSurface);
binaryWriter.Write(Main.rockLayer);
binaryWriter.Write(tempTime);
binaryWriter.Write(value);
bin
|
请发表评论