feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) + game logic (GameFix/GameDAL/ServerData) + network layer (NetWorkMessage) + data layer (ObjectModel) + utilities (MrWu/Core/Config/CloudAPI/dll) + adapters (zyxAdapter/base) .NET 8.0 C# solution, 16 projects, 958 source files
This commit is contained in:
54
ObjectModel/Game/IGameMapField.cs
Normal file
54
ObjectModel/Game/IGameMapField.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ObjectModel.Game
|
||||
{
|
||||
/// <summary>
|
||||
/// 转换成字段列表
|
||||
/// </summary>
|
||||
public interface IGameMapField
|
||||
{
|
||||
public List<GameMapFieldData> ToFields();
|
||||
}
|
||||
|
||||
public class GameMapFieldData
|
||||
{
|
||||
public string Name; // 字段名称
|
||||
public bool IsSummary; // 需要纳入统计的字段
|
||||
|
||||
public Func<decimal> GetDecimal;
|
||||
public Action<decimal> SetDecimal;
|
||||
|
||||
public Func<int> GetInt;
|
||||
public Action<int> SetInt;
|
||||
|
||||
public Func<string> GetString;
|
||||
public Action<string> SetString;
|
||||
|
||||
public string ParseStringValue()
|
||||
{
|
||||
if (GetString != null) return GetString();
|
||||
if (GetInt != null) return GetInt().ToString();
|
||||
if (GetDecimal != null) return GetDecimal().ToString();
|
||||
return "";
|
||||
}
|
||||
|
||||
public void SetValue(object value)
|
||||
{
|
||||
if (SetDecimal != null)
|
||||
{
|
||||
decimal.TryParse(value.ToString(), out decimal v);
|
||||
SetDecimal(v);
|
||||
}
|
||||
else if (SetInt != null)
|
||||
{
|
||||
int.TryParse(value.ToString(), out int v);
|
||||
SetInt(v);
|
||||
}
|
||||
else if (SetString != null)
|
||||
{
|
||||
SetString(value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user