void AddText(string line) { var lines = line.Split(';'); string firstline = lines[0]; thisLineDelay = .8f; if (firstline.Contains(">")) { int index = firstline.IndexOf('>'); var cmd = firstline.Substring(0, index); lines[0] = firstline.Substring(index + 1); for (int i = 0; i < cmd.Length; ++i) { if (cmd[i] == 'D') { this.thisLineDelay *= 1.2f; } } } foreach (var L in text) { L.Kill(); L.remove = true; } int height = 0; foreach (var l in lines) { var t = new SHGUItext(SHGUI.current.GetASCIIartFromFont(l), 0, 0, 'w'); t.x = (int)(SHGUI.current.resolutionX / 2) - (int)(t.GetLineLength() / 2); t.y = (int)(SHGUI.current.resolutionY / 2) - (int)(t.CountLines() / 2) + height; AddSubView(t); height += (int)(SHGUI.current.resolutionY / 2) - (int)(t.CountLines() / 2) - 1; t.PunchIn(1f); text.Add(t); } foreach (var t in text) { t.y -= (int)(height / 4); } PlaySound(); }
public void AddTextToQueueCentered(string Text, float Delay, char color = 'z') { SHGUItext TextView = new SHGUItext(Text, 0, 0, color); TextView.x = frameOffset + (int)(SHGUI.current.resolutionX / 2) - (int)(TextView.GetLineLength() / 2); queue.Add(new scrollmessage(TextView, TextView.CountLines(), Delay, false, .5f)); }
public void AddTextToQueueBreakLines(string Text, float Delay, char color = 'z', int offset = 0) { SHGUItext TextView = new SHGUItext(Text, frameOffset + offset, 0, color); TextView.BreakCut(SHGUI.current.resolutionX - frameOffset, 100); queue.Add(new scrollmessage(TextView, TextView.CountLines(), Delay, false, .5f)); }
public SHGUItext GetCenteredAsciiArt(string artname, int screenPosX = 32, int screenPosY = 12) { SHGUItext t = new SHGUItext(GetASCIIartByName(artname), 1, 1, 'w') as SHGUItext; t.x = screenPosX - (int)(t.GetLineLength() / 2); t.y = screenPosY - (int)(t.CountLines() / 2); return(t); }
public void AddInteractivePrompterToQueue(string Text, string prefix = "") { SHGUItext TextView = new SHGUItext(Text, frameOffset, 0, 'w'); TextView.BreakCut(SHGUI.current.resolutionX - 2, 100); SHGUIprompter promp = new SHGUIprompter(frameOffset, 0, 'w'); promp.SetInput(Text); promp.SwitchToManualInputMode(); promp.maxLineLength = SHGUI.current.resolutionX - 2 - frameOffset; promp.maxSmartBreakOffset = 0; promp.AddPrefix(prefix); queue.Add(new scrollmessage(promp, TextView.CountLines(), 0)); }
public void AddPrompterToQueue(string Text, float Delay, bool centered = false) { SHGUItext TextView = new SHGUItext(Text, frameOffset, 0, 'z'); TextView.BreakCut(SHGUI.current.resolutionX - 2 - frameOffset, 100); int width = TextView.GetLongestLineLength(); SHGUIprompter promp = new SHGUIprompter(frameOffset, 0, 'w'); promp.SetInput(Text); if (centered) { promp.x = (int)(SHGUI.current.resolutionX / 2) - (int)(promp.GetFirstLineLengthWithoutSpecialSigns() / 2); } promp.maxLineLength = SHGUI.current.resolutionX - 2; promp.maxSmartBreakOffset = 0; queue.Add(new scrollmessage(promp, TextView.CountLines(), Delay)); }
public void AddTextToQueue(string Text, float Delay, char color = 'z', int offset = 0) { SHGUItext TextView = new SHGUItext(Text, frameOffset + offset, 0, color); queue.Add(new scrollmessage(TextView, TextView.CountLines(), Delay, false, .5f)); }