Files
hjha-server/ObjectModel/Game/IGameMapField.cs
xiaoou e9616125ce 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
2026-07-07 12:02:15 +08:00

54 lines
1.4 KiB
C#

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());
}
}
}
}