110 lines
3.1 KiB
C#
110 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using ServerCore;
|
|
using ServerBase;
|
|
|
|
|
|
using SESSION_ID = System.Int32;
|
|
using META_ID = System.UInt32;
|
|
using ENTITY_GUID = System.String;
|
|
using ACCOUNT_ID = System.String;
|
|
using OWNER_GUID = System.String;
|
|
using USER_GUID = System.String;
|
|
using CHARACTER_GUID = System.String;
|
|
using ITEM_GUID = System.String;
|
|
|
|
|
|
|
|
namespace ServerCommon;
|
|
|
|
public class CustomDefinedUiAttrib : AttribBase
|
|
{
|
|
[JsonProperty("owner_guid")]
|
|
public OWNER_GUID OwnerGuid { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("owner_entity_type")]
|
|
public OwnerEntityType OwnerEntityType { get; set; } = OwnerEntityType.None;
|
|
|
|
[JsonProperty("ui_key")]
|
|
public string UiKey { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("custom_defined_ui")]
|
|
public string CustomDefinedUi { get; set; } = string.Empty;
|
|
|
|
public CustomDefinedUiAttrib()
|
|
: base(typeof(CustomDefinedUiAttrib).Name)
|
|
{ }
|
|
}
|
|
|
|
//=============================================================================================
|
|
// Primary Key
|
|
// PK(Partition Key) : "custom_defined_ui#owner_guid" [owner_guid : user_guid, ugc_npc_meta_guid]
|
|
// SK(Sort Key) : "ui_key#custom_ui_key"
|
|
// DocType : CustomDefinedUiDoc
|
|
// CustomDefinedUiAttrib : {}
|
|
// ...
|
|
//=============================================================================================
|
|
public class CustomDefinedUiDoc : DynamoDbDocBase
|
|
{
|
|
public static string getPrefixOfPK() { return "custom_defined_ui#"; }
|
|
public static string getPrefixOfSK() { return "ui_key#"; }
|
|
|
|
public CustomDefinedUiDoc()
|
|
: base(typeof(CustomDefinedUiDoc).Name)
|
|
{
|
|
appendAttribWrapperAll();
|
|
}
|
|
|
|
public CustomDefinedUiDoc(OwnerEntityType ownerEntityType, string guidOfOwnerEntityType, string uiKey)
|
|
: base(typeof(CustomDefinedUiDoc).Name)
|
|
{
|
|
setCombinationKeyForPK(guidOfOwnerEntityType);
|
|
setCombinationKeyForSK(uiKey);
|
|
|
|
appendAttribWrapperAll();
|
|
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
|
|
var doc_custom_defined_ui_attrib = getAttrib<CustomDefinedUiAttrib>();
|
|
NullReferenceCheckHelper.throwIfNull(doc_custom_defined_ui_attrib, () => $"doc_custom_defined_ui_attrib is null !!!");
|
|
|
|
doc_custom_defined_ui_attrib.OwnerEntityType = ownerEntityType;
|
|
doc_custom_defined_ui_attrib.OwnerGuid = guidOfOwnerEntityType;
|
|
doc_custom_defined_ui_attrib.UiKey = uiKey;
|
|
}
|
|
|
|
private void appendAttribWrapperAll()
|
|
{
|
|
appendAttribWrapper(new AttribWrapper<CustomDefinedUiAttrib>());
|
|
}
|
|
|
|
protected override string onGetPrefixOfPK()
|
|
{
|
|
return getPrefixOfPK();
|
|
}
|
|
|
|
protected override string onGetPrefixOfSK()
|
|
{
|
|
return getPrefixOfSK();
|
|
}
|
|
|
|
protected override string onMakeSK()
|
|
{
|
|
return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}";
|
|
}
|
|
|
|
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
|
{
|
|
getPrimaryKey().fillUpSK(sortKey);
|
|
return ServerErrorCode.Success;
|
|
}
|
|
}
|