同步移动到示例文件
This commit is contained in:
62
Samples~/ConfigUIElement/Scripts/ConfigButton.cs
Normal file
62
Samples~/ConfigUIElement/Scripts/ConfigButton.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace LRC
|
||||
{
|
||||
public class ConfigButton : ConfigSelectableItem
|
||||
{
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
||||
|
||||
public Button targetButton;
|
||||
|
||||
public override bool AllowInput
|
||||
{
|
||||
get => base.AllowInput;
|
||||
set
|
||||
{
|
||||
if (targetButton != null)
|
||||
targetButton.interactable = !value;
|
||||
base.AllowInput = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ʵ<EFBFBD><EFBFBD>
|
||||
|
||||
protected override void SetValue(object newValue)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public override void RefreshValueWithoutEvent(object newValue, bool forceSet = false)
|
||||
{
|
||||
base.RefreshValueWithoutEvent(newValue, forceSet);
|
||||
}
|
||||
|
||||
private bool _doOnce = false;
|
||||
protected override void Initialization_ChildConstruction(UIBehaviour component)
|
||||
{
|
||||
base.Initialization_ChildConstruction(component);
|
||||
|
||||
var name = component.transform.name;
|
||||
if (name is not "button") return;
|
||||
if (_doOnce)
|
||||
{
|
||||
Debug.LogError("<22><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>飺" + name);
|
||||
return;
|
||||
}
|
||||
if (component is Button button)
|
||||
{
|
||||
_doOnce = true;
|
||||
if (targetButton != null)
|
||||
targetButton = button;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user