Skip to content

Commit 76c5325

Browse files
committed
[修改]1. 修改背包数据存档
1 parent 5b66514 commit 76c5325

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

GameFrameX.Apps/Player/Bag/Component/BagComponent.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,4 @@ namespace GameFrameX.Apps.Player.Bag.Component;
1111
[ComponentType(GlobalConst.ActorTypePlayer)]
1212
public sealed class BagComponent : StateComponent<BagState>
1313
{
14-
/// <summary>
15-
/// 修改背包状态
16-
/// </summary>
17-
/// <returns></returns>
18-
/// <exception cref="NotImplementedException"></exception>
19-
public async Task<BagState> Save()
20-
{
21-
await WriteStateAsync();
22-
return State;
23-
}
2414
}

GameFrameX.Hotfix/Logic/Player/Bag/BagComponentAgent.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public async Task<BagState> UpdateChanged(INetWorkChannel netWorkChannel, Dictio
7272

7373

7474
await netWorkChannel.WriteAsync(notifyBagInfoChanged);
75-
var result = await OwnerComponent.Save();
76-
return result;
75+
await OwnerComponent.WriteStateAsync();
76+
return bagState;
7777
}
7878

7979
/// <summary>
@@ -118,15 +118,9 @@ public async Task OnRemoveBagItem(INetWorkChannel netWorkChannel, ReqRemoveItem
118118
}
119119
}
120120

121-
var result = await OwnerComponent.Save();
122-
if (result.IsNull())
123-
{
124-
response.ErrorCode = (int)OperationStatusCode.Unprocessable;
125-
return;
126-
}
121+
await OwnerComponent.WriteStateAsync();
127122
}
128123

129-
130124
/// <summary>
131125
/// 减少背包物品
132126
/// </summary>
@@ -172,13 +166,7 @@ public async Task OnUseBagItem(INetWorkChannel netWorkChannel, ReqUseItem messag
172166
return;
173167
}
174168

175-
176-
var result = await OwnerComponent.Save();
177-
if (result.IsNull())
178-
{
179-
response.ErrorCode = (int)OperationStatusCode.Unprocessable;
180-
return;
181-
}
169+
await OwnerComponent.WriteStateAsync();
182170
}
183171

184172
/// <summary>

0 commit comments

Comments
 (0)