-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDescriptionWindow.cs
40 lines (31 loc) · 1.27 KB
/
DescriptionWindow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using BrokeProtocolClient.utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.InputSystem;
namespace BrokeProtocolClient.UI
{
class DescriptionWindow
{
public static string currentTooltip;
const int padding = 8;
static Color contentColor = new Color(1, 1, 1, 1);
static Color backgroundColor = new Color(0, 0, 0, 0.9f);
public static void render()
{
if (currentTooltip.Length <= 0) return;
//var backgroundPos = Mouse.current.position.ReadValue();
//backgroundPos = new Vector2(backgroundPos.x, Screen.height - backgroundPos.y);
var backgroundPos = new Vector2(Screen.width * 0.5f, Screen.height * 0.8f);
var contentPos = backgroundPos;
var content = new GUIContent(currentTooltip);
var contentSize = Render.StringStyle.CalcSize(content);
var backgroundSize = new Vector2(contentSize.x + padding, contentSize.y + padding);
Render.DrawBox(backgroundPos, backgroundSize, backgroundColor);
Render.DrawString(contentPos, currentTooltip, contentColor);
}
}
}