초기커밋
This commit is contained in:
96
ServerCommon/Doc/OwnerContents/EndQuestDoc.cs
Normal file
96
ServerCommon/Doc/OwnerContents/EndQuestDoc.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using ServerBase;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
|
||||
public class EndQuestAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty("quest_id")]
|
||||
public UInt32 m_quest_id { get; set; } = 0;
|
||||
[JsonProperty("quest_revision")]
|
||||
public UInt32 m_quest_revision { get; set; } = 0;
|
||||
|
||||
[JsonProperty("end_count")]
|
||||
public Int32 m_end_count { get; set; } = 0;
|
||||
[JsonProperty("last_end_time")]
|
||||
public DateTime m_last_end_time { get; set; } = new();
|
||||
|
||||
public EndQuestAttrib()
|
||||
: base(typeof(EndQuestAttrib).Name)
|
||||
{ }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "end_quest#owner_guid"
|
||||
// SK(Sort Key) : "quest_id"
|
||||
// DocType : EndQuestDoc
|
||||
// EndQuestAttrib : {}
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class EndQuestDoc : DynamoDbDocBase
|
||||
{
|
||||
public EndQuestDoc(string ownerGuid, UInt32 questId, UInt32 questRevision)
|
||||
: base(typeof(EndQuestDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPK(ownerGuid);
|
||||
setCombinationKeyForSK(maskEndQuestSKString(questId, questRevision));
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
appendAttribWrapper(new AttribWrapper<EndQuestAttrib>());
|
||||
}
|
||||
|
||||
public EndQuestDoc()
|
||||
: base(typeof(EndQuestDoc).Name)
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<EndQuestAttrib>());
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return "end_quest#";
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfSK()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
protected override string onMakePK()
|
||||
{
|
||||
return $"{onGetPrefixOfPK()}{getCombinationKeyForPK()}";
|
||||
}
|
||||
|
||||
protected override string onMakeSK()
|
||||
{
|
||||
return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}";
|
||||
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetPK(string pk)
|
||||
{
|
||||
getPrimaryKey().fillUpPK(pk);
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
||||
{
|
||||
getPrimaryKey().fillUpSK(sortKey);
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
|
||||
public static string maskEndQuestSKString(UInt32 questId, UInt32 questRevision)
|
||||
{
|
||||
return $"{questId}#{questRevision}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user