mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-27 06:20:17 +00:00
56 lines
1.1 KiB
C#
56 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using SanAndreasUnity.Utilities;
|
|
|
|
namespace SanAndreasUnity.UI {
|
|
|
|
public class MessageBox : PauseMenuWindow
|
|
{
|
|
|
|
public string Title { get; set; }
|
|
public string Text { get; set; }
|
|
public bool UseTextField { get; set; }
|
|
|
|
|
|
MessageBox() {
|
|
|
|
// set default parameters
|
|
|
|
this.windowName = "";
|
|
this.useScrollView = true;
|
|
this.DestroyOnClose = true;
|
|
// adjust rect
|
|
this.windowRect = GUIUtils.GetCenteredRect( new Vector2(400, 300) );
|
|
|
|
}
|
|
|
|
void Start () {
|
|
|
|
}
|
|
|
|
protected override void OnWindowGUI()
|
|
{
|
|
|
|
this.windowName = this.Title;
|
|
|
|
if (this.UseTextField)
|
|
GUILayout.TextField(this.Text);
|
|
else
|
|
GUILayout.Label(this.Text);
|
|
|
|
}
|
|
|
|
public static MessageBox Show(string title, string text, bool useTextField = false)
|
|
{
|
|
var msgBox = PauseMenuWindow.Create<MessageBox>();
|
|
msgBox.Title = title;
|
|
msgBox.Text = text;
|
|
msgBox.UseTextField = useTextField;
|
|
|
|
msgBox.IsOpened = true;
|
|
|
|
return msgBox;
|
|
}
|
|
|
|
}
|
|
}
|