public static void AddText(string text, GUCView.Fonts font, ColorRGBA color, long duration = TextDuration) { if (string.IsNullOrWhiteSpace(text)) { return; } if (vis.Texts.Count == 0) { vis.CreateTextCenterX("", 0); } int vFontSize = GUCView.PixelToVirtualY(GUCView.GetFontSize(font)); // push up active texts for (int i = endTimes.Count - 1; i >= 0; i--) { if (i == vis.Texts.Count - 1) { vis.CreateTextCenterX("", 0); } var newText = vis.Texts[i + 1]; var curText = vis.Texts[i]; newText.Font = curText.Font; newText.SetColor(curText.GetColor()); newText.Text = curText.Text; newText.SetPosY(curText.VPos.Y - vFontSize, true); } // add new text var visText = vis.Texts[0]; visText.Font = font; visText.SetColor(color); visText.Text = text; visText.SetPosY(0xB00 - vFontSize, true); endTimes.Insert(0, GameTime.Ticks + duration); if (endTimes.Count == 1) { vis.Show(); GUCScripts.OnUpdate += Update; } }
public void UpdateSelectedTeam() { if (GameMode.IsActive && GameMode.ActiveMode is TDMMode) { int index = (int)PlayerInfo.HeroInfo.TeamID; if (index >= 0) { if (Cast.Try(items[index], out MainMenuButton button)) { arrow.SetPosY(button.VPos.Y + GUCView.PixelToVirtualY(5), true); arrow.SetPosX(button.VPos.X - GUCView.PixelToVirtualX(25), true); arrow.Show(); return; } } } arrow.Hide(); }
public void UpdateSelectedTeam() { if (TeamMode.ActiveTODef != null) { var team = TeamMode.TeamDef; int index = TeamMode.ActiveTODef.Teams.IndexOf(team); if (team != null && index >= 0) { if (Cast.Try(items[index], out MainMenuButton button)) { arrow.SetPosY(button.VPos.Y + GUCView.PixelToVirtualY(5), true); arrow.SetPosX(button.VPos.X - GUCView.PixelToVirtualX(25), true); arrow.Show(); return; } } } arrow.Hide(); }