public override void Load() { { InvasionHandler.AddInvasion(out SpiritMod.customEvent, new InvasionInfo(customEventName, "The depths are stirring!", "The Tide has waned!", delegate() { int amountOfPlayers = 0; int maxAmountOfPlayers = 6; for (int i = 0; i < 255; ++i) { if (Main.player[i].active && Main.player[i].statLifeMax >= 400) { amountOfPlayers++; if (amountOfPlayers == maxAmountOfPlayers) { break; } } } if (amountOfPlayers > 0) { InvasionWorld.invasionSize = 120 + (30 * amountOfPlayers); InvasionWorld.invasionX = Main.spawnTileX; } return(false); })); } SpecialKey = RegisterHotKey("Cosmic Wrath", "G"); GoreKey = RegisterHotKey("Ichor Rage", "T"); IchorKey = RegisterHotKey("Ichor Guard", "C"); WraithKey = RegisterHotKey("Wraith", "E"); HolyKey = RegisterHotKey("Holy Ward", "U"); DepthKey = RegisterHotKey("Shark Attack", "D"); if (!Main.dedServ) { Filters.Scene["SpiritMod:Overseer"] = new Filter(new SeerScreenShaderData("FilterMiniTower").UseColor(0f, 0.3f, 1f).UseOpacity(0.75f), EffectPriority.VeryHigh); SkyManager.Instance["SpiritMod:Overseer"] = new SeerSky(); Filters.Scene["SpiritMod:IlluminantMaster"] = new Filter(new SeerScreenShaderData("FilterMiniTower").UseColor(1.2f, 0.1f, 1f).UseOpacity(0.75f), EffectPriority.VeryHigh); SkyManager.Instance["SpiritMod:IlluminantMasterr"] = new SeerSky(); Filters.Scene["SpiritMod:Atlas"] = new Filter(new AtlasScreenShaderData("FilterMiniTower").UseColor(0.5f, 0.5f, 0.5f).UseOpacity(0.6f), EffectPriority.VeryHigh); SkyManager.Instance["SpiritMod:Atlas"] = new AtlasSky(); } }
public override void LoadLegacy(BinaryReader reader) { string[] splitInvasionData = reader.ReadString().Split(':'); // Load values into InvasionWorld. invasionType = int.Parse(splitInvasionData[0]); invasionSizeStart = int.Parse(splitInvasionData[1]); invasionSize = int.Parse(splitInvasionData[2]); invasionX = int.Parse(splitInvasionData[3]); invasionProgress = int.Parse(splitInvasionData[4]); invasionProgressMax = int.Parse(splitInvasionData[5]); // Load values into InvasionHandler. InvasionHandler.currentInvasion = InvasionHandler.GetInvasionInfo(invasionType); loaded = false; }
public override void PostDrawInterface(SpriteBatch spriteBatch) { if (InvasionWorld.invasionType <= 0 || InvasionWorld.invasionProgress == -1) { return; } if (InvasionHandler.currentInvasion == null || InvasionHandler.currentInvasion != InvasionHandler.GetInvasionInfo(InvasionWorld.invasionType)) { InvasionHandler.currentInvasion = InvasionHandler.GetInvasionInfo(InvasionWorld.invasionType); if (Main.netMode == 0) { Main.NewText(InvasionHandler.currentInvasion.beginMessage, 175, 75, 255, false); return; } if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, InvasionHandler.currentInvasion.beginMessage, 255, 175f, 75f, 255f, 0, 0, 0); } } if (!Main.gamePaused && InvasionHandler.invasionProgressDisplayLeft > 0) { InvasionHandler.invasionProgressDisplayLeft--; } if (InvasionHandler.invasionProgressDisplayLeft > 0) { InvasionHandler.invasionProgressAlpha += 0.05f; } else { InvasionHandler.invasionProgressAlpha -= 0.05f; } if (InvasionHandler.invasionProgressAlpha < 0f) { InvasionHandler.invasionProgressAlpha = 0f; } if (InvasionHandler.invasionProgressAlpha > 1f) { InvasionHandler.invasionProgressAlpha = 1f; } if (InvasionHandler.invasionProgressAlpha > 0) { float num = 0.5f + InvasionHandler.invasionProgressAlpha * 0.5f; string text = InvasionHandler.currentInvasion.name; Color c = new Color(64, 109, 164) * 0.5f; int num7 = (int)(200f * num); int num8 = (int)(45f * num); Vector2 vector3 = new Vector2((float)(Main.screenWidth - 120), (float)(Main.screenHeight - 40)); Rectangle r2 = new Rectangle((int)vector3.X - num7 / 2, (int)vector3.Y - num8 / 2, num7, num8); Utils.DrawInvBG(spriteBatch, r2, new Color(63, 65, 151, 255) * 0.785f); string text3; if (InvasionWorld.invasionProgressMax == 0) { text3 = InvasionWorld.invasionProgress.ToString(); } else { text3 = ((int)((float)InvasionWorld.invasionProgress * 100f / (float)InvasionWorld.invasionProgressMax)).ToString() + "%"; } text3 = "Cleared " + text3; Texture2D texture2D4 = Main.colorBarTexture; Texture2D texture2D5 = Main.colorBlipTexture; if (InvasionWorld.invasionProgressMax != 0) { spriteBatch.Draw(texture2D4, vector3, null, Color.White * InvasionHandler.invasionProgressAlpha, 0f, new Vector2((float)(texture2D4.Width / 2), 0f), num, SpriteEffects.None, 0f); float num9 = MathHelper.Clamp((float)InvasionWorld.invasionProgress / (float)InvasionWorld.invasionProgressMax, 0f, 1f); float num10 = 169f * num; float num11 = 8f * num; Vector2 vector4 = vector3 + Vector2.UnitY * num11 + Vector2.UnitX * 1f; Utils.DrawBorderString(Main.spriteBatch, text3, vector4, Color.White * InvasionHandler.invasionProgressAlpha, num, 0.5f, 1f, -1); vector4 += Vector2.UnitX * (num9 - 0.5f) * num10; spriteBatch.Draw(Main.magicPixel, vector4, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * InvasionHandler.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(num10 * num9, num11), SpriteEffects.None, 0f); spriteBatch.Draw(Main.magicPixel, vector4, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * InvasionHandler.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, num11), SpriteEffects.None, 0f); spriteBatch.Draw(Main.magicPixel, vector4, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * InvasionHandler.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(num10 * (1f - num9), num11), SpriteEffects.None, 0f); } Vector2 center = new Vector2((Main.screenWidth - 120), (Main.screenHeight - 80)); Vector2 value = Main.fontItemStack.MeasureString(text); Rectangle r3 = Utils.CenteredRectangle(center, (value + new Vector2((float)(20), 10f)) * num); Utils.DrawInvBG(Main.spriteBatch, r3, c); Utils.DrawBorderString(spriteBatch, text, r3.Right() + Vector2.UnitX * num * -8f, Color.White * InvasionHandler.invasionProgressAlpha, num * 0.9f, 1f, 0.4f, -1); } }