mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
GUI rearrangement
This commit is contained in:
parent
04f8c6a2e4
commit
2e50221118
90 changed files with 435 additions and 1440 deletions
43
Assets/Scripts/GUI/DropdownMenu.cs
Normal file
43
Assets/Scripts/GUI/DropdownMenu.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class DropdownMenu : MonoBehaviour, IDeselectHandler
|
||||
{
|
||||
public Transform dropdownMenu;
|
||||
|
||||
public void OpenMenu()
|
||||
{
|
||||
dropdownMenu.gameObject.SetActive(true);
|
||||
EventSystem.current.SetSelectedGameObject(this.gameObject);
|
||||
}
|
||||
|
||||
public void CloseMenu()
|
||||
{
|
||||
if (EventSystem.current.currentSelectedGameObject != null)
|
||||
{
|
||||
Transform child = transform.FindDeepChild(EventSystem.current.currentSelectedGameObject.name);
|
||||
|
||||
if (child != null)
|
||||
{
|
||||
EventSystem.current.SetSelectedGameObject(this.gameObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dropdownMenu.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnDeselect(BaseEventData eventData)
|
||||
{
|
||||
Invoke("CloseMenu", 0.15f);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue