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