62 lines
1.3 KiB
C#
62 lines
1.3 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
namespace BFEditor
|
|
{
|
|
public class AddAccountWindow : EditorWindow
|
|
{
|
|
static Action<string> onClickAdd;
|
|
|
|
string accountJson;
|
|
|
|
static AddAccountWindow window;
|
|
|
|
AddAccountWindow()
|
|
{
|
|
this.titleContent = new GUIContent("添加账号");
|
|
}
|
|
|
|
void OnGUI()
|
|
{
|
|
GUILayout.Space(10);
|
|
|
|
GUILayout.BeginHorizontal();
|
|
GUILayout.Space(20);
|
|
|
|
var style = new GUIStyle(GUI.skin.textField);
|
|
style.wordWrap = true;
|
|
accountJson = GUILayout.TextField(accountJson, style, GUILayout.Width(400), GUILayout.Height(150));
|
|
|
|
GUILayout.EndHorizontal();
|
|
|
|
GUILayout.Space(20);
|
|
|
|
if (GUILayout.Button("导入"))
|
|
{
|
|
if (onClickAdd != null)
|
|
{
|
|
onClickAdd(accountJson);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void OpenWindow(Action<string> action)
|
|
{
|
|
var rect = new Rect(Screen.width / 2, Screen.height / 2, 450, 245);
|
|
window = (AddAccountWindow)EditorWindow.GetWindowWithRect(typeof(AddAccountWindow), rect);
|
|
window.Show();
|
|
|
|
onClickAdd = action;
|
|
}
|
|
|
|
public static void CloseWindow()
|
|
{
|
|
if (window != null)
|
|
{
|
|
window.Close();
|
|
}
|
|
}
|
|
}
|
|
}
|