111
This commit is contained in:
@@ -5,7 +5,6 @@ using UnityEngine.UI;
|
||||
|
||||
public class DeviceXEventHandler : MonoBehaviour
|
||||
{
|
||||
public static DeviceXEventHandler Global;
|
||||
public bool XBackOrReturn = false;
|
||||
private float pressStartTime;
|
||||
private bool isPressing = false;
|
||||
@@ -31,16 +30,6 @@ public class DeviceXEventHandler : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Global == null)
|
||||
{
|
||||
Global = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(this);
|
||||
return;
|
||||
}
|
||||
|
||||
var deviceXEventPanelHandle = Resources.Load<GameObject>("DeviceXEventPanel");
|
||||
if (deviceXEventPanelHandle)
|
||||
{
|
||||
@@ -63,18 +52,34 @@ public class DeviceXEventHandler : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
StringEventSystem.Global.Register<bool>("X_Button", SetXbutton);
|
||||
StringEventSystem.Global.Register<HierarchyType>("X_SetHierarchyType", SetHierarchyType);
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
StringEventSystem.Global.UnRegister<bool>("X_Button", SetXbutton);
|
||||
StringEventSystem.Global.UnRegister<HierarchyType>("X_ButtonHierarchyType", SetHierarchyType);
|
||||
}
|
||||
|
||||
void SetXbutton(bool isActive)
|
||||
{
|
||||
XBackOrReturn = isActive;
|
||||
}
|
||||
|
||||
private void SetHierarchyType(HierarchyType type)
|
||||
{
|
||||
hierarchyType = type;
|
||||
switch (hierarchyType)
|
||||
{
|
||||
case HierarchyType.Domain:
|
||||
XBackOrReturn = false;
|
||||
break;
|
||||
case HierarchyType.ScenePanel:
|
||||
XBackOrReturn = true;
|
||||
break;
|
||||
case HierarchyType.SceneActive:
|
||||
XBackOrReturn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (XBackOrReturn)
|
||||
@@ -175,14 +180,17 @@ public class DeviceXEventHandler : MonoBehaviour
|
||||
switch (hierarchyType)
|
||||
{
|
||||
case HierarchyType.Domain:
|
||||
XBackOrReturn=false;
|
||||
// 域层级双击逻辑
|
||||
break;
|
||||
case HierarchyType.ScenePanel:
|
||||
// 场景面板层级双击逻辑
|
||||
XBackOrReturn=false;
|
||||
StringEventSystem.Global.Send("Rollback");
|
||||
break;
|
||||
case HierarchyType.SceneActive:
|
||||
// 场景激活层级双击逻辑
|
||||
XBackOrReturn=true;
|
||||
StringEventSystem.Global.Send("UnloadCurrentScene");
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user