public void CreateNPCLabel(string word, int wordOrder) { TempLabel = null; for (int i = 0; i < LabelList.Count; i++) { if (LabelList[i].Text != word || LabelList[i].ForeColour != (wordOrder == 0 ? NameColour : Color.White)) { continue; } TempLabel = LabelList[i]; break; } if (TempLabel != null && !TempLabel.IsDisposed) { return; } TempLabel = new MirLabel { AutoSize = true, BackColour = Color.Transparent, ForeColour = wordOrder == 0 ? NameColour : Color.White, OutLine = true, OutLineColour = Color.Black, Text = word, }; TempLabel.Disposing += (o, e) => LabelList.Remove(TempLabel); LabelList.Add(TempLabel); }
public override void CreateLabel() { base.CreateLabel(); OwnerLabel = null; string ownerText = $"{OwnerName}'s Hero"; for (int i = 0; i < LabelList.Count; i++) { if (LabelList[i].Text != ownerText || LabelList[i].ForeColour != NameColour) { continue; } OwnerLabel = LabelList[i]; break; } if (OwnerLabel != null && !OwnerLabel.IsDisposed) { return; } OwnerLabel = new MirLabel { AutoSize = true, BackColour = Color.Transparent, ForeColour = NameColour, OutLine = true, OutLineColour = Color.Black, Text = ownerText, }; OwnerLabel.Disposing += (o, e) => LabelList.Remove(OwnerLabel); LabelList.Add(OwnerLabel); }