2024-08-17 14:27:18 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DotRecast.Core.Collections;
|
|
|
|
|
using Entitas;
|
|
|
|
|
using Game.JNGFrame.Logic.Entity;
|
|
|
|
|
using Game.JNGFrame.Logic.Entity.Contexts;
|
|
|
|
|
using JNGame.Math;
|
|
|
|
|
using JNGame.Sync.State.Tile.Entity;
|
|
|
|
|
using JNGame.Sync.System;
|
|
|
|
|
using JNGame.Sync.System.Data;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Game.JNGState.Logic.Data
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
2024-08-22 20:37:39 +08:00
|
|
|
|
public class EDPlayerValue : GDataValue
|
2024-08-17 14:27:18 +08:00
|
|
|
|
{
|
|
|
|
|
public int? Auth = null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-22 20:37:39 +08:00
|
|
|
|
public class EDPlayerData : GDataBase<EDPlayerData,EDPlayerValue,EDPlayer>
|
2024-08-17 14:27:18 +08:00
|
|
|
|
{
|
|
|
|
|
public EDPlayerData()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-22 20:37:39 +08:00
|
|
|
|
public EDPlayerData(EDPlayer node) : base(node)
|
|
|
|
|
{
|
2024-08-17 14:27:18 +08:00
|
|
|
|
Value.Auth = node.Controller.Auth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool IsEquals(ISData data)
|
|
|
|
|
{
|
|
|
|
|
var node = data as EDPlayerData;
|
|
|
|
|
if (node is null) return false;
|
2024-08-22 20:37:39 +08:00
|
|
|
|
return base.IsEquals(data) && Value.Auth.Equals(node.Value.Auth);
|
2024-08-17 14:27:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-22 20:37:39 +08:00
|
|
|
|
public override EDPlayerValue GetDifference(ISData diffValue = null)
|
2024-08-17 14:27:18 +08:00
|
|
|
|
{
|
|
|
|
|
var diff = diffValue as EDPlayerData;
|
2024-08-22 20:37:39 +08:00
|
|
|
|
var value = base.GetDifference(diffValue);
|
|
|
|
|
if (value is null || diff is null) return null;
|
2024-08-17 14:27:18 +08:00
|
|
|
|
|
|
|
|
|
if (diff.Value.Auth is not null) value.Auth = diff.Value.Auth;
|
|
|
|
|
|
2024-08-22 20:37:39 +08:00
|
|
|
|
return value;
|
2024-08-17 14:27:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-22 20:37:39 +08:00
|
|
|
|
public override void UData(EDPlayerValue data)
|
2024-08-17 14:27:18 +08:00
|
|
|
|
{
|
2024-08-22 20:37:39 +08:00
|
|
|
|
base.UData(data);
|
|
|
|
|
if (data.Auth is not null) Value.Auth = data.Auth;
|
2024-08-17 14:27:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-22 20:37:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class EDPlayerDataSystem : GDataBaseSystem<EDPlayerData,EDPlayer>
|
2024-08-17 14:27:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public EDPlayerDataSystem(SStateDataEnum type) : base(type)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int NetID => (int)NetDataEnum.EDPlayerData;
|
|
|
|
|
|
|
|
|
|
public override JNTileContext<EDPlayer> NodeContext => Contexts.GetContext<EDPlayerContext>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override Dictionary<long, EDPlayerData> GetLatest()
|
|
|
|
|
{
|
|
|
|
|
var nodes = new Dictionary<long, EDPlayerData>();
|
|
|
|
|
NodeContext.GetEntities().ForEach(child =>
|
|
|
|
|
{
|
|
|
|
|
nodes.Add(child.Id,new EDPlayerData(child));
|
|
|
|
|
});
|
|
|
|
|
return nodes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|