초기커밋
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class SwitchingPropAction : EntityActionBase
|
||||
{
|
||||
public SwitchingPropAction(EntityBase owner)
|
||||
: base(owner)
|
||||
{ }
|
||||
|
||||
public async override Task<Result> onInit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
var result = new Result();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void onClear()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Result> updateSwitchingProp(QuestTaskUpdateHandler handler, Int32 propId, Int32 propState)
|
||||
{
|
||||
var result = new Result();
|
||||
await Task.CompletedTask;
|
||||
|
||||
var player = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
||||
|
||||
var fn_update_switching_prop = async delegate ()
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
|
||||
var attribute = player.getEntityAttribute<SwitchingPropAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(attribute, () => $"attribute is null !!!");
|
||||
|
||||
attribute.m_switching_props.AddOrUpdate(propId, propState, (key, old) => propState);
|
||||
attribute.modifiedEntityAttribute(true);
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var batch = new QueryBatchEx<QueryRunnerWithDocument>(player, LogActionType.SwitchingProp
|
||||
, server_logic.getDynamoDbClient());
|
||||
{
|
||||
batch.addQuery(new DBQWriteToAttributeAllWithTransactionRunner());
|
||||
}
|
||||
var log_invoker = new SwitchingPropBusinessLog(handler.m_quest_id, propId, propState);
|
||||
batch.appendBusinessLogs(new List<ILogInvoker>(){log_invoker});
|
||||
result = await QueryHelper.sendQueryAndBusinessLog(batch);
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
SwitchingPropHelper.send_GS2C_NTF_SWITCHING_PROP_STATE(player, propId, propState);
|
||||
return result;
|
||||
};
|
||||
|
||||
result = await player.runTransactionRunnerSafely(TransactionIdType.PrivateContents, "SwitchingProp", fn_update_switching_prop);
|
||||
if (result.isFail())
|
||||
{
|
||||
var err_msg = $"Failed to runTransactionRunnerSafely() !!! : {result.toBasicString()} - {player.toBasicString()}";
|
||||
ServerCore.Log.getLogger().error(err_msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user