protected void RenderAnswerBox(Rect posBackground) { // Draw Background Color color = Color.black; GUIHelpers.DrawQuad(posBackground, color); }
void OnGUI() { if (CameraUtil.IsFaded) { return; } if (Toolbox.Instance.gameState.DayCounter == GameState.REGULAR_DAY) { Vector3 pos = Camera.main.WorldToScreenPoint(_loadedContracts[_highlightedContract].transform.position); Rect selectionPos = new Rect(pos.x, Screen.height - pos.y, 20, 20); GUIHelpers.DrawQuad(selectionPos, Color.blue); } }
void OnGUI() { var diff = _moneyCounter - _renderMoney; if (Mathf.Abs(diff) > 0) { var a = Mathf.Max(1, diff / 15f); _renderMoney += (int)(Mathf.Sign(diff) * a); } var moneyGUI = new Rect(0, 0, Screen.width, 20); var style = new GUIStyle { fontSize = 20, alignment = TextAnchor.UpperCenter, normal = { textColor = Color.white } }; var moneyText = "Bank Balance: $ " + _renderMoney; var moneyTextDimensions = GUI.skin.label.CalcSize(new GUIContent(moneyText)); //Draw blackbar + money GUIHelpers.DrawQuad(moneyGUI, Color.black); GUI.Label(moneyGUI, moneyText, style); //Draw money additions. var moneyDrawOffset = Screen.width / 2f + moneyTextDimensions.x; //the money text is centered in the middle of the screen. foreach (var moneyAddition in _moneyAdditions) { var positive = Mathf.Sign(moneyAddition.Amount) > 0; var addText = positive ? "+" + moneyAddition.Amount : "" + moneyAddition.Amount; var addSize = GUI.skin.label.CalcSize(new GUIContent(addText)); var addStyle = new GUIStyle(style) { normal = { textColor = positive ? Color.green : Color.red } }; GUI.Label(new Rect(moneyDrawOffset, 0, addSize.x, addSize.y), addText, addStyle); moneyDrawOffset += addSize.x * 2; } _moneyAdditions.RemoveAll(m => m.ExpirationTime < Time.time); //Draw centertext if (_showingCenterText) { GUI.Label(_center, _centerText, new GUIStyle { fontSize = 30, alignment = TextAnchor.MiddleCenter, normal = { textColor = Color.white } }); } }
protected void RenderAnswer(int i, float dialogueOffset) { int dialogueOffsetInt = (int)dialogueOffset; // Offsets the responses in the y-direction so they don't clash with the displayed dialogue. Rect responsePos = new Rect(0, (i * dialogueFontSize) + dialogueOffsetInt + 5, Screen.width, dialogueFontSize); if (i == _highlightedResponse) { GUIHelpers.DrawQuad(responsePos, Color.white); } GUIStyle style = new GUIStyle(); style.fontSize = dialogueFontSize; style.alignment = TextAnchor.UpperCenter; if (i == _highlightedResponse) { style.normal.textColor = Color.black; } else { style.normal.textColor = Color.white; } GUI.Label(responsePos, "[ " + CurrentNode.Responses[i] + " ]", style); }