mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
规范化protected的Fields 命名规范。
protected一定程度上与private类似,外部无法访问。
This commit is contained in:
@@ -35,17 +35,17 @@ namespace GameLogic
|
||||
/// <summary>
|
||||
/// 所属UI父节点。
|
||||
/// </summary>
|
||||
protected UIBase parent = null;
|
||||
protected UIBase _parent = null;
|
||||
|
||||
/// <summary>
|
||||
/// UI父节点。
|
||||
/// </summary>
|
||||
public UIBase Parent => parent;
|
||||
public UIBase Parent => _parent;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义数据集。
|
||||
/// </summary>
|
||||
protected System.Object[] userDatas;
|
||||
protected System.Object[] _userDatas;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义数据。
|
||||
@@ -54,9 +54,9 @@ namespace GameLogic
|
||||
{
|
||||
get
|
||||
{
|
||||
if (userDatas != null && userDatas.Length >= 1)
|
||||
if (_userDatas != null && _userDatas.Length >= 1)
|
||||
{
|
||||
return userDatas[0];
|
||||
return _userDatas[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -68,21 +68,24 @@ namespace GameLogic
|
||||
/// <summary>
|
||||
/// 自定义数据集。
|
||||
/// </summary>
|
||||
public System.Object[] UserDatas => userDatas;
|
||||
public System.Object[] UserDatas => _userDatas;
|
||||
|
||||
/// <summary>
|
||||
/// 窗口的实例资源对象。
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public virtual GameObject gameObject { protected set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 窗口位置组件。
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public virtual Transform transform { protected set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 窗口矩阵位置组件。
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public virtual RectTransform rectTransform { protected set; get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -98,17 +101,17 @@ namespace GameLogic
|
||||
/// <summary>
|
||||
/// UI子组件列表。
|
||||
/// </summary>
|
||||
public List<UIWidget> ListChild = new List<UIWidget>();
|
||||
internal readonly List<UIWidget> ListChild = new List<UIWidget>();
|
||||
|
||||
/// <summary>
|
||||
/// 存在Update更新的UI子组件列表。
|
||||
/// </summary>
|
||||
protected List<UIWidget> ListUpdateChild = null;
|
||||
protected List<UIWidget> _listUpdateChild = null;
|
||||
|
||||
/// <summary>
|
||||
/// 是否持有Update行为。
|
||||
/// </summary>
|
||||
protected bool UpdateListValid = false;
|
||||
protected bool _updateListValid = false;
|
||||
|
||||
/// <summary>
|
||||
/// 代码自动生成绑定。
|
||||
@@ -139,23 +142,23 @@ namespace GameLogic
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗口刷新
|
||||
/// 窗口刷新。
|
||||
/// </summary>
|
||||
protected virtual void OnRefresh()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否需要Update
|
||||
/// 是否需要Update。
|
||||
/// </summary>
|
||||
protected bool HasOverrideUpdate = true;
|
||||
protected bool _hasOverrideUpdate = true;
|
||||
|
||||
/// <summary>
|
||||
/// 窗口更新
|
||||
/// 窗口更新。
|
||||
/// </summary>
|
||||
protected virtual void OnUpdate()
|
||||
{
|
||||
HasOverrideUpdate = false;
|
||||
_hasOverrideUpdate = false;
|
||||
}
|
||||
|
||||
internal void CallDestroy()
|
||||
@@ -164,7 +167,7 @@ namespace GameLogic
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗口销毁
|
||||
/// 窗口销毁。
|
||||
/// </summary>
|
||||
protected virtual void OnDestroy()
|
||||
{
|
||||
@@ -186,7 +189,7 @@ namespace GameLogic
|
||||
|
||||
internal void SetUpdateDirty()
|
||||
{
|
||||
UpdateListValid = false;
|
||||
_updateListValid = false;
|
||||
if (Parent != null)
|
||||
{
|
||||
Parent.SetUpdateDirty();
|
||||
|
@@ -39,7 +39,7 @@ namespace GameLogic
|
||||
{
|
||||
get
|
||||
{
|
||||
var parentUI = base.parent;
|
||||
var parentUI = base._parent;
|
||||
while (parentUI != null)
|
||||
{
|
||||
if (parentUI.Type == UIType.Window)
|
||||
@@ -78,15 +78,15 @@ namespace GameLogic
|
||||
List<UIWidget> listNextUpdateChild = null;
|
||||
if (ListChild != null && ListChild.Count > 0)
|
||||
{
|
||||
listNextUpdateChild = ListUpdateChild;
|
||||
var updateListValid = UpdateListValid;
|
||||
listNextUpdateChild = _listUpdateChild;
|
||||
var updateListValid = _updateListValid;
|
||||
List<UIWidget> listChild = null;
|
||||
if (!updateListValid)
|
||||
{
|
||||
if (listNextUpdateChild == null)
|
||||
{
|
||||
listNextUpdateChild = new List<UIWidget>();
|
||||
ListUpdateChild = listNextUpdateChild;
|
||||
_listUpdateChild = listNextUpdateChild;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -119,16 +119,16 @@ namespace GameLogic
|
||||
|
||||
if (!updateListValid)
|
||||
{
|
||||
UpdateListValid = true;
|
||||
_updateListValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool needUpdate = false;
|
||||
if (listNextUpdateChild is not { Count: > 0 })
|
||||
{
|
||||
HasOverrideUpdate = true;
|
||||
_hasOverrideUpdate = true;
|
||||
OnUpdate();
|
||||
needUpdate = HasOverrideUpdate;
|
||||
needUpdate = _hasOverrideUpdate;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -206,7 +206,7 @@ namespace GameLogic
|
||||
}
|
||||
|
||||
RestChildCanvas(parentUI);
|
||||
parent = parentUI;
|
||||
_parent = parentUI;
|
||||
Parent.ListChild.Add(this);
|
||||
Parent.SetUpdateDirty();
|
||||
ScriptGenerator();
|
||||
@@ -301,9 +301,9 @@ namespace GameLogic
|
||||
/// </summary>
|
||||
public void Destroy()
|
||||
{
|
||||
if (parent != null)
|
||||
if (_parent != null)
|
||||
{
|
||||
parent.ListChild.Remove(this);
|
||||
_parent.ListChild.Remove(this);
|
||||
OnDestroy();
|
||||
OnDestroyWidget();
|
||||
}
|
||||
|
@@ -20,13 +20,13 @@ namespace GameLogic
|
||||
|
||||
private Canvas _canvas;
|
||||
|
||||
protected Canvas Canvas => _canvas;
|
||||
public Canvas Canvas => _canvas;
|
||||
|
||||
private Canvas[] _childCanvas;
|
||||
|
||||
private GraphicRaycaster _raycaster;
|
||||
|
||||
protected GraphicRaycaster GraphicRaycaster => _raycaster;
|
||||
public GraphicRaycaster GraphicRaycaster => _raycaster;
|
||||
|
||||
private GraphicRaycaster[] _childRaycaster;
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace GameLogic
|
||||
internal void TryInvoke(System.Action<UIWindow> prepareCallback, System.Object[] userDatas)
|
||||
{
|
||||
CancelHideToCloseTimer();
|
||||
base.userDatas = userDatas;
|
||||
base._userDatas = userDatas;
|
||||
if (IsPrepare)
|
||||
{
|
||||
prepareCallback?.Invoke(this);
|
||||
@@ -247,7 +247,7 @@ namespace GameLogic
|
||||
internal async UniTaskVoid InternalLoad(string location, Action<UIWindow> prepareCallback, bool isAsync, System.Object[] userDatas)
|
||||
{
|
||||
_prepareCallback = prepareCallback;
|
||||
this.userDatas = userDatas;
|
||||
this._userDatas = userDatas;
|
||||
if (!FromResources)
|
||||
{
|
||||
if (isAsync)
|
||||
@@ -295,15 +295,15 @@ namespace GameLogic
|
||||
List<UIWidget> listNextUpdateChild = null;
|
||||
if (ListChild != null && ListChild.Count > 0)
|
||||
{
|
||||
listNextUpdateChild = ListUpdateChild;
|
||||
var updateListValid = UpdateListValid;
|
||||
listNextUpdateChild = _listUpdateChild;
|
||||
var updateListValid = _updateListValid;
|
||||
List<UIWidget> listChild = null;
|
||||
if (!updateListValid)
|
||||
{
|
||||
if (listNextUpdateChild == null)
|
||||
{
|
||||
listNextUpdateChild = new List<UIWidget>();
|
||||
ListUpdateChild = listNextUpdateChild;
|
||||
_listUpdateChild = listNextUpdateChild;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -336,16 +336,16 @@ namespace GameLogic
|
||||
|
||||
if (!updateListValid)
|
||||
{
|
||||
UpdateListValid = true;
|
||||
_updateListValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool needUpdate = false;
|
||||
if (listNextUpdateChild == null || listNextUpdateChild.Count <= 0)
|
||||
{
|
||||
HasOverrideUpdate = true;
|
||||
_hasOverrideUpdate = true;
|
||||
OnUpdate();
|
||||
needUpdate = HasOverrideUpdate;
|
||||
needUpdate = _hasOverrideUpdate;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user