public void Update() { timeDelta += Time.deltaTime; if (timeDelta >= 1) { timeDelta = 0; UndoCounter(); } if (Input.GetMouseButton(1)) { currentAction = null; TooltipController.SetText(""); constructionController.CloseMenu(); editController.CloseMenu(); } if (Input.GetKeyDown("space")) RotateStructure(90); if (currentAction != null) { UpdateTooltip(); } }
public void StopAction() { currentAction = null; TooltipController.SetText(""); constructionController.CloseMenu(); editController.CloseMenu(); }
private IEnumerator ShowTooltip(TooltipId speech) { if (_bFirstDialogue) { _tooltipControl.SetText(_dialogueDict[speech]); _tooltipControl.StartCoroutine("ShowText", true); } else { yield return(_tooltipControl.StartCoroutine("ShowText", false)); _tooltipControl.SetText(_dialogueDict[speech]); _tooltipControl.StartCoroutine("ShowText", true); } if (_waitType == WaitType.InGamePause || _waitType == WaitType.VillageSpeech) { yield return(StartCoroutine("WaitForTooltip")); } else { yield return(StartCoroutine("KeepTooltipOnScreen")); } }
void UpdateTooltip() { float cost = 0; if (currentAction.Do == "paint") { TooltipController.SetText(currentAction.What); return; } else if (modeController.currentMode == Mode.Construct && currentAction.Do == "place") cost = GetConstructCost(actionLocations, currentAction); else if (modeController.currentMode == Mode.Construct && currentAction.Do == "demolish") cost = GetDemolishCost(actionLocations, currentAction); TooltipController.SetText(MoneyController.symbol + "" + cost); TooltipController.SetColor(moneyController.Money >= cost ? Color.white : Color.red); }
public void HideTooltip() { TooltipController.SetText(null); }
public void ShowTooltip() { TooltipController.SetText(Info); }
public virtual void OpenMenu(GameObject page) { if (timeController != null) { if (Time.timeScale == 0 && dontOpenWhenPaused) { return; } } //only open if correct mode if (modeController != null) { if (!openOnModes.Contains(modeController.currentMode)) { return; } } //if menu was already open if (menu.activeSelf) { wasOpen = true; } //if should close when button is pressed again, and the intended page is not the main page if (page.activeSelf && closeIfAlreadyOpen && page != mainPage) { CloseMenu(); return; } //close all pages but desired page foreach (GameObject go in pages) { go.SetActive(false); } page.SetActive(true); //check if the game was paused before if (timeController != null) { if (!wasOpen) { wasPaused = timeController.IsPaused; } //if the game must be paused while open, pause it if (pauseWhenOpen) { timeController.Pause(); } } menu.SetActive(true); if (tooltipController != null) { tooltipController.SetText(""); } if (modeController != null) { if (!openOnModes.Contains(modeController.currentMode)) { return; } } foreach (GameObject go in hideUI) { //add to dictionary which says if it was active or inactive when reached if (!wasOpen) { wasVisible[go] = go.activeSelf; } go.SetActive(false); } }