2025-01-25 04:38:09 +08:00

79 lines
2.5 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using Thousandto.CoreSDK.Event;
using EventManager = UnityEngine.Gonbest.MagicCube.EventManager;
using EventSystemHandler = UnityEngine.Gonbest.MagicCube.EventSystemHandler;
namespace Thousandto.UpdateForm.Form
{
public class SDKRootScript : MonoBehaviour
{
private static float DURATION = 2.0f;
private float _counter = 0;
private static float _timer;
// private Vector3 _downPos;
//private bool _startCalcTime;
//// Use this for initialization
void Start()
{
//SDKEventManager.SharedInstance.RegFixEventHandle(SDKEventDefine.UI_EVENT_OPEN_UPLOAD_LOG_FORM, OpenLogForm);
//SDKEventManager.SharedInstance.RegFixEventHandle(SDKEventDefine.UI_EVENT_UPLOAD_LOG_FORM_UPDATE, OnUploadLogFormUpdateEvent);
//首先清除TryExitGame,然后注册---在SDKSystem也注册了这个消息
EventManager.SharedInstance.ClearFixEvent(SDKEventDefine.SDK_TRY_EXIT_GAME);
EventManager.SharedInstance.RegFixEventHandle(SDKEventDefine.SDK_TRY_EXIT_GAME, (x, y) => { CoreSDK.FuncellSDK.Instance.ExitGame(); });
Application.quitting -= DoApplicationQuit;
Application.quitting += DoApplicationQuit;
}
// Update is called once per frame
void Update()
{
if ((Input.GetKeyUp(KeyCode.Escape)))
{
EventManager.SharedInstance.PushFixEvent(SDKEventDefine.SDK_TRY_EXIT_GAME);
}
}
/*
private void OpenLogForm(object param)
{
string roleId = param as string;
UIUploadLogForm.Instance.Open(roleId);
}
public static void OnUploadLogFormUpdateEvent(object obj)
{
OnUploadLogFormUpdate();
}
/// <summary>
/// 在需要用到的窗体脚本的update中调用长按5秒
/// </summary>
public static void OnUploadLogFormUpdate()
{
if (Input.GetMouseButton(0))
{
_timer += Time.deltaTime;
if (_timer >= 5)
{
// UIUploadLogForm.Instance.Open();
_timer = 0;
}
}
else
_timer = 0;
}
//在窗体关闭时调用
public static void ResetUploadLogForm()
{
_timer = 0;
}
*/
void DoApplicationQuit()
{
Thousandto.Update.Manager.UpdateManager.Instance.AbortFlows();
}
}
}