// Update is called once per frame void Update() { if (Time.unscaledDeltaTime < .3f) { scriptsLoaded--; } if (scriptsLoaded > 0) { return; } if (views.Count == 0) { PopViewFromQueue(); //return; } waiter--; if (waiter > 0) { return; } waiter = 0; Clear(); int startIndex = 0; for (int i = views.Count - 1; i >= 0; --i) { if (views[i].dontDrawViewsBelow) { startIndex = i; break; } } for (int i = startIndex; i < views.Count; i++) { views[i].Update(); views[i].FadeUpdate(); views[i].Redraw(0, 0); } ReactToInputKeyboard(); ReactToInputMouse(); for (int i = views.Count - 1; i >= 0; --i) { if (views[i].remove) { views.RemoveAt(i); break; } } if (OnScreen == false) { return; } SHGUIview interactable = GetInteractableView(); int YLineOld = cursorY; int XLineOld = cursorX; int mouseLocalX = (int)((Input.mousePosition.x / Screen.width) * 80.0f); int mouseLocalY = (int)(((Screen.height - Input.mousePosition.y) / Screen.height) * 24.0f); cursorX = mouseLocalX; cursorY = mouseLocalY; mouseX += Input.GetAxis("mouse x"); mouseY -= Input.GetAxis("mouse y"); // UnityEngine.Cursor.lockState = CursorLockMode.Confined; UnityEngine.Cursor.visible = false; cursorX = Mathf.Clamp(cursorX, 0, 79); cursorY = Mathf.Clamp(cursorY, 0, 23); if (YLineOld != cursorY || XLineOld != cursorX) { cursorActive = true; //cursorAnimator = 0; cursorTimer = 5f; if (!cursorVirgin) { if (interactable != null) { interactable.SpeedUpFadeIn(); } } cursorVirgin = false; } cursorTimer -= Time.unscaledDeltaTime; if (cursorTimer < 0) { cursorActive = false; } if (cursorActive && interactable != null && interactable.allowCursorDraw) { cursorAnimatorTimer -= Time.unscaledDeltaTime; if (cursorAnimatorTimer < 0) { cursorAnimatorTimer = .02f; cursorAnimator++; if (cursorAnimator > cursorAnimation.Length - 1) { cursorAnimator = 0; } } if (stringContainsChar(GetPixelFront(cursorX, cursorY), cursorFrontingChars)) { SHGUI.current.SetPixelFront(cursorAnimation[cursorAnimator], cursorX, cursorY, 'r'); } else { SHGUI.current.SetPixelBack(cursorAnimation[cursorAnimator], cursorX, cursorY, 'r'); } //SHGUI.current.SetPixelFront (cursorAnimator.ToString()[0], XLine, YLine, 'r'); } PrintBackground(); PrintForground(); }