隐藏和返回功能
This commit is contained in:
parent
194672f17c
commit
d101ab8565
@ -3,7 +3,6 @@ using QFramework.Example;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using XMLTool;
|
||||
@ -29,6 +28,8 @@ public class Body3DController : MonoSingleton<Body3DController>
|
||||
|
||||
public Status status = Status.Normal;
|
||||
private Vector2 mouseDownPosition; // ¼Ç¼Êó±ê°´ÏÂʱµÄλÖÃ
|
||||
|
||||
Stack<GameObject> activeObjs = new Stack<GameObject>();
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
base.OnSingletonInit();
|
||||
@ -75,6 +76,8 @@ public class Body3DController : MonoSingleton<Body3DController>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetStatus(Status status, bool isAdd)
|
||||
{
|
||||
if (isAdd)
|
||||
@ -92,7 +95,21 @@ public class Body3DController : MonoSingleton<Body3DController>
|
||||
return (this.status & status) == status;
|
||||
}
|
||||
|
||||
|
||||
public void AddActiveObj(GameObject obj)
|
||||
{
|
||||
activeObjs.Push(obj);
|
||||
}
|
||||
public GameObject PopActiveObj()
|
||||
{
|
||||
if (activeObjs.Count > 0)
|
||||
{
|
||||
return activeObjs.Pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Active(bool isActive)
|
||||
{
|
||||
|
||||
@ -39,6 +39,7 @@ public class Body3DOjbItem : MonoBehaviour
|
||||
if (isOn == true)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
Body3DController.Instance.AddActiveObj(gameObject);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -33,7 +33,7 @@ namespace QFramework.Example
|
||||
|
||||
ActiveBack.onClick.AddListener(() =>
|
||||
{
|
||||
|
||||
Body3DController.Instance.PopActiveObj()?.gameObject.SetActive(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user