초기커밋
This commit is contained in:
142
ServerCommon/Doc/UserBase/CharacterBaseDoc.cs
Normal file
142
ServerCommon/Doc/UserBase/CharacterBaseDoc.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
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 CharacterBaseAttrib : AttribBase
|
||||
{
|
||||
public class AppearanceProfile
|
||||
{
|
||||
[JsonProperty("basic_style")]
|
||||
public UInt32 BasicStyle { get; set; } = 0;
|
||||
|
||||
[JsonProperty("body_shape")]
|
||||
public UInt32 BodyShape { get; set; } = 0;
|
||||
|
||||
[JsonProperty("hair_style")]
|
||||
public UInt32 HairStyle { get; set; } = 0;
|
||||
|
||||
[JsonProperty("custom_values")]
|
||||
public List<int> CustomValues { get; set; } = new();
|
||||
|
||||
[JsonProperty("is_custom_completed")]
|
||||
public bool IsCustomCompleted { get; set; } = false;
|
||||
|
||||
public void reset()
|
||||
{
|
||||
BasicStyle = 0;
|
||||
BodyShape = 0;
|
||||
HairStyle = 0;
|
||||
CustomValues.Clear();
|
||||
IsCustomCompleted = false;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var clone = new AppearanceProfile();
|
||||
clone.BasicStyle = BasicStyle;
|
||||
clone.BodyShape = BodyShape;
|
||||
clone.HairStyle = HairStyle;
|
||||
clone.CustomValues = CustomValues.Select(x => x).ToList();
|
||||
clone.IsCustomCompleted = IsCustomCompleted;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
public void copyFromAppearanceProfile(CharacterAttribute.AppearanceProfile attribute)
|
||||
{
|
||||
BasicStyle = attribute.BasicStyle;
|
||||
BodyShape = attribute.BodyShape;
|
||||
HairStyle = attribute.HairStyle;
|
||||
CustomValues = attribute.CustomValues.Select(x => x).ToList();
|
||||
IsCustomCompleted = attribute.IsCustomCompleted;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonProperty("character_guid")]
|
||||
public CHARACTER_GUID CharacterGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("user_guid")]
|
||||
public USER_GUID UserGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("state_info")]
|
||||
public EntityStateInfo StateInfo { get; set; } = new EntityStateInfo();
|
||||
|
||||
[JsonProperty("appearance_profile")]
|
||||
public AppearanceProfile ApperanceProfileValue { get; set; } = new();
|
||||
|
||||
|
||||
public CharacterBaseAttrib()
|
||||
: base(typeof(CharacterBaseAttrib).Name)
|
||||
{ }
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// Primary Key
|
||||
// PK(Partition Key) : "character_base#user_guid"
|
||||
// SK(Sort Key) : "character_guid"
|
||||
// CharacterBaseAttrib :
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class CharacterBaseDoc : DynamoDbDocBase
|
||||
{
|
||||
private static string getPrefixOfPK() { return "character_base#"; }
|
||||
private static string getPrefixOfSK() { return ""; }
|
||||
|
||||
public CharacterBaseDoc()
|
||||
: base(typeof(CharacterBaseDoc).Name)
|
||||
{
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public CharacterBaseDoc(USER_GUID userGuid, CHARACTER_GUID characterGuid)
|
||||
: base(typeof(CharacterBaseDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPK(userGuid);
|
||||
setCombinationKeyForSK(characterGuid);
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<CharacterBaseAttrib>());
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return getPrefixOfPK();
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
||||
{
|
||||
getPrimaryKey().fillUpSK(sortKey);
|
||||
setCombinationKeyForSK(sortKey);
|
||||
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user