更改了文件结构

This commit is contained in:
CortexCore
2023-09-02 00:51:39 +08:00
parent 5561f5c3cc
commit ebf9c1f526
6446 changed files with 0 additions and 45 deletions

View File

@@ -0,0 +1,78 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UIElements;
// ReSharper disable MemberCanBeProtected.Global
// ReSharper disable ClassWithVirtualMembersNeverInherited.Global
// ReSharper disable UnusedMember.Global
namespace BITKit.UX
{
public class UIToolKitPanel : MonoBehaviour,IUXPanel
{
public UIToolKitPanel()
{
Index = GetType().FullName;
}
[Header(Constant.Header.Components)]
[SerializeField] protected UIDocument document;
[Header(Constant.Header.Settings)]
[SerializeField] private bool isAnimate;
[SerializeField] private bool allowCursor;
[SerializeField] private bool allowInput;
[SerializeField] private bool autoEntry;
public bool IsAnimate => isAnimate;
public bool IsValid => cancellationToken.IsCancellationRequested is false;
public string Index { get; private set; }
public bool AllowCursor => allowCursor;
public bool AllowInput => allowInput;
protected CancellationToken cancellationToken { get; private set; }
protected virtual void Awake()
{
cancellationToken = gameObject.GetCancellationTokenOnDestroy();
Index= typeof(UIToolKitPanel) == GetType() ? gameObject.name : GetType().Name;
}
protected virtual void Start()
{
if(IsValid && autoEntry)
UXService.Entry(this);
}
public void Entry()
{
UXService.Entry(this);
}
protected virtual void OnEnable()=>UXService.Register(this);
protected virtual void OnDisable()=>UXService.UnRegister(this);
void IUXPanel.Entry()
{
OnEntryOrExit(true);
document.rootVisualElement.SetActive(true);
OnEntry?.Invoke();
}
void IUXPanel.Exit()
{
if (IsValid is false) return;
OnEntryOrExit(false);
try
{
document.rootVisualElement.SetActive(false);
}
catch (Exception e)
{
BIT4Log.Warning<UIToolKitPanel>(name);
BIT4Log.LogException(e);
}
OnExit?.Invoke();
}
public event Action OnEntry;
public event Action OnExit;
protected virtual void OnEntryOrExit(bool isEntry)
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b9df4ccf721aaec45a7fadfead86ec48
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: