void ShowPopup(string phrase) { if (phase < skipToPhase) { return; } if (popupShownThisPhase) { return; } if (popup != null) { popup.Kill(); } popupShownThisPhase = true; popup = new SHGUIview(); popup.x = 32 - (int)(phrase.Length / 2); popup.y = 11; AddSubView(popup); popup.AddSubView(new SHGUIrect(-1, -1, phrase.Length, 1)); popup.AddSubView(new SHGUIframe(-1, -1, phrase.Length, 1, 'r')); popup.AddSubView(new SHGUItext(phrase, 0, 0, 'r')); }
public void Update() { if (SHGUI.current != null) // is there a GUI displayed { SHGUIview guiView = SHGUI.current.GetInteractableView(); if (guiView != null) // is the current view the main view { if (guiView is SHGUIcommanderview) { SHGUIcommanderview guiCommander = guiView as SHGUIcommanderview; if (guiCommander.path.EndsWith("SETTINGS\\") && guiCommander.buttons.Count == 6) //is in the settings menu and we didn't add any buttons yet { separatorButton = new SHGUIcommanderbutton("------------│--------", 'z', null).SetListLink(guiCommander).SetData(string.Empty).SetLocked(true); resetSecretsButton = new SHGUIcommanderbutton("delsecr.bat │--FILE->", 'w', delegate(SHGUIcommanderbutton x) { CreateChoiceView(ResetGuiView.Action.ResetSecrets); }).SetListLink(guiCommander).SetData("* reset secrets found \n* leaves story progression\n* leaves records intact"); resetStoryButton = new SHGUIcommanderbutton("newsave.bat │--FILE->", 'w', delegate(SHGUIcommanderbutton x) { CreateChoiceView(ResetGuiView.Action.ResetStory); }).SetListLink(guiCommander).SetData("* reset secrets found \n* reset story progression\n* leaves records intact"); resetAllButton = new SHGUIcommanderbutton("format.bat │--FILE->", 'w', delegate(SHGUIcommanderbutton x) { CreateChoiceView(ResetGuiView.Action.ResetAll); }).SetListLink(guiCommander).SetData("DESTROY YOUR SAVE, YOUR MIND AND YOUR BANK ACCOUNT !!!!11!!1!! \n\n\n\n\n\n\n\n\njk"); guiCommander.AddButtonView(separatorButton); guiCommander.AddButtonView(resetSecretsButton); guiCommander.AddButtonView(resetStoryButton); guiCommander.AddButtonView(resetAllButton); } } } } }
public scrollmessage(SHGUIview View, int Height, float Delay, bool overrideLast = false, float baseFade = 0.0f, string controlCommand = "") { view = View; height = Height; delay = Delay; this.overrideLast = overrideLast; this.baseFade = baseFade; this.controlCommand = controlCommand; }
void PrepareInstruction() { instruction = new SHGUIview(); SHGUIview v2 = new SHGUIview(); string ttt2 = "[PRESS ENTER TO START]"; v2.AddSubView(new SHGUItext(ttt2, 31 - (int)(ttt2.Length / 2), 17, 'w')); instruction.AddSubView(v2); }
public SHGUIprogressbar(int X, int Y, int Length, string label, string sub) { Init(); x = X; y = Y; rect = AddSubView(new SHGUIrect(0, 0, Length + 2, 2)); frame = AddSubView(new SHGUIframe(0, 0, Length + 2, 2, 'z')); labelView = AddSubView(new SHGUItext(label, (int)((Length + 2) / 2 - label.Length / 2) + 1, 0, 'w')); subtitleView = AddSubView(new SHGUItext(sub, (int)((Length + 2) / 2 - sub.Length / 2) + 1, 2, 'w')); length = Length; }
public void ShowChatFrames() { frame = AddSubView(new SHGUIframe(0, 0, SHGUI.current.resolutionX - 1, SHGUI.current.resolutionY - 1, 'z')); appname = AddSubView(new SHGUItext("guruCHAT", 3, 0, 'w')); chatQuitInstructions = AddSubView(new SHGUItext("", SHGUI.current.resolutionX - 22, SHGUI.current.resolutionY - 1, 'z')) as SHGUItext; clock = AddSubView(new SHGUIclock(77, 0, 'w')); frameOffset = 1; lines = 1; }
public void RemoveView(SHGUIview v) { for (int i = 0; i < children.Count; ++i) { if (children[i].id == v.id) { children.RemoveAt(i); break; } } }
public SHGUIluasandbox(SHGUIview parent, string script) { this.parent = parent; luaVirtualMachine = new Lua(); luaVirtualMachine["SHGUI"] = this; luaVirtualMachine.DoString(script); boundRedrawFunction = luaVirtualMachine.GetFunction("Redraw"); boundInitFunction = luaVirtualMachine.GetFunction("Init"); boundUpdateFunction = luaVirtualMachine.GetFunction("Update"); boundInputFunction = luaVirtualMachine.GetFunction("Input"); }
public SHGUIview LaunchAppByName(string name) { System.Type t = System.Type.GetType(name); if (t != null) { SHGUIview view = System.Activator.CreateInstance(t) as SHGUIview; AddViewOnTop(view); return(view); } else { Debug.Log("app: " + name + " not found"); return(null); } }
void AddFigletTextParticle(string text, int x, int y, char color) { //centered X SHGUIview temp = new SHGUItempview(.4f); int halflen = (text.Length - 1) * 3; temp.fade = 1f; SHGUItext t = new SHGUItext(SHGUI.current.GetASCIIartFromFont(text), x - halflen, y, color); temp.AddSubView(t); t.fade = 1f; AddSubView(temp); lastFigletParticle = temp; }
public SHGUIprogressbar SetBlinkingLabel(string label, float blinkTime) { if (labelView != null) { labelView.KillInstant(); } SHGUIview top = AddSubView(new SHGUIview()); SHGUIview b = top.AddSubView(new SHGUIblinkview(blinkTime)); b.AddSubView(new SHGUItext(label, (int)((length + 2) / 2 - label.Length / 2) + 1, 0, 'w')); labelView = top; return(this); }
void ShowNextItemWhenReady() { currentTimer -= Time.unscaledDeltaTime; bool ready = (currentTimer < 0); if (currentView != null && currentView is SHGUIguruchatwindow) { if (!(currentView as SHGUIguruchatwindow).finished) { ready = false; currentTimer += Time.unscaledDeltaTime; } } if (currentView != null && currentView is SHGUImultichat) { if (!(currentView as SHGUImultichat).finished) { ready = false; currentTimer += Time.unscaledDeltaTime; } } if (ready) { if (timers.Count > 0) { if (currentView != null) { currentView.Kill(); } currentView = queue[0]; currentTimer = timers[0]; queue.RemoveAt(0); timers.RemoveAt(0); AddSubView(currentView); } else { Kill(); } } }
public SHGUIview PopViewFromQueue() { if (viewQueue.Count > 0) { SHGUIview q = viewQueue [0]; AddViewOnTop(q); viewQueue.RemoveAt(0); return(q); } else { //Debug.Log("finished"); finished = true; return(null); } }
public SHGUIcommanderview() { Init(); left = 3; width = SHGUI.current.resolutionX - left - left - 1; buttons = new List <SHGUIcommanderbutton> (); AddSubView(new SHGUIline(left, left + width, 0, true, 'z').SetStyle("┌─┐")); AddSubView(new SHGUIline(left, left + width, SHGUI.current.resolutionY - 1, true, 'z').SetStyle("└─┘")); AddSubView(new SHGUIline(0, SHGUI.current.resolutionY - 1, left, false, 'z').SetStyle("┌│└")); AddSubView(new SHGUIline(0, SHGUI.current.resolutionY - 1, left + width, false, 'z').SetStyle("┐│┘")); AddSubView(new SHGUIline(left, left + width, SHGUI.current.resolutionY - 3, true, 'z').SetStyle("├─┤")); AddSubView(new SHGUIline(0, SHGUI.current.resolutionY - 3, left + 13, false, 'z').SetStyle("┬│┴")); AddSubView(new SHGUIline(0, SHGUI.current.resolutionY - 3, left + 22, false, 'z').SetStyle("┬│┴")); clock = AddSubView(new SHGUIclock(SHGUI.current.resolutionX - 3 - left, 0, 'w')); //AddSubView(new SHGUItext("piOS-v2.1", SHGUI.current.resolutionX - 3 - left - 8, 0, 'w').GoFromRight()); AddSubView(new SHGUItext("0mni-piOS-v2.1.01p", SHGUI.current.resolutionX - 21 - left, SHGUI.current.resolutionY - 1, 'w')); pathView = AddSubView(new SHGUItext(path, left + 1, SHGUI.current.resolutionY - 2, 'w')) as SHGUItext; listLength = SHGUI.current.resolutionY - 4; minListOffset = 1; maxListOffset = 0; /* * rightPanel = new SHGUIview (); * rightPanel.x = 25; * rightPanel.y = 1; */ /* * string content = "wlazł-kotek-na-plotek-i-"; * for (int i = 0; i < 10; ++i) { * content += content; * } */ string content = ""; rightPanelContentWidth = 32; rightPanel = AddSubView(new SHGUItext(content, left + 24, 1, 'z').BreakTextForLineLength(rightPanelContentWidth).CutTextForMaxLines(19)) as SHGUItext; //AddSubView (rightPanel); }
void AddHotView() { return; if (superView != null) { superView.Kill(); } if (hotView != null) { hotView.Kill(); } hotView = new SHGUItext(SHGUI.current.GetASCIIartByName("hotsmall"), 16, 8, '0'); hotView.overrideFadeInSpeed = 2f; AddSubView(hotView); }
void PrepareFinalAnimation() { finalAnimation = new SHGUIview(); SHGUIsprite s = new SHGUIsprite(); s.x = 32 - 11; s.y = 8; TreeDudeSequence(s, "TT|| D|0| TT|| D| D|"); TreeDudeSequence(s, "TT|| D|2| TT|| D| D|"); s.animationSpeed = .25f; s.loops = true; finalAnimation.AddSubView(s); }
public override void Update() { base.Update(); if (lastView == null || lastView.remove) { if (queue.Count > 0) { AddSubView(queue[0]); lastView = queue[0]; queue.RemoveAt(0); } else { Kill(); } } }
void PreparePrompters() { prompters = new SHGUIview(); prompters.hidden = true; SHGUIprompter p1 = new SHGUIprompter(32 - 10, 6, 'w'); p1.SetInput("^M2HIS NAME IS TREEDUDE"); prompters.AddSubView(p1); SHGUIprompter p2 = new SHGUIprompter(32 - 9, 15, 'w'); p2.SetInput("^M2^W9AND HIS SONG IS^M1^W2.^W2.^W2.^W7"); prompters.AddSubView(p2); //AddSubView (prompters); }
public APPmindcopy() : base("copy-by-SUPERHOT") { brain = SHGUI.current.GetASCIIartByName("Brain"); cypherBrain1 = SHGUI.current.GetASCIIartByName("CypherBrain1"); cypherBrain0 = SHGUI.current.GetASCIIartByName("CypherBrain0"); brainView = SHGUI.current.GetCenteredAsciiArt("Brain"); brainView.x = brainViewSideX; brainView.y = brainViewSideY; //AddSubView (brainView); cypherBrainView = SHGUI.current.GetCenteredAsciiArt("CypherBrain01"); cypherBrainView.x = cypherBrainViewSideX; cypherBrainView.y = cypherBrainViewSideY; //AddSubView (cypherBrainView); memoryFrame = new SHGUIview(); memoryFrameGlow = new SHGUIrect(-2, -2, 13, 6, 'z', ' ', 0); memoryFrameGlow.hidden = true; memoryFrame.AddSubView(memoryFrameGlow); memoryFrameItself = new SHGUIframe(-1, -1, 12, 5, 'z'); memoryFrame.AddSubView(memoryFrameItself); brainCover = new SHGUIview(); brainCoverItself = new SHGUIrect(7, 2, 18, 6, 'z', ' ', 0); //brainCoverItself = new SHGUIrect (6, 1, 19, 7, 'z', ' ', 0); brainCover.AddSubView(brainCoverItself); //brainCover.AddSubView (new SHGUIframe (6, 1, 19, 7, 'z')); phase = 0; progress = 0; APPFRAME.hidden = true; APPINSTRUCTION.hidden = true; APPLABEL.hidden = true; //Debug.Log ("brainView: " + brainView.x + ", " + brainView.y); //Debug.Log ("cypherBrainView: " + cypherBrainView.x + ", " + cypherBrainView.y); }
public void Dismiss() { if (!restrictDismissing) { Kill(); for (int i = 0; i < queueSkips; ++i) { SHGUIview v = SHGUI.current.PopViewFromQueue(); if (v != null) { v.KillInstant(); } } } else { char c = 'w'; if (restrictInstruction != null) { restrictInstruction.KillInstant(); c = 'w'; } if (color == 'r') { c = 'r'; } restrictInstruction = null; string text = restrictedInstructions[UnityEngine.Random.Range(0, restrictedInstructions.Count)]; restrictInstruction = new SHGUItempview(1f); restrictInstruction.AddSubView(new SHGUItext(text, instructionX, instructionY, c).GoFromRight()); AddSubView(restrictInstruction); PunchIn(.8f); restrictInstruction.PunchIn(0f); SHGUI.current.PlaySound(SHGUIsound.noescape); } }
public APPquit() { dontDrawViewsBelow = false; int width = 30; int textoff = 7; SHGUIview container = AddSubView(new SHGUIview()); container.x = (int)(SHGUI.current.resolutionX / 2) - (int)(width / 2); container.y = (int)(SHGUI.current.resolutionY / 2) - 4; container.AddSubView(new SHGUIrect(0, 0, width, 4)); container.AddSubView(new SHGUIframe(0, 0, width, 4, 'r')); container.AddSubView(new SHGUItext("SHUTTING DOWN", 1 + textoff, 2, 'r')); container.AddSubView(new SHGUILoadingIndicator(16 + textoff, 2, .05f, 'r')); quitInstruction = container.AddSubView(new SHGUItext(LocalizationManager.Instance.GetLocalized("CANCEL_INPUT"), width - 3, 4, 'r').GoFromRight()); }
public void OnGUI() { if (DEBUG_GUI == false) { return; } int basePosX = 900; SHGUI gui = SHGUI.current; if (gui == null) { GUI.Label(new Rect(basePosX, 0, 100, 25), "No gui"); } else { GUI.Label(new Rect(basePosX, 0, 400, 25), gui.GetType().Name + " (" + gui.name + ")"); SHGUIview guiInter = gui.GetInteractableView(); if (guiInter == null) { GUI.Label(new Rect(basePosX, 25, 100, 25), "No view"); } else { GUI.Label(new Rect(basePosX, 25, 400, 25), guiInter.GetType().Name); if (guiInter is SHGUIcommanderview) { SHGUIcommanderview guiComm = (SHGUIcommanderview)guiInter; int i = 0; foreach (SHGUIcommanderbutton but in guiComm.buttons) { GUI.Label(new Rect(basePosX, 50 + i++ *25, 400, 25), but.ButtonText + " (" + but.IsLocked + ")"); } } } } }
void PrepareDudeJumping() { dude = new SHGUIview(); SHGUIsprite s = new SHGUIsprite(); s.AddSpecyficFrameFromFile("APPtreedudedude", 6, 0); s.frames [s.frames.Count - 1] = "\n" + s.frames [s.frames.Count - 1]; s.AddSpecyficFrameFromFile("APPtreedudedude", 6, 1); s.AddSpecyficFrameFromFile("APPtreedudedude", 6, 2); s.frames [s.frames.Count - 1] = "\n" + s.frames [s.frames.Count - 1]; s.loops = false; s.killOnAnimationComplete = false; s.animationSpeed = .2f; s.x = 32 - 10; s.y = 7; dude.AddSubView(s); }
public void Popup(string msg, int originx, int originy, bool overrideLast = true) { if (lastPopup != null && overrideLast) { lastPopup.Kill(); } int X = camerax + originx + 2; int Y = cameray + originy; SHGUItempview pop = new SHGUItempview(.75f); SHGUIview text = new SHGUItext(msg, X, Y, 'w'); pop.AddSubView(new SHGUIrect(X, Y, X + msg.Length - 1, Y, 'z', ' ', 2)); pop.AddSubView(text); this.AddSubViewBottom(pop); lastPopup = pop; }
public APPguruchat() { Init(); allowCursorDraw = false; chats = new List <SHGUIguruchatwindow> (); frame = AddSubView(new SHGUIframe(0, 0, SHGUI.current.resolutionX - 1, SHGUI.current.resolutionY - 1, 'z')); appname = AddSubView(new SHGUItext("guruCHAT", 3, 0, 'w')); instructions = AddSubView(new SHGUItext("", SHGUI.current.resolutionX - 22, SHGUI.current.resolutionY - 1, 'w')) as SHGUItext; clock = AddSubView(new SHGUIclock(77, 0, 'w')); messageQueue = new List <gurumessage> (); //AddChatMessage ("asdfasdf", "", true); /* * SetInstructions ("WAIT-FOR-YOUR-PARTNER"); * SetInstructions ("TYPE-TO-SPEAK"); * SetInstructions ("PRESS-ENTER-TO-END-YOUR-TURN"); */ }
public APPmessage() { string message = "INCOMING MESSAGE"; char frameColor = 'z'; char textColor = 'w'; x = (int)(SHGUI.current.resolutionX / 2) - (int)(message.Length / 2); y = 12 - 3; //AddSubView (new SHGUIrect (-3, -1, message.Length + 4, 6, 'z', '░')); back = AddSubView(new SHGUIrect(-3, -1, message.Length + 4, 3, '0', '▒')); //back.AddSubView (new SHGUIframe (-3, -2, message.Length + 4, 6, 'z')); allowCursorDraw = false; frame = AddSubView(new SHGUIframe(-2, -1, message.Length + 3, 3, frameColor)); //frame = AddSubView(new SHGUIframe(-2, -1, message.Length + 3, 3, frameColor)); float blinkTime = .6f; blink = new SHGUIblinkview(blinkTime); AddSubView(blink); text = blink.AddSubView(new SHGUItext(message, 1, 1, textColor)); blink2 = new SHGUIblinkview(blinkTime).SetFlipped(); AddSubView(blink2); instructions1 = blink2.AddSubView(new SHGUItext(LocalizationManager.Instance.GetLocalized("INCOMING_MESSAGE_REPLY_INPUT"), 1, 1, textColor)); if (InputManager.ActiveDevice.Name != "Keyboard/Mouse") { instructions1.x -= 1; } instructions2 = AddSubView(new SHGUItext(LocalizationManager.Instance.GetLocalized("INCOMING_MESSAGE_DISMISS_INPUT"), message.Length, 3, 'z').GoFromRight()); instructionX = message.Length; instructionY = instructions2.y; dontDrawViewsBelow = false; restrictedInstructions = new List <string> (); AddSubView(new SHGUIplaysound(SHGUIsound.incomingmessage)); }
public APPtreedude() : base("TREE-DUDE-TREE-DUDE-DUDE-by-piotr") { //AddSubView (new SHGUItext (SHGUI.current.GetASCIIartByName ("APPtreedudeback"), 0, 0, 'z')); timeToDie = timeToDieMax * .5f; GenerateDifficulty(); trees = new List <SHGUIsprite> (); dude = new SHGUIsprite().AddFramesFromFile("APPtreedudedude", 6); AddSubView(dude); AddTreeOnTop(true); AddTreeOnTop(true); AddTreeOnTop(true); for (int i = 0; i < 10; ++i) { AddTreeOnTop(false); AddTreeOnTop(true); } timeToDieBar = new SHGUIprogressbar(20, 3, 21, "", "").SetBlinkingLabel("WATCH-TIME!", .2f); timeToDieBar.SetStyle("z█z░z█"); AddSubView(timeToDieBar); tutorialView = new SHGUIview(); AddSubView(tutorialView); SHGUIblinkview b1 = new SHGUIblinkview(.75f).SetFlipped(); int tutorialy = 15; b1.AddSubView(new SHGUItext("CHOP-LEFT-->", 13, tutorialy, 'w')); tutorialView.AddSubView(b1); SHGUIblinkview b2 = new SHGUIblinkview(.75f).SetFlipped(); b2.AddSubView(new SHGUItext("<--CHOP-RIGHT", 40, tutorialy, 'w')); tutorialView.AddSubView(b2); }
public void AddViewOnTop(SHGUIview view) { if (views.Count > 0 && views.Last() != null) { views.Last().OnExit(); } SHGUIview v = GetInteractableView(); if (v == null) { views.Add(view); } else { int i = GetInteractableViewIndex() + 1; views.Insert(i, view); } views.Last().OnEnter(); }
void PrepareLoading() { loading = new SHGUIview(); SHGUIsprite s = new SHGUIsprite(); s.AddFrame("Loading |"); s.AddFrame("Loading /"); s.AddFrame("Loading -"); s.AddFrame("Loading \\"); s.loops = true; s.animationSpeed = .1f; s.x = 32 - 5; s.y = 11; loading.AddSubView(s); // loading.hidden = true; //AddSubView (loading); }
public APPrecruit() { Init(); queue = new List <SHGUIview> (); timers = new List <float> (); AddSubView(new SHGUIrect(0, 0, SHGUI.current.resolutionX - 1, SHGUI.current.resolutionY - 1)); allowCursorDraw = false; overrideFadeInSpeed = .35f; overrideFadeOutSpeed = .5f; StringBuilder s = new StringBuilder(); for (int X = 0; X < 24; ++X) { for (int Y = 0; Y < 64; ++Y) { if (Random.value > .5f) { s.Append('0'); } else { s.Append('1'); } } s.Append('\n'); } //background = AddSubView (new SHGUItext (s.ToString (), 0, 0, 'z')); background = AddSubView(new SHGUIview()); Version3(); }