您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
58 行
1.6 KiB
58 行
1.6 KiB
using System;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.Experimental.Rendering.Universal.Path2D.GUIFramework
|
|
{
|
|
internal class GenericDefaultControl : DefaultControl
|
|
{
|
|
public Func<IGUIState, Vector3> position;
|
|
public Func<IGUIState, Vector3> forward;
|
|
public Func<IGUIState, Vector3> up;
|
|
public Func<IGUIState, Vector3> right;
|
|
public Func<IGUIState, object> userData = null;
|
|
|
|
public GenericDefaultControl(string name) : base(name)
|
|
{
|
|
}
|
|
|
|
protected override Vector3 GetPosition(IGUIState guiState, int index)
|
|
{
|
|
if (position != null)
|
|
return position(guiState);
|
|
|
|
return base.GetPosition(guiState, index);
|
|
}
|
|
|
|
protected override Vector3 GetForward(IGUIState guiState, int index)
|
|
{
|
|
if (forward != null)
|
|
return forward(guiState);
|
|
|
|
return base.GetForward(guiState, index);
|
|
}
|
|
|
|
protected override Vector3 GetUp(IGUIState guiState, int index)
|
|
{
|
|
if (up != null)
|
|
return up(guiState);
|
|
|
|
return base.GetUp(guiState, index);
|
|
}
|
|
|
|
protected override Vector3 GetRight(IGUIState guiState, int index)
|
|
{
|
|
if (right != null)
|
|
return right(guiState);
|
|
|
|
return base.GetRight(guiState, index);
|
|
}
|
|
|
|
protected override object GetUserData(IGUIState guiState, int index)
|
|
{
|
|
if (userData != null)
|
|
return userData(guiState);
|
|
|
|
return base.GetUserData(guiState, index);
|
|
}
|
|
}
|
|
}
|