We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d8970c8 commit 9ef9f30Copy full SHA for 9ef9f30
1 file changed
GameFrameX.Core/Components/StateComponent.cs
@@ -108,13 +108,26 @@ internal override bool ReadyToInactive
108
get { return State == null || !State.IsModify(); }
109
}
110
111
+ /// <summary>
112
+ /// 激活状态的时候异步读取数据
113
+ /// </summary>
114
+ /// <returns>返回查询的数据结果对象,没有数据返回null</returns>
115
+ protected virtual Task<TState> ActiveReadStateAsync()
116
+ {
117
+ return null;
118
+ }
119
+
120
/// <summary>
121
/// 准备状态
122
/// </summary>
123
/// <returns></returns>
124
public async Task ReadStateAsync()
125
{
- State = await GameDb.FindAsync<TState>(ActorId);
126
+ State = await ActiveReadStateAsync();
127
+ if (State.IsNull())
128
129
+ State = await GameDb.FindAsync<TState>(ActorId);
130
131
132
StateDic.TryRemove(State.Id, out _);
133
StateDic.TryAdd(State.Id, State);
0 commit comments