mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交新概念 Tile从服务器
This commit is contained in:
@@ -20,6 +20,8 @@ namespace JNGame.Sync.State.Tile.Entity.Component
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public IJNTileEntity TileEntity => Entity as IJNTileEntity;
|
||||
|
||||
public virtual void OnTileEnter(){}
|
||||
|
||||
|
@@ -70,9 +70,8 @@ namespace JNGame.Sync.State.Tile.Entity
|
||||
/// <returns></returns>
|
||||
public T[] GetHostEntities()
|
||||
{
|
||||
if (_entitiesCache is null) return Array.Empty<T>();
|
||||
var items = new List<T>();
|
||||
foreach (var item in _entitiesCache)
|
||||
foreach (var item in GetEntities())
|
||||
{
|
||||
if (item.IsHost)
|
||||
{
|
||||
|
@@ -11,9 +11,19 @@ namespace JNGame.Sync.State.Tile.Entity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 是否所属当前区块
|
||||
/// 是否有权限
|
||||
/// </summary>
|
||||
public bool IsHost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否将数据同步到从服务器
|
||||
/// </summary>
|
||||
public bool IsSyncSlave { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否将数据同步到主服务器
|
||||
/// </summary>
|
||||
public bool IsSyncMaster { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 区块同步属性(通过网络同步过来的实体数据)
|
||||
@@ -28,8 +38,21 @@ namespace JNGame.Sync.State.Tile.Entity
|
||||
public abstract class JNTileEntity : JNEntity,IJNTileCycle,IJNTileEntity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 是否有权限
|
||||
/// </summary>
|
||||
public bool IsHost { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否将数据同步到从服务器
|
||||
/// </summary>
|
||||
public bool IsSyncSlave { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否将数据同步到主服务器
|
||||
/// </summary>
|
||||
public bool IsSyncMaster { get; set; } = false;
|
||||
|
||||
public abstract void TileSyncData(ISTileData data);
|
||||
|
||||
//区块生命周期
|
||||
|
@@ -0,0 +1,20 @@
|
||||
namespace JNGame.Sync.State.Tile
|
||||
{
|
||||
|
||||
public enum TileMasterSlaveEnum
|
||||
{
|
||||
Master,
|
||||
Slave,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 瓦片状态同步 : 主从服务器代码
|
||||
/// </summary>
|
||||
public abstract partial class JNSSTileServerService : JNSStateServerService
|
||||
{
|
||||
public abstract TileMasterSlaveEnum MSRole { get; }
|
||||
public bool IsMaster => MSRole == TileMasterSlaveEnum.Master;
|
||||
public bool IsSlave => MSRole == TileMasterSlaveEnum.Slave;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9fc15e9ea9f4f46b05ef0f56aa0423f
|
||||
timeCreated: 1724726167
|
Reference in New Issue
Block a user