Files
caliverse_server/ServerCommon/Doc/UserBase/MinimapMarkerDoc.cs
2025-05-01 07:20:41 +09:00

83 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using ServerCore;
using ServerBase;
using META_ID = System.UInt32;
using OWNER_GUID = System.String;
namespace ServerCommon;
public class MinimapMarkerAttrib : AttribBase
{
[JsonProperty("world_meta_id")]
public META_ID WorldMetaId { get; set; } = 0;
[JsonProperty("marker_pos")]
public Vector3 MarkerPos { get; set; } = new();
public MinimapMarkerAttrib()
: base(typeof(MinimapMarkerAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "minimap_marker#user_guid"
// SK(Sort Key) : "world_meta_id"
// DocType : MinimapMarkerDoc
// MinimapMarkerAttrib : {}
// ...
//=============================================================================================
public class MinimapMarkerDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "minimap_marker#"; }
private static string getPrefixOfSK() { return ""; }
public MinimapMarkerDoc()
: base(typeof(MinimapMarkerDoc).Name)
{
appendAttribWrapperAll();
}
public MinimapMarkerDoc(string userGuid, META_ID worldMetaId)
: base(typeof(MinimapMarkerDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(worldMetaId.ToString());
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<MinimapMarkerAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}