internal static void Warn(this RichLabel label, String message) { if (label == null || String.IsNullOrEmpty(message)) { return; } label.AddText(message, System.Drawing.Color.Yellow); label.AddLineBreak(); }
public ArrestReportDetails(Base parent) : base(parent) { //Top this.TopDock.Height = 75; Base instructionsContainer = new Base(this.TopDock); instructionsContainer.Dock = Pos.Fill; RichLabel instructions = new RichLabel(instructionsContainer); instructions.AddText("Please enter in the details for the arrest report below.", System.Drawing.Color.Black); instructions.AddLineBreak(); instructions.AddText("Toggle the Party button. Double click a party in the right pane to quickly insert their name into the report", System.Drawing.Color.Black); instructions.SetSize(600, this.TopDock.Height); instructions.Position(Pos.Top, 25, 15); //this.TopDock.FitChildrenToSize(); //Center/Fill reportDetailsTextBox = new StateControlledMultilineTextbox(this); reportDetailsTextBox.Dock = Pos.Fill; reportDetailsTextBox.TextChanged += ReportDetailsTextChanged; reportDetailsTextBox.ForceWordWrap = false; //Bottom this.BottomDock.Height = 60; Base actionButtonContainer = new Base(this.BottomDock); actionButtonContainer.Dock = Pos.Fill; transferTextFromSimpleNotepad = new Button(actionButtonContainer); transferTextFromSimpleNotepad.SetToolTipText("Transfer from SimpleNotepad"); transferTextFromSimpleNotepad.CopyContentIcon(); transferTextFromSimpleNotepad.Position(Pos.Top, 25, 15); transferTextFromSimpleNotepad.Clicked += ActionButtonClicked; //Right this.RightDock.Width = 200; lb_allParties = new ListBox(this); lb_allParties.IsTabable = true; lb_allParties.RowSelected += PartyListItemClicked; AllButton = this.RightDock.TabControl.AddPage("All", lb_allParties); AllButton.UserData = ArrestReportAdditionalParty.PartyTypes.UNKNOWN; WitnessButton = this.RightDock.TabControl.AddPage("Witnesses", lb_allParties); WitnessButton.UserData = ArrestReportAdditionalParty.PartyTypes.WITNESS; VictimButton = this.RightDock.TabControl.AddPage("Victims", lb_allParties); VictimButton.UserData = ArrestReportAdditionalParty.PartyTypes.VICTIM; //var accomplices = this.RightDock.TabControl.AddPage("Accomplices", lb_allParties); //accomplices.UserData = ArrestReportAdditionalParty.PartyTypes.ACCOMPLICE; //all.Press(); //Must trigger before we add the rest of the pressed handlers AllButton.Pressed += FilteredPartiesButtonPressed; WitnessButton.Pressed += FilteredPartiesButtonPressed; VictimButton.Pressed += FilteredPartiesButtonPressed; //accomplices.Pressed += FilteredPartiesButtonPressed; }
public void Show() { mCreditsWindow.IsHidden = false; mRichLabel.ClearText(); var credits = new Credits(); var creditsFile = Path.Combine("resources", "credits.json"); if (File.Exists(creditsFile)) { credits = JsonConvert.DeserializeObject <Credits>(File.ReadAllText(creditsFile)); } else { var line = new Credits.CreditsLine(); line.Text = "Insert your credits here!"; line.Alignment = "center"; line.Size = 12; line.Clr = Intersect.Color.White; line.Font = "sourcesansproblack"; credits.Lines.Add(line); } File.WriteAllText(creditsFile, JsonConvert.SerializeObject(credits, Formatting.Indented)); foreach (var line in credits.Lines) { if (line.Text.Trim().Length == 0) { mRichLabel.AddLineBreak(); } else { mRichLabel.AddText( line.Text, new Color(line.Clr.A, line.Clr.R, line.Clr.G, line.Clr.B), line.GetAlignment(), GameContentManager.Current.GetFont(line.Font, line.Size) ); mRichLabel.AddLineBreak(); } } mRichLabel.SizeToChildren(false, true); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); RichLabel label = new RichLabel(this); label.SetBounds(10, 10, 400, 200); f1 = new Font("Arial", 15); label.AddText("This test uses Arial 15, White. Padding. ", Color.White, f1); f2 = new Font("Times New Roman Bold", 20); label.AddText("This text uses Times New Roman Bold 20, Pink. Padding. ", Color.Pink, f2); f3 = new Font("Courier New Italic", 15); label.AddText("This text uses Courier New Italic 15, Yellow. Padding. ", Color.Yellow, f3); label.AddLineBreak(); label.AddText("This test uses Arial 15, Cyan. Padding. ", Color.Cyan * 1.2, f1); }
private void UpdateSelectedQuest() { if (mSelectedQuest == null) { mQuestList.Show(); mQuestTitle.Hide(); mQuestDescArea.Hide(); mQuestStatus.Hide(); mBackButton.Hide(); mQuitButton.Hide(); } else { mQuestDescLabel.ClearText(); mQuitButton.IsDisabled = true; ListBoxRow rw; string[] myText = null; var taskString = new List <string>(); if (Globals.Me.QuestProgress.ContainsKey(mSelectedQuest.Id)) { if (Globals.Me.QuestProgress[mSelectedQuest.Id].TaskId != Guid.Empty) { //In Progress mQuestStatus.SetText(Strings.QuestLog.inprogress); mQuestStatus.SetTextColor(Color.Yellow, Label.ControlState.Normal); if (mSelectedQuest.InProgressDescription.Length > 0) { mQuestDescLabel.AddText( mSelectedQuest.InProgressDescription, Color.White, Alignments.Left, mQuestDescTemplateLabel.Font ); mQuestDescLabel.AddLineBreak(); mQuestDescLabel.AddLineBreak(); } mQuestDescLabel.AddText( Strings.QuestLog.currenttask, Color.White, Alignments.Left, mQuestDescTemplateLabel.Font ); mQuestDescLabel.AddLineBreak(); for (var i = 0; i < mSelectedQuest.Tasks.Count; i++) { if (mSelectedQuest.Tasks[i].Id == Globals.Me.QuestProgress[mSelectedQuest.Id].TaskId) { if (mSelectedQuest.Tasks[i].Description.Length > 0) { mQuestDescLabel.AddText( mSelectedQuest.Tasks[i].Description, Color.White, Alignments.Left, mQuestDescTemplateLabel.Font ); mQuestDescLabel.AddLineBreak(); mQuestDescLabel.AddLineBreak(); } if (mSelectedQuest.Tasks[i].Objective == QuestObjective.GatherItems) //Gather Items { mQuestDescLabel.AddText( Strings.QuestLog.taskitem.ToString( Globals.Me.QuestProgress[mSelectedQuest.Id].TaskProgress, mSelectedQuest.Tasks[i].Quantity, ItemBase.GetName(mSelectedQuest.Tasks[i].TargetId) ), Color.White, Alignments.Left, mQuestDescTemplateLabel.Font ); } else if (mSelectedQuest.Tasks[i].Objective == QuestObjective.KillNpcs) //Kill Npcs { mQuestDescLabel.AddText( Strings.QuestLog.tasknpc.ToString( Globals.Me.QuestProgress[mSelectedQuest.Id].TaskProgress, mSelectedQuest.Tasks[i].Quantity, NpcBase.GetName(mSelectedQuest.Tasks[i].TargetId) ), Color.White, Alignments.Left, mQuestDescTemplateLabel.Font ); } } } mQuitButton.IsDisabled = !mSelectedQuest.Quitable; } else { if (Globals.Me.QuestProgress[mSelectedQuest.Id].Completed) { //Completed if (mSelectedQuest.LogAfterComplete) { mQuestStatus.SetText(Strings.QuestLog.completed); mQuestStatus.SetTextColor(Color.Green, Label.ControlState.Normal); mQuestDescLabel.AddText( mSelectedQuest.EndDescription, Color.White, Alignments.Left, mQuestDescTemplateLabel.Font ); } } else { //Not Started if (mSelectedQuest.LogBeforeOffer) { mQuestStatus.SetText(Strings.QuestLog.notstarted); mQuestStatus.SetTextColor(Color.Red, Label.ControlState.Normal); mQuestDescLabel.AddText( mSelectedQuest.BeforeDescription, Color.White, Alignments.Left, mQuestDescTemplateLabel.Font ); mQuitButton?.Hide(); } } } } else { //Not Started if (mSelectedQuest.LogBeforeOffer) { mQuestStatus.SetText(Strings.QuestLog.notstarted); mQuestStatus.SetTextColor(Color.Red, Label.ControlState.Normal); mQuestDescLabel.AddText( mSelectedQuest.BeforeDescription, Color.White, Alignments.Left, mQuestDescTemplateLabel.Font ); } } mQuestList.Hide(); mQuestTitle.IsHidden = false; mQuestTitle.Text = mSelectedQuest.Name; mQuestDescArea.IsHidden = false; mQuestDescLabel.Width = mQuestDescArea.Width - mQuestDescArea.GetVerticalScrollBar().Width; mQuestDescLabel.SizeToChildren(false, true); mQuestStatus.Show(); mBackButton.Show(); mQuitButton.Show(); } }
public ItemDescWindow( ItemBase item, int amount, int x, int y, int[] statBuffs, string titleOverride = "", string valueLabel = "", bool centerHorizontally = false ) { var title = titleOverride; if (string.IsNullOrWhiteSpace(title)) { title = item.Name; } mDescWindow = new ImagePanel(Interface.GameUi.GameCanvas, "ItemDescWindow"); if (item != null && item.ItemType == ItemTypes.Equipment) { mDescWindow.Name = "ItemDescWindowExpanded"; } if (item != null) { var icon = new ImagePanel(mDescWindow, "ItemIcon"); var itemName = new Label(mDescWindow, "ItemNameLabel"); itemName.Text = title; var itemQuantity = new Label(mDescWindow, "ItemQuantityLabel"); if (amount > 1) { itemQuantity.Text += amount.ToString("N0").Replace(",", Strings.Numbers.comma); } itemName.AddAlignment(Alignments.CenterH); var itemType = new Label(mDescWindow, "ItemTypeLabel"); var itemValue = new Label(mDescWindow, "ItemValueLabel"); itemType.Text = Strings.ItemDesc.itemtypes[(int)item.ItemType]; itemValue.SetText(valueLabel); if (item.ItemType == ItemTypes.Equipment && item.EquipmentSlot >= 0 && item.EquipmentSlot < Options.EquipmentSlots.Count) { itemType.Text = Options.EquipmentSlots[item.EquipmentSlot]; if (item.EquipmentSlot == Options.WeaponIndex && item.TwoHanded) { itemType.Text += " - " + Strings.ItemDesc.twohand; } } if (item.Rarity > 0) { itemType.Text += " - " + Strings.ItemDesc.rarity[item.Rarity]; var rarity = CustomColors.Items.Rarities.ContainsKey(item.Rarity) ? CustomColors.Items.Rarities[item.Rarity] : Color.White; itemType.TextColorOverride.R = rarity.R; itemType.TextColorOverride.G = rarity.G; itemType.TextColorOverride.B = rarity.B; itemType.TextColorOverride.A = rarity.A; } var itemDesc = new RichLabel(mDescWindow, "ItemDescription"); var itemDescText = new Label(mDescWindow, "ItemDescText"); itemDescText.Font = itemDescText.Parent.Skin.DefaultFont; var itemStatsText = new Label(mDescWindow, item.ItemType == ItemTypes.Equipment ? "ItemStatsText" : ""); itemStatsText.Font = itemStatsText.Parent.Skin.DefaultFont; var itemStats = new RichLabel(mDescWindow, item.ItemType == ItemTypes.Equipment ? "ItemStats" : ""); itemDescText.IsHidden = true; itemStatsText.IsHidden = true; //Load this up now so we know what color to make the text when filling out the desc mDescWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString()); if (item.Description.Length > 0) { itemDesc.AddText( Strings.ItemDesc.desc.ToString(item.Description), itemDesc.RenderColor, itemDescText.CurAlignments.Count > 0 ? itemDescText.CurAlignments[0] : Alignments.Left, itemDescText.Font ); itemDesc.AddLineBreak(); itemDesc.AddLineBreak(); } var stats = ""; if (item.ItemType == ItemTypes.Equipment) { stats = Strings.ItemDesc.bonuses; itemStats.AddText( stats, itemStats.RenderColor, itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left, itemDescText.Font ); itemStats.AddLineBreak(); if (item.ItemType == ItemTypes.Equipment && item.EquipmentSlot == Options.WeaponIndex) { stats = Strings.ItemDesc.damage.ToString(item.Damage); itemStats.AddText( stats, itemStats.RenderColor, itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left, itemDescText.Font ); itemStats.AddLineBreak(); } for (var i = 0; i < (int)Vitals.VitalCount; i++) { var bonus = item.VitalsGiven[i].ToString(); if (item.PercentageVitalsGiven[i] > 0) { if (item.VitalsGiven[i] > 0) { bonus += " + "; } else { bonus = ""; } bonus += item.PercentageVitalsGiven[i] + "%"; } var vitals = Strings.ItemDesc.vitals[i].ToString(bonus); itemStats.AddText( vitals, itemStats.RenderColor, itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left, itemDescText.Font ); itemStats.AddLineBreak(); } if (statBuffs != null) { for (var i = 0; i < (int)Stats.StatCount; i++) { var flatStat = item.StatsGiven[i] + statBuffs[i]; var bonus = flatStat.ToString(); if (item.PercentageStatsGiven[i] > 0) { if (flatStat > 0) { bonus += " + "; } else { bonus = ""; } bonus += item.PercentageStatsGiven[i] + "%"; } stats = Strings.ItemDesc.stats[i].ToString(bonus); itemStats.AddText( stats, itemStats.RenderColor, itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left, itemDescText.Font ); itemStats.AddLineBreak(); } } } if (item.ItemType == ItemTypes.Equipment && item.Effect.Type != EffectType.None && item.Effect.Percentage > 0) { itemStats.AddText( Strings.ItemDesc.effect.ToString( item.Effect.Percentage, Strings.ItemDesc.effects[(int)item.Effect.Type - 1] ), itemStats.RenderColor, itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left, itemDescText.Font ); } //Load Again for positioning purposes. mDescWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString()); var itemTex = Globals.ContentManager.GetTexture(GameContentManager.TextureType.Item, item.Icon); if (itemTex != null) { icon.Texture = itemTex; icon.RenderColor = item.Color; } itemDesc.SizeToChildren(false, true); itemStats.SizeToChildren(false, true); itemDescText.IsHidden = true; itemStatsText.IsHidden = true; if (centerHorizontally) { mDescWindow.MoveTo(x - mDescWindow.Width / 2, y + mDescWindow.Padding.Top); } else { mDescWindow.MoveTo(x - mDescWindow.Width - mDescWindow.Padding.Right, y + mDescWindow.Padding.Top); } } }
public SpellDescWindow(Guid spellId, int x, int y, bool centerHorizontally = false) { var spell = SpellBase.Get(spellId); if (spell == null) { return; } mDescWindow = new ImagePanel(Interface.GameUi.GameCanvas, "SpellDescWindowExpanded"); var icon = new ImagePanel(mDescWindow, "SpellIcon"); var spellName = new Label(mDescWindow, "SpellName"); spellName.Text = spell.Name; var spellType = new Label(mDescWindow, "SpellType"); spellType.Text = Strings.SpellDesc.spelltypes[(int)spell.SpellType]; var spellDesc = new RichLabel(mDescWindow, "SpellDesc"); var spellStats = new RichLabel(mDescWindow, "SpellStats"); var spellDescText = new Label(mDescWindow, "SpellDescText"); spellDescText.Font = spellDescText.Parent.Skin.DefaultFont; var spellStatsText = new Label(mDescWindow, "SpellStatsText"); spellStatsText.Font = spellStatsText.Parent.Skin.DefaultFont; spellDescText.IsHidden = true; spellStatsText.IsHidden = true; //Load this up now so we know what color to make the text when filling out the desc mDescWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString()); if (spell.Description.Length > 0) { spellDesc.AddText( Strings.SpellDesc.desc.ToString(spell.Description), spellDesc.RenderColor, spellDescText.CurAlignments.Count > 0 ? spellDescText.CurAlignments[0] : Alignments.Left, spellDescText.Font ); spellDesc.AddLineBreak(); spellDesc.AddLineBreak(); } if (spell.SpellType == (int)SpellTypes.CombatSpell) { if (spell.Combat.TargetType == SpellTargetTypes.Projectile) { var proj = ProjectileBase.Get(spell.Combat.ProjectileId); spellType.Text = Strings.SpellDesc.targettypes[(int)spell.Combat.TargetType] .ToString(proj?.Range ?? 0, spell.Combat.HitRadius); } else { spellType.Text = Strings.SpellDesc.targettypes[(int)spell.Combat.TargetType] .ToString(spell.Combat.CastRange, spell.Combat.HitRadius); } } if (spell.SpellType == (int)SpellTypes.CombatSpell && (spell.Combat.TargetType == SpellTargetTypes.AoE || spell.Combat.TargetType == SpellTargetTypes.Single) && spell.Combat.HitRadius > 0) { spellStats.AddText( Strings.SpellDesc.radius.ToString(spell.Combat.HitRadius), spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); spellStats.AddLineBreak(); } if (spell.CastDuration > 0) { var castDuration = (float)spell.CastDuration / 1000f; spellStats.AddText( Strings.SpellDesc.casttime.ToString(castDuration), spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); if (spell.CooldownDuration <= 0) { spellStats.AddLineBreak(); } } if (spell.CooldownDuration > 0) { var cdr = 1 - Globals.Me.GetCooldownReduction() / 100; var cd = (float)(spell.CooldownDuration * cdr) / 1000f; spellStats.AddText( Strings.SpellDesc.cooldowntime.ToString(cd), spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); spellStats.AddLineBreak(); } var requirements = spell.VitalCost[(int)Vitals.Health] > 0 || spell.VitalCost[(int)Vitals.Mana] > 0; if (requirements == true) { spellStats.AddText( Strings.SpellDesc.prereqs, spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); if (spell.VitalCost[(int)Vitals.Health] > 0) { spellStats.AddText( Strings.SpellDesc.vitalcosts[(int)Vitals.Health] .ToString(spell.VitalCost[(int)Vitals.Health]), spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); } if (spell.VitalCost[(int)Vitals.Mana] > 0) { spellStats.AddText( Strings.SpellDesc.vitalcosts[(int)Vitals.Mana].ToString(spell.VitalCost[(int)Vitals.Mana]), spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); } spellStats.AddLineBreak(); } var stats = ""; if (spell.SpellType == (int)SpellTypes.CombatSpell) { stats = Strings.SpellDesc.effects; spellStats.AddText( stats, spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); if (spell.Combat.Effect > 0) { spellStats.AddText( Strings.SpellDesc.effectlist[(int)spell.Combat.Effect], spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); } for (var i = 0; i < (int)Vitals.VitalCount; i++) { var vitalDiff = spell.Combat.VitalDiff?[i] ?? 0; if (vitalDiff == 0) { continue; } var vitalSymbol = vitalDiff < 0 ? Strings.SpellDesc.addsymbol : Strings.SpellDesc.removesymbol; if (spell.Combat.Effect == StatusTypes.Shield) { stats = Strings.SpellDesc.shield.ToString(Math.Abs(vitalDiff)); } else { stats = Strings.SpellDesc.vitals[i].ToString(vitalSymbol, Math.Abs(vitalDiff)); } spellStats.AddText( stats, spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); } if (spell.Combat.Duration > 0) { for (var i = 0; i < (int)Stats.StatCount; i++) { if (spell.Combat.StatDiff[i] != 0) { spellStats.AddText( Strings.SpellDesc.stats[i] .ToString( (spell.Combat.StatDiff[i] > 0 ? Strings.SpellDesc.addsymbol.ToString() : Strings.SpellDesc.removesymbol.ToString()) + Math.Abs(spell.Combat.StatDiff[i]) ), spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); } } var duration = (float)spell.Combat.Duration / 1000f; spellStats.AddText( Strings.SpellDesc.duration.ToString(duration), spellStats.RenderColor, spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left, spellStatsText.Font ); spellStats.AddLineBreak(); } } spellStats.SizeToChildren(false, true); if (spellStats.Children.Count == 0) { mDescWindow.Name = "SpellDescWindow"; spellStats.Name = ""; spellStatsText.Name = ""; } //Load Again for positioning purposes. mDescWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString()); spellDescText.IsHidden = true; spellStatsText.IsHidden = true; icon.Texture = Globals.ContentManager.GetTexture(GameContentManager.TextureType.Spell, spell.Icon); spellStats.SizeToChildren(false, true); if (centerHorizontally) { mDescWindow.MoveTo(x - mDescWindow.Width / 2, y + mDescWindow.Padding.Top); } else { mDescWindow.MoveTo(x - mDescWindow.Width - mDescWindow.Padding.Right, y + mDescWindow.Padding.Top); } }