Пользователь
- Статус
- Оффлайн
- Регистрация
- 13 Янв 2018
- Сообщения
- 198
- Реакции
- 75
Бесполезно но красиво.
Рендер string'a
Рендер rect'a
Само оповещение.
Кидаете в update
Вот что должно получится в итоге.
Рендер string'a
Код:
public static void DrawString2(Rect pos, string text, Color color, int size, bool center = true, bool outline = false, int lines = 2)
{
Render.guistyle_0.fontSize = size;
Render.guistyle_0.normal.textColor = color;
GUIContent content = new GUIContent(text);
if (center)
{
pos.x -= Render.guistyle_0.CalcSize(content).x / 2f;
}
Rect rect = new Rect(pos.x, pos.y, 300f, (float)lines * 25f);
if (!outline)
{
GUI.Label(rect, content, Render.guistyle_0);
return;
}
Render.DrawOutlinedString(rect, text, color);
}
private static GUIStyle guistyle_0 = new GUIStyle(GUI.skin.label);
Код:
public static void BoxRect(Rect rect, Color color)
{
if (color != Render.color_0)
{
Render.texture2D_0.SetPixel(0, 0, color);
Render.texture2D_0.Apply();
Render.color_0 = color;
}
GUI.DrawTexture(rect, Render.texture2D_0);
}
private static Texture2D texture2D_0 = new Texture2D(1, 1);
private static Color color_0;
Код:
private static float TimeToHide = 0f;
private static float Speed;
private static bool ShowInjectStatis = false;
private static float RectW1 = 0f;
private static float RectW = 0f;
private static float TextX = 0f;
private static void InjectStatus()
{
Color Rect1 = new Color32(45, 45, 45, 255);
Color Rect2 = new Color32(255, 45, 45, 255);
Color String = new Color32(255, 60, 60, 255);
Render.BoxRect(new Rect(0f, 50f, RectW, 50f), Rect2);
Render.BoxRect(new Rect(0f, 50f, RectW1, 50f), Rect1);
if (ShowInjectStatis == true)
{
Render.DrawString2(new Rect(RectW1 - 100f, 55f, 300f, 100f), "Injected!", String, 25);
TimeToHide += Time.deltaTime * Speed;
RectW = Mathf.Lerp(RectW, 180f, 2f * Time.deltaTime);
if (RectW >= 150f)
{
RectW1 = Mathf.Lerp(RectW1, 170f, Time.deltaTime);
}
if (TimeToHide >= 16f)
{
ShowInjectStatis = false;
}
}
if (ShowInjectStatis == false)
{
Render.DrawString2(new Rect(RectW1 - 100f, 55f, 300f, 100f), "Injected!", String, 25);
RectW1 = Mathf.Lerp(RectW1, -10f, 2f * Time.deltaTime);
if (RectW1 <= 10f)
{
RectW = Mathf.Lerp(RectW, -10f, Time.deltaTime);
}
}
}
Код:
private void Update()
{
InjectStatus();
}
Вот что должно получится в итоге.
Последнее редактирование: