mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
优化属性更新逻辑
This commit is contained in:
3
JNFrame2/Assets/Scripts/Game/Data/State.meta
Normal file
3
JNFrame2/Assets/Scripts/Game/Data/State.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cecc61f462364f198db69cf70c6c557d
|
||||
timeCreated: 1726941153
|
@@ -10,6 +10,10 @@ using JNGame.Sync.System.Data;
|
||||
|
||||
namespace Game.JNGState.Logic.Data
|
||||
{
|
||||
public enum EDPlayerValueCode : int
|
||||
{
|
||||
Auth = 201
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class EDPlayerValue : GDataValue
|
||||
@@ -46,7 +50,11 @@ namespace Game.JNGState.Logic.Data
|
||||
public override void UData(EDPlayerValue data)
|
||||
{
|
||||
base.UData(data);
|
||||
if (data.Auth is not null) Value.Auth = data.Auth;
|
||||
if (data.Auth is not null)
|
||||
{
|
||||
Value.Auth = data.Auth;
|
||||
WriteUpdate((int)EDPlayerValueCode.Auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,17 +9,41 @@ using JNGame.Sync.System;
|
||||
using JNGame.Sync.System.Data;
|
||||
using Plugins.JNGame.Network.Action;
|
||||
using Plugins.JNGame.Util;
|
||||
using TouchSocket.Core;
|
||||
|
||||
namespace Game.JNGState.Logic.Data
|
||||
{
|
||||
|
||||
public enum GDataValueCode : int
|
||||
{
|
||||
Position = 101
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class GDataValue
|
||||
{
|
||||
public DValuePosition Position = null;
|
||||
}
|
||||
|
||||
public abstract class IGDataBase : ISTileData
|
||||
{
|
||||
|
||||
//计入修改
|
||||
public readonly ConcurrentList<int> WriteCodes = new();
|
||||
|
||||
/// <summary>
|
||||
/// 计入修改
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
public void WriteUpdate(int code)
|
||||
{
|
||||
if (WriteCodes.Contains(code)) return;
|
||||
WriteCodes.Add(code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class GDataBase<Self,T,N> : ISTileData where Self : GDataBase<Self,T,N> where T : GDataValue,new() where N : JNTileEntity
|
||||
public class GDataBase<Self,T,N> : IGDataBase where Self : GDataBase<Self,T,N> where T : GDataValue,new() where N : JNTileEntity
|
||||
{
|
||||
|
||||
public readonly T Value = new ();
|
||||
@@ -93,7 +117,11 @@ namespace Game.JNGState.Logic.Data
|
||||
/// </summary>
|
||||
public virtual void UData(T data)
|
||||
{
|
||||
if (data.Position is not null) Value.Position = data.Position;
|
||||
if (data.Position is not null)
|
||||
{
|
||||
Value.Position = data.Position;
|
||||
WriteUpdate((int)GDataValueCode.Position);
|
||||
}
|
||||
}
|
||||
|
||||
public override LVector3 GetDataPosition()
|
Reference in New Issue
Block a user