mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-25 19:04:43 +00:00
70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using DotRecast.Core.Collections;
|
|
using Game.JNGFrame.Logic.Entity;
|
|
using Game.JNGFrame.Logic.Entity.Contexts;
|
|
using Game.Logic.Entity.Nodes;
|
|
using JNGame.Sync.State.Tile.Entity;
|
|
using JNGame.Sync.System;
|
|
using JNGame.Sync.System.Data;
|
|
|
|
namespace Game.JNGState.Logic.Data
|
|
{
|
|
public enum EDPlayerValueCode : int
|
|
{
|
|
Auth = 201
|
|
}
|
|
|
|
[Serializable]
|
|
public class EDPlayerValue : GDataValue
|
|
{
|
|
public int? Auth = null;
|
|
}
|
|
|
|
public class EDPlayerData : GDataBase<EDPlayerData,EDPlayerValue,EDPlayer>
|
|
{
|
|
public override void BindEntity(JNTileEntity entity)
|
|
{
|
|
base.BindEntity(entity);
|
|
Value.Auth = Node.Controller.Auth;
|
|
}
|
|
|
|
public override bool IsEquals(ISData data)
|
|
{
|
|
var node = data as EDPlayerData;
|
|
if (node is null) return false;
|
|
return base.IsEquals(data) && Value.Auth.Equals(node.Value.Auth);
|
|
}
|
|
|
|
public override void Difference(EDPlayerValue value, EDPlayerValue diff)
|
|
{
|
|
base.Difference(value, diff);
|
|
if (diff.Auth is not null && !Equals(Value.Auth, diff.Auth)) value.Auth = diff.Auth;
|
|
}
|
|
|
|
public override void UData(EDPlayerValue data)
|
|
{
|
|
base.UData(data);
|
|
if (data.Auth is not null)
|
|
{
|
|
Value.Auth = data.Auth;
|
|
WriteUpdate((int)EDPlayerValueCode.Auth);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public class EDPlayerDataSystem : GDataBaseSystem<EDPlayerData,EDPlayerValue,EDPlayer>
|
|
{
|
|
|
|
public EDPlayerDataSystem(SStateDataEnum type) : base(type)
|
|
{
|
|
}
|
|
|
|
public override int NetID => (int)NetDataEnum.EDPlayerData;
|
|
|
|
public override JNTileContext<EDPlayer> NodeContext => Contexts.GetContext<EDPlayerContext>();
|
|
|
|
}
|
|
|
|
} |