ict.xunfei/Assets/Scripts/WindowTest.cs

80 lines
1.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class WindowTest : MonoBehaviour
{
public Button minimize, nokuang, fullscreen;
public WindowsToolMgr toolMgr;
public TextMeshProUGUI tmp;
public TMP_InputField inputField;
public TextMeshProUGUI tmp2;
public TextMeshProUGUI tmp3;
public bool can_quit;
void Awake()
{
Application.wantsToQuit += () =>
{
tmp3.text = "ÇëÇóÍ˳ö,µ±Ç°canquit=" + can_quit;
return can_quit;
};
}
// Start is called before the first frame update
void Start()
{
minimize.onClick.AddListener(toolMgr.MinWindows);
nokuang.onClick.AddListener(() => { toolMgr.SetNoFrame(Screen.width, Screen.height); });
fullscreen.onClick.AddListener(() =>
{
//toolMgr.SwitchScreenResolution
});
}
public bool drag;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
var rect = toolMgr.GetRect();
Debug.Log(rect.Left + "," + rect.Top + "," + rect.Right + "," + rect.Bottom);
tmp.text = rect.Left + "," + rect.Top + "," + rect.Right + "," + rect.Bottom;
Debug.Log(Screen.width);
}
tmp2.text = toolMgr.width + "-" + toolMgr.height;
if (Input.GetKeyDown(KeyCode.Escape))
{
can_quit = !can_quit;
}
}
// Update is called once per frame
//void Update()
//{
// if (Input.GetMouseButtonDown(0))
// {
// drag = true;
// }
// if (Input.GetMouseButton(0))
// {
// }
// if (Input.GetMouseButtonUp(0))
// {
// drag = false;
// }
// if(drag)
// {
// toolMgr.Drag();
// }
//}
}