// Update game info panel // update time and total currency earn public void UpdateGameInfoUI() { timeCount += Time.deltaTime; TimeSpan timeSpan = TimeSpan.FromSeconds((int)timeCount); infoTxt.text = "Total Game Time: " + string.Format("{0:D2}:{1:D2}:{2:D2}:{3:D2}", timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds) + "\n" + "Total Currency Earn: " + Simplify.LargeNumConvert(totalCurrencyEarn); }
// When pointer enter service upgrade button, tool tip will be appear public void ToolTipPointerEnter(int buttonInd) { if (upgradeCost[buttonInd] == -1 || upgradeCost[buttonInd] == -2) { return; } toolTip = (GameObject)GameManager.Instantiate(Resources.Load("ToolTip"), GameObject.Find("Canvas").GetComponent <Canvas>().transform); toolTip.transform.position = new Vector3(upgradeBtn[buttonInd].transform.position.x, upgradeBtn[buttonInd].transform.position.y + 20, 0); Text ToolTipTxt = toolTip.transform.Find("ToolTipTxt").gameObject.GetComponent <Text>(); ToolTipTxt.text = title + " produce twice\n" + "Cost: " + Simplify.LargeNumConvert(upgradeCost[buttonInd]); toolTip.GetComponent <RectTransform>().sizeDelta = new Vector2(ToolTipTxt.preferredWidth, ToolTipTxt.preferredHeight); }
// Running once every frame // Update progress info on the game void UpdateProgressInfoUI() { curCurrencyTxt.text = "Currency\n" + Simplify.LargeNumConvert(curCurrency); curCpSTxt.text = "Currency Per Second\n" + Simplify.LargeNumConvert(curCpS); }
// Update service UI on the game public void UpdateUI() { infoTxt.text = "Level: " + curLevel + "\n" + "Total CpS:" + Simplify.LargeNumConvert(totalCpS); btnTxt.text = "Level Up + " + Simplify.LargeNumConvert(unitCpS) + " CpS\n" + Simplify.LargeNumConvert(curCost) + " Currency"; }