public virtual void drawTarget(string typeName = "app:") { if (bounds.Height <= 14) { return; } var text = "IP: " + targetIP; var destinationRectangle = bounds; destinationRectangle.Height = Math.Min(bounds.Height, 14); ++destinationRectangle.X; destinationRectangle.Width -= 2; spriteBatch.Draw(Utils.white, destinationRectangle, os.exeModuleTopBar); RenderedRectangle.doRectangleOutline(destinationRectangle.X, destinationRectangle.Y, destinationRectangle.Width, destinationRectangle.Height, 1, os.topBarColor); if (destinationRectangle.Height < 14) { return; } var vector2 = GuiData.detailfont.MeasureString(text); spriteBatch.DrawString(GuiData.detailfont, text, new Vector2(bounds.X + bounds.Width - vector2.X, bounds.Y), os.exeModuleTitleText); spriteBatch.DrawString(GuiData.detailfont, typeName + IdentifierName, new Vector2(bounds.X + 2, bounds.Y), os.exeModuleTitleText); }
private void DrawAssignmentPhase(float t) { Utils.FillEverywhereExcept(Utils.InsetRectangle(this.os.terminal.Bounds, 1), Utils.GetFullscreen(), this.spriteBatch, Color.Black * 0.8f); float num1 = Utils.CubicInCurve((float)(1.0 - (double)Math.Min(2f, this.TimeInThisState / 2f) / 2.0)); Rectangle rectangle = Utils.InsetRectangle(this.os.terminal.bounds, (int)(-1.0 * 200.0 * (double)num1)); float num2 = 1f - num1; if ((double)num2 >= 0.800000011920929) { num2 = (float)((1.0 - ((double)num2 - 0.800000011920929) * 5.0) * 0.800000011920929); } RenderedRectangle.doRectangleOutline(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, (int)(60.0 * (0.0599999986588955 + (double)num1)), new Color?(this.os.highlightColor * num2)); string wholeText = this.AssignmentsCompleteText; if (!this.AllAssignmentsComplete) { wholeText = this.IsOnAssignment1 ? this.Assignment1Text : this.Assignment2Text; } this.charsRenderedSoFar = TextWriterTimed.WriteTextToTerminal(wholeText, (object)this.os, 0.04f, 1f, 20f, this.TimeInThisState, this.charsRenderedSoFar); if (this.charsRenderedSoFar < wholeText.Length) { return; } this.StartAssignment(); }
public virtual void drawOutline() { Rectangle bounds = this.bounds; RenderedRectangle.doRectangleOutline(bounds.X, bounds.Y, bounds.Width, bounds.Height, 1, new Color?(this.os.moduleColorSolid)); ++bounds.X; ++bounds.Y; bounds.Width -= 2; bounds.Height -= 2; this.spriteBatch.Draw(Utils.white, bounds, this.os.moduleColorBacking * this.fade); }
public virtual void drawOutline() { var destinationRectangle = bounds; RenderedRectangle.doRectangleOutline(destinationRectangle.X, destinationRectangle.Y, destinationRectangle.Width, destinationRectangle.Height, 1, os.moduleColorSolid); ++destinationRectangle.X; ++destinationRectangle.Y; destinationRectangle.Width -= 2; destinationRectangle.Height -= 2; spriteBatch.Draw(Utils.white, destinationRectangle, os.moduleColorBacking * fade); }
public void drawFrame() { tmpRect = bounds; tmpRect.Y -= PANEL_HEIGHT; tmpRect.Height += PANEL_HEIGHT; spriteBatch.Draw(Utils.white, tmpRect, os.moduleColorBacking); RenderedRectangle.doRectangleOutline(tmpRect.X, tmpRect.Y, tmpRect.Width, tmpRect.Height, 1, os.moduleColorSolid); tmpRect.Height = PANEL_HEIGHT; spriteBatch.Draw(Utils.white, tmpRect, os.moduleColorStrong); spriteBatch.DrawString(GuiData.detailfont, name, new Vector2(tmpRect.X + 2, tmpRect.Y + 2), os.semiTransText); }
public void drawFrame() { Module.tmpRect = this.bounds; Module.tmpRect.Y -= Module.PANEL_HEIGHT; Module.tmpRect.Height += Module.PANEL_HEIGHT; this.spriteBatch.Draw(Utils.white, Module.tmpRect, this.os.moduleColorBacking); RenderedRectangle.doRectangleOutline(Module.tmpRect.X, Module.tmpRect.Y, Module.tmpRect.Width, Module.tmpRect.Height, 1, new Color?(this.os.moduleColorSolid)); Module.tmpRect.Height = Module.PANEL_HEIGHT; this.spriteBatch.Draw(Utils.white, Module.tmpRect, this.os.moduleColorStrong); this.spriteBatch.DrawString(GuiData.detailfont, this.name, new Vector2((float)(Module.tmpRect.X + 2), (float)(Module.tmpRect.Y + 2)), this.os.semiTransText); Module.tmpRect = this.bounds; Module.tmpRect.Y -= Module.PANEL_HEIGHT; Module.tmpRect.Height += Module.PANEL_HEIGHT; RenderedRectangle.doRectangleOutline(Module.tmpRect.X, Module.tmpRect.Y, Module.tmpRect.Width, Module.tmpRect.Height, 1, new Color?(this.os.moduleColorSolid)); }
public virtual void drawTarget(string typeName = "app:") { if (this.bounds.Height <= 14) { return; } string text = "IP: " + this.targetIP; Rectangle bounds = this.bounds; bounds.Height = Math.Min(this.bounds.Height, 14); ++bounds.X; bounds.Width -= 2; this.spriteBatch.Draw(Utils.white, bounds, this.os.exeModuleTopBar); RenderedRectangle.doRectangleOutline(bounds.X, bounds.Y, bounds.Width, bounds.Height, 1, new Color?(this.os.topBarColor)); if (bounds.Height >= 14) { Vector2 vector2 = GuiData.detailfont.MeasureString(text); this.spriteBatch.DrawString(GuiData.detailfont, text, new Vector2((float)(this.bounds.X + this.bounds.Width) - vector2.X, (float)this.bounds.Y), this.os.exeModuleTitleText); this.spriteBatch.DrawString(GuiData.detailfont, typeName + this.IdentifierName, new Vector2((float)(this.bounds.X + 2), (float)this.bounds.Y), this.os.exeModuleTitleText); } }
private void DrawUpgrades(Rectangle bounds, SpriteBatch sb) { int panelHeight = 28; if (this.scrollerPanel == null) { this.scrollerPanel = new ScrollableSectionedPanel(panelHeight, sb.GraphicsDevice); } this.scrollerPanel.NumberOfPanels = this.upgradeNames.Count; Button.outlineOnly = true; Button.drawingOutline = false; int drawnThisCycle = 0; bool needsButtonChecks = bounds.Contains(GuiData.getMousePoint()); this.scrollerPanel.Draw((Action <int, Rectangle, SpriteBatch>)((index, drawAreaFull, sprBatch) => { Rectangle destinationRectangle = new Rectangle(drawAreaFull.X, drawAreaFull.Y, drawAreaFull.Width - 12, drawAreaFull.Height); int myID = 115700 + index * 111; if (needsButtonChecks && Button.doButton(myID, destinationRectangle.X, destinationRectangle.Y, destinationRectangle.Width, destinationRectangle.Height, "", new Color?(Color.Transparent))) { this.PurchaseUpgrade(index); } else if (!needsButtonChecks && GuiData.hot == myID) { GuiData.hot = -1; } bool flag1 = (double)this.upgradeCosts[index] <= (double)this.activeState.points; bool flag2 = flag1 && GuiData.hot == myID; if (GuiData.hot == myID) { this.hoverIndex = index; } if (flag2) { int height = destinationRectangle.Height; int num1 = 0; int num2 = 0; if (drawAreaFull.X == 0 && drawAreaFull.Y == 0) { if (drawnThisCycle == 0) { num1 = bounds.X; num2 = bounds.Y; } else { num1 = bounds.X; num2 = bounds.Y + bounds.Height - panelHeight / 2; } } Rectangle rectangle = new Rectangle(num1 + destinationRectangle.X - height, num2 + destinationRectangle.Y - height, destinationRectangle.Width + 2 * height, destinationRectangle.Height + 2 * height); for (int index1 = 0; index1 < this.Stars.Count; ++index1) { this.DrawStar(rectangle, sb, this.Stars[index1]); } sb.Draw(this.scanlinesTextBackground, rectangle, this.ThemeColor * (GuiData.active == myID ? 0.6f : 0.3f)); } sprBatch.Draw(this.scanlinesTextBackground, destinationRectangle, new Rectangle?(new Rectangle(this.scanlinesTextBackground.Width / 2, this.scanlinesTextBackground.Height / 9 * 4, this.scanlinesTextBackground.Width / 2, this.scanlinesTextBackground.Height / 4)), flag1 ? this.ThemeColor * 0.2f : Utils.AddativeWhite * 0.08f); if (GuiData.hot == myID) { RenderedRectangle.doRectangle(destinationRectangle.X + 1, destinationRectangle.Y + 1, destinationRectangle.Width - 2, destinationRectangle.Height - 2, new Color?(flag2 ? (GuiData.active == myID ? Color.Black : this.ThemeColorBacking) : Color.Black)); } if (index == 0) { Utils.drawLine(sprBatch, new Vector2((float)(destinationRectangle.X + 1), (float)(destinationRectangle.Y + 1)), new Vector2((float)(destinationRectangle.X + destinationRectangle.Width - 2), (float)(destinationRectangle.Y + 1)), Vector2.Zero, this.ThemeColor, 0.8f); } Utils.drawLine(sprBatch, new Vector2((float)(destinationRectangle.X + 1), (float)(destinationRectangle.Y + destinationRectangle.Height - 2)), new Vector2((float)(destinationRectangle.X + destinationRectangle.Width - 2), (float)(destinationRectangle.Y + destinationRectangle.Height - 2)), Vector2.Zero, this.ThemeColor, 0.8f); if (flag1) { sprBatch.Draw(Utils.white, new Rectangle(destinationRectangle.X, destinationRectangle.Y + 1, 8, destinationRectangle.Height - 2), this.ThemeColor); } string text = "[" + this.activeState.upgradeCounts[index].ToString("000") + "] " + this.upgradeNames[index]; TextItem.doFontLabel(new Vector2((float)(destinationRectangle.X + 4 + (flag1 ? 10 : 0)), (float)(destinationRectangle.Y + 4)), text, GuiData.UISmallfont, new Color?(flag2 ? (GuiData.active == myID ? this.ThemeColor : (flag1 ? Color.White : Color.Gray)) : (flag1 ? Utils.AddativeWhite : Color.Gray)), (float)(destinationRectangle.Width - 6), float.MaxValue, false); ++drawnThisCycle; }), sb, bounds); Button.outlineOnly = false; Button.drawingOutline = true; }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); PostProcessor.begin(); ScreenManager.FadeBackBufferToBlack(255); GuiData.startDraw(); PatternDrawer.draw(new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch); if (Button.doButton("Back".GetHashCode(), 10, 10, 220, 30, "<- " + LocaleTerms.Loc("Back"), Color.Gray)) { if (IsChange && !Saved) { ScreenManager.AddScreen(MessageBox_NeedSave, ScreenManager.controllingPlayer); } SettingsLoader.writeStatusFile(); ExitScreen(); } if (Button.doButton("Save".GetHashCode(), 10, 45, 220, 30, "ModsCore.Mods.Save".Translate(), Color.Blue)) { Save(); } TextItem.doLabel(new Vector2(75, 100), $"Mods ({"ModsCore.Mods.Activate".Translate()})", null, 300); //打开了Setting界面不允许修改选定的Mod if (OpenSettingUI) { SelectableTextList.doFancyList(25, 50, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 190, m_ActivatedMods.ToArray(), currentActMods, Color.White); } else { currentActMods = SelectableTextList.doFancyList(25, 50, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 50, m_ActivatedMods.ToArray(), currentActMods, Color.White); } if (OpenSettingUI && Button.doButton("CloseSettingUI".GetHashCode(), 400, 210, 150, 30, "ModsCore.Mods.CloseSettingUI".Translate(), Color.BlueViolet)) { OpenSettingUI = false; } if (currentActMods > 0 && Button.doButton("Up".GetHashCode(), 400, 250, 150, 30, "ModsCore.Mods.Up".Translate(), Color.BlueViolet)) { MoveUp(); IsChange = true; Saved = false; } if (currentActMods >= 0 && currentActMods != m_ActivatedMods.Count - 1 && Button.doButton("Down".GetHashCode(), 400, 290, 150, 30, "ModsCore.Mods.Down".Translate(), Color.BlueViolet)) { MoveDown(); IsChange = true; Saved = false; } if (!OpenSettingUI && currentActMods != -1 && Button.doButton("OpenSettingUI".GetHashCode(), 400, 210, 150, 30, "ModsCore.Mods.OpenSettingUI".Translate(), Color.BlueViolet)) { OpenSettingUI = true; } if (currentActMods >= 0 && Button.doButton("DeactivateMod".GetHashCode(), 400, 330, 150, 30, "ModsCore.Mods.DeactivateMod".Translate(), Color.BlueViolet)) { IsChange = true; Saved = false; m_DeactivatedMods.Add(m_ActivatedMods[currentActMods]); m_DeactDicModModEntries.Add(m_ActivatedMods[currentActMods].GetHashCode(), m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()]); m_ActDicModEntries.Remove(m_ActivatedMods[currentActMods].GetHashCode()); m_ActivatedMods.RemoveAt(currentActMods); ModManager.ModsConfig ModsConfig = (ModManager.ModsConfig)ModsConfig_FieldInfo.GetValue(new ModManager()); ModsConfig.EnabledMod.RemoveAt(currentActMods); ModsConfig_FieldInfo.SetValue(null, ModsConfig); currentDeactMods = m_DeactivatedMods.Count - 1; currentActMods = -1; } if (!OpenSettingUI && currentDeactMods >= 0 && Button.doButton("ActivateMod".GetHashCode(), 400, 370, 150, 30, "ModsCore.Mods.ActivateMod".Translate(), Color.BlueViolet)) { IsChange = true; Saved = false; m_ActivatedMods.Add(m_DeactivatedMods[currentDeactMods]); m_ActDicModEntries.Add(m_DeactivatedMods[currentDeactMods].GetHashCode(), m_DeactDicModModEntries[m_DeactivatedMods[currentDeactMods].GetHashCode()]); ModManager.ModsConfig ModsConfig = (ModManager.ModsConfig)ModsConfig_FieldInfo.GetValue(new ModManager()); ModsConfig.EnabledMod.Add(Path.GetFileName(m_DeactDicModModEntries[m_DeactivatedMods[currentDeactMods].GetHashCode()].Path)); ModsConfig_FieldInfo.SetValue(null, ModsConfig); m_DeactDicModModEntries.Remove(m_DeactivatedMods[currentDeactMods].GetHashCode()); m_DeactivatedMods.RemoveAt(currentDeactMods); currentActMods = m_ActivatedMods.Count - 1; currentDeactMods = -1; } if (OpenSettingUI && m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].Started && m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].DrawSettingUIMethod != null) { RenderedRectangle.doRectangleOutline(570, 100, ScreenManager.GraphicsDevice.Viewport.Width - 50 - 570, ScreenManager.GraphicsDevice.Viewport.Height - 100 - 50, 2, Color.White); m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].DrawSettingUIMethod(m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()], new object[] { ScreenManager, 575, 100, ScreenManager.GraphicsDevice.Viewport.Width - 50 - 570, ScreenManager.GraphicsDevice.Viewport.Height - 100 - 50 }); } else { TextItem.doLabel(new Vector2(600, 100), $"Mods ({"ModsCore.Mods.Deactivate".Translate()})", null, 300); currentDeactMods = SelectableTextList.doFancyList(25, 575, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 50, m_DeactivatedMods.ToArray(), currentDeactMods, null); } GuiData.endDraw(); PostProcessor.end(); }
private void DrawUpgrades(Rectangle bounds, SpriteBatch sb) { var panelHeight = 28; if (scrollerPanel == null) { scrollerPanel = new ScrollableSectionedPanel(panelHeight, sb.GraphicsDevice); } scrollerPanel.NumberOfPanels = upgradeNames.Count; Button.outlineOnly = true; Button.drawingOutline = false; var drawnThisCycle = 0; var needsButtonChecks = bounds.Contains(GuiData.getMousePoint()); scrollerPanel.Draw((index, drawAreaFull, sprBatch) => { var destinationRectangle = new Rectangle(drawAreaFull.X, drawAreaFull.Y, drawAreaFull.Width - 12, drawAreaFull.Height); var myID = 115700 + index * 111; if (needsButtonChecks && Button.doButton(myID, destinationRectangle.X, destinationRectangle.Y, destinationRectangle.Width, destinationRectangle.Height, "", Color.Transparent)) { PurchaseUpgrade(index); } else if (!needsButtonChecks && GuiData.hot == myID) { GuiData.hot = -1; } var flag1 = upgradeCosts[index] <= (double)activeState.points; var flag2 = flag1 && GuiData.hot == myID; if (GuiData.hot == myID) { hoverIndex = index; } if (flag2) { var num1 = destinationRectangle.Height; var num2 = 0; var num3 = 0; if (drawAreaFull.X == 0 && drawAreaFull.Y == 0) { if (drawnThisCycle == 0) { num2 = bounds.X; num3 = bounds.Y; } else { num2 = bounds.X; num3 = bounds.Y + bounds.Height - panelHeight / 2; } } var rectangle = new Rectangle(num2 + destinationRectangle.X - num1, num3 + destinationRectangle.Y - num1, destinationRectangle.Width + 2 * num1, destinationRectangle.Height + 2 * num1); for (var index1 = 0; index1 < Stars.Count; ++index1) { DrawStar(rectangle, sb, Stars[index1]); } sb.Draw(scanlinesTextBackground, rectangle, ThemeColor * (GuiData.active == myID ? 0.6f : 0.3f)); } sprBatch.Draw(scanlinesTextBackground, destinationRectangle, new Rectangle(scanlinesTextBackground.Width / 2, scanlinesTextBackground.Height / 9 * 4, scanlinesTextBackground.Width / 2, scanlinesTextBackground.Height / 4), flag1 ? ThemeColor * 0.2f : Utils.AddativeWhite * 0.08f); if (GuiData.hot == myID) { RenderedRectangle.doRectangle(destinationRectangle.X + 1, destinationRectangle.Y + 1, destinationRectangle.Width - 2, destinationRectangle.Height - 2, flag2 ? (GuiData.active == myID ? Color.Black : ThemeColorBacking) : Color.Black); } if (index == 0) { Utils.drawLine(sprBatch, new Vector2(destinationRectangle.X + 1, destinationRectangle.Y + 1), new Vector2(destinationRectangle.X + destinationRectangle.Width - 2, destinationRectangle.Y + 1), Vector2.Zero, ThemeColor, 0.8f); } Utils.drawLine(sprBatch, new Vector2(destinationRectangle.X + 1, destinationRectangle.Y + destinationRectangle.Height - 2), new Vector2(destinationRectangle.X + destinationRectangle.Width - 2, destinationRectangle.Y + destinationRectangle.Height - 2), Vector2.Zero, ThemeColor, 0.8f); if (flag1) { sprBatch.Draw(Utils.white, new Rectangle(destinationRectangle.X, destinationRectangle.Y + 1, 8, destinationRectangle.Height - 2), ThemeColor); } var text = "[" + activeState.upgradeCounts[index].ToString("000") + "] " + upgradeNames[index]; TextItem.doFontLabel( new Vector2(destinationRectangle.X + 4 + (flag1 ? 10 : 0), destinationRectangle.Y + 4), text, GuiData.UISmallfont, flag2 ? (GuiData.active == myID ? ThemeColor : (flag1 ? Color.White : Color.Gray)) : (flag1 ? Utils.AddativeWhite : Color.Gray), destinationRectangle.Width - 6, float.MaxValue); ++drawnThisCycle; }, sb, bounds); Button.outlineOnly = false; Button.drawingOutline = true; }