File tree 1 file changed +14
-1
lines changed
GameFrameX.Core/Components
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -108,13 +108,26 @@ internal override bool ReadyToInactive
108
108
get { return State == null || ! State . IsModify ( ) ; }
109
109
}
110
110
111
+ /// <summary>
112
+ /// 激活状态的时候异步读取数据
113
+ /// </summary>
114
+ /// <returns>返回查询的数据结果对象,没有数据返回null</returns>
115
+ protected virtual Task < TState > ActiveReadStateAsync ( )
116
+ {
117
+ return null ;
118
+ }
119
+
111
120
/// <summary>
112
121
/// 准备状态
113
122
/// </summary>
114
123
/// <returns></returns>
115
124
public async Task ReadStateAsync ( )
116
125
{
117
- State = await GameDb . FindAsync < TState > ( ActorId ) ;
126
+ State = await ActiveReadStateAsync ( ) ;
127
+ if ( State . IsNull ( ) )
128
+ {
129
+ State = await GameDb . FindAsync < TState > ( ActorId ) ;
130
+ }
118
131
119
132
StateDic . TryRemove ( State . Id , out _ ) ;
120
133
StateDic . TryAdd ( State . Id , State ) ;
You can’t perform that action at this time.
0 commit comments