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:
2026-07-07 12:02:15 +08:00
commit e9616125ce
958 changed files with 158203 additions and 0 deletions

79
.editorconfig Normal file
View File

@ -0,0 +1,79 @@
[*]
charset = utf-8-bom
end_of_line = crlf
trim_trailing_whitespace = false
insert_final_newline = false
indent_style = space
indent_size = 4
# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
dotnet_naming_rule.property_rule.import_to_resharper = as_predefined
dotnet_naming_rule.property_rule.resharper_style = AaBb, aaBb
dotnet_naming_rule.property_rule.severity = warning
dotnet_naming_rule.property_rule.style = upper_camel_case_style
dotnet_naming_rule.property_rule.symbols = property_symbols
dotnet_naming_rule.type_parameters_rule.import_to_resharper = as_predefined
dotnet_naming_rule.type_parameters_rule.severity = warning
dotnet_naming_rule.type_parameters_rule.style = upper_camel_case_style
dotnet_naming_rule.type_parameters_rule.symbols = type_parameters_symbols
dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
dotnet_naming_rule.unity_serialized_field_rule.severity = warning
dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style
dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
dotnet_naming_symbols.property_symbols.applicable_accessibilities = *
dotnet_naming_symbols.property_symbols.applicable_kinds = property
dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = *
dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# ReSharper properties
resharper_autodetect_indent_settings = true
resharper_formatter_off_tag = @formatter:off
resharper_formatter_on_tag = @formatter:on
resharper_formatter_tags_enabled = true
resharper_indent_preprocessor_directives = normal
resharper_use_indent_from_vs = false
# ReSharper inspection severities
resharper_arrange_redundant_parentheses_highlighting = hint
resharper_arrange_this_qualifier_highlighting = hint
resharper_arrange_type_member_modifiers_highlighting = hint
resharper_arrange_type_modifiers_highlighting = hint
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
resharper_built_in_type_reference_style_highlighting = hint
resharper_redundant_base_qualifier_highlighting = warning
resharper_suggest_var_or_type_built_in_types_highlighting = hint
resharper_suggest_var_or_type_elsewhere_highlighting = hint
resharper_suggest_var_or_type_simple_types_highlighting = hint
resharper_web_config_module_not_resolved_highlighting = warning
resharper_web_config_type_not_resolved_highlighting = warning
resharper_web_config_wrong_module_highlighting = warning
[*.{appxmanifest,asax,ascx,aspx,axaml,build,c,c++,cc,cginc,compute,cp,cpp,cs,cshtml,cu,cuh,cxx,dtd,fs,fsi,fsscript,fsx,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,hxx,inc,inl,ino,ipp,ixx,master,ml,mli,mpp,mq4,mq5,mqh,nuspec,paml,razor,resw,resx,shader,skin,tpp,usf,ush,vb,xaml,xamlx,xoml,xsd}]
indent_style = space
indent_size = 4
tab_width = 4

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
# Backup zip archive - do not commit
hjha_Server.zip
# .NET build outputs
bin/
obj/
*.user
*.suo
*.vs/
.vs/
# Rider
.idea/
*.sln.DotSettings.user

View File

@ -0,0 +1,14 @@
namespace Cloud.Alibaba
{
public enum Account
{
/// <summary>
/// OSS 的账号
/// </summary>
Oss,
/// <summary>
/// ECS 的账号
/// </summary>
Ecs
}
}

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.IO;
using Cloud.Alibaba.Oss;
namespace Cloud.Alibaba
{
/// <summary>
/// 账号配置
/// </summary>
public class AccountConfig
{
public readonly string AccessKey;
public readonly string SecretKey;
private static readonly Dictionary<Account,AccountConfig> Configs = new Dictionary<Account, AccountConfig>();
static AccountConfig()
{
Configs.Add(Account.Oss, new AccountConfig("ALIBABA_CLOUD_ACCESS_KEY_ID","ALIBABA_CLOUD_ACCESS_KEY_SECRET","aliyun.config"));
Configs.Add(Account.Ecs, new AccountConfig("ALIBABA_CLOUD_ACCESS_KEY_ID_ECS","ALIBABA_CLOUD_ACCESS_KEY_SECRET_ECS","ecsaliyun.config"));
}
public AccountConfig(string environmentAccessKey,string environmentSecretKey,string fileConfig)
{
string ak = EnvironmentVariableHelper.GetEnvironmentVariable(environmentAccessKey);
string sk = EnvironmentVariableHelper.GetEnvironmentVariable(environmentSecretKey);
if ((string.IsNullOrEmpty(ak) || string.IsNullOrEmpty(sk)) && File.Exists(fileConfig))
{
string[] accessContent = File.ReadAllLines(fileConfig);
ak = accessContent[0];
sk = accessContent[1];
}
AccessKey = ak;
SecretKey = sk;
}
public static AccountConfig GetConfig(Account account)
{
return Configs[account];
}
}
}

View File

@ -0,0 +1,10 @@
namespace Cloud.Alibaba.Oss
{
public enum Bucket
{
B8880666,
B8880666s,
HJHAManager,
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using Aliyun.OSS;
using Aliyun.OSS.Common;
using PutObjectRequest = Aliyun.OSS.PutObjectRequest;
#if UNITY_EDITOR
using UnityEngine.Networking;
#else
using System.Web;
#endif
namespace Cloud.Alibaba.Oss
{
public static class OSSHelper
{
public static bool PutObject(Bucket bucket, string key, string content, Account account = Account.Oss)
{
return true;
}
}
}

View File

@ -0,0 +1,37 @@
using System.Collections.Concurrent;
using Aliyun.Api.LogService;
using Cloud.Alibaba.Oss;
namespace Cloud.Alibaba.Sls
{
public class ClientManager
{
private static readonly ConcurrentDictionary<string, ILogServiceClient> ClientCache = new ConcurrentDictionary<string, ILogServiceClient>();
public static ILogServiceClient GetClient(Account account, SlsProject project)
{
string cacheKey = GetCacheKey(account, project);
ILogServiceClient result = ClientCache.GetOrAdd(cacheKey, (key) =>
{
AccountConfig accountConfig = AccountConfig.GetConfig(account);
SlsProjectConfig projectConfig = SlsProjectConfig.GetConfig(project);
return LogServiceClientBuilders.HttpBuilder
.Endpoint(projectConfig.Endpoint, projectConfig.ProjectName)
.Credential(accountConfig.AccessKey, accountConfig.SecretKey)
.Build();
});
return result;
}
private static string GetCacheKey(Account account, SlsProject project)
{
return $"{account}_{project}";
}
}
}

View File

@ -0,0 +1,15 @@
namespace Cloud.Alibaba.Sls
{
public enum SlsProject
{
/// <summary>
/// 客户端日志
/// </summary>
ClientLog,
/// <summary>
/// 服务器日志
/// </summary>
ServerLog,
}
}

View File

@ -0,0 +1,34 @@
using System.Collections.Generic;
namespace Cloud.Alibaba.Sls
{
public class SlsProjectConfig
{
public readonly string ProjectName;
public readonly string Endpoint;
public SlsProjectConfig(string projectName, string endpoint)
{
ProjectName = projectName;
Endpoint = endpoint;
}
private static readonly Dictionary<SlsProject, SlsProjectConfig> SlsProjectConfigs =
new Dictionary<SlsProject, SlsProjectConfig>();
static SlsProjectConfig()
{
SlsProjectConfigs.Add(SlsProject.ClientLog, new SlsProjectConfig("hjhaGame", "cn-hangzhou.log.aliyuncs.com"));
SlsProjectConfigs.Add(SlsProject.ServerLog, new SlsProjectConfig("hjha-game", "cn-hangzhou.log.aliyuncs.com"));
}
public static SlsProjectConfig GetConfig(SlsProject project)
{
return SlsProjectConfigs[project];
}
}
}

View File

@ -0,0 +1,24 @@
using System;
namespace Cloud
{
public static class EnvironmentVariableHelper
{
public static string GetEnvironmentVariable(string name)
{
string value = Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.User);
if (!string.IsNullOrEmpty(value))
{
return value;
}
value = Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Machine);
if (!string.IsNullOrEmpty(value))
{
return value;
}
return Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process);
}
}
}

32
CloudAPI/Cloud/Log.cs Normal file
View File

@ -0,0 +1,32 @@
namespace Cloud
{
public static class Log
{
public static void Debug(string msg)
{
#if UNITY_EDITOR
UnityEngine.Debug.Log(msg);
#else
MrWu.Debug.Debug.Info(msg);
#endif
}
public static void Warning(string msg)
{
#if UNITY_EDITOR
UnityEngine.Debug.LogWarning(msg);
#else
MrWu.Debug.Debug.Warning(msg);
#endif
}
public static void Error(string msg)
{
#if UNITY_EDITOR
UnityEngine.Debug.LogError(msg);
#else
MrWu.Debug.Debug.Error(msg);
#endif
}
}
}

71
CloudAPI/CloudAPI.csproj Normal file
View File

@ -0,0 +1,71 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<RootNamespace>CloudAPI</RootNamespace>
<AssemblyName>CloudAPI</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aliyun.OSS.SDK" />
<PackageReference Include="AlibabaCloud.EndpointUtil" />
<PackageReference Include="AlibabaCloud.GatewaySpi" />
<PackageReference Include="AlibabaCloud.OpenApiClient" />
<PackageReference Include="AlibabaCloud.OpenApiUtil" />
<PackageReference Include="AlibabaCloud.SDK.Dypnsapi20170525" />
<PackageReference Include="AlibabaCloud.TeaUtil" />
<PackageReference Include="AlibabaCloud.TeaXML" />
<PackageReference Include="Aliyun.Credentials" />
<PackageReference Include="Tea" />
<PackageReference Include="HuaweiCloud.SDK.Core" />
<PackageReference Include="HuaweiCloud.SDK.Cdn" />
<PackageReference Include="System.Memory" />
</ItemGroup>
<!-- <ItemGroup>-->
<!-- <Compile Include="..\..\hjha_Client\Assets\ScriptCode\Editor\Cloud\**\*.cs">-->
<!-- <Link>Cloud\%(RecursiveDir)%(Filename)%(Extension)</Link>-->
<!-- </Compile>-->
<!-- </ItemGroup>-->
<ItemGroup>
<Reference Include="Aliyun.Api.LogService">
<HintPath>..\dll\Aliyun.Api.LogService.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MrWu\MrWu.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Cloud\Huawei\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CloudAPI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CloudAPI")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ABEDE08A-A2A2-43C9-8C06-220F4C86D00C")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,116 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class CastlesConfig : Luban.BeanBase
{
public CastlesConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
GameId = _buf.ReadInt();
CastleId = _buf.ReadInt();
BeiLv = _buf.ReadInt();
MinMoney = _buf.ReadInt();
MaxMoney = _buf.ReadInt();
Tax = _buf.ReadInt();
RaceTax = _buf.ReadInt();
Exp = _buf.ReadInt();
ScoreMultiple = _buf.ReadInt();
CanSaiJuanReward = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Tings = new int[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { int __e0;__e0 = _buf.ReadInt(); Tings[__index0] = __e0;}}
Queuetag = _buf.ReadString();
}
public static CastlesConfig DeserializeCastlesConfig(ByteBuf _buf)
{
return new CastlesConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 服务器id
/// </summary>
public readonly int GameId;
/// <summary>
/// 城堡id
/// </summary>
public readonly int CastleId;
/// <summary>
/// 倍率
/// </summary>
public readonly int BeiLv;
/// <summary>
/// 最小金币数额
/// </summary>
public readonly int MinMoney;
/// <summary>
/// 最大金币数额
/// </summary>
public readonly int MaxMoney;
/// <summary>
/// 税收
/// </summary>
public readonly int Tax;
/// <summary>
/// 比赛税收
/// </summary>
public readonly int RaceTax;
/// <summary>
/// 经验加成
/// </summary>
public readonly int Exp;
/// <summary>
/// 比赛积分比例
/// </summary>
public readonly int ScoreMultiple;
/// <summary>
/// 参赛券奖励
/// </summary>
public readonly int CanSaiJuanReward;
/// <summary>
/// 拥有的厅
/// </summary>
public readonly int[] Tings;
/// <summary>
/// 排队标记<br/>(标记相同的房间可以排队在一起)
/// </summary>
public readonly string Queuetag;
public const int __ID__ = -1352367747;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "gameId:" + GameId + ","
+ "castleId:" + CastleId + ","
+ "beiLv:" + BeiLv + ","
+ "minMoney:" + MinMoney + ","
+ "maxMoney:" + MaxMoney + ","
+ "tax:" + Tax + ","
+ "raceTax:" + RaceTax + ","
+ "exp:" + Exp + ","
+ "scoreMultiple:" + ScoreMultiple + ","
+ "canSaiJuanReward:" + CanSaiJuanReward + ","
+ "tings:" + Luban.StringUtil.CollectionToString(Tings) + ","
+ "queuetag:" + Queuetag + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class CastlesConfigCategory : ConfigSingleton<CastlesConfigCategory>
{
public const string TableName = Tables.CastlesConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, CastlesConfig> _dataMap;
private readonly System.Collections.Generic.List<CastlesConfig> _dataList;
public CastlesConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, CastlesConfig>();
_dataList = new System.Collections.Generic.List<CastlesConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<CastlesConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
CastlesConfig _v;
_v = CastlesConfig.DeserializeCastlesConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, CastlesConfig> DataMap => _dataMap;
public System.Collections.Generic.List<CastlesConfig> DataList => _dataList;
public CastlesConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public CastlesConfig Get(int key) => _dataMap[key];
public CastlesConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

110
Config/Code/ConstConfig.cs Normal file
View File

@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class ConstConfig : Luban.BeanBase
{
public ConstConfig(ByteBuf _buf)
{
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Relief = new int[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { int __e0;__e0 = _buf.ReadInt(); Relief[__index0] = __e0;}}
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Poor = new int[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { int __e0;__e0 = _buf.ReadInt(); Poor[__index0] = __e0;}}
ReliefLimitCnt = _buf.ReadInt();
AdGiftCnt = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);AdGiftReward = new int[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { int __e0;__e0 = _buf.ReadInt(); AdGiftReward[__index0] = __e0;}}
SignReward = _buf.ReadInt();
PrizeWheelLimit = _buf.ReadInt();
PrizeWheelFreeCnt = _buf.ReadInt();
GeneralAdLimit = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);GeneralAdRewardRange = new int[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { int __e0;__e0 = _buf.ReadInt(); GeneralAdRewardRange[__index0] = __e0;}}
RealNameSecreKey = _buf.ReadString();
HandTrackerDiamondCnt = _buf.ReadInt();
}
public static ConstConfig DeserializeConstConfig(ByteBuf _buf)
{
return new ConstConfig(_buf);
}
/// <summary>
/// 救济金 单位W
/// </summary>
public readonly int[] Relief;
/// <summary>
/// 可领救济金的穷人 单位W
/// </summary>
public readonly int[] Poor;
/// <summary>
/// 救济金 每日领取上限
/// </summary>
public readonly int ReliefLimitCnt;
/// <summary>
/// 广告礼包数量
/// </summary>
public readonly int AdGiftCnt;
/// <summary>
/// 广告礼包奖励 单位W
/// </summary>
public readonly int[] AdGiftReward;
/// <summary>
/// 签到奖励
/// </summary>
public readonly int SignReward;
/// <summary>
/// 每日转盘上限
/// </summary>
public readonly int PrizeWheelLimit;
/// <summary>
/// 每日转盘免费次数
/// </summary>
public readonly int PrizeWheelFreeCnt;
/// <summary>
/// 通用广告礼包次数 服务器是这个数值的2倍
/// </summary>
public readonly int GeneralAdLimit;
/// <summary>
/// 广告奖励金额范围,单位万
/// </summary>
public readonly int[] GeneralAdRewardRange;
/// <summary>
/// 实名认证秘钥
/// </summary>
public readonly string RealNameSecreKey;
/// <summary>
/// 记牌器消耗的钻石数量
/// </summary>
public readonly int HandTrackerDiamondCnt;
public const int __ID__ = -1271334811;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "Relief:" + Luban.StringUtil.CollectionToString(Relief) + ","
+ "Poor:" + Luban.StringUtil.CollectionToString(Poor) + ","
+ "ReliefLimitCnt:" + ReliefLimitCnt + ","
+ "AdGiftCnt:" + AdGiftCnt + ","
+ "AdGiftReward:" + Luban.StringUtil.CollectionToString(AdGiftReward) + ","
+ "SignReward:" + SignReward + ","
+ "PrizeWheelLimit:" + PrizeWheelLimit + ","
+ "PrizeWheelFreeCnt:" + PrizeWheelFreeCnt + ","
+ "GeneralAdLimit:" + GeneralAdLimit + ","
+ "GeneralAdRewardRange:" + Luban.StringUtil.CollectionToString(GeneralAdRewardRange) + ","
+ "RealNameSecreKey:" + RealNameSecreKey + ","
+ "HandTrackerDiamondCnt:" + HandTrackerDiamondCnt + ","
+ "}";
}
}
}

View File

@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class ConstConfigCategory : ConfigSingleton<ConstConfigCategory>
{
public const string TableName = Tables.ConstConfigCategory;
private ConstConfig _data;
public ConstConfig Data => _data;
public ConstConfigCategory()
{
this.ReLoadData();
}
public sealed override void ReLoadData()
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
protected sealed override void LoadData(ByteBuf _buf)
{
int n = _buf.ReadSize();
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
_data = ConstConfig.DeserializeConstConfig(_buf);
PostInit();
}
/// <summary>
/// 救济金 单位W
/// </summary>
public int[] Relief => _data.Relief;
/// <summary>
/// 可领救济金的穷人 单位W
/// </summary>
public int[] Poor => _data.Poor;
/// <summary>
/// 救济金 每日领取上限
/// </summary>
public int ReliefLimitCnt => _data.ReliefLimitCnt;
/// <summary>
/// 广告礼包数量
/// </summary>
public int AdGiftCnt => _data.AdGiftCnt;
/// <summary>
/// 广告礼包奖励 单位W
/// </summary>
public int[] AdGiftReward => _data.AdGiftReward;
/// <summary>
/// 签到奖励
/// </summary>
public int SignReward => _data.SignReward;
/// <summary>
/// 每日转盘上限
/// </summary>
public int PrizeWheelLimit => _data.PrizeWheelLimit;
/// <summary>
/// 每日转盘免费次数
/// </summary>
public int PrizeWheelFreeCnt => _data.PrizeWheelFreeCnt;
/// <summary>
/// 通用广告礼包次数 服务器是这个数值的2倍
/// </summary>
public int GeneralAdLimit => _data.GeneralAdLimit;
/// <summary>
/// 广告奖励金额范围,单位万
/// </summary>
public int[] GeneralAdRewardRange => _data.GeneralAdRewardRange;
/// <summary>
/// 实名认证秘钥
/// </summary>
public string RealNameSecreKey => _data.RealNameSecreKey;
/// <summary>
/// 记牌器消耗的钻石数量
/// </summary>
public int HandTrackerDiamondCnt => _data.HandTrackerDiamondCnt;
partial void PostInit();
}
}

View File

@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class DiamondMallConfig : Luban.BeanBase
{
public DiamondMallConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
PlatProductId = _buf.ReadString();
Name = _buf.ReadString();
Price = _buf.ReadInt();
AppStoreType = _buf.ReadInt();
NotShelved = _buf.ReadBool();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Packages = new ResData[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { ResData __e0;__e0 = ResData.DeserializeResData(_buf); Packages[__index0] = __e0;}}
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Gift = new ResData[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { ResData __e0;__e0 = ResData.DeserializeResData(_buf); Gift[__index0] = __e0;}}
Sort = _buf.ReadInt();
Desc = _buf.ReadString();
}
public static DiamondMallConfig DeserializeDiamondMallConfig(ByteBuf _buf)
{
return new DiamondMallConfig(_buf);
}
/// <summary>
/// 商品ID
/// </summary>
public readonly int Id;
/// <summary>
/// 第三方平台Id
/// </summary>
public readonly string PlatProductId;
/// <summary>
/// 商品名称
/// </summary>
public readonly string Name;
/// <summary>
/// 价格(人民币元)
/// </summary>
public readonly int Price;
/// <summary>
/// app商店类型<br/>0 默认<br/>1 微信小游戏<br/>2 应用包<br/>3 AppStore<br/>4 官网<br/>5 华为<br/>6 公众号<br/>7 小米<br/>
/// </summary>
public readonly int AppStoreType;
/// <summary>
/// 未上架
/// </summary>
public readonly bool NotShelved;
/// <summary>
/// 商品包
/// </summary>
public readonly ResData[] Packages;
/// <summary>
/// 赠送包
/// </summary>
public readonly ResData[] Gift;
/// <summary>
/// 排序数字<br/>降序
/// </summary>
public readonly int Sort;
/// <summary>
/// 描述
/// </summary>
public readonly string Desc;
public const int __ID__ = 1355365066;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "platProductId:" + PlatProductId + ","
+ "name:" + Name + ","
+ "price:" + Price + ","
+ "appStoreType:" + AppStoreType + ","
+ "notShelved:" + NotShelved + ","
+ "packages:" + Luban.StringUtil.CollectionToString(Packages) + ","
+ "gift:" + Luban.StringUtil.CollectionToString(Gift) + ","
+ "sort:" + Sort + ","
+ "desc:" + Desc + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class DiamondMallConfigCategory : ConfigSingleton<DiamondMallConfigCategory>
{
public const string TableName = Tables.DiamondMallConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, DiamondMallConfig> _dataMap;
private readonly System.Collections.Generic.List<DiamondMallConfig> _dataList;
public DiamondMallConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, DiamondMallConfig>();
_dataList = new System.Collections.Generic.List<DiamondMallConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<DiamondMallConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
DiamondMallConfig _v;
_v = DiamondMallConfig.DeserializeDiamondMallConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, DiamondMallConfig> DataMap => _dataMap;
public System.Collections.Generic.List<DiamondMallConfig> DataList => _dataList;
public DiamondMallConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public DiamondMallConfig Get(int key) => _dataMap[key];
public DiamondMallConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class EntityExchangeMallCategory : ConfigSingleton<EntityExchangeMallCategory>
{
public const string TableName = Tables.EntityExchangeMallCategory;
private readonly System.Collections.Generic.Dictionary<int, EntityExchangeMallConfig> _dataMap;
private readonly System.Collections.Generic.List<EntityExchangeMallConfig> _dataList;
public EntityExchangeMallCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, EntityExchangeMallConfig>();
_dataList = new System.Collections.Generic.List<EntityExchangeMallConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<EntityExchangeMallConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
EntityExchangeMallConfig _v;
_v = EntityExchangeMallConfig.DeserializeEntityExchangeMallConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, EntityExchangeMallConfig> DataMap => _dataMap;
public System.Collections.Generic.List<EntityExchangeMallConfig> DataList => _dataList;
public EntityExchangeMallConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public EntityExchangeMallConfig Get(int key) => _dataMap[key];
public EntityExchangeMallConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,104 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class EntityExchangeMallConfig : Luban.BeanBase
{
public EntityExchangeMallConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Name = _buf.ReadString();
RedMoney = _buf.ReadInt();
ProductType = _buf.ReadInt();
MallType = _buf.ReadInt();
DayLimit = _buf.ReadInt();
UserDayLimit = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);AppStore = new int[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { int __e0;__e0 = _buf.ReadInt(); AppStore[__index0] = __e0;}}
NotShelved = _buf.ReadBool();
Sort = _buf.ReadInt();
Desc = _buf.ReadString();
}
public static EntityExchangeMallConfig DeserializeEntityExchangeMallConfig(ByteBuf _buf)
{
return new EntityExchangeMallConfig(_buf);
}
/// <summary>
/// 商品Id
/// </summary>
public readonly int Id;
/// <summary>
/// 商品名称
/// </summary>
public readonly string Name;
/// <summary>
/// 红卡数量
/// </summary>
public readonly int RedMoney;
/// <summary>
/// 商品类型<br/>1 实物商品<br/>2 虚拟商品
/// </summary>
public readonly int ProductType;
/// <summary>
/// 客户端展示分类<br/>1 实物<br/>2 会员话费<br/>
/// </summary>
public readonly int MallType;
/// <summary>
/// 单日限兑数量
/// </summary>
public readonly int DayLimit;
/// <summary>
/// 单个用户单日限兑数量
/// </summary>
public readonly int UserDayLimit;
/// <summary>
/// 支持的APP商城类型<br/>支持的APP商城类型<br/>0 默认<br/>1 微信小游戏<br/>2 应用包<br/>3 AppStore<br/>4 官网<br/>5 华为<br/>6 公众号<br/>7 小米
/// </summary>
public readonly int[] AppStore;
/// <summary>
/// 未上架
/// </summary>
public readonly bool NotShelved;
/// <summary>
/// 排序数字<br/>升序
/// </summary>
public readonly int Sort;
/// <summary>
/// 描述
/// </summary>
public readonly string Desc;
public const int __ID__ = -868244900;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "name:" + Name + ","
+ "redMoney:" + RedMoney + ","
+ "productType:" + ProductType + ","
+ "mallType:" + MallType + ","
+ "dayLimit:" + DayLimit + ","
+ "userDayLimit:" + UserDayLimit + ","
+ "appStore:" + Luban.StringUtil.CollectionToString(AppStore) + ","
+ "notShelved:" + NotShelved + ","
+ "sort:" + Sort + ","
+ "desc:" + Desc + ","
+ "}";
}
}
}

View File

@ -0,0 +1,92 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class ExchangeMallConfig : Luban.BeanBase
{
public ExchangeMallConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Name = _buf.ReadString();
MallType = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);SourceItems = new ResData[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { ResData __e0;__e0 = ResData.DeserializeResData(_buf); SourceItems[__index0] = __e0;}}
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);TargetItems = new ResData[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { ResData __e0;__e0 = ResData.DeserializeResData(_buf); TargetItems[__index0] = __e0;}}
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);AppStore = new int[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { int __e0;__e0 = _buf.ReadInt(); AppStore[__index0] = __e0;}}
NotShelved = _buf.ReadBool();
Sort = _buf.ReadInt();
Desc = _buf.ReadString();
}
public static ExchangeMallConfig DeserializeExchangeMallConfig(ByteBuf _buf)
{
return new ExchangeMallConfig(_buf);
}
/// <summary>
/// 兑换Id
/// </summary>
public readonly int Id;
/// <summary>
/// 商品名称
/// </summary>
public readonly string Name;
/// <summary>
/// 兑换商店类型<br/>0 全部,这里不能配置<br/>1 金币<br/>2 道具<br/>3 活动
/// </summary>
public readonly int MallType;
/// <summary>
/// 需要消耗的物品列表
/// </summary>
public readonly ResData[] SourceItems;
/// <summary>
/// 兑换获得的物品列表
/// </summary>
public readonly ResData[] TargetItems;
/// <summary>
/// 支持的APP商城类型<br/>0 默认<br/>1 微信小游戏<br/>2 应用包<br/>3 AppStore<br/>4 官网<br/>5 华为<br/>6 公众号<br/>7 小米
/// </summary>
public readonly int[] AppStore;
/// <summary>
/// 未上架
/// </summary>
public readonly bool NotShelved;
/// <summary>
/// 排序数字<br/>降序
/// </summary>
public readonly int Sort;
/// <summary>
/// 描述
/// </summary>
public readonly string Desc;
public const int __ID__ = -1269715687;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "name:" + Name + ","
+ "mallType:" + MallType + ","
+ "SourceItems:" + Luban.StringUtil.CollectionToString(SourceItems) + ","
+ "TargetItems:" + Luban.StringUtil.CollectionToString(TargetItems) + ","
+ "appStore:" + Luban.StringUtil.CollectionToString(AppStore) + ","
+ "notShelved:" + NotShelved + ","
+ "sort:" + Sort + ","
+ "desc:" + Desc + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class ExchangeMallConfigCategory : ConfigSingleton<ExchangeMallConfigCategory>
{
public const string TableName = Tables.ExchangeMallConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, ExchangeMallConfig> _dataMap;
private readonly System.Collections.Generic.List<ExchangeMallConfig> _dataList;
public ExchangeMallConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, ExchangeMallConfig>();
_dataList = new System.Collections.Generic.List<ExchangeMallConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<ExchangeMallConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
ExchangeMallConfig _v;
_v = ExchangeMallConfig.DeserializeExchangeMallConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, ExchangeMallConfig> DataMap => _dataMap;
public System.Collections.Generic.List<ExchangeMallConfig> DataList => _dataList;
public ExchangeMallConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public ExchangeMallConfig Get(int key) => _dataMap[key];
public ExchangeMallConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class FZMJGameConfig : Luban.BeanBase
{
public FZMJGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static FZMJGameConfig DeserializeFZMJGameConfig(ByteBuf _buf)
{
return new FZMJGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = 2011573797;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class FZMJGameConfigCategory : ConfigSingleton<FZMJGameConfigCategory>
{
public const string TableName = Tables.FZMJGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, FZMJGameConfig> _dataMap;
private readonly System.Collections.Generic.List<FZMJGameConfig> _dataList;
public FZMJGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, FZMJGameConfig>();
_dataList = new System.Collections.Generic.List<FZMJGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<FZMJGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
FZMJGameConfig _v;
_v = FZMJGameConfig.DeserializeFZMJGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, FZMJGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<FZMJGameConfig> DataList => _dataList;
public FZMJGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public FZMJGameConfig Get(int key) => _dataMap[key];
public FZMJGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,47 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class FZMJTingConfig : Luban.BeanBase
{
public FZMJTingConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Value = new byte[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { byte __e0;__e0 = _buf.ReadByte(); Value[__index0] = __e0;}}
}
public static FZMJTingConfig DeserializeFZMJTingConfig(ByteBuf _buf)
{
return new FZMJTingConfig(_buf);
}
public readonly int Id;
/// <summary>
/// 0
/// </summary>
public readonly byte[] Value;
public const int __ID__ = 1399982113;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Luban.StringUtil.CollectionToString(Value) + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class FZMJTingConfigCategory : ConfigSingleton<FZMJTingConfigCategory>
{
public const string TableName = Tables.FZMJTingConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, FZMJTingConfig> _dataMap;
private readonly System.Collections.Generic.List<FZMJTingConfig> _dataList;
public FZMJTingConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, FZMJTingConfig>();
_dataList = new System.Collections.Generic.List<FZMJTingConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<FZMJTingConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
FZMJTingConfig _v;
_v = FZMJTingConfig.DeserializeFZMJTingConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, FZMJTingConfig> DataMap => _dataMap;
public System.Collections.Generic.List<FZMJTingConfig> DataList => _dataList;
public FZMJTingConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public FZMJTingConfig Get(int key) => _dataMap[key];
public FZMJTingConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class GZGameConfig : Luban.BeanBase
{
public GZGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static GZGameConfig DeserializeGZGameConfig(ByteBuf _buf)
{
return new GZGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = -78508249;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class GZGameConfigCategory : ConfigSingleton<GZGameConfigCategory>
{
public const string TableName = Tables.GZGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, GZGameConfig> _dataMap;
private readonly System.Collections.Generic.List<GZGameConfig> _dataList;
public GZGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, GZGameConfig>();
_dataList = new System.Collections.Generic.List<GZGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<GZGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
GZGameConfig _v;
_v = GZGameConfig.DeserializeGZGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, GZGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<GZGameConfig> DataList => _dataList;
public GZGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public GZGameConfig Get(int key) => _dataMap[key];
public GZGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class GZMJGameConfig : Luban.BeanBase
{
public GZMJGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static GZMJGameConfig DeserializeGZMJGameConfig(ByteBuf _buf)
{
return new GZMJGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = 1506015172;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class GZMJGameConfigCategory : ConfigSingleton<GZMJGameConfigCategory>
{
public const string TableName = Tables.GZMJGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, GZMJGameConfig> _dataMap;
private readonly System.Collections.Generic.List<GZMJGameConfig> _dataList;
public GZMJGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, GZMJGameConfig>();
_dataList = new System.Collections.Generic.List<GZMJGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<GZMJGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
GZMJGameConfig _v;
_v = GZMJGameConfig.DeserializeGZMJGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, GZMJGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<GZMJGameConfig> DataList => _dataList;
public GZMJGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public GZMJGameConfig Get(int key) => _dataMap[key];
public GZMJGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,47 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class GZMJTingConfig : Luban.BeanBase
{
public GZMJTingConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Value = new byte[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { byte __e0;__e0 = _buf.ReadByte(); Value[__index0] = __e0;}}
}
public static GZMJTingConfig DeserializeGZMJTingConfig(ByteBuf _buf)
{
return new GZMJTingConfig(_buf);
}
public readonly int Id;
/// <summary>
/// 0
/// </summary>
public readonly byte[] Value;
public const int __ID__ = 894423488;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Luban.StringUtil.CollectionToString(Value) + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class GZMJTingConfigCategory : ConfigSingleton<GZMJTingConfigCategory>
{
public const string TableName = Tables.GZMJTingConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, GZMJTingConfig> _dataMap;
private readonly System.Collections.Generic.List<GZMJTingConfig> _dataList;
public GZMJTingConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, GZMJTingConfig>();
_dataList = new System.Collections.Generic.List<GZMJTingConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<GZMJTingConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
GZMJTingConfig _v;
_v = GZMJTingConfig.DeserializeGZMJTingConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, GZMJTingConfig> DataMap => _dataMap;
public System.Collections.Generic.List<GZMJTingConfig> DataList => _dataList;
public GZMJTingConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public GZMJTingConfig Get(int key) => _dataMap[key];
public GZMJTingConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

122
Config/Code/GameConfig.cs Normal file
View File

@ -0,0 +1,122 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class GameConfig : Luban.BeanBase
{
public GameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
GameId = _buf.ReadInt();
ClientId = _buf.ReadInt();
GameName = _buf.ReadString();
GameMode = _buf.ReadByte();
GameStyle = _buf.ReadByte();
OpenGold = _buf.ReadByte();
GoldDeskWarTimeOut = _buf.ReadInt();
OpenFriend = _buf.ReadByte();
FriendDeskWarTimeOut = _buf.ReadInt();
FriendStarWarTimeOut = _buf.ReadInt();
ClubReadyTimeOut = _buf.ReadInt();
FriendAutoReady = _buf.ReadInt();
ClubBalance = _buf.ReadFloat();
}
public static GameConfig DeserializeGameConfig(ByteBuf _buf)
{
return new GameConfig(_buf);
}
/// <summary>
/// ID<br/>与节点信息对应
/// </summary>
public readonly int Id;
/// <summary>
/// 服务器游戏id
/// </summary>
public readonly int GameId;
/// <summary>
/// 客户端游戏id
/// </summary>
public readonly int ClientId;
/// <summary>
/// 游戏名称
/// </summary>
public readonly string GameName;
/// <summary>
/// 游戏模式<br/>0普通模式<br/>1百家乐模式<br/>2休闲模式
/// </summary>
public readonly byte GameMode;
/// <summary>
/// 0牌类<br/>1麻将类<br/>2休闲类
/// </summary>
public readonly byte GameStyle;
/// <summary>
/// 是否开启金币场
/// </summary>
public readonly byte OpenGold;
/// <summary>
/// 金币场战斗超时间(分钟)<br/>超过时间自动解散
/// </summary>
public readonly int GoldDeskWarTimeOut;
/// <summary>
/// 是否开启朋友房
/// </summary>
public readonly byte OpenFriend;
/// <summary>
/// 朋友房桌子超时时间(小时)<br/>超过时间自动解散
/// </summary>
public readonly int FriendDeskWarTimeOut;
/// <summary>
/// 朋友房未开战超时时间(分钟)<br/>超过时间自动解散
/// </summary>
public readonly int FriendStarWarTimeOut;
/// <summary>
/// 竞技赛场准备超时时间(秒)<br/>超过时间自动踢到下一桌
/// </summary>
public readonly int ClubReadyTimeOut;
/// <summary>
/// 朋友房自动准备时间(秒)
/// </summary>
public readonly int FriendAutoReady;
/// <summary>
/// 俱乐部平衡参数<br/>控制输的平均值(倍数)
/// </summary>
public readonly float ClubBalance;
public const int __ID__ = -2136581644;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "gameId:" + GameId + ","
+ "clientId:" + ClientId + ","
+ "gameName:" + GameName + ","
+ "gameMode:" + GameMode + ","
+ "gameStyle:" + GameStyle + ","
+ "openGold:" + OpenGold + ","
+ "goldDeskWarTimeOut:" + GoldDeskWarTimeOut + ","
+ "openFriend:" + OpenFriend + ","
+ "friendDeskWarTimeOut:" + FriendDeskWarTimeOut + ","
+ "friendStarWarTimeOut:" + FriendStarWarTimeOut + ","
+ "clubReadyTimeOut:" + ClubReadyTimeOut + ","
+ "friendAutoReady:" + FriendAutoReady + ","
+ "clubBalance:" + ClubBalance + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class GameConfigCategory : ConfigSingleton<GameConfigCategory>
{
public const string TableName = Tables.GameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, GameConfig> _dataMap;
private readonly System.Collections.Generic.List<GameConfig> _dataList;
public GameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, GameConfig>();
_dataList = new System.Collections.Generic.List<GameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<GameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
GameConfig _v;
_v = GameConfig.DeserializeGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, GameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<GameConfig> DataList => _dataList;
public GameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public GameConfig Get(int key) => _dataMap[key];
public GameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

62
Config/Code/HttpConfig.cs Normal file
View File

@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class HttpConfig : Luban.BeanBase
{
public HttpConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Host = _buf.ReadString();
Port = _buf.ReadInt();
TimeOut = _buf.ReadInt();
}
public static HttpConfig DeserializeHttpConfig(ByteBuf _buf)
{
return new HttpConfig(_buf);
}
/// <summary>
/// id 对应的节点ID
/// </summary>
public readonly int Id;
/// <summary>
/// host
/// </summary>
public readonly string Host;
/// <summary>
/// 端口
/// </summary>
public readonly int Port;
/// <summary>
/// 超时时间 毫秒
/// </summary>
public readonly int TimeOut;
public const int __ID__ = -1827615222;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "host:" + Host + ","
+ "port:" + Port + ","
+ "timeOut:" + TimeOut + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class HttpConfigCategory : ConfigSingleton<HttpConfigCategory>
{
public const string TableName = Tables.HttpConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, HttpConfig> _dataMap;
private readonly System.Collections.Generic.List<HttpConfig> _dataList;
public HttpConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, HttpConfig>();
_dataList = new System.Collections.Generic.List<HttpConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<HttpConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
HttpConfig _v;
_v = HttpConfig.DeserializeHttpConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, HttpConfig> DataMap => _dataMap;
public System.Collections.Generic.List<HttpConfig> DataList => _dataList;
public HttpConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public HttpConfig Get(int key) => _dataMap[key];
public HttpConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class JAMJGameConfig : Luban.BeanBase
{
public JAMJGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static JAMJGameConfig DeserializeJAMJGameConfig(ByteBuf _buf)
{
return new JAMJGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = -1265520120;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class JAMJGameConfigCategory : ConfigSingleton<JAMJGameConfigCategory>
{
public const string TableName = Tables.JAMJGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, JAMJGameConfig> _dataMap;
private readonly System.Collections.Generic.List<JAMJGameConfig> _dataList;
public JAMJGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, JAMJGameConfig>();
_dataList = new System.Collections.Generic.List<JAMJGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<JAMJGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
JAMJGameConfig _v;
_v = JAMJGameConfig.DeserializeJAMJGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, JAMJGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<JAMJGameConfig> DataList => _dataList;
public JAMJGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public JAMJGameConfig Get(int key) => _dataMap[key];
public JAMJGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,47 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class JAMJTingConfig : Luban.BeanBase
{
public JAMJTingConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Value = new byte[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { byte __e0;__e0 = _buf.ReadByte(); Value[__index0] = __e0;}}
}
public static JAMJTingConfig DeserializeJAMJTingConfig(ByteBuf _buf)
{
return new JAMJTingConfig(_buf);
}
public readonly int Id;
/// <summary>
/// 0
/// </summary>
public readonly byte[] Value;
public const int __ID__ = -1877111804;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Luban.StringUtil.CollectionToString(Value) + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class JAMJTingConfigCategory : ConfigSingleton<JAMJTingConfigCategory>
{
public const string TableName = Tables.JAMJTingConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, JAMJTingConfig> _dataMap;
private readonly System.Collections.Generic.List<JAMJTingConfig> _dataList;
public JAMJTingConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, JAMJTingConfig>();
_dataList = new System.Collections.Generic.List<JAMJTingConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<JAMJTingConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
JAMJTingConfig _v;
_v = JAMJTingConfig.DeserializeJAMJTingConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, JAMJTingConfig> DataMap => _dataMap;
public System.Collections.Generic.List<JAMJTingConfig> DataList => _dataList;
public JAMJTingConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public JAMJTingConfig Get(int key) => _dataMap[key];
public JAMJTingConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class LPLFGameConfig : Luban.BeanBase
{
public LPLFGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static LPLFGameConfig DeserializeLPLFGameConfig(ByteBuf _buf)
{
return new LPLFGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = 381040242;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class LPLFGameConfigCategory : ConfigSingleton<LPLFGameConfigCategory>
{
public const string TableName = Tables.LPLFGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, LPLFGameConfig> _dataMap;
private readonly System.Collections.Generic.List<LPLFGameConfig> _dataList;
public LPLFGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, LPLFGameConfig>();
_dataList = new System.Collections.Generic.List<LPLFGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<LPLFGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
LPLFGameConfig _v;
_v = LPLFGameConfig.DeserializeLPLFGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, LPLFGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<LPLFGameConfig> DataList => _dataList;
public LPLFGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public LPLFGameConfig Get(int key) => _dataMap[key];
public LPLFGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class NCMJGameConfig : Luban.BeanBase
{
public NCMJGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static NCMJGameConfig DeserializeNCMJGameConfig(ByteBuf _buf)
{
return new NCMJGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = 420406662;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class NCMJGameConfigCategory : ConfigSingleton<NCMJGameConfigCategory>
{
public const string TableName = Tables.NCMJGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, NCMJGameConfig> _dataMap;
private readonly System.Collections.Generic.List<NCMJGameConfig> _dataList;
public NCMJGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, NCMJGameConfig>();
_dataList = new System.Collections.Generic.List<NCMJGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<NCMJGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
NCMJGameConfig _v;
_v = NCMJGameConfig.DeserializeNCMJGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, NCMJGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<NCMJGameConfig> DataList => _dataList;
public NCMJGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public NCMJGameConfig Get(int key) => _dataMap[key];
public NCMJGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,47 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class NCMJTingConfig : Luban.BeanBase
{
public NCMJTingConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Value = new byte[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { byte __e0;__e0 = _buf.ReadByte(); Value[__index0] = __e0;}}
}
public static NCMJTingConfig DeserializeNCMJTingConfig(ByteBuf _buf)
{
return new NCMJTingConfig(_buf);
}
public readonly int Id;
/// <summary>
/// 0
/// </summary>
public readonly byte[] Value;
public const int __ID__ = -191185022;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Luban.StringUtil.CollectionToString(Value) + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class NCMJTingConfigCategory : ConfigSingleton<NCMJTingConfigCategory>
{
public const string TableName = Tables.NCMJTingConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, NCMJTingConfig> _dataMap;
private readonly System.Collections.Generic.List<NCMJTingConfig> _dataList;
public NCMJTingConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, NCMJTingConfig>();
_dataList = new System.Collections.Generic.List<NCMJTingConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<NCMJTingConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
NCMJTingConfig _v;
_v = NCMJTingConfig.DeserializeNCMJTingConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, NCMJTingConfig> DataMap => _dataMap;
public System.Collections.Generic.List<NCMJTingConfig> DataList => _dataList;
public NCMJTingConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public NCMJTingConfig Get(int key) => _dataMap[key];
public NCMJTingConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class NCSTGameConfig : Luban.BeanBase
{
public NCSTGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static NCSTGameConfig DeserializeNCSTGameConfig(ByteBuf _buf)
{
return new NCSTGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = 405258570;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class NCSTGameConfigCategory : ConfigSingleton<NCSTGameConfigCategory>
{
public const string TableName = Tables.NCSTGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, NCSTGameConfig> _dataMap;
private readonly System.Collections.Generic.List<NCSTGameConfig> _dataList;
public NCSTGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, NCSTGameConfig>();
_dataList = new System.Collections.Generic.List<NCSTGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<NCSTGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
NCSTGameConfig _v;
_v = NCSTGameConfig.DeserializeNCSTGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, NCSTGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<NCSTGameConfig> DataList => _dataList;
public NCSTGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public NCSTGameConfig Get(int key) => _dataMap[key];
public NCSTGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

116
Config/Code/NodeConfig.cs Normal file
View File

@ -0,0 +1,116 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class NodeConfig : Luban.BeanBase
{
public NodeConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
NodeId = _buf.ReadByte();
NodeNum = _buf.ReadByte();
ServerName = _buf.ReadString();
MaxVer = _buf.ReadInt();
MinVer = _buf.ReadInt();
MaxCVer = _buf.ReadInt();
MinCVer = _buf.ReadInt();
WebSocketPort = _buf.ReadInt();
InnerNetPort = _buf.ReadInt();
OuterNetPort = _buf.ReadInt();
InnerHost = _buf.ReadString();
OnTime = _buf.ReadInt();
}
public static NodeConfig DeserializeNodeConfig(ByteBuf _buf)
{
return new NodeConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 模块id
/// </summary>
public readonly byte NodeId;
/// <summary>
/// 节点编号
/// </summary>
public readonly byte NodeNum;
/// <summary>
/// 服务器名称
/// </summary>
public readonly string ServerName;
/// <summary>
/// 大版本
/// </summary>
public readonly int MaxVer;
/// <summary>
/// 小版本
/// </summary>
public readonly int MinVer;
/// <summary>
/// 兼容客户端的最大版本
/// </summary>
public readonly int MaxCVer;
/// <summary>
/// 兼容客户端的最小版本
/// </summary>
public readonly int MinCVer;
/// <summary>
/// WebSocket端口<br/>0表示不开启
/// </summary>
public readonly int WebSocketPort;
/// <summary>
/// 内部网络端口
/// </summary>
public readonly int InnerNetPort;
/// <summary>
/// 外部网络端口<br/>0表示不开启
/// </summary>
public readonly int OuterNetPort;
/// <summary>
/// 内部网络地址(内网地址)
/// </summary>
public readonly string InnerHost;
/// <summary>
/// 定时器时间间隔
/// </summary>
public readonly int OnTime;
public const int __ID__ = -1552158716;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "NodeId:" + NodeId + ","
+ "NodeNum:" + NodeNum + ","
+ "ServerName:" + ServerName + ","
+ "MaxVer:" + MaxVer + ","
+ "MinVer:" + MinVer + ","
+ "MaxCVer:" + MaxCVer + ","
+ "MinCVer:" + MinCVer + ","
+ "WebSocketPort:" + WebSocketPort + ","
+ "InnerNetPort:" + InnerNetPort + ","
+ "OuterNetPort:" + OuterNetPort + ","
+ "InnerHost:" + InnerHost + ","
+ "onTime:" + OnTime + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class NodeConfigCategory : ConfigSingleton<NodeConfigCategory>
{
public const string TableName = Tables.NodeConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, NodeConfig> _dataMap;
private readonly System.Collections.Generic.List<NodeConfig> _dataList;
public NodeConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, NodeConfig>();
_dataList = new System.Collections.Generic.List<NodeConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<NodeConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
NodeConfig _v;
_v = NodeConfig.DeserializeNodeConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, NodeConfig> DataMap => _dataMap;
public System.Collections.Generic.List<NodeConfig> DataList => _dataList;
public NodeConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public NodeConfig Get(int key) => _dataMap[key];
public NodeConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class PDKGameConfig : Luban.BeanBase
{
public PDKGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static PDKGameConfig DeserializePDKGameConfig(ByteBuf _buf)
{
return new PDKGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = -1278693877;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class PDKGameConfigCategory : ConfigSingleton<PDKGameConfigCategory>
{
public const string TableName = Tables.PDKGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, PDKGameConfig> _dataMap;
private readonly System.Collections.Generic.List<PDKGameConfig> _dataList;
public PDKGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, PDKGameConfig>();
_dataList = new System.Collections.Generic.List<PDKGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<PDKGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
PDKGameConfig _v;
_v = PDKGameConfig.DeserializePDKGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, PDKGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<PDKGameConfig> DataList => _dataList;
public PDKGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public PDKGameConfig Get(int key) => _dataMap[key];
public PDKGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class PXMJGameConfig : Luban.BeanBase
{
public PXMJGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static PXMJGameConfig DeserializePXMJGameConfig(ByteBuf _buf)
{
return new PXMJGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = 1837760857;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class PXMJGameConfigCategory : ConfigSingleton<PXMJGameConfigCategory>
{
public const string TableName = Tables.PXMJGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, PXMJGameConfig> _dataMap;
private readonly System.Collections.Generic.List<PXMJGameConfig> _dataList;
public PXMJGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, PXMJGameConfig>();
_dataList = new System.Collections.Generic.List<PXMJGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<PXMJGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
PXMJGameConfig _v;
_v = PXMJGameConfig.DeserializePXMJGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, PXMJGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<PXMJGameConfig> DataList => _dataList;
public PXMJGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public PXMJGameConfig Get(int key) => _dataMap[key];
public PXMJGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,47 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class PXMJTingConfig : Luban.BeanBase
{
public PXMJTingConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Value = new byte[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { byte __e0;__e0 = _buf.ReadByte(); Value[__index0] = __e0;}}
}
public static PXMJTingConfig DeserializePXMJTingConfig(ByteBuf _buf)
{
return new PXMJTingConfig(_buf);
}
public readonly int Id;
/// <summary>
/// 0
/// </summary>
public readonly byte[] Value;
public const int __ID__ = 1226169173;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Luban.StringUtil.CollectionToString(Value) + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class PXMJTingConfigCategory : ConfigSingleton<PXMJTingConfigCategory>
{
public const string TableName = Tables.PXMJTingConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, PXMJTingConfig> _dataMap;
private readonly System.Collections.Generic.List<PXMJTingConfig> _dataList;
public PXMJTingConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, PXMJTingConfig>();
_dataList = new System.Collections.Generic.List<PXMJTingConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<PXMJTingConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
PXMJTingConfig _v;
_v = PXMJTingConfig.DeserializePXMJTingConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, PXMJTingConfig> DataMap => _dataMap;
public System.Collections.Generic.List<PXMJTingConfig> DataList => _dataList;
public PXMJTingConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public PXMJTingConfig Get(int key) => _dataMap[key];
public PXMJTingConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,56 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class PrizeWheelConfig : Luban.BeanBase
{
public PrizeWheelConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Reward = ResData.DeserializeResData(_buf);
Weight = _buf.ReadInt();
}
public static PrizeWheelConfig DeserializePrizeWheelConfig(ByteBuf _buf)
{
return new PrizeWheelConfig(_buf);
}
/// <summary>
/// 资源ID(大于100000一定是道具)
/// </summary>
public readonly int Id;
/// <summary>
/// 资源名称
/// </summary>
public readonly ResData Reward;
/// <summary>
/// 权重
/// </summary>
public readonly int Weight;
public const int __ID__ = -185314517;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "reward:" + Reward + ","
+ "weight:" + Weight + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class PrizeWheelConfigCategory : ConfigSingleton<PrizeWheelConfigCategory>
{
public const string TableName = Tables.PrizeWheelConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, PrizeWheelConfig> _dataMap;
private readonly System.Collections.Generic.List<PrizeWheelConfig> _dataList;
public PrizeWheelConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, PrizeWheelConfig>();
_dataList = new System.Collections.Generic.List<PrizeWheelConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<PrizeWheelConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
PrizeWheelConfig _v;
_v = PrizeWheelConfig.DeserializePrizeWheelConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, PrizeWheelConfig> DataMap => _dataMap;
public System.Collections.Generic.List<PrizeWheelConfig> DataList => _dataList;
public PrizeWheelConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public PrizeWheelConfig Get(int key) => _dataMap[key];
public PrizeWheelConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

39
Config/Code/PropType.cs Normal file
View File

@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Server.Config
{
public enum PropType
{
/// <summary>
/// 复活卡
/// </summary>
ReviveCard = 10004,
/// <summary>
/// 公会令
/// </summary>
ClubToken = 10005,
/// <summary>
/// 总公会令
/// </summary>
ClubSuperToken = 10006,
/// <summary>
/// 参赛券
/// </summary>
MatchCard = 10007,
/// <summary>
/// 计牌器
/// </summary>
HandTracker = 200000,
}
}

View File

@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class QueueConfig : Luban.BeanBase
{
public QueueConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
GameId = _buf.ReadInt();
PlayerCnt = _buf.ReadInt();
MergeRobotProb = _buf.ReadFloat();
}
public static QueueConfig DeserializeQueueConfig(ByteBuf _buf)
{
return new QueueConfig(_buf);
}
/// <summary>
/// ID
/// </summary>
public readonly int Id;
/// <summary>
/// 服务器游戏id
/// </summary>
public readonly int GameId;
/// <summary>
/// 真人数量
/// </summary>
public readonly int PlayerCnt;
/// <summary>
/// 强制排队的概率<br/>(排机器人)
/// </summary>
public readonly float MergeRobotProb;
public const int __ID__ = 307257235;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "gameId:" + GameId + ","
+ "playerCnt:" + PlayerCnt + ","
+ "mergeRobotProb:" + MergeRobotProb + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class QueueConfigCategory : ConfigSingleton<QueueConfigCategory>
{
public const string TableName = Tables.QueueConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, QueueConfig> _dataMap;
private readonly System.Collections.Generic.List<QueueConfig> _dataList;
public QueueConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, QueueConfig>();
_dataList = new System.Collections.Generic.List<QueueConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<QueueConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
QueueConfig _v;
_v = QueueConfig.DeserializeQueueConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, QueueConfig> DataMap => _dataMap;
public System.Collections.Generic.List<QueueConfig> DataList => _dataList;
public QueueConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public QueueConfig Get(int key) => _dataMap[key];
public QueueConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,74 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class RabbitConfig : Luban.BeanBase
{
public RabbitConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Port = _buf.ReadInt();
Host = _buf.ReadString();
UserName = _buf.ReadString();
Pwd = _buf.ReadString();
Vhost = _buf.ReadString();
}
public static RabbitConfig DeserializeRabbitConfig(ByteBuf _buf)
{
return new RabbitConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 端口
/// </summary>
public readonly int Port;
/// <summary>
/// 地址
/// </summary>
public readonly string Host;
/// <summary>
/// 用户名
/// </summary>
public readonly string UserName;
/// <summary>
/// 密码
/// </summary>
public readonly string Pwd;
/// <summary>
/// 项目名
/// </summary>
public readonly string Vhost;
public const int __ID__ = 875638812;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "port:" + Port + ","
+ "host:" + Host + ","
+ "userName:" + UserName + ","
+ "pwd:" + Pwd + ","
+ "vhost:" + Vhost + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class RabbitConfigCategory : ConfigSingleton<RabbitConfigCategory>
{
public const string TableName = Tables.RabbitConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, RabbitConfig> _dataMap;
private readonly System.Collections.Generic.List<RabbitConfig> _dataList;
public RabbitConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, RabbitConfig>();
_dataList = new System.Collections.Generic.List<RabbitConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<RabbitConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
RabbitConfig _v;
_v = RabbitConfig.DeserializeRabbitConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, RabbitConfig> DataMap => _dataMap;
public System.Collections.Generic.List<RabbitConfig> DataList => _dataList;
public RabbitConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public RabbitConfig Get(int key) => _dataMap[key];
public RabbitConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

63
Config/Code/RaceType.cs Normal file
View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Server.Config
{
public enum RaceType
{
/// <summary>
/// 金币场
/// </summary>
NoRace = 0,
/// <summary>
/// 普通比赛
/// </summary>
Common = 1,
/// <summary>
/// 大奖赛
/// </summary>
BigRace = 2,
/// <summary>
/// 电视选拔赛
/// </summary>
TvRace = 3,
/// <summary>
/// 每日冲榜赛
/// </summary>
DailyRanking = 4,
/// <summary>
/// 免费体验赛
/// </summary>
FreeExperience = 5,
/// <summary>
/// 地主挑战赛
/// </summary>
LandlordChallenge = 6,
/// <summary>
/// 二七王月赛
/// </summary>
MoonRace = 7,
/// <summary>
/// 二七王季赛
/// </summary>
SeasonRace = 8,
/// <summary>
/// 二七王年终赛
/// </summary>
YearRace = 9,
/// <summary>
/// 新年比赛
/// </summary>
NewYearRace = 10,
}
}

View File

@ -0,0 +1,68 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class RedisConfig : Luban.BeanBase
{
public RedisConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Name = _buf.ReadString();
ConnectTimeOut = _buf.ReadInt();
Port = _buf.ReadInt();
Host = _buf.ReadString();
}
public static RedisConfig DeserializeRedisConfig(ByteBuf _buf)
{
return new RedisConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 名称
/// </summary>
public readonly string Name;
/// <summary>
/// 超时时间(单位毫秒)
/// </summary>
public readonly int ConnectTimeOut;
/// <summary>
/// 端口
/// </summary>
public readonly int Port;
/// <summary>
/// 地址
/// </summary>
public readonly string Host;
public const int __ID__ = -731728771;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "name:" + Name + ","
+ "connectTimeOut:" + ConnectTimeOut + ","
+ "port:" + Port + ","
+ "host:" + Host + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class RedisConfigCategory : ConfigSingleton<RedisConfigCategory>
{
public const string TableName = Tables.RedisConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, RedisConfig> _dataMap;
private readonly System.Collections.Generic.List<RedisConfig> _dataList;
public RedisConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, RedisConfig>();
_dataList = new System.Collections.Generic.List<RedisConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<RedisConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
RedisConfig _v;
_v = RedisConfig.DeserializeRedisConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, RedisConfig> DataMap => _dataMap;
public System.Collections.Generic.List<RedisConfig> DataList => _dataList;
public RedisConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public RedisConfig Get(int key) => _dataMap[key];
public RedisConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

56
Config/Code/ResConfig.cs Normal file
View File

@ -0,0 +1,56 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class ResConfig : Luban.BeanBase
{
public ResConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Name = _buf.ReadString();
ResType = _buf.ReadInt();
}
public static ResConfig DeserializeResConfig(ByteBuf _buf)
{
return new ResConfig(_buf);
}
/// <summary>
/// 资源ID(大于100000一定是道具)
/// </summary>
public readonly int Id;
/// <summary>
/// 资源名称
/// </summary>
public readonly string Name;
/// <summary>
/// 1 (原始货币, 历史遗留问题)<br/>2 道具<br/>3 活动道具(限时)
/// </summary>
public readonly int ResType;
public const int __ID__ = -1244442654;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "name:" + Name + ","
+ "resType:" + ResType + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class ResConfigCategory : ConfigSingleton<ResConfigCategory>
{
public const string TableName = Tables.ResConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, ResConfig> _dataMap;
private readonly System.Collections.Generic.List<ResConfig> _dataList;
public ResConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, ResConfig>();
_dataList = new System.Collections.Generic.List<ResConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<ResConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
ResConfig _v;
_v = ResConfig.DeserializeResConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, ResConfig> DataMap => _dataMap;
public System.Collections.Generic.List<ResConfig> DataList => _dataList;
public ResConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public ResConfig Get(int key) => _dataMap[key];
public ResConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

44
Config/Code/ResData.cs Normal file
View File

@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class ResData : Luban.BeanBase
{
public ResData(ByteBuf _buf)
{
Id = _buf.ReadInt();
Count = _buf.ReadLong();
}
public static ResData DeserializeResData(ByteBuf _buf)
{
return new ResData(_buf);
}
public readonly int Id;
public readonly long Count;
public const int __ID__ = -1534237622;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "count:" + Count + ","
+ "}";
}
}
}

View File

@ -0,0 +1,56 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class RouterConfig : Luban.BeanBase
{
public RouterConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Path = _buf.ReadString();
Port = _buf.ReadInt();
}
public static RouterConfig DeserializeRouterConfig(ByteBuf _buf)
{
return new RouterConfig(_buf);
}
/// <summary>
/// 对应节点Id
/// </summary>
public readonly int Id;
/// <summary>
/// 监听的路径
/// </summary>
public readonly string Path;
/// <summary>
/// 端口
/// </summary>
public readonly int Port;
public const int __ID__ = -576389109;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "path:" + Path + ","
+ "port:" + Port + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class RouterConfigCategory : ConfigSingleton<RouterConfigCategory>
{
public const string TableName = Tables.RouterConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, RouterConfig> _dataMap;
private readonly System.Collections.Generic.List<RouterConfig> _dataList;
public RouterConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, RouterConfig>();
_dataList = new System.Collections.Generic.List<RouterConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<RouterConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
RouterConfig _v;
_v = RouterConfig.DeserializeRouterConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, RouterConfig> DataMap => _dataMap;
public System.Collections.Generic.List<RouterConfig> DataList => _dataList;
public RouterConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public RouterConfig Get(int key) => _dataMap[key];
public RouterConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

62
Config/Code/SignConfig.cs Normal file
View File

@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class SignConfig : Luban.BeanBase
{
public SignConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);SignData = new ResData[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { ResData __e0;__e0 = ResData.DeserializeResData(_buf); SignData[__index0] = __e0;}}
DataType = _buf.ReadInt();
RewardDay = _buf.ReadInt();
}
public static SignConfig DeserializeSignConfig(ByteBuf _buf)
{
return new SignConfig(_buf);
}
/// <summary>
/// 签到数据
/// </summary>
public readonly int Id;
/// <summary>
/// 资源名称
/// </summary>
public readonly ResData[] SignData;
/// <summary>
/// 1 签到<br/>2 礼包
/// </summary>
public readonly int DataType;
/// <summary>
/// 连续签到天数
/// </summary>
public readonly int RewardDay;
public const int __ID__ = 51128191;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "signData:" + Luban.StringUtil.CollectionToString(SignData) + ","
+ "dataType:" + DataType + ","
+ "rewardDay:" + RewardDay + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class SignConfigCategory : ConfigSingleton<SignConfigCategory>
{
public const string TableName = Tables.SignConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, SignConfig> _dataMap;
private readonly System.Collections.Generic.List<SignConfig> _dataList;
public SignConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, SignConfig>();
_dataList = new System.Collections.Generic.List<SignConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<SignConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
SignConfig _v;
_v = SignConfig.DeserializeSignConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, SignConfig> DataMap => _dataMap;
public System.Collections.Generic.List<SignConfig> DataList => _dataList;
public SignConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public SignConfig Get(int key) => _dataMap[key];
public SignConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

74
Config/Code/SqlConfig.cs Normal file
View File

@ -0,0 +1,74 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class SqlConfig : Luban.BeanBase
{
public SqlConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Port = _buf.ReadInt();
Host = _buf.ReadString();
UserName = _buf.ReadString();
Pwd = _buf.ReadString();
CacheCount = _buf.ReadInt();
}
public static SqlConfig DeserializeSqlConfig(ByteBuf _buf)
{
return new SqlConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 端口
/// </summary>
public readonly int Port;
/// <summary>
/// 地址
/// </summary>
public readonly string Host;
/// <summary>
/// 用户名
/// </summary>
public readonly string UserName;
/// <summary>
/// 密码
/// </summary>
public readonly string Pwd;
/// <summary>
/// 缓存链接数
/// </summary>
public readonly int CacheCount;
public const int __ID__ = -1235600752;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "port:" + Port + ","
+ "host:" + Host + ","
+ "userName:" + UserName + ","
+ "pwd:" + Pwd + ","
+ "cacheCount:" + CacheCount + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class SqlConfigCategory : ConfigSingleton<SqlConfigCategory>
{
public const string TableName = Tables.SqlConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, SqlConfig> _dataMap;
private readonly System.Collections.Generic.List<SqlConfig> _dataList;
public SqlConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, SqlConfig>();
_dataList = new System.Collections.Generic.List<SqlConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<SqlConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
SqlConfig _v;
_v = SqlConfig.DeserializeSqlConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, SqlConfig> DataMap => _dataMap;
public System.Collections.Generic.List<SqlConfig> DataList => _dataList;
public SqlConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public SqlConfig Get(int key) => _dataMap[key];
public SqlConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

100
Config/Code/Tables.cs Normal file
View File

@ -0,0 +1,100 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
using System.Collections;
using System.Collections.Generic;
namespace Server.Config
{
public partial class Tables
{
public const string SqlConfigCategory = "sqlconfigcategory";
public const string RabbitConfigCategory = "rabbitconfigcategory";
public const string RedisConfigCategory = "redisconfigcategory";
public const string NodeConfigCategory = "nodeconfigcategory";
public const string HttpConfigCategory = "httpconfigcategory";
public const string RouterConfigCategory = "routerconfigcategory";
public const string XYMJGameConfigCategory = "xymjgameconfigcategory";
public const string XYMJTingConfigCategory = "xymjtingconfigcategory";
public const string PXMJGameConfigCategory = "pxmjgameconfigcategory";
public const string PXMJTingConfigCategory = "pxmjtingconfigcategory";
public const string JAMJGameConfigCategory = "jamjgameconfigcategory";
public const string JAMJTingConfigCategory = "jamjtingconfigcategory";
public const string GZMJGameConfigCategory = "gzmjgameconfigcategory";
public const string GZMJTingConfigCategory = "gzmjtingconfigcategory";
public const string FZMJGameConfigCategory = "fzmjgameconfigcategory";
public const string FZMJTingConfigCategory = "fzmjtingconfigcategory";
public const string NCMJGameConfigCategory = "ncmjgameconfigcategory";
public const string NCMJTingConfigCategory = "ncmjtingconfigcategory";
public const string GZGameConfigCategory = "gzgameconfigcategory";
public const string WLGameConfigCategory = "wlgameconfigcategory";
public const string LPLFGameConfigCategory = "lplfgameconfigcategory";
public const string PDKGameConfigCategory = "pdkgameconfigcategory";
public const string NCSTGameConfigCategory = "ncstgameconfigcategory";
public const string QueueConfigCategory = "queueconfigcategory";
public const string ConstConfigCategory = "constconfigcategory";
public const string GameConfigCategory = "gameconfigcategory";
public const string TingConfigCategory = "tingconfigcategory";
public const string VersionConfigCategory = "versionconfigcategory";
public const string CastlesConfigCategory = "castlesconfigcategory";
public const string SignConfigCategory = "signconfigcategory";
public const string ResConfigCategory = "resconfigcategory";
public const string PrizeWheelConfigCategory = "prizewheelconfigcategory";
public const string DiamondMallConfigCategory = "diamondmallconfigcategory";
public const string ExchangeMallConfigCategory = "exchangemallconfigcategory";
public const string EntityExchangeMallCategory = "entityexchangemallcategory";
private static readonly string[] tables = new[]
{
SqlConfigCategory,
RabbitConfigCategory,
RedisConfigCategory,
NodeConfigCategory,
HttpConfigCategory,
RouterConfigCategory,
XYMJGameConfigCategory,
XYMJTingConfigCategory,
PXMJGameConfigCategory,
PXMJTingConfigCategory,
JAMJGameConfigCategory,
JAMJTingConfigCategory,
GZMJGameConfigCategory,
GZMJTingConfigCategory,
FZMJGameConfigCategory,
FZMJTingConfigCategory,
NCMJGameConfigCategory,
NCMJTingConfigCategory,
GZGameConfigCategory,
WLGameConfigCategory,
LPLFGameConfigCategory,
PDKGameConfigCategory,
NCSTGameConfigCategory,
QueueConfigCategory,
ConstConfigCategory,
GameConfigCategory,
TingConfigCategory,
VersionConfigCategory,
CastlesConfigCategory,
SignConfigCategory,
ResConfigCategory,
PrizeWheelConfigCategory,
DiamondMallConfigCategory,
ExchangeMallConfigCategory,
EntityExchangeMallCategory,
};
public IEnumerable GetTabels()
{
return tables;
}
}
}

View File

@ -0,0 +1,43 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Server.Config
{
public enum TimeRankType
{
/// <summary>
/// 日榜
/// </summary>
Day = 1,
/// <summary>
/// 月榜
/// </summary>
Month = 2,
/// <summary>
/// 年榜
/// </summary>
Year = 3,
/// <summary>
/// 季傍
/// </summary>
Quarter = 4,
/// <summary>
/// 周榜
/// </summary>
Week = 5,
/// <summary>
/// 冲榜
/// </summary>
ChongBang = 99,
}
}

92
Config/Code/TingConfig.cs Normal file
View File

@ -0,0 +1,92 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class TingConfig : Luban.BeanBase
{
public TingConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
GameId = _buf.ReadInt();
TingId = _buf.ReadInt();
TingName = _buf.ReadString();
MinPlayerCnt = _buf.ReadInt();
MaxPlayerCnt = _buf.ReadInt();
DeskMaxRobotCnt = _buf.ReadInt();
DeskCnt = _buf.ReadInt();
QueueName = _buf.ReadString();
}
public static TingConfig DeserializeTingConfig(ByteBuf _buf)
{
return new TingConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 服务器Id
/// </summary>
public readonly int GameId;
/// <summary>
/// 厅Id
/// </summary>
public readonly int TingId;
/// <summary>
/// 厅名称
/// </summary>
public readonly string TingName;
/// <summary>
/// 最小开战人数
/// </summary>
public readonly int MinPlayerCnt;
/// <summary>
/// 最大开战人数
/// </summary>
public readonly int MaxPlayerCnt;
/// <summary>
/// 桌上机器人最大数量
/// </summary>
public readonly int DeskMaxRobotCnt;
/// <summary>
/// 桌子数量<br/>0表示自动创建<br/>1表示固定创建
/// </summary>
public readonly int DeskCnt;
/// <summary>
/// 排队器名称
/// </summary>
public readonly string QueueName;
public const int __ID__ = 1546793968;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "gameId:" + GameId + ","
+ "tingId:" + TingId + ","
+ "tingName:" + TingName + ","
+ "minPlayerCnt:" + MinPlayerCnt + ","
+ "maxPlayerCnt:" + MaxPlayerCnt + ","
+ "deskMaxRobotCnt:" + DeskMaxRobotCnt + ","
+ "deskCnt:" + DeskCnt + ","
+ "queueName:" + QueueName + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class TingConfigCategory : ConfigSingleton<TingConfigCategory>
{
public const string TableName = Tables.TingConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, TingConfig> _dataMap;
private readonly System.Collections.Generic.List<TingConfig> _dataList;
public TingConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, TingConfig>();
_dataList = new System.Collections.Generic.List<TingConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<TingConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
TingConfig _v;
_v = TingConfig.DeserializeTingConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, TingConfig> DataMap => _dataMap;
public System.Collections.Generic.List<TingConfig> DataList => _dataList;
public TingConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public TingConfig Get(int key) => _dataMap[key];
public TingConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,209 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class VersionConfig : Luban.BeanBase
{
public VersionConfig(ByteBuf _buf)
{
CVersion48 = _buf.ReadInt();
CVersion49Prop = _buf.ReadInt();
CVersion50 = _buf.ReadInt();
CVersion51 = _buf.ReadInt();
CVersion52 = _buf.ReadInt();
CVersion53 = _buf.ReadInt();
CVersion54 = _buf.ReadInt();
CVersion55 = _buf.ReadInt();
CVersion56 = _buf.ReadInt();
CVersion57 = _buf.ReadInt();
CVersion58 = _buf.ReadInt();
CVersion59 = _buf.ReadInt();
CVersion60 = _buf.ReadInt();
CVersion61 = _buf.ReadInt();
CVersion62 = _buf.ReadInt();
CVersion63 = _buf.ReadInt();
CVersion64 = _buf.ReadInt();
CVersion65 = _buf.ReadInt();
CVersion66 = _buf.ReadInt();
CVersion67 = _buf.ReadInt();
CVersion68 = _buf.ReadInt();
CVersion69 = _buf.ReadInt();
CVersion70 = _buf.ReadInt();
CVersion71 = _buf.ReadInt();
CVersion72 = _buf.ReadInt();
CVersion73 = _buf.ReadInt();
CVersion74 = _buf.ReadInt();
CVersion75 = _buf.ReadInt();
CVersion76 = _buf.ReadInt();
CVersion77 = _buf.ReadInt();
CVersion78 = _buf.ReadInt();
CVersion79 = _buf.ReadInt();
CVersion80 = _buf.ReadInt();
CVersion81 = _buf.ReadInt();
CVersion82 = _buf.ReadInt();
CVersion83 = _buf.ReadInt();
CVersion84 = _buf.ReadInt();
CVersion85 = _buf.ReadInt();
CVersion86 = _buf.ReadInt();
CVersion87 = _buf.ReadInt();
CVersion88 = _buf.ReadInt();
CVersion89 = _buf.ReadInt();
CVersion90 = _buf.ReadInt();
CVersion91 = _buf.ReadInt();
CVersion92 = _buf.ReadInt();
CVersion93 = _buf.ReadInt();
CVersion94 = _buf.ReadInt();
CVersion95 = _buf.ReadInt();
CVersion96 = _buf.ReadInt();
CVersion97 = _buf.ReadInt();
CVersion98 = _buf.ReadInt();
CVersion99 = _buf.ReadInt();
CVersion100 = _buf.ReadInt();
}
public static VersionConfig DeserializeVersionConfig(ByteBuf _buf)
{
return new VersionConfig(_buf);
}
/// <summary>
/// 城堡由3个合并成一个真实房间
/// </summary>
public readonly int CVersion48;
/// <summary>
/// 道具系统改版
/// </summary>
public readonly int CVersion49Prop;
/// <summary>
/// 签到,转盘,救济金修改
/// </summary>
public readonly int CVersion50;
/// <summary>
/// 登录时主动发送建材比赛的协议
/// </summary>
public readonly int CVersion51;
public readonly int CVersion52;
public readonly int CVersion53;
public readonly int CVersion54;
public readonly int CVersion55;
public readonly int CVersion56;
public readonly int CVersion57;
public readonly int CVersion58;
public readonly int CVersion59;
public readonly int CVersion60;
public readonly int CVersion61;
public readonly int CVersion62;
public readonly int CVersion63;
public readonly int CVersion64;
public readonly int CVersion65;
public readonly int CVersion66;
public readonly int CVersion67;
public readonly int CVersion68;
public readonly int CVersion69;
public readonly int CVersion70;
public readonly int CVersion71;
public readonly int CVersion72;
public readonly int CVersion73;
public readonly int CVersion74;
public readonly int CVersion75;
public readonly int CVersion76;
public readonly int CVersion77;
public readonly int CVersion78;
public readonly int CVersion79;
public readonly int CVersion80;
public readonly int CVersion81;
public readonly int CVersion82;
public readonly int CVersion83;
public readonly int CVersion84;
public readonly int CVersion85;
public readonly int CVersion86;
public readonly int CVersion87;
public readonly int CVersion88;
public readonly int CVersion89;
public readonly int CVersion90;
public readonly int CVersion91;
public readonly int CVersion92;
public readonly int CVersion93;
public readonly int CVersion94;
public readonly int CVersion95;
public readonly int CVersion96;
public readonly int CVersion97;
public readonly int CVersion98;
public readonly int CVersion99;
public readonly int CVersion100;
public const int __ID__ = 1110817306;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "CVersion48:" + CVersion48 + ","
+ "CVersion49Prop:" + CVersion49Prop + ","
+ "CVersion50:" + CVersion50 + ","
+ "CVersion51:" + CVersion51 + ","
+ "CVersion52:" + CVersion52 + ","
+ "CVersion53:" + CVersion53 + ","
+ "CVersion54:" + CVersion54 + ","
+ "CVersion55:" + CVersion55 + ","
+ "CVersion56:" + CVersion56 + ","
+ "CVersion57:" + CVersion57 + ","
+ "CVersion58:" + CVersion58 + ","
+ "CVersion59:" + CVersion59 + ","
+ "CVersion60:" + CVersion60 + ","
+ "CVersion61:" + CVersion61 + ","
+ "CVersion62:" + CVersion62 + ","
+ "CVersion63:" + CVersion63 + ","
+ "CVersion64:" + CVersion64 + ","
+ "CVersion65:" + CVersion65 + ","
+ "CVersion66:" + CVersion66 + ","
+ "CVersion67:" + CVersion67 + ","
+ "CVersion68:" + CVersion68 + ","
+ "CVersion69:" + CVersion69 + ","
+ "CVersion70:" + CVersion70 + ","
+ "CVersion71:" + CVersion71 + ","
+ "CVersion72:" + CVersion72 + ","
+ "CVersion73:" + CVersion73 + ","
+ "CVersion74:" + CVersion74 + ","
+ "CVersion75:" + CVersion75 + ","
+ "CVersion76:" + CVersion76 + ","
+ "CVersion77:" + CVersion77 + ","
+ "CVersion78:" + CVersion78 + ","
+ "CVersion79:" + CVersion79 + ","
+ "CVersion80:" + CVersion80 + ","
+ "CVersion81:" + CVersion81 + ","
+ "CVersion82:" + CVersion82 + ","
+ "CVersion83:" + CVersion83 + ","
+ "CVersion84:" + CVersion84 + ","
+ "CVersion85:" + CVersion85 + ","
+ "CVersion86:" + CVersion86 + ","
+ "CVersion87:" + CVersion87 + ","
+ "CVersion88:" + CVersion88 + ","
+ "CVersion89:" + CVersion89 + ","
+ "CVersion90:" + CVersion90 + ","
+ "CVersion91:" + CVersion91 + ","
+ "CVersion92:" + CVersion92 + ","
+ "CVersion93:" + CVersion93 + ","
+ "CVersion94:" + CVersion94 + ","
+ "CVersion95:" + CVersion95 + ","
+ "CVersion96:" + CVersion96 + ","
+ "CVersion97:" + CVersion97 + ","
+ "CVersion98:" + CVersion98 + ","
+ "CVersion99:" + CVersion99 + ","
+ "CVersion100:" + CVersion100 + ","
+ "}";
}
}
}

View File

@ -0,0 +1,115 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class VersionConfigCategory : ConfigSingleton<VersionConfigCategory>
{
public const string TableName = Tables.VersionConfigCategory;
private VersionConfig _data;
public VersionConfig Data => _data;
public VersionConfigCategory()
{
this.ReLoadData();
}
public sealed override void ReLoadData()
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
protected sealed override void LoadData(ByteBuf _buf)
{
int n = _buf.ReadSize();
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
_data = VersionConfig.DeserializeVersionConfig(_buf);
PostInit();
}
/// <summary>
/// 城堡由3个合并成一个真实房间
/// </summary>
public int CVersion48 => _data.CVersion48;
/// <summary>
/// 道具系统改版
/// </summary>
public int CVersion49Prop => _data.CVersion49Prop;
/// <summary>
/// 签到,转盘,救济金修改
/// </summary>
public int CVersion50 => _data.CVersion50;
/// <summary>
/// 登录时主动发送建材比赛的协议
/// </summary>
public int CVersion51 => _data.CVersion51;
public int CVersion52 => _data.CVersion52;
public int CVersion53 => _data.CVersion53;
public int CVersion54 => _data.CVersion54;
public int CVersion55 => _data.CVersion55;
public int CVersion56 => _data.CVersion56;
public int CVersion57 => _data.CVersion57;
public int CVersion58 => _data.CVersion58;
public int CVersion59 => _data.CVersion59;
public int CVersion60 => _data.CVersion60;
public int CVersion61 => _data.CVersion61;
public int CVersion62 => _data.CVersion62;
public int CVersion63 => _data.CVersion63;
public int CVersion64 => _data.CVersion64;
public int CVersion65 => _data.CVersion65;
public int CVersion66 => _data.CVersion66;
public int CVersion67 => _data.CVersion67;
public int CVersion68 => _data.CVersion68;
public int CVersion69 => _data.CVersion69;
public int CVersion70 => _data.CVersion70;
public int CVersion71 => _data.CVersion71;
public int CVersion72 => _data.CVersion72;
public int CVersion73 => _data.CVersion73;
public int CVersion74 => _data.CVersion74;
public int CVersion75 => _data.CVersion75;
public int CVersion76 => _data.CVersion76;
public int CVersion77 => _data.CVersion77;
public int CVersion78 => _data.CVersion78;
public int CVersion79 => _data.CVersion79;
public int CVersion80 => _data.CVersion80;
public int CVersion81 => _data.CVersion81;
public int CVersion82 => _data.CVersion82;
public int CVersion83 => _data.CVersion83;
public int CVersion84 => _data.CVersion84;
public int CVersion85 => _data.CVersion85;
public int CVersion86 => _data.CVersion86;
public int CVersion87 => _data.CVersion87;
public int CVersion88 => _data.CVersion88;
public int CVersion89 => _data.CVersion89;
public int CVersion90 => _data.CVersion90;
public int CVersion91 => _data.CVersion91;
public int CVersion92 => _data.CVersion92;
public int CVersion93 => _data.CVersion93;
public int CVersion94 => _data.CVersion94;
public int CVersion95 => _data.CVersion95;
public int CVersion96 => _data.CVersion96;
public int CVersion97 => _data.CVersion97;
public int CVersion98 => _data.CVersion98;
public int CVersion99 => _data.CVersion99;
public int CVersion100 => _data.CVersion100;
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class WLGameConfig : Luban.BeanBase
{
public WLGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static WLGameConfig DeserializeWLGameConfig(ByteBuf _buf)
{
return new WLGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = 1374330505;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class WLGameConfigCategory : ConfigSingleton<WLGameConfigCategory>
{
public const string TableName = Tables.WLGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, WLGameConfig> _dataMap;
private readonly System.Collections.Generic.List<WLGameConfig> _dataList;
public WLGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, WLGameConfig>();
_dataList = new System.Collections.Generic.List<WLGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<WLGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
WLGameConfig _v;
_v = WLGameConfig.DeserializeWLGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, WLGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<WLGameConfig> DataList => _dataList;
public WLGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public WLGameConfig Get(int key) => _dataMap[key];
public WLGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class XYMJGameConfig : Luban.BeanBase
{
public XYMJGameConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
Value = _buf.ReadByte();
}
public static XYMJGameConfig DeserializeXYMJGameConfig(ByteBuf _buf)
{
return new XYMJGameConfig(_buf);
}
/// <summary>
/// id
/// </summary>
public readonly int Id;
/// <summary>
/// 配置值
/// </summary>
public readonly byte Value;
public const int __ID__ = 1794856146;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Value + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class XYMJGameConfigCategory : ConfigSingleton<XYMJGameConfigCategory>
{
public const string TableName = Tables.XYMJGameConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, XYMJGameConfig> _dataMap;
private readonly System.Collections.Generic.List<XYMJGameConfig> _dataList;
public XYMJGameConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, XYMJGameConfig>();
_dataList = new System.Collections.Generic.List<XYMJGameConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<XYMJGameConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
XYMJGameConfig _v;
_v = XYMJGameConfig.DeserializeXYMJGameConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, XYMJGameConfig> DataMap => _dataMap;
public System.Collections.Generic.List<XYMJGameConfig> DataList => _dataList;
public XYMJGameConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public XYMJGameConfig Get(int key) => _dataMap[key];
public XYMJGameConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

View File

@ -0,0 +1,47 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public sealed partial class XYMJTingConfig : Luban.BeanBase
{
public XYMJTingConfig(ByteBuf _buf)
{
Id = _buf.ReadInt();
{int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Value = new byte[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { byte __e0;__e0 = _buf.ReadByte(); Value[__index0] = __e0;}}
}
public static XYMJTingConfig DeserializeXYMJTingConfig(ByteBuf _buf)
{
return new XYMJTingConfig(_buf);
}
public readonly int Id;
/// <summary>
/// 0
/// </summary>
public readonly byte[] Value;
public const int __ID__ = 1183264462;
public override int GetTypeId() => __ID__;
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "value:" + Luban.StringUtil.CollectionToString(Value) + ","
+ "}";
}
}
}

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class XYMJTingConfigCategory : ConfigSingleton<XYMJTingConfigCategory>
{
public const string TableName = Tables.XYMJTingConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, XYMJTingConfig> _dataMap;
private readonly System.Collections.Generic.List<XYMJTingConfig> _dataList;
public XYMJTingConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, XYMJTingConfig>();
_dataList = new System.Collections.Generic.List<XYMJTingConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<XYMJTingConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
XYMJTingConfig _v;
_v = XYMJTingConfig.DeserializeXYMJTingConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, XYMJTingConfig> DataMap => _dataMap;
public System.Collections.Generic.List<XYMJTingConfig> DataList => _dataList;
public XYMJTingConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public XYMJTingConfig Get(int key) => _dataMap[key];
public XYMJTingConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}

30
Core/Core.csproj Normal file
View File

@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<RootNamespace>Core</RootNamespace>
<AssemblyName>Core</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
</Project>

39
Core/Pool/IReference.cs Normal file
View File

@ -0,0 +1,39 @@
using System;
namespace Server.Core
{
/// <summary>
/// 引用池对象
/// </summary>
public interface IReference : IDisposable
{
bool IsFromPool
{
get;
set;
}
long ReferenceId
{
get;
set;
}
}
public abstract class Reference : IReference
{
public bool IsFromPool
{
get;
set;
}
public long ReferenceId
{
get;
set;
}
public abstract void Dispose();
}
}

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Concurrent;
using System.Threading;
namespace Server.Core
{
public static partial class ReferencePool
{
private class Pool
{
private readonly Type objectType;
private readonly int MaxCapacity;
public int NumItems;
private readonly ConcurrentQueue<IReference> _items = new ConcurrentQueue<IReference>();
private IReference FastItem;
public Pool(Type objectType, int maxCapacity)
{
this.objectType = objectType;
MaxCapacity = maxCapacity;
}
public object Get()
{
IReference item = FastItem;
if (item == null || Interlocked.CompareExchange(ref FastItem,null,item) != item)
{
if (_items.TryDequeue(out item))
{
Interlocked.Decrement(ref NumItems);
return item;
}
return Activator.CreateInstance(this.objectType);
}
return item;
}
public void Return(IReference obj)
{
if (FastItem != null || Interlocked.CompareExchange(ref FastItem,obj,null) != null)
{
if (Interlocked.Increment(ref NumItems) <= MaxCapacity)
{
_items.Enqueue(obj);
return;
}
Interlocked.Decrement(ref NumItems);
}
}
}
}
}

View File

@ -0,0 +1,91 @@
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
namespace Server.Core
{
public static partial class ReferencePool
{
private static ConcurrentDictionary<Type, Pool> objPool = new ConcurrentDictionary<Type, Pool>();
private static readonly Func<Type, Pool> AddPoolFunc = type => new Pool(type, 100);
public static T Fetch<T>(bool isFromPool = true) where T : IReference
{
return (T)Fetch(typeof(T),isFromPool);
}
private static long refreshId = long.MinValue;
public static long GetRefreshId()
{
return Interlocked.Increment(ref refreshId);
}
public static object Fetch(Type type, bool isFromPool = true)
{
if (!isFromPool)
{
return Activator.CreateInstance(type);
}
//Debug.Log($"ReferencePool Fetch {type}");
Pool pool = GetPool(type);
object obj = pool.Get();
if (obj is IReference p)
{
p.IsFromPool = true;
p.ReferenceId = GetRefreshId();
}
return obj;
}
public static void Recycle(IReference p)
{
if (!p.IsFromPool)
{
return;
}
// 防止多次入池
p.IsFromPool = false;
//p.Dispose();
Type type = p.GetType();
//Debug.Log($"ReferencePool Recycle {type}");
Pool pool = GetPool(type);
pool.Return(p);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static Pool GetPool(Type type)
{
return objPool.GetOrAdd(type, AddPoolFunc);
}
/// <summary>
/// 获取对象池中的所有对象
/// </summary>
/// <returns></returns>
public static Type[] GetPoolTypes()
{
return objPool.Keys.ToArray();
}
public static int GetPoolCnt(Type type)
{
Pool pool = GetPool(type);
if (pool != null)
{
return pool.NumItems;
}
return 0;
}
}
}

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Core")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("300E6AE7-80E4-483A-A5F0-D43BA7630522")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

99
Directory.Packages.props Normal file
View File

@ -0,0 +1,99 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<!-- json -->
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<!-- MessagePack -->
<PackageVersion Include="MessagePack" Version="3.1.4" />
<PackageVersion Include="MessagePack.Annotations" Version="3.1.4" />
<PackageVersion Include="MessagePackAnalyzer" Version="3.1.4" />
<!-- 阿里云 -->
<!-- oss -->
<PackageVersion Include="Aliyun.OSS.SDK" Version="2.14.1" />
<!-- 号码认证 -->
<PackageVersion Include="AlibabaCloud.EndpointUtil" Version="0.1.2" />
<PackageVersion Include="AlibabaCloud.GatewaySpi" Version="0.0.3" />
<PackageVersion Include="AlibabaCloud.OpenApiClient" Version="0.1.15" />
<PackageVersion Include="AlibabaCloud.OpenApiUtil" Version="1.1.2" />
<PackageVersion Include="AlibabaCloud.SDK.Dypnsapi20170525" Version="2.0.0" />
<PackageVersion Include="AlibabaCloud.TeaUtil" Version="0.1.19" />
<PackageVersion Include="AlibabaCloud.TeaXML" Version="0.0.5" />
<PackageVersion Include="Aliyun.Credentials" Version="1.5.0" />
<PackageVersion Include="Tea" Version="1.1.3" />
<!-- 华为云 -->
<PackageVersion Include="HuaweiCloud.SDK.Core" Version="3.1.191" />
<PackageVersion Include="HuaweiCloud.SDK.Cdn" Version="3.1.191" />
<!-- Fody -->
<PackageVersion Include="Costura.Fody" Version="6.0.0" />
<PackageVersion Include="Fody" Version="6.9.3" />
<!-- EPPlus -->
<PackageVersion Include="EPPlus" Version="8.4.1" />
<PackageVersion Include="EPPlus.Interfaces" Version="8.4.0" />
<PackageVersion Include="Flurl" Version="4.0.0" />
<PackageVersion Include="Flurl.Http" Version="4.0.2" />
<PackageVersion Include="HttpMultipartParser" Version="9.2.0" />
<PackageVersion Include="K4os.Compression.LZ4" Version="1.3.8" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" />
<PackageVersion Include="Microsoft.IdentityModel.Abstractions" Version="8.14.0" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.14.0" />
<PackageVersion Include="Microsoft.IdentityModel.Logging" Version="8.14.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.14.0" />
<PackageVersion Include="Microsoft.NET.StringTools" Version="17.11.4" />
<PackageVersion Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.14.0" />
<PackageVersion Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.410101" />
<PackageVersion Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="3.1.5" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.5" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.5" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.5" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="3.1.5" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.5" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="3.1.5" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="3.1.5" />
<PackageVersion Include="System.Buffers" Version="4.6.1" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="6.0.2" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.14.0" />
<PackageVersion Include="System.Memory" Version="4.6.3" />
<PackageVersion Include="System.Numerics.Vectors" Version="4.6.1" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
<PackageVersion Include="System.Text.Encodings.Web" Version="9.0.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.2" />
<PackageVersion Include="System.IO.Pipelines" Version="9.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.6.1" />
<PackageVersion Include="System.Data.SQLite.Core" Version="1.0.119" />
<PackageVersion Include="Dapper" Version="2.1.35" />
<PackageVersion Include="Google.Protobuf" Version="3.5.1" />
<PackageVersion Include="JetBrains.Annotations" Version="11.1.0" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
<PackageVersion Include="Iconic.Zlib.Netstandard" Version="1.0.0" />
<PackageVersion Include="HttpMultipartParser" Version="9.2.0" />
<PackageVersion Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.12.0" />
<PackageVersion Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.15.0" />
<PackageVersion Include="SKIT.FlurlHttpClient.Common" Version="3.1.1" />
<PackageVersion Include="Flurl" Version="4.0.0" />
<PackageVersion Include="Flurl.Http" Version="4.0.2" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,62 @@
using GameData;
using GameDAL.Game;
using MrWu.Basic;
using MrWu.Debug;
using ObjectModel;
using ObjectModel.Backend;
using Server.DB.Redis;
using Server.DB.Sql;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ObjectModel.User;
namespace GameDAL.Backend
{
public static class BMAdminDal
{
const int DBIdx = 8;
public static readonly TimeSpan outT = new TimeSpan(1, 0, 0);
/// <summary>
/// 根据推广标识获取用户
/// </summary>
/// <param name="platTag"></param>
/// <returns></returns>
public static BMAdminModel GetBMAdminModelByPlatTag(string platTag)
{
return null;
}
public static Task<long> GetRedNumAsync(int userid)
{
return Task.Run(() => GetRedNum(userid));
}
/// <summary>
/// 获取玩家红包
/// </summary>
/// <param name="userid"></param>
/// <returns></returns>
public static long GetRedNum(int userid)
{
return 1;
}
/// <summary>
/// 给玩家加减红包
/// </summary>
/// <param name="userid"></param>
/// <param name="num">正数加 负数减</param>
public static void AddRedNum(int userid, int num)
{
}
}
}

View File

@ -0,0 +1,32 @@
using ObjectModel;
using ObjectModel.Config;
using Server.DB.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GameData;
namespace GameDAL.Backend
{
public class DeskPlayerDal
{
/// <summary>
/// 获取禁止同桌信息
/// </summary>
/// <returns></returns>
public static string GetNoDeskPlayer() {
return redisManager.GetBiSaidb(ConstClass.NoDeskMatesAllowedDBIdx).StringGet(ConstClass.NoDeskMatesAllowedKey);
}
/// <summary>
/// 设置禁止同桌信息
/// </summary>
/// <param name="playerInfos"></param>
public static void SetNoDeskPlayer(List<NoDeskPlayerInfo> playerInfos) {
if (playerInfos == null) return;
redisManager.GetBiSaidb(ConstClass.NoDeskMatesAllowedDBIdx).StringSet(ConstClass.NoDeskMatesAllowedKey, JsonPack.GetJson(playerInfos));
}
}
}

View File

@ -0,0 +1,61 @@
using MrWu.Debug;
using ObjectModel.Config;
using Server.DB.Sql;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GameData;
using GameMessage;
namespace GameDAL
{
public class ChongZhiShangPingDal
{
private static void ConvertData(DataTable dt,List<ChongZhiShangPing> shangPings)
{
if (dt == null || dt.Rows.Count <= 0) return;
int len = dt.Rows.Count;
for (int i = 0; i < len; i++)
{
var id = (int)dt.Rows[i]["id"];
if (id <= 3) continue;
ChongZhiShangPing temp = new ChongZhiShangPing();
temp.id = id;
temp.jiazhi = (int)dt.Rows[i]["jiazhi"];
temp.GetJinBi = (long)dt.Rows[i]["deJinbi"];
temp.GetCanSaiJuan = (int)dt.Rows[i]["deCanSaiJuan"];
temp.GetFuHuoKa = (int)dt.Rows[i]["deFuhuoKa"];
temp.GetZuanShi = (int)dt.Rows[i]["deZuanShi"];
temp.GetHuiYuan = (int)dt.Rows[i]["deHuiYuan"];
temp.PayZuanShi = (int)dt.Rows[i]["fuZuanshi"];
temp.PayLiJuan = (int)dt.Rows[i]["fuLijuan"];
temp.PayRMB = (int)dt.Rows[i]["fuRMB"];
temp.PayHongBao = (int)dt.Rows[i]["payHongBao"];
temp.Title = dt.Rows[i]["title"].ToString();
Debug.Info($"id:{temp.id} title:{temp.Title} i:{temp.PayRMB}");
//if (temp.PayLiJuan > 0) continue;
shangPings.Add(temp);
}
}
public static async Task<List<ChongZhiShangPing>> GetAllShangPingsAsync()
{
List<ChongZhiShangPing> result = new List<ChongZhiShangPing>();
try
{
DataTable dt = await GameDB.Instance.selectDbAsync(dbbase.game2018, "tbChongZhiShangPing");
ConvertData(dt,result);
}
catch (Exception e)
{
Debug.Error($"获取所有充值商品出错 msg:{e.Message},code{e.StackTrace}");
}
return result;
}
}
}

View File

@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.DB.Redis;
using System.Text;
using StackExchange.Redis;
using MrWu.Debug;
namespace GameDAL {
/// <summary>
/// 竞技比赛的 禁止玩家游玩
/// </summary>
public class ClubBankPlayerInGame {
public const int DbIdx = 6;
private ClubBankPlayerInGame() { }
static ClubBankPlayerInGame() {
instance = new ClubBankPlayerInGame();
}
public static ClubBankPlayerInGame instance {
get;
private set;
}
/// <summary>
/// 数据库单项操作
/// </summary>
public IDatabaseProxy dbp {
get {
return redisManager.Getdb(DbIdx);
}
}
/// <summary>
/// 数据库操作
/// </summary>
public IDatabase db {
get {
return redisManager.GetDataBase(DbStyle.main, DbIdx);
}
}
/*
* 数据结构
*
* ClubBankPlayers:clubid [243633,243663]
* ClubBankPlayers:clubid [243634,246338]
*
* */
public const string baseKey = "ClubBankPlayers";
/// <summary>
/// 获取竞技比赛的 禁止同桌 所有集合的 key
/// </summary>
/// <param name="clubid"></param>
/// <returns></returns>
public string GetClubBankKey(int clubid) {
return $"{baseKey}:{clubid}";
}
public List<int> GetAll(int clubId)
{
string key = GetClubBankKey(clubId);
var values = dbp.SetMembers(key);
var ret = values.Select(x=>int.Parse(x)).ToList();
return ret;
}
/// <summary>
/// 添加一个禁止游玩的玩家 (过期时间一年)
/// </summary>
/// <param name="clubId">竞技比赛id</param>
/// <param name="userId">用户id</param>
/// <returns></returns>
public bool Add(int clubId, int userId) {
string key = GetClubBankKey(clubId);
var isSuccess = dbp.SetAdd(key, userId);
db.KeyExpire(key, TimeSpan.FromDays(365));
return isSuccess;
}
/// <summary>
/// 移除玩家限制
/// <param name="clubId">竞技比赛id</param>
/// <param name="userId">用户id</param>
/// </summary>
public bool Remove(int clubId, int userId) {
string key = GetClubBankKey(clubId);
var isSuccess = dbp.SetRemove(key, userId);
db.KeyExpire(key, TimeSpan.FromDays(365));
return isSuccess;
}
/// <summary>
/// 移除
/// </summary>
public bool Remove(int clubId) {
string key = GetClubBankKey(clubId);
var isSuccess = dbp.KeyDelete(key);
return isSuccess;
}
/// <summary>
/// 是否包含玩家
/// <param name="clubId">竞技比赛id</param>
/// <param name="userId">用户id</param>
/// </summary>
public bool Contains(int clubId, int userId) {
string key = GetClubBankKey(clubId);
return dbp.SetContains(key, userId);
}
}
}

296
GameDAL/Club/ClubDBUtil.cs Normal file
View File

@ -0,0 +1,296 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Dapper;
using GameData;
using GameData.Club;
using GameMessage;
using MrWu.Debug;
using ObjectModel.Club;
using Server.DB.Sql;
namespace GameDAL.Club
{
public static class ClubDBUtil
{
/// <summary>
/// id增量
/// </summary>
public const int IdIncrement = 100000;
#region ClubExitMatchClubList
/// <summary>
/// 移除淘汰(退赛俱乐部)
/// 直接添加解禁标记 ReliefId不直接删除
/// </summary>
public static async Task RemoveClubExitMatchAsync(int leagueClubId, int clubId)
{
long timeStamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
string sql = "UPDATE ClubExitMatchClubList SET ReliefId=@ReliefId where ClubId=@ClubId AND LeagueClubId=@LeagueClubId AND ReliefId=0";
await GameDB.Instance.DapperExecuteAsync(dbbase.game2018, sql,
new {
ClubId = clubId,
LeagueClubId = leagueClubId,
ReliefId = timeStamp
});
}
/// <summary>
/// 添加淘汰(退赛俱乐部)
/// </summary>
public static async Task AddClubExitMatchAsync(LeagueMatchClubExitScore data)
{
const string sql = @"
INSERT INTO ClubExitMatchClubList (
[ClubId],
[LeagueClubId],
[MatchId],
[CardScore],
[DeskScore],
[ClubUserSumScore],
[LeagueScore],
[JoinRoom],
[UpdateTime],
[ReliefId],
[AwardId]
) VALUES (
@ClubId,
@LeagueClubId,
@MatchId,
@CardScore,
@DeskScore,
@ClubUserSumScore,
@LeagueScore,
@JoinRoom,
@UpdateTime,
@ReliefId,
@AwardId
)";
await GameDB.Instance.DapperExecuteAsync(dbbase.game2018, sql, data);
}
public static async Task UpdateAwardIdOnMatchClose(int matchId)
{
string sql =
$"UPDATE ClubExitMatchClubList SET AwardId = {ConstData.AwardId_InHistoryCloseMatchWithResetScore} where MatchId=@MatchId AND ReliefId <> 0";
await GameDB.Instance.DapperExecuteAsync(dbbase.game2018, sql, new { MatchId = matchId });
}
/// <summary>
/// 获取联盟下退赛俱乐部的列表
/// </summary>
public static List<LeagueMatchClubExitScore> GetLeagueExitMathClubList(int leagueClubId)
{
// ReliefId = 0 表示当前没有解禁的俱乐部数据
string sql = "SELECT * FROM ClubExitMatchClubList where LeagueClubId=@LeagueClubId AND ReliefId=0";
var list = GameDB.Instance.DapperQuery<LeagueMatchClubExitScore>(dbbase.game2018, sql, new { LeagueClubId = leagueClubId });
return list?.ToList() ?? new List<LeagueMatchClubExitScore>();
}
/// <summary>
/// 获取联盟下已经解禁但是没有产生颁奖记录的俱乐部数据
/// </summary>
/// <param name="leagueClubId">联盟俱乐部Id</param>
/// <param name="startTime">比赛开始时间</param>
/// <param name="endTime">比赛结束时间</param>
/// <param name="isHistoryMatch">是否是历史比赛</param>
public static async Task<List<LeagueMatchClubExitScore>> GetLeagueExitClubReliefDataAsync(int leagueClubId, int leagueMatchId,
DateTime startTime, DateTime endTime, bool isHistoryMatch)
{
var parameters = new DynamicParameters();
string sql = "SELECT * FROM ClubExitMatchClubList where LeagueClubId=@LeagueClubId";
parameters.Add("LeagueClubId", leagueClubId);
parameters.Add("MatchId", leagueMatchId);
parameters.Add("StartTime", new DateTimeOffset(startTime).ToUnixTimeSeconds());
parameters.Add("EndTime", new DateTimeOffset(endTime).ToUnixTimeSeconds());
sql += isHistoryMatch
? $" AND MatchId=@MatchId AND ReliefId>=@StartTime AND ReliefId<=@EndTime AND AwardId < {ConstData.AwardId_Default} AND AwardId > 0"
: $" AND AwardId = {ConstData.AwardId_Default}";
var list = await GameDB.Instance.DapperQueryAsync<LeagueMatchClubExitScore>(dbbase.game2018, sql,
parameters);
return list?.ToList() ?? new List<LeagueMatchClubExitScore>();
}
/// <summary>
/// 获取联盟下已经解禁的颁奖记录历史数据
/// </summary>
public static async Task<List<LeagueMatchClubExitScore>> GetLeagueAwardExitClubReliefRecord(int leagueClubId, int leagueMatchId, List<long> awardIds)
{
string sql = "SELECT * FROM ClubExitMatchClubList where LeagueClubId=@LeagueClubId AND AwardId In @AwardIds";
var list = await GameDB.Instance.DapperQueryAsync<LeagueMatchClubExitScore>(dbbase.game2018, sql,
new { LeagueClubId = leagueClubId, MatchId = leagueMatchId, AwardIds = awardIds });
return list?.ToList() ?? new List<LeagueMatchClubExitScore>();
}
/// <summary>
/// 直接数据库的联盟颁奖逻辑,并对解禁数据进行标记
/// </summary>
public static async Task<bool> DoLeagueAwardRecord(long awardId, int leagueClubId, int leagueMatchId, List<AwardRecord> list)
{
if (list == null || list.Count < 1) return false;
string awardSql = @"
INSERT INTO LeagueAwardRecord([RecordId],[CreateTime],[ClubMatchId],[ClubName],[ClubId],
[CardScore],[DeskScore],[ClubUserSumScore],[JoinRoom],[LeagueScore],[Index]) Values
(@RecordId,@CreateTime,@ClubMatchId,@ClubName,@ClubId,@CardScore,@DeskScore,@ClubUserSumScore,@JoinRoom,@LeagueScore,@Index)";
// 记录颁奖数据 如果为1就表示已经颁奖过但是不会在颁奖记录中汇总
string exitReliefSql = @$"UPDATE ClubExitMatchClubList
SET AwardId = CASE
WHEN (ReliefId <> 0 AND AwardId = {ConstData.AwardId_Default}) THEN @AwardId
ELSE {ConstData.AwardId_AwardNoInHistory}
END
WHERE LeagueClubId = @LeagueClubId
AND MatchId = @MatchId";
Debug.Log(exitReliefSql);
return await GameDB.Instance.DapperExecuteTransactionAsync(dbbase.game2018, async (conn, tran) =>
{
await conn.ExecuteAsync(awardSql, list, tran);
await conn.ExecuteAsync(exitReliefSql, new
{
AwardId = awardId,
LeagueClubId = leagueClubId,
MatchId = leagueMatchId
}, tran);
return true;
});
}
#endregion
#region clubPayCard
/// <summary>
/// 带日志的添加房卡操作 (目前只处理添加的情况)
/// </summary>
public static async Task<bool> AddClubPayCardAsync(List<ClubPayCardDBEntity> entities)
{
if(entities == null || entities.Count <= 0) return false;
int clubId = entities[0].clubId;
int cardCount = 0;
foreach (var e in entities)
{
if (clubId != e.clubId)
{
Debug.Warning("[Club]批处理暂时只处理一个俱乐部的数据。");
return false;
}
cardCount += e.cardCount;
}
if (cardCount <= 0)
{
Debug.Warning("[Club]添加的房卡数量小于0!暂不处理减逻辑");
return false;
}
const string logSql = @"
INSERT INTO clubPayCard ([clubId],[userId],[cardCount],[nickName],[datetime],[sex],[origin]
) VALUES (@clubId,@userId,@cardCount,@nickName,@datetime,@sex,@origin)";
const string clubUpdateSql = @"
UPDATE top(1) clubs SET [cards] = [cards] + @cardCount
WHERE [id] = @clubId";
clubId = clubId - IdIncrement;
await GameDB.Instance.DapperExecuteAsync(dbbase.game2018, clubUpdateSql, new { clubId, cardCount });
await GameDB.Instance.DapperExecuteAsync(dbbase.gamedb, logSql, entities);
return true;
}
/// <summary>
/// 分页获取俱乐部的房卡记录
/// </summary>
public static async Task<(int Count, List<ClubPayCardDBEntity> Data)> GetClubPayCardAsync(int clubId, int pageNumber, int pageSize)
{
int skip = pageSize * (pageNumber - 1);
// 分页获取
string sql = @"
WITH Results As (SELECT *, ROW_NUMBER() OVER (ORDER BY id DESC) AS RowNum FROM clubPayCard WHERE clubId=@clubId)
SELECT * FROM Results WHERE RowNum BETWEEN @StartIndex AND @EndIndex;
SELECT COUNT(*) FROM clubPayCard WHERE clubId=@clubId;
";
return await GameDB.Instance.DapperQueryMultipleAsync(dbbase.gamedb, sql,
new { clubId, StartIndex = skip, EndIndex = skip + pageSize },
async reader =>
{
var datas = (await reader.ReadAsync<ClubPayCardDBEntity>()).ToList();
var count = await reader.ReadSingleAsync<int>();
return (count, datas);
});
}
#endregion
#region clubs_rm
public static async Task<List<int>> GetRemoveClubIds()
{
string sql = "SELECT Id FROM ClubsRM";
var list = await GameDB.Instance.DapperQueryAsync<DBEntitys.ClubRM>(dbbase.game2018, sql, null);
return list?.Select(x => x.Id).ToList() ?? new List<int>();
}
public static async Task<bool> DeleteClubAsync(DBEntitys.ClubRM club, List<DBEntitys.ClubPlayerDBEntity> clubPlayers)
{
string clubsSql = "DELETE FROM clubs WHERE ID = @Id";
string clubsRmSql = @"
INSERT INTO ClubsRM (
[Id],[ClubName],[Notice],[Cards],[ManCnt],[Mans],[Newways],[WayVer],[Password],[CreateTime],[DeleteTime],[LeaderUserId], [Setting]
) VALUES (
@Id,@ClubName,@Notice,@Cards,@ManCnt,@Mans,@Newways,@WayVer,@Password,@CreateTime,@DeleteTime,@LeaderUserId,@Setting
)";
string leaguePowerSql = $"DELETE FROM LeagueClubLeaguePower WHERE ClubId = @Id + {IdIncrement}";
string playerUpdateSql = "UPDATE TOP(1) players SET myclubinfodata=@myclubinfodata, joinclubinfodata=@joinclubinfodata WHERE userid2018 = @userid2018";
string clubmsgRmSql = "DELETE FROM clubmsg WHERE receiveid = @Id";
return await GameDB.Instance.DapperExecuteTransactionAsync(dbbase.game2018, async (conn, tran) =>
{
await conn.ExecuteAsync(clubsRmSql, club, tran);
await conn.ExecuteAsync(clubsSql, club, tran);
await conn.ExecuteAsync(leaguePowerSql, club, tran);
if (clubPlayers.Count > 0)
await conn.ExecuteAsync(playerUpdateSql, clubPlayers, tran);
return true;
});
}
/// <summary>
/// 更新导出club
/// </summary>
public static async Task<bool> UpdateExportClubAsync(DBEntitys.ClubsDBEntity club, List<DBEntitys.ClubPlayerDBEntity> clubPlayers)
{
string playerUpdateSql = "UPDATE TOP(1) players SET myclubinfodata=@myclubinfodata, joinclubinfodata=@joinclubinfodata WHERE userid2018 = @userid2018";
string clubUpdateSql = "UPDATE TOP(1) clubs SET mans=@mans, manCnt=@manCnt, wayVer=@wayVer, newways=@newways WHERE ID = @ID";
return await GameDB.Instance.DapperExecuteTransactionAsync(dbbase.game2018, async (conn, tran) =>
{
await conn.ExecuteAsync(clubUpdateSql, club, tran);
await conn.ExecuteAsync(playerUpdateSql, clubPlayers, tran);
return true;
});
}
#endregion
#region clubs
public static async Task<bool> UpdateClubSettingAsync(int clubId, ClubSetting setting)
{
if (setting == null) return false;
clubId = clubId - IdIncrement;
string settingJson = JsonPack.GetJson(setting);
string sql = "UPDATE TOP(1) clubs SET [setting] = @Setting WHERE [id] = @ClubId";
int result = await GameDB.Instance.DapperExecuteAsync(dbbase.game2018, sql,
new { ClubId = clubId, Setting = settingJson });
return result > 0;
}
#endregion
}
}

View File

@ -0,0 +1,1670 @@
/*
* 由SharpDevelop创建。
* 用户: Administrator
* 日期: 2019-03-28
* 时间: 14:23
*
* 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
*/
using System;
using System.Collections.Concurrent;
using Server.DB.Sql;
using System.Data;
using MrWu.Debug;
using System.Collections.Generic;
using MrWu.Time;
using MrWu.Binary;
using MrWu.Basic;
using System.Threading;
using System.Threading.Tasks;
using MrWu.DB;
using GameData;
using Server.Data.ClubDef;
using Server.Data;
using System.Data.SqlClient;
using System.Text;
using Server.DB.Redis;
using StackExchange.Redis;
using System.Data.SqlTypes;
using GameData.Club;
using GameMessage;
namespace GameDAL
{
/// <summary>
/// 竞技比赛数据管理
/// </summary>
public static class ClubDataManager
{
/// <summary>
/// 竞技比赛表名称
/// </summary>
public const string tb_clubs = "clubs";
/// <summary>
/// id列名
/// </summary>
public const string fd_id = "id";
/// <summary>
/// 竞技比赛名称列名
/// </summary>
public const string fd_clubname = "clubname";
/// <summary>
/// 公告列名
/// </summary>
public const string fd_notice = "notice";
/// <summary>
/// 竞技比赛会长列名
/// </summary>
public const string fd_leadername = "leadername";
/// <summary>
/// 玩法版本
/// </summary>
public const string fd_wayVer = "wayVer";
/// <summary>
/// 时间小时部分列名
/// </summary>
public const string fd_createtimeh = "createtimeh";
/// <summary>
/// 时间分钟部分列名
/// </summary>
public const string fd_createtimem = "createtimem";
/// <summary>
/// 时间秒部分列名
/// </summary>
public const string fd_createtimes = "createtimes";
/// <summary>
/// 关闭时间小时部分列名
/// </summary>
public const string fd_closetimeh = "closetimeh";
/// <summary>
/// 关闭时间分钟部分列名
/// </summary>
public const string fd_closetimem = "closetimem";
/// <summary>
/// 关闭时间秒钟部分列名
/// </summary>
public const string fd_closetimes = "closetimes";
/// <summary>
/// 房卡 列名
/// </summary>
public const string fd_cards = "cards";
/// <summary>
/// 玩家数量 列名
/// </summary>
public const string fd_manCnt = "manCnt";
/// <summary>
/// 所有的竞技比赛玩家数据 列名
/// </summary>
public const string fd_mans = "mans";
/// <summary>
/// 俱乐部密码
/// </summary>
public const string fd_Password = "password";
/// <summary>
/// 新玩法列
/// </summary>
public const string fd_newways = "newways";
/// <summary>
/// 设置
/// </summary>
public const string fd_setting = "setting";
/// <summary>
/// 积分 消耗一张房卡得1积分
/// </summary>
public const string fd_integral = "integral";
/// <summary>
/// 竞技比赛所有玩家表
/// </summary>
public const string tb_players = "players";
/// <summary>
/// userid列
/// </summary>
public const string fd_userid2018 = "userid2018";
/// <summary>
/// 用户名
/// </summary>
public const string fd_nickname2018 = "nickname2018";
/// <summary>
/// 联系方式-没用上
/// </summary>
//public const string fd_contact = "contact";
/// <summary>
/// 我的竞技比赛信息_老的
/// </summary>
public const string fd_myclubinfo = "myclubinfo";
/// <summary>
/// 我的竞技比赛信息 新的
/// </summary>
public const string fd_myclubinfodata = "myclubinfodata";
/// <summary>
/// 我加入的竞技比赛信息 老的
/// </summary>
public const string fd_joinclubinfo = "joinclubinfo";
/// <summary>
/// 我加入的竞技比赛信息 新的
/// </summary>
public const string fd_joinclubinfodata = "joinclubinfodata";
/// <summary>
/// 战斗记录id 老的
/// </summary>
public const string fd_fightcord = "fightrecordid";
/// <summary>
/// 战斗记录 新的
/// </summary>
public const string fd_fightcorddata = "fightrecordiddata";
/// <summary>
/// 竞技比赛消息白哦
/// </summary>
public const string tb_message = "clubmsg";
/// <summary>
/// 消息类型字段
/// </summary>
public const string fd_style = "style";
/// <summary>
/// 消息状态
/// </summary>
public const string fd_state = "state";
/// <summary>
/// 内容
/// </summary>
public const string fd_strcontent = "strcontent";
/// <summary>
/// 接收时间
/// </summary>
public const string fd_sendTime = "sendTime";
/// <summary>
/// 处理时间
/// </summary>
public const string fd_dotime = "dotime";
/// <summary>
/// 处理者
/// </summary>
public const string fd_doman = "doman";
/// <summary>
/// 处理人名称
/// </summary>
public const string fd_domanname = "domanname";
/// <summary>
/// 接收人id 转变为竞技比赛id
/// </summary>
public const string fd_receiveid = "receiveid";
/// <summary>
/// 发送者id 转变为用户id
/// </summary>
public const string fd_sendid = "sendid";
/// <summary>
/// 发送者名称
/// </summary>
public const string fd_sendname = "sendname";
/// <summary>
/// 竞技比赛战斗记录表
/// </summary>
public const string tb_ClubFightRecord = "club_FightRecord";
/// <summary>
/// 竞技比赛大赢家表
/// </summary>
public const string tb_ClubBigWiner = "Club_BigWiner";
/// <summary>
/// 竞技比赛id
/// </summary>
public const string fd_clubid = "clubid";
/// <summary>
/// 玩法id
/// </summary>
public const string fd_wayid = "wayid";
/// <summary>
/// 房间的唯一码
/// </summary>
public const string fd_weiyima = "weiyima";
/// <summary>
/// 游戏服务器id
/// </summary>
public const string fd_gameserid = "gameserid";
/// <summary>
/// 房间号
/// </summary>
public const string fd_roomnum = "roomnum";
/// <summary>
/// 房间战斗次数
/// </summary>
public const string fd_warcnt = "warcnt";
/// <summary>
/// 开始时间
/// </summary>
public const string fd_startTime = "startTime";
/// <summary>
/// 结束时间
/// </summary>
public const string fd_endTime = "endTime";
/// <summary>
/// 玩家分值信息
/// </summary>
public const string fd_scores = "scores";
/// <summary>
/// userid
/// </summary>
public const string fd_userid = "userid";
/// <summary>
/// 昵称
/// </summary>
public const string fd_nickname = "nickname";
/// <summary>
/// 备注
/// </summary>
public const string fd_remark = "remark";
/// <summary>
/// 头像
/// </summary>
public const string fd_photo = "photo";
/// <summary>
/// id增量
/// </summary>
public const int idIncrement = 100000;
/// <summary>
/// 创建竞技比赛存储过程
/// </summary>
public const string pr_createclubnew = "createclubnew";
/// <summary>
/// 创建竞技比赛玩家
/// </summary>
public const string pr_createplayer = "CreateClubPlayer";
/// <summary>
/// 加载所有的竞技比赛数据
/// </summary>
public static List<Club_Base> LoadClubs()
{
List<Club_Base> clubs = new List<Club_Base>();
DataTable dt = GameDB.Instance.selectDb(dbbase.game2018, tb_clubs);
int len = dt.Rows.Count;
for (int i = 0; i < len; i++)
{
clubs.Add(_LoadClub(dt.Rows[i]));
}
return clubs;
}
public static async Task<Club_Base> LoadClubAsync(int clubid)
{
return await Task.Run(()=>LoadClub(clubid));
}
public static Club_Base LoadClub(int clubid)
{
clubid = clubid -= 100000;
DataTable dt = GameDB.Instance.selectDb(dbbase.game2018, tb_clubs, null, $"id={clubid}");
if (dt.Rows.Count <= 0)
{
return null;
}
return _LoadClub(dt.Rows[0]);
}
public static bool ExistClub(int clubId)
{
clubId = clubId -= 100000;
bool exists = GameDB.Instance.DapperExecuteScalar<int>(dbbase.game2018,
$"SELECT COUNT(1) FROM {tb_clubs} WHERE Id = @Id",
new { Id = clubId }) > 0;
return exists;
}
/// <summary>
/// 从行数据中加载竞技比赛数据
/// </summary>
/// <param name="row">行</param>
/// <returns></returns>
private static Club_Base _LoadClub(DataRow row)
{
Club_Base club = new Club_Base();
club.Init();
club.id = int.Parse(row[fd_id].ToString()) + idIncrement;
club.clubname = row[fd_clubname].ToString();
club.notice = row[fd_notice].ToString();
club.leadername = row[fd_leadername].ToString();
club.wayVer = (int)row[fd_wayVer];
int timeh = int.Parse(row[fd_createtimeh].ToString());
int timem = int.Parse(row[fd_createtimem].ToString());
int times = int.Parse(row[fd_createtimes].ToString());
//if (club.id > 100050)
// Console.WriteLine("1111");
CustomTime custime = new CustomTime(timeh, (byte)timem, (byte)times, 0);
club.createTime = TimeConvert.CustomTimeToDateTime(custime);
club.card = int.Parse(row[fd_cards].ToString());
club.mancnt = int.Parse(row[fd_manCnt].ToString());
byte[] bts = row[fd_mans] as byte[];
tr_clubMans mans = BinaryConvert.BytesToStruct<tr_clubMans>(bts, 0);
if (mans.ids != null)
{
club.mansid.AddRange(mans.ids.GetNewArray(0, club.mancnt));
}
if (club.mancnt != club.mansid.Count)
{
Debug.Error($"数据错误,玩家数量与真实数量不一致! {club.id}");
}
string ways = row[fd_newways].ToString();
if (club.wayVer == Club_Base.allServerVer)
{
PlayWay[] plways = JsonPack.GetData<PlayWay[]>(ways);
if (plways != null)
club.ways.AddRange(plways);
}
club.PassWord = row[fd_Password].ToString();
string setting = row[fd_setting].ToString();
if (!string.IsNullOrEmpty(setting))
{
club.Setting = JsonPack.GetData<ClubSetting>(setting);
}
else
{
club.Setting = new ClubSetting();
}
Debug.Info("加载竞技比赛:" + club.clubname);
// Thread.Sleep(2);//不知为何要等待100ms, 单元测试当数据较多时大于200将导致测试因超时失败因此由原100修改为2
return club;
}
/// <summary>
/// 加载所有的拥有竞技比赛的玩家
/// </summary>
/// <returns></returns>
public static List<ClubPlayer> LoadPlayers()
{
List<ClubPlayer> players = new List<ClubPlayer>();
DataTable dt = GameDB.Instance.selectDb(dbbase.game2018, tb_players);
int len = dt.Rows.Count;
for (int i = 0; i < len; i++)
{
players.Add(_LoadPlayer(dt.Rows[i]));
}
return players;
}
public static ClubPlayer LoadPlayer(int userId)
{
DataTable dt = GameDB.Instance.selectDb(dbbase.game2018, tb_players, null, $"userid2018={userId}");
int len = dt.Rows.Count;
if (len > 0)
{
return _LoadPlayer(dt.Rows[0]);
}
return null;
}
/// <summary>
/// 删除俱乐部玩家
/// </summary>
/// <param name="userid"></param>
/// <returns></returns>
public static bool DeletePlayer(int userid)
{
string sql = $"delete from players where userid2018={userid}";
return 1 == GameDB.Instance.ExceSql(dbbase.game2018, sql);
}
/// <summary>
/// 删除俱乐部
/// </summary>
/// <param name="clubid"></param>
/// <returns></returns>
public static bool DeleteClub(int clubid)
{
string sql = $"DELETE FROM clubs WHERE ID = {clubid}";
string leaguePowerSql = $"DELETE FROM LeagueClubLeaguePower WHERE ClubId = {clubid}";
var ret = dbbase.game2018.ExecuteTransaction(t =>
{
t.ExecuteNonQuery(sql);
t.ExecuteNonQuery(leaguePowerSql);
return true;
});
return ret;
}
/// <summary>
/// 删除俱乐部消息,申请加入之类的消息
/// </summary>
/// <param name="clubId">俱乐部Id减去了100000的id真实的俱乐部Id</param>
/// <returns></returns>
public static bool DeleteClubsByClubId(int clubId)
{
string sql = $"DELETE FROM clubmsg WHERE receiveid = {clubId}";
var c = GameDB.Instance.ExceSql(dbbase.game2018, sql);
Debug.ImportantLog($"删除俱乐部:{clubId} 的消息条数为:{c}");
return c > 0;
}
public static Task<bool> PlayerIsInClubAsync(int userid)
{
return Task.Run(() => PlayerIsInClub(userid));
}
/// <summary>
/// 玩家是否在俱乐部里面有数据
/// </summary>
/// <returns>true有数据 false没有数据</returns>
public static bool PlayerIsInClub(int userid)
{
string sql = $"select top 1 * from players where userid2018={userid}";
DataSet ds = new DataSet();
GameDB.Instance.ExceSql(dbbase.game2018, sql, null, ds);
var b = ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0;
if (!b) return false;
var myinfo = ds.Tables[0].Rows[0][fd_myclubinfodata] == DBNull.Value;
var joinInfo = ds.Tables[0].Rows[0][fd_joinclubinfodata] == DBNull.Value;
//Debug.ImportantLog($"b m:{myinfo} ,j:{joinInfo}");
if (myinfo && joinInfo)
{
return false;
}
else
{
string myText = ds.Tables[0].Rows[0][fd_myclubinfodata] as string; //空数据一般是[]
string joinText = ds.Tables[0].Rows[0][fd_joinclubinfodata] as string;
//Debug.ImportantLog($"mytext:{myText}, join:{joinText}");
if (myText.Length <= 3 && joinText.Length <= 3)
{
return false;
}
}
return true;
}
/// <summary>
/// 加载竞技比赛玩家
///
/// 2020-06-21 修改竞技比赛的玩家表
/// 原来存储的是二进制数据,完全没有办法拓展。
/// 所以把我的竞技比赛信息,加入的竞技比赛信息战斗记录的id换成 josn 格式存储 新增数据库字段
/// 也就是这个版本升级之contact 字段 myclubinfo 字段 joinclubinfo 字段 fightrecordid 字段 都废弃了
///
/// </summary>
/// <param name="row">行</param>
/// <returns>竞技比赛玩家</returns>
private static ClubPlayer _LoadPlayer(DataRow row)
{
ClubPlayer player = new ClubPlayer();
//userid
player.userid = int.Parse(row[fd_userid2018].ToString());
//用户昵称
player.nickname = row[fd_nickname2018].ToString();
if (row["sex"] != DBNull.Value)
{ //这是新加的字段
player.sex = int.Parse(row["sex"].ToString());
}
bool isSave = false;
//先去加载新的, 如果加载不到 就去加载老的
if (row[fd_myclubinfodata] == DBNull.Value)
{ //新的是空 去加载老的, 并把这个数据存到新的里面去
byte[] bts = row[fd_myclubinfo] as byte[];
tr_clubsOfPlayer myclubinfo = BinaryConvert.BytesToStruct<tr_clubsOfPlayer>(bts);
player.myClubs = tr_clubsOfPlayerToListPlayerofClub(ref myclubinfo);
//存到新的里去
isSave = true;
}
else
{
string text = row[fd_myclubinfodata] as string;
player.myClubs = JsonPack.GetData<List<playerofClub>>(text);
if (player.myClubs == null)
{
Debug.Error("新表中没有存储到我的竞技比赛数据" + player.userid);
player.myClubs = new List<playerofClub>();
}
}
if (row[fd_joinclubinfodata] == DBNull.Value)
{ //新的是空 去加载老的,并把这个数据存到新的里面去
byte[] bts = row[fd_joinclubinfo] as byte[];
tr_clubsOfPlayer joinclubinfo = BinaryConvert.BytesToStruct<tr_clubsOfPlayer>(bts);
player.joinClubs = tr_clubsOfPlayerToListPlayerofClub(ref joinclubinfo);
//存到新的里面去
isSave = true;
}
else
{
string text = row[fd_joinclubinfodata] as string;
player.joinClubs = JsonPack.GetData<List<playerofClub>>(text);
if (player.joinClubs == null)
{
Debug.Error("新表中没有存储到我加入的竞技比赛数据:" + player.userid);
player.joinClubs = new List<playerofClub>();
}
}
if (row[fd_fightcorddata] == DBNull.Value)
{
byte[] bts = row[fd_fightcord] as byte[];
tr_playerFightRecordId fightrecord = BinaryConvert.BytesToStruct<tr_playerFightRecordId>(bts);
player.fightRecordids = FightRecordidToListid(ref fightrecord);
//存到新的里面去
isSave = true;
}
else
{
string text = row[fd_fightcorddata] as string;
player.fightRecordids = JsonPack.GetData<List<int>>(text);
if (player.fightRecordids == null)
{
Debug.Error("新表中没有存储到战斗记录数据的id:" + player.userid);
player.fightRecordids = new List<int>();
}
}
if (isSave)
UpdatePlayer(player);
return player;
}
/// <summary>
/// 时间转换
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
private static DateTime ConvertTime(ref tr_sifangdatetime time)
{
CustomTime ct = new CustomTime(time.hours, time.minute, time.second);
return TimeConvert.CustomTimeToDateTime(ct);
}
/// <summary>
/// 时间转换
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
private static tr_sifangdatetime ConvertTime(DateTime time)
{
CustomTime ct = TimeConvert.DateTimeToCustomTime(time);
tr_sifangdatetime sftime;
sftime.hours = ct.hours;
sftime.minute = ct.minute;
sftime.second = ct.second;
return sftime;
}
/// <summary>
/// 玩家的单个竞技比赛结构数据转类数据
/// </summary>
/// <returns></returns>
private static playerofClub Tr_playerInfoOfClubToplayerofClub(ref tr_playerInfoOfClub tpic)
{
playerofClub item = new playerofClub();
item.clubid = tpic.clubid;
item.inGame = tpic.ingame;
item.position = tpic.position;
item.remark = BinaryConvert.BytesToShortString(tpic.remark, BinaryConvert.GB2312);
if (item.remark.Length != 0)
Console.WriteLine(item.remark);
item.joinTime = ConvertTime(ref tpic.jointime);
item.permission = tpic.bak1;
return item;
}
/// <summary>
/// 玩家的单个竞技比赛类数据转结构数据
/// </summary>
/// <param name="pc"></param>
/// <returns></returns>
private static tr_playerInfoOfClub PlayerofClubTotr_playerInfoOfClub(playerofClub pc)
{
tr_playerInfoOfClub tpic = tr_playerInfoOfClub.CreateTr_playerInfoOfClub();
tpic.clubid = pc.clubid;
tpic.ingame = (byte)pc.inGame;
tpic.jointime = ConvertTime(pc.joinTime);
tpic.position = (byte)pc.position;
tpic.bak1 = (ushort)pc.permission;
BinaryConvert.ShortStringToBytes(pc.remark, tpic.remark, 0, BinaryConvert.GB2312);
return tpic;
}
/// <summary>
/// 玩家的竞技比赛结构数据 转类数据
/// </summary>
/// <param name="tcp"></param>
/// <returns></returns>
private static List<playerofClub> tr_clubsOfPlayerToListPlayerofClub(ref tr_clubsOfPlayer tcp)
{
List<playerofClub> pc = new List<playerofClub>();
for (int i = 0; i < tcp.cnt; i++)
{
pc.Add(Tr_playerInfoOfClubToplayerofClub(ref tcp.datas[i]));
}
return pc;
}
/// <summary>
/// 玩家的竞技比赛类数据 转结构数据
/// </summary>
/// <param name="clubdata"></param>
/// <returns></returns>
private static tr_clubsOfPlayer ListPlayerofClubTotr_clubsOfPlayer(List<playerofClub> clubdata)
{
tr_clubsOfPlayer tcp = tr_clubsOfPlayer.CreateTr_clubsOfPlayer();//new tr_clubsOfPlayer();
tcp.cnt = clubdata.Count;
for (int i = 0; i < tcp.cnt; i++)
{
if (i < tcp.datas.Length)
tcp.datas[i] = PlayerofClubTotr_playerInfoOfClub(clubdata[i]);
}
return tcp;
}
/// <summary>
/// 玩家战斗记录id结构体转链表
/// </summary>
/// <param name="pfr"></param>
/// <returns></returns>
private static List<int> FightRecordidToListid(ref tr_playerFightRecordId pfr)
{
List<int> records = new List<int>();
for (int i = 0; i < pfr.cnt; i++)
{
records.Add(pfr.fightrecords[i]);
}
return records;
}
/// <summary>
/// 玩家战斗记录id链表转结构体
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public static tr_playerFightRecordId ListidToFightRecordid(List<int> ids)
{
tr_playerFightRecordId tpfr = new tr_playerFightRecordId();
tpfr.cnt = ids.Count;
for (int i = 0; i < tpfr.cnt; i++)
{
tpfr.fightrecords[i] = ids[i];
}
return tpfr;
}
/// <summary>
/// 数组转 竞技比赛 中的玩家数据
/// </summary>
/// <param name="mansid"></param>
/// <returns></returns>
public static tr_clubMans ArrayTotr_clubMans(List<int> mansid)
{
tr_clubMans mans = tr_clubMans.CreateClubMans();
int len = mansid.Count;
for (int i = 0; i < len; i++)
{
mans.ids[i] = mansid[i];
}
return mans;
}
/// <summary>
/// 创建竞技比赛存储过程
/// </summary>
/// <param name="club">竞技比赛数据</param>
/// <param name="myclubs">我的竞技比赛数据</param>
/// <param name="createuser">创建者userid</param>
/// <returns>0程序出错 -1未找到创建者 -2竞技比赛名称同名 -3表示已存在竞技比赛id</returns>
public static int CreateClub(Club_Base club, List<playerofClub> myclubs, int createuser)
{
var spp = GameDB.Instance.BeginSetProcedureParameter(dbbase.game2018, pr_createclubnew);
GameDB.Instance.AddProdureParameters(spp, "@clubid", SqlDbType.Int, club.id - ClubDataManager.idIncrement);
GameDB.Instance.AddProdureParameters(spp, "@clubname", SqlDbType.NVarChar, club.clubname);
GameDB.Instance.AddProdureParameters(spp, "@clubnotice", SqlDbType.NVarChar, club.notice);
GameDB.Instance.AddProdureParameters(spp, "@createruser", SqlDbType.NVarChar, createuser);
CustomTime ct = TimeConvert.DateTimeToCustomTime(club.createTime);
GameDB.Instance.AddProdureParameters(spp, "@createH", SqlDbType.Int, ct.hours);
GameDB.Instance.AddProdureParameters(spp, "@createM", SqlDbType.Int, ct.minute);
GameDB.Instance.AddProdureParameters(spp, "@createS", SqlDbType.Int, ct.second);
GameDB.Instance.AddProdureParameters(spp, "@cards", SqlDbType.Int, club.card);
var ids = ArrayTotr_clubMans(club.mansid);
byte[] bts = BinaryConvert.StructToBytes(ids);
GameDB.Instance.AddProdureParameters(spp, "@mans", SqlDbType.Binary, bts);
GameDB.Instance.AddProdureParameters(spp, "@mancnt", SqlDbType.Int, club.mancnt);
GameDB.Instance.AddProdureParameters(spp, "@ways", SqlDbType.Text, JsonPack.GetJson(club.ways));
var clubsinfo = JsonPack.GetJson(myclubs);
/* 老的二进制方式
var clubsinfo = ListPlayerofClubTotr_clubsOfPlayer(myclubs);
bts = BinaryConvert.StructToBytes(clubsinfo);
*/
GameDB.Instance.AddProdureParameters(spp, "@myclubinfo", SqlDbType.Text, clubsinfo);
GameDB.Instance.AddProdureParameters(spp, "@result", SqlDbType.Int, 0, ParameterDirection.Output);
DataSet ds = new DataSet();
Dictionary<string, object> pars = GameDB.Instance.EndAddProdureParameters(spp, ds);
return (int)pars["@result"];
}
/// <summary>
/// 创建一个竞技比赛玩家
/// </summary>
/// <param name="player"></param>
/// <returns></returns>
public static bool CreatePlayer(ClubPlayer player)
{
var spp = GameDB.Instance.BeginSetProcedureParameter(dbbase.game2018, pr_createplayer);
GameDB.Instance.AddProdureParameters(spp, "@userid", SqlDbType.Int, player.userid);
/* 老的
var clubsinfo = ListPlayerofClubTotr_clubsOfPlayer(player.myClubs);
byte[] bts = BinaryConvert.StructToBytes(clubsinfo);
GameDB.Instance.AddProdureParameters(spp, "@myclubinfo", SqlDbType.Binary, bts);
*/
var clubsinfo = JsonPack.GetJson(player.myClubs);
GameDB.Instance.AddProdureParameters(spp, "@myclubinfo", SqlDbType.Text, clubsinfo);
/* 老的
clubsinfo = ListPlayerofClubTotr_clubsOfPlayer(player.joinClubs);
bts = BinaryConvert.StructToBytes(clubsinfo);
GameDB.Instance.AddProdureParameters(spp, "@joinclubinfo", SqlDbType.Binary, bts);
*/
clubsinfo = JsonPack.GetJson(player.joinClubs);
GameDB.Instance.AddProdureParameters(spp, "@joinclubinfo", SqlDbType.Text, clubsinfo);
/* 老的
var pfr = ListidToFightRecordid(player.fightRecordids);
bts = BinaryConvert.StructToBytes(pfr);
GameDB.Instance.AddProdureParameters(spp, "@fightrecordids", SqlDbType.Binary, bts);
*/
var pfr = JsonPack.GetJson(player.fightRecordids);
GameDB.Instance.AddProdureParameters(spp, "@fightrecordids", SqlDbType.Text, pfr);
GameDB.Instance.AddProdureParameters(spp, "@result", SqlDbType.Int, 0, ParameterDirection.Output);
DataSet ds = new DataSet();
Dictionary<string, object> pars = GameDB.Instance.EndAddProdureParameters(spp, ds);
if (ds.Tables.Count > 0)
{
player.nickname = ds.Tables[0].Rows[0][fd_nickname].ToString();
}
return (int)pars["@result"] == 1;
}
/// <summary>
/// 更新玩家 修改玩家权限,设置小黑屋都需要调用更新 玩家数据
/// </summary>
/// <param name="player"></param>
public static bool UpdatePlayer(ClubPlayer player)
{
string sql = string.Format("update Top(1) {0} set {1}=@nickname,{2}=@myclubinfo,{3}=@joinclubinfo,{4}=@fightrecord where {5}={6};",
tb_players, fd_nickname2018, fd_myclubinfodata, fd_joinclubinfodata, fd_fightcorddata, fd_userid2018, player.userid);
//List<ISqlAloneParameter<SqlDbType>> sqlpms = new List<ISqlAloneParameter<SqlDbType>>();
/* 老的存储
var clubsinfo = ListPlayerofClubTotr_clubsOfPlayer(player.myClubs);
byte[] bts1 = BinaryConvert.StructToBytes(clubsinfo);
var param1 = new SqlParameter("@myclubinfo", SqlDbType.Binary, bts1.Length) { Value = bts1 };//sqlpms.Add(new SqlAloneParameter("@myclubinfo", bts, bts.Length));
*/
var paramNick = new SqlParameter("@nickname", SqlDbType.Text) { Value = player.nickname };
var clubsinfo = JsonPack.GetJson(player.myClubs);
var param1 = new SqlParameter("@myclubinfo", SqlDbType.Text) { Value = clubsinfo };
/* 老的存储
var clubsinfo2 = ListPlayerofClubTotr_clubsOfPlayer(player.joinClubs);
var bts2 = BinaryConvert.StructToBytes(clubsinfo2);
var param2 = new SqlParameter("@joinclubinfo", SqlDbType.Binary, bts2.Length) { Value = bts2 };//sqlpms.Add(new SqlAloneParameter("@joinclubinfo", bts, bts.Length));
*/
var clubsinfo2 = JsonPack.GetJson(player.joinClubs);
var param2 = new SqlParameter("@joinclubinfo", SqlDbType.Text) { Value = clubsinfo2 };
/* 老的存储
var pfr = ListidToFightRecordid(player.fightRecordids);
var bts3 = BinaryConvert.StructToBytes(pfr);
var param3 = new SqlParameter("@fightrecord", SqlDbType.Binary, bts3.Length) { Value = bts3 };//sqlpms.Add(new SqlAloneParameter("@fightrecord", bts, bts.Length));
*/
var pfd = JsonPack.GetJson(player.fightRecordids);
var param3 = new SqlParameter("@fightrecord", SqlDbType.Text) { Value = pfd };
var sqlpms = new SqlParameter[] { paramNick, param1, param2, param3 };
return 1 == GameDB.Instance.ExceSql(dbbase.game2018, sql, sqlpms);
}
public static bool UpdatePlayers(IEnumerable<ClubPlayer> players)
{
var transaction = GameDB.Instance.BeginTransaction(dbbase.game2018);
var succ = false;
try
{
foreach (var player in players)
{
string sql = string.Format("update Top(1) {0} set {1}=@nickname,{2}=@myclubinfo,{3}=@joinclubinfo,{4}=@fightrecord where {5}={6};",
tb_players, fd_nickname2018, fd_myclubinfodata, fd_joinclubinfodata, fd_fightcorddata, fd_userid2018, player.userid);
var paramNick = new SqlAloneParameter("@nickname", player.nickname, player.nickname.Length, SqlDbType.Text);
var clubsinfo = JsonPack.GetJson(player.myClubs);
var param1 = new SqlAloneParameter("@myclubinfo", clubsinfo, clubsinfo.Length, SqlDbType.Text);
var clubsinfo2 = JsonPack.GetJson(player.joinClubs);
var param2 = new SqlAloneParameter("@joinclubinfo", clubsinfo2, clubsinfo2.Length, SqlDbType.Text);
var pfd = JsonPack.GetJson(player.fightRecordids);
var param3 = new SqlAloneParameter("@fightrecord", pfd, pfd.Length, SqlDbType.Text);
var sqlpms = new List<ISqlAloneParameter<SqlDbType>> { paramNick, param1, param2, param3 };
succ = GameDB.Instance.TransactionAddSql(transaction, sql, sqlpms) == 1;
if (transaction.isException)
{
throw transaction.exception;//发生异常,抛出
}
if (!succ)
{
throw new Exception($"UpdatePlayers failed, sql: {sql}");
}
}
succ = true;
}
catch (Exception ex)
{
Debug.Error($"UpdatePlayers ex{ex}");
}
finally
{
succ &= GameDB.Instance.SubTransaction(transaction);
}
return succ;
}
/// <summary>
/// 获取下一个竞技比赛id
/// </summary>
/// <returns></returns>
public static int GetNextClubId()
{
string sql = string.Format("select top(1) id from {0} order by {1} desc", tb_clubs, fd_id);
DataSet ds = new DataSet();
GameDB.Instance.ExceSql(dbbase.game2018, sql, null, ds);
if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count < 1) return 1;
return int.Parse(ds.Tables[0].Rows[0]["id"].ToString()) + 1;
}
/// <summary>
/// 查看公告格式
/// </summary>
/// <param name="notice"></param>
/// <returns></returns>
private static bool CheckNotice(string notice)
{
return BaseFun.CheckStringLength(notice, 0, 32, true, Encoding.GetEncoding("gb2312"))
&& BaseFun.ProcessSqlStr(notice);
}
/// <summary>
/// 执行sql语句修改竞技比赛公告
/// </summary>
/// <param name="clubid"></param>
/// <param name="notice"></param>
public static void ExceSqlSetClubNotice(int clubid, string notice)
{
//string sql = string.Format("update top(1) {2} set {3} = '{0}' where {4} = {1}", notice, clubid, tb_clubs, fd_notice, fd_id);
// update top(1) {tb_clubs} set {fd_notice} = '{notice}' where {fd_id} = {clubid}
string sql = string.Format("update top(1) {0} set {1} = @notice where [ID] = @p2", tb_clubs, fd_notice);
GameDB.Instance.ExceSql(dbbase.game2018, sql, new SqlParameter[]{
new SqlParameter("@p2", SqlDbType.Int){ Value = clubid - ClubDataManager.idIncrement },
new SqlParameter("@notice",notice ?? (object)DBNull.Value)
});
}
/// <summary>
/// 保存俱乐部密码
/// </summary>
/// <param name="clubid"></param>
/// <param name="notice"></param>
public static void SaveClubPassword(int clubid, string password)
{
string sql = string.Format("update top(1) {0} set {1} = @password where [ID] = @p2", tb_clubs, fd_Password);
GameDB.Instance.ExceSql(dbbase.game2018, sql, new SqlParameter[]{
new SqlParameter("@p2", SqlDbType.Int){ Value = clubid - ClubDataManager.idIncrement },
new SqlParameter("@password",password ?? string.Empty)
});
}
/// <summary>
/// 修改俱乐部群主的名字
/// </summary>
/// <param name="clubid"></param>
/// <param name="nickName"></param>
public static void UpdateLeaderName(int clubid, string nickName)
{
string sql = string.Format("update top(1) {0} set {1} = @nickName where [ID] = @p2", tb_clubs, fd_leadername);
GameDB.Instance.ExceSql(dbbase.game2018, sql, new SqlParameter[]{
new SqlParameter("@p2", SqlDbType.Int){ Value = clubid - ClubDataManager.idIncrement },
new SqlParameter("@nickName",nickName ?? string.Empty)
});
}
/// <summary>
/// 设置竞技比赛公告
/// </summary>
/// <param name="clubid">竞技比赛id</param>
/// <param name="notice">公告</param>
/// <returns>公告符不符合格式</returns>
public static bool SetClubNotice(int clubid, string notice)
{
bool r = CheckNotice(notice);
if (r)
{
ExceSqlSetClubNotice(clubid, notice);
}
return r;
}
/// <summary>
/// 设置竞技比赛公告
/// </summary>
/// <param name="clubid">竞技比赛id</param>
/// <param name="notice">公告</param>
/// <returns></returns>
public static bool SetClubNoticeAsyn(int clubid, string notice)
{
bool r = CheckNotice(notice);
if (r)
{
Task.Factory.StartNew(
() =>
{
ExceSqlSetClubNotice(clubid, notice);
}
);
}
return r;
}
/// <summary>
/// 计算带折扣房卡的最终值
/// </summary>
public static int CalClubCardWithDiscount(int clubId, int cardCnt)
{
var discount = ClubRCDiscountRedisUtil.GetClub(clubId);
return (int)Math.Round(cardCnt / discount);
}
public static Task<bool> AddClubCardAsync(int clubId,int cardCnt)
{
return Task.Run(() => AddClubCard(clubId, cardCnt));
}
/// <summary>
/// 添加竞技比赛房卡
/// </summary>
/// <param name="clubid">竞技比赛id</param>
/// <param name="cardCnt">房卡数量</param>
public static bool AddClubCard(int clubid, int cardCnt)
{
string sql;
int cnt = Math.Abs(cardCnt);
if (cardCnt >= 0) //返还房卡
sql = $"update top(1) {tb_clubs} set {fd_cards} = {fd_cards} + {cnt},{fd_integral} = {fd_integral} - {cnt} where {fd_id} = {clubid - idIncrement}";
//sql = string.Format("update Top(1) {0} set {1} = {1} + {2}, {5} = {5} - {2} where {3} = {4}", tb_clubs, fd_cards, cardCnt, fd_id, , (clubid - idIncrement));
else
sql = $"update top(1) {tb_clubs} set {fd_cards} = {fd_cards} - {cnt},{fd_integral} = {fd_integral} + {cnt} where {fd_id} = {clubid - idIncrement}";
//sql = string.Format("update Top(1) {0} set {1} = {1} {2} where {3} = {4}", tb_clubs, fd_cards, cardCnt, fd_id, (clubid - idIncrement));
Debug.ImportantLog(sql);
return GameDB.Instance.ExceSql(dbbase.game2018, sql) > 0;
}
/// <summary>
/// 异步添加竞技比赛房卡
/// </summary>
/// <param name="clubid"></param>
/// <param name="cardCnt"></param>
public static async Task<bool> AddClubCardAsyn(int clubid, int cardCnt)
{
return await Task.Factory.StartNew(
() =>
{
return AddClubCard(clubid, cardCnt);
}
);
}
/*
/// <summary>
/// 获取竞技比赛消息_未处理的
/// </summary>
/// <param name="clubid">竞技比赛id</param>
/// <param name="count">最大接收数量</param>
/// <returns></returns>
public static List<ClubMessage> GetClubMessage(int clubid, int count) {
List<ClubMessage> msgs = new List<ClubMessage>();
string sql = string.Format("select Top({0}) * from {1} where {2}={3} and {4}=0 Order By sendTime desc;",
count, tb_message, fd_receiveid, clubid - idIncrement, fd_state);
DataSet ds = new DataSet();
GameDB.Instance.ExceSql(dbbase.game2018, sql, null, ds);
if (ds.Tables.Count == 0)
return msgs;
DataTable dt = ds.Tables[0];
for (int i = 0; i < dt.Rows.Count; i++) {
msgs.Add(LoadClubMessage(dt.Rows[i]));
}
return msgs;
}
*/
/// <summary>
/// 加载竞技比赛消息
/// </summary>
/// <param name="row">行</param>
/// <returns></returns>
public static ClubMessage LoadClubMessage(DataRow row)
{
ClubMessage clubmsg = new ClubMessage();
clubmsg.id = (int)row[fd_id];
clubmsg.style = (int)row[fd_style];
clubmsg.state = (int)row[fd_state];
clubmsg.content = row[fd_strcontent].ToString();
clubmsg.sendTime = DateTime.Parse(row[fd_sendTime].ToString());
string doTime = row[fd_dotime].ToString();
if (!string.IsNullOrEmpty(doTime))
{
clubmsg.doTime = DateTime.Parse(doTime);
}
if (row[fd_doman] != DBNull.Value)
clubmsg.doman = (int)row[fd_doman];
if (row[fd_domanname] != DBNull.Value)
clubmsg.domanname = row[fd_domanname].ToString();
if (row[fd_receiveid] != DBNull.Value)
clubmsg.reciveid = (int)row[fd_receiveid] + idIncrement;
clubmsg.sendid = (int)row[fd_sendid];
clubmsg.sendname = row[fd_sendname].ToString();
if (row.Table.Columns.Contains("Sex"))
if (row["Sex"] != DBNull.Value)
clubmsg.SendSex = (int)row["Sex"];
clubmsg.param1 = (int)row["param1"];
clubmsg.param2 = row["param2"] is DBNull ? null : (string)row["param2"];
return clubmsg;
}
public static Task<ClubMessage> GetClubMessageAsync(int msgid)
{
return Task.Run(
() => GetClubMessage(msgid)
);
}
/// <summary>
/// 获取竞技比赛消息
/// </summary>
/// <param name="msgid"></param>
/// <returns></returns>
public static ClubMessage GetClubMessage(int msgid)
{
string sql = string.Format($"select Top(1) * from {tb_message} where {fd_id} = {msgid}");
DataSet ds = new DataSet();
GameDB.Instance.ExceSql(dbbase.game2018, sql, null, ds);
if (ds.Tables.Count == 0)
return null;
DataTable dt = ds.Tables[0];
return LoadClubMessage(dt.Rows[0]);
}
public static Task<List<ClubMessage>> GetClubMessageByClubAsync(int clubId)
{
return Task.Run(() => GetClubMessageByClub(clubId));
}
/// <summary>
/// 获取竞技比赛未处理的消息
/// </summary>
/// <param name="club"></param>
/// <returns></returns>
public static List<ClubMessage> GetClubMessageByClub(int clubid)
{
List<ClubMessage> lst = new List<ClubMessage>();
string sql = $"SELECT TOP 500 c.[id],c.[style],c.[state],c.[sendTime],c.[dotime],c.[doman],c.[domanname],c.[receiveid],c.[sendid],c.[sendname],c.[strcontent],c.[param1],c.[param2],us.Sex FROM [game2018].[dbo].[clubmsg] c INNER JOIN jnxdgame.dbo.tbUserBaseInfo us on c.sendid=us.UserID where c.receiveid= {clubid - idIncrement} and (((c.style=0 or c.style=2) and c.state=0) or (c.style=1 and c.state=4)) order by c.id desc";//and (c.style=0 or c.style=2)
DataSet ds = new DataSet();
GameDB.Instance.ExceSql(dbbase.game2018, sql, null, ds);
if (BaseFun.DataSetIsNullOrEmpty(ds) || BaseFun.DataTableIsNullOrEmpty(ds.Tables[0]))
return lst;
var dt = ds.Tables[0];
int len = dt.Rows.Count;
for (int i = 0; i < len; i++)
{
lst.Add(LoadClubMessage(dt.Rows[i]));
}
return lst;
}
/// <summary>
/// 获取个人的消息记录
/// </summary>
/// <param name="userid"></param>
/// <returns></returns>
public static List<ClubMessage> GetClubMessageByPerson(int userid)
{
List<ClubMessage> lst = new List<ClubMessage>();
string sql = string.Format($"select * from {tb_message} where {fd_sendid} = {userid} order by {fd_id} desc");
DataSet ds = new DataSet();
GameDB.Instance.ExceSql(dbbase.game2018, sql, null, ds);
if (BaseFun.DataSetIsNullOrEmpty(ds) || BaseFun.DataTableIsNullOrEmpty(ds.Tables[0]))
return lst;
var dt = ds.Tables[0];
int len = dt.Rows.Count;
for (int i = 0; i < len; i++)
{
lst.Add(LoadClubMessage(dt.Rows[i]));
}
return lst;
}
public static Task<int> DoClubMessageAsync(ClubMessage clubmsg)
{
return Task.Run(() => DoClubMessage(clubmsg));
}
/// <summary>
/// 更新竞技比赛消息
/// </summary>
/// <param name="clubmsg"></param>
public static int DoClubMessage(ClubMessage clubmsg)
{
string sql = string.Format($"update top(1) {tb_message} set {fd_state}={clubmsg.state},{fd_doman}='{clubmsg.doman}',{fd_dotime}='{clubmsg.doTime}',{fd_domanname}=@domanname where {fd_id}={clubmsg.id} and ((({fd_style}=0 or {fd_style}=2) and {fd_state} = 0) or ({fd_style}=1 and {fd_state} = 4))");
return GameDB.Instance.ExceSql(dbbase.game2018, sql, new[] { new SqlParameter("@domanname", clubmsg.domanname ?? (object)DBNull.Value) });
}
public static Task<bool> InsertClubMessageAsync(ClubMessage clubmsg)
{
return Task.Run(() => InsertClubMessage(clubmsg));
}
/// <summary>
/// 插入一条消息
/// </summary>
/// <param name="clubmsg"></param>
/// <returns></returns>
public static bool InsertClubMessage(ClubMessage clubmsg)
{
if (clubmsg.domanname == null)
clubmsg.domanname = string.Empty;
if (clubmsg.content == null)
clubmsg.content = string.Empty;
string sql = $"insert into {tb_message}({fd_style},{fd_state},{fd_sendTime},{fd_receiveid},{fd_sendid},{fd_sendname},{fd_strcontent})" +
$" values({clubmsg.style},{clubmsg.state},'{clubmsg.sendTime}',{clubmsg.reciveid},{clubmsg.sendid},@sendname,@content)";
return GameDB.Instance.ExceSql(dbbase.game2018, sql, new[] {
new SqlParameter("@content", clubmsg.content ?? (object)DBNull.Value),
new SqlParameter("@sendname", clubmsg.sendname ?? (object)string.Empty)//clubmsg 的sendname字段不允许为null
}) == 1;
}
public static Task<bool> AskForJoinClubMessageAsync(ClubMessage clubmsg)
{
return Task.Run(() => AskForJoinClubMessage(clubmsg));
}
/// <summary>
/// 请求加入竞技比赛
/// </summary>
/// <param name="clubmsg"></param>
public static bool AskForJoinClubMessage(ClubMessage clubmsg)
{
string sql = string.Empty;
try
{
if (clubmsg.domanname == null)
clubmsg.domanname = string.Empty;
if (clubmsg.content == null)
clubmsg.content = string.Empty;
//如果不存在 这个竞技比赛的申请 就可以去申请
sql = string.Format($"if not exists(select Top(1) 1 from {tb_message} where {fd_receiveid} = {clubmsg.reciveid - idIncrement} and {fd_sendid} = {clubmsg.sendid} and {fd_style} = {clubmsg.style} and {fd_state} = {clubmsg.state}) begin{Environment.NewLine}");
sql += string.Format($"insert into {tb_message}({fd_style},{fd_state},{fd_sendTime},{fd_doman},{fd_domanname},{fd_receiveid},{fd_sendid},{fd_sendname},{fd_strcontent}, param1, param2) " +
$"values({clubmsg.style},{clubmsg.state},'{clubmsg.sendTime}',{clubmsg.doman},@domanname,{clubmsg.reciveid - idIncrement},{clubmsg.sendid},@sendname,@content, {clubmsg.param1}, @param2);");//{(clubmsg.param2 == null ? "NULL" : string.Format("'{0}'", clubmsg.param2))}
sql += " end;";
//Debug.Warning("AskForJoinClubMessage:" + sql);
/*
* 0724 帮看下,这里有语法错误,输出日志看下 --over
*
*
* */
return GameDB.Instance.ExceSql(dbbase.game2018, sql, new[]{
new SqlParameter("@domanname", clubmsg.domanname),
new SqlParameter("@sendname", clubmsg.sendname),
new SqlParameter("@content", clubmsg.content),
new SqlParameter("@param2", clubmsg.param2 ?? (object)DBNull.Value)
}) == 1;
}
catch (Exception ex)
{
throw new Exception("AskForJoinClubMessage: " + sql, ex);
}
}
/// <summary>
/// 加入竞技比赛数据处理_异步的
/// </summary>
/// <param name="club"></param>
/// <param name="clubPlayer"></param>
/// <returns></returns>
public static Task ClubPlayerChange_Asyn(Club_Base club, ClubPlayer clubPlayer)
{
return Task.Factory.StartNew(
() => ClubPlayerChange(club, clubPlayer)
);
}
/// <summary>
/// 加入竞技比赛数据处理
/// </summary>
/// <param name="club"></param>
/// <param name="clubPlayer"></param>
public static void ClubPlayerChange(Club_Base club, ClubPlayer clubPlayer)
{
//保存竞技比赛数据以及玩家数据
var spp = GameDB.Instance.BeginTransaction(dbbase.game2018);
string sql = string.Format("update Top(1) {0} set {1} = {2}, {3}=@mans where {4} = {5};" //更改竞技比赛
, tb_clubs, fd_manCnt, club.mancnt, fd_mans, fd_id, club.id - idIncrement);
var ids = ArrayTotr_clubMans(club.mansid);
byte[] bts = BinaryConvert.StructToBytes(ids);
List<ISqlAloneParameter<SqlDbType>> sqlpms = new List<ISqlAloneParameter<SqlDbType>>();
sqlpms.Add(new SqlAloneParameter("@mans", bts, bts.Length));
GameDB.Instance.TransactionAddSql(spp, sql, sqlpms);
sql = string.Format("update Top(1) {0} set {1} = @joinclub,{4}=@joinclubnew where {2} = {3};",
tb_players, fd_joinclubinfo, fd_userid2018, clubPlayer.userid, fd_joinclubinfodata);
var clubsinfo = ListPlayerofClubTotr_clubsOfPlayer(clubPlayer.joinClubs);
bts = BinaryConvert.StructToBytes(clubsinfo);
var strJoin = JsonPack.GetJson(clubPlayer.joinClubs);
sqlpms = new List<ISqlAloneParameter<SqlDbType>>();
sqlpms.Add(new SqlAloneParameter("joinclub", bts, bts.Length));
sqlpms.Add(new SqlAloneParameter("joinclubnew", strJoin, strJoin.Length, SqlDbType.Text));
GameDB.Instance.TransactionAddSql(spp, sql, sqlpms);
if (!GameDB.Instance.SubTransaction(spp))
throw spp.exception;
}
/// <summary>
/// 保存玩法
/// </summary>
/// <param name="clubid"></param>
/// <param name="ways"></param>
static void SavePlayWay(int clubid, string ways)
{
string sql = string.Format("update Top(1) {0} set {1}={2},{3}=@way where {4}={5};",
tb_clubs, fd_wayVer, Club_Base.allServerVer, fd_newways, fd_id, clubid - idIncrement);
//List<ISqlAloneParameter<SqlDbType>> sqlpms = new List<ISqlAloneParameter<SqlDbType>>();
//sqlpms.Add(new SqlAloneParameter("@way", ways, ways.Length, SqlDbType.Text));
GameDB.Instance.ExceSql(dbbase.game2018, sql, new SqlParameter[] { new SqlParameter("@way", SqlDbType.Text, ways.Length) { Value = ways } });
}
/// <summary>
/// 保存玩法
/// </summary>
/// <param name="club"></param>
public static void SavePlayWay(Club_Base club)
{
int clubid = club.id;
string ways = JsonPack.GetJson(club.ways);
SavePlayWay(clubid, ways);
}
/// <summary>
/// 保存玩法_异步操作
/// </summary>
/// <param name="club"></param>
public static void SavePlayWayAysn(Club_Base club)
{
int clubid = club.id;
string ways = JsonPack.GetJson(club.ways);
Task.Factory.StartNew(
() => SavePlayWay(clubid, ways)
);
}
/// <summary>
/// 分页查询
/// </summary>
public static List<FightScore> GetFightScoresByPage(int clubId, DateTime startDateTime, DateTime endDateTime,
int pageSize, int pageIndex)
{
var sqlclubId = clubId - ClubDataManager.idIncrement;
string subSql = "(SELECT ROW_NUMBER() OVER (ORDER BY id ASC) AS rownumber, * FROM club_FightRecord";
subSql += $" WHERE clubid={sqlclubId} AND endtime BETWEEN '{startDateTime}' and '{endDateTime}')";
string sql = $"SELECT TOP {pageSize} * FROM {subSql} AS temp_row WHERE rownumber > {pageSize * pageIndex}";
Debug.Info($"sql:{sql}");
return GetFightScoreBySql(sql, sqlclubId);
}
private static List<FightScore> GetFightScoreBySql(string sql,int clubId=0)
{
List<FightScore> fights = new List<FightScore>();
DataSet ds = new DataSet();
GameDB.Instance.ExceSql(dbbase.game2018, sql, null, ds);
if (ds.Tables == null || ds.Tables.Count == 0)
{
//没有记录
return fights;
}
DataTable dt = ds.Tables[0];
if (dt.Rows != null && dt.Rows.Count > 0)
{
int len = dt.Rows.Count;
for (int i = 0; i < len; i++)
{
fights.Add(GetFightScore(clubId, dt.Rows[i]));
}
}
return fights;
}
/// <summary>
/// 获取某个俱乐部的某个玩法的前多少条战斗记录
/// </summary>
/// <param name="clubid">界面显示的俱乐部ID</param>
/// <param name="wayId">玩法ID</param>
/// <param name="top">前多少条</param>
/// <returns></returns>
public static List<FightScore> GetFightScoreByWayId(int clubid,string wayId,int top = 100)
{
var sql = $"select top {top} * from club_FightRecord where clubid = {clubid- idIncrement} and wayid='{wayId}' order by id desc";
return GetFightScoreBySql(sql);
}
/// <summary>
/// 加载战斗记录
/// </summary>
/// <param name="clubid"></param>
/// <param name="weiyima"></param>
/// <returns></returns>
public static FightScore LoadFightScore(int clubid, string weiyima)
{
DataTable dt = GameDB.Instance.selectDb(dbbase.game2018, tb_ClubFightRecord, null, string.Format("clubid={0} and weiyima='{1}'", clubid - idIncrement, weiyima));
if (dt.Rows != null && dt.Rows.Count > 0)
{
return GetFightScore(clubid, dt.Rows[0]);
}
return null;
}
/// <summary>
/// 根据id获取战绩记录
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static FightScore GetFightScoreById(int id)
{
DataTable dt = GameDB.Instance.selectDb(dbbase.game2018, tb_ClubFightRecord, null, string.Format("id={0}", id));
if (dt.Rows != null && dt.Rows.Count > 0)
{
return GetFightScore(-1, dt.Rows[0]);
}
return null;
}
/// <summary>
/// 获取战斗记录
/// </summary>
/// <param name="row"></param>
/// <returns></returns>
public static FightScore GetFightScore(int clubid, DataRow row)
{
FightScore fs = new FightScore();
fs.clubid = clubid > 0 ? clubid : (idIncrement + (int)row["clubid"]);
fs.id = (int)row[fd_id];
fs.roomnum = (int)row[fd_roomnum];
fs.warCnt = (int)row[fd_warcnt];
fs.wayid = row[fd_wayid].ToString(); //未使用
fs.game_serid = (int)row[fd_gameserid];
fs.weiyima = row[fd_weiyima].ToString();
string json = row[fd_scores].ToString();
fs.scores = JsonPack.GetData<FightScore.Player[]>(json);
fs.startTime = DateTime.Parse(row[fd_startTime].ToString());
fs.endTime = DateTime.Parse(row[fd_endTime].ToString());
if (row["CardNum"] != DBNull.Value)
{
fs.CardNum = (int)row["CardNum"];
}
if (row["style"] != DBNull.Value)
{
fs.Style = (short)row["style"];
}
if (row["disUserId"] != DBNull.Value)
{
fs.DisUserId = (int)row["disUserId"];
}
//if (row["playclub"] != DBNull.Value)
//{
// string strp = row["playclub"].ToString();
// if (!string.IsNullOrEmpty(strp) && strp.Length > 2)
// {
// if (strp.IndexOf("Name") >= 0)
// {
// fs.PlayInClubInfo = JsonPack.GetData<Dictionary<int, IdName>>(strp);
// }
// else
// {
// fs.PlayInClub = JsonPack.GetData<Dictionary<int, int>>(strp);
// }
// }
//}
return fs;
}
static string GetHidesKey(int clubid)
{
return $"HidesWay:{clubid}";
}
/// <summary>
/// 保存俱乐部隐藏玩法
/// </summary>
/// <param name="clubId"></param>
/// <param name="list"></param>
public static void SaveHideWays(int clubId, List<string> list,bool isSync = false)
{
if (clubId <= 0 || list == null) return;
var key = GetHidesKey(clubId);
var str = JsonPack.GetJson(list);
Debug.Info($"保存隐藏:{clubId}{str}");
if (isSync)
{
redisManager.GetBiSaidb(6).StringSetAsync(key, str);
}
else
{
redisManager.GetBiSaidb(6).StringSet(key, str);
}
}
/// <summary>
/// 删除隐藏玩法
/// </summary>
public static void RemoveHideWays(int clubId)
{
var key = GetHidesKey(clubId);
redisManager.GetBiSaidb(6).KeyDelete(key);
}
public static Task<List<string>> GetHidesAsync(int clubId)
{
return Task.Run(() => GetHides(clubId));
}
/// <summary>
/// 读取俱乐部隐藏玩法
/// </summary>
/// <param name="clubid"></param>
/// <returns></returns>
public static List<string> GetHides(int clubid)
{
if (clubid <= 0) return new List<string>();
var key = GetHidesKey(clubid);
string str = redisManager.GetBiSaidb(6).StringGet(key);
if (!string.IsNullOrWhiteSpace(str) && str.Length > 2)
{
Debug.Info($"读取隐藏:{clubid}{str}");
return JsonPack.GetData<List<string>>(str);
}
else
{
return new List<string>();
}
}
static string GetPlayerHideWayKey(int clubId)
{
return $"GetPlayerHideWayKey:{clubId}";
}
/// <summary>
/// 保存玩家不能玩哪些玩法
/// </summary>
/// <param name="clubId"></param>
/// <param name="data"></param>
public static void SavePlayerHideWay(int clubId, Dictionary<int, List<string>> data)
{
if (clubId <= 0 || data == null) return;
var key = GetPlayerHideWayKey(clubId);
var str = JsonPack.GetJson(data);
redisManager.GetBiSaidb(6).StringSet(key, str);
}
/// <summary>
/// 获取玩家不能玩哪些玩法
/// </summary>
/// <param name="clubId"></param>
/// <returns></returns>
public static Dictionary<int, List<string>> GetPlayerHideWay(int clubId)
{
if (clubId <= 0) return new Dictionary<int, List<string>>();
var key = GetPlayerHideWayKey(clubId);
string str = redisManager.GetBiSaidb(6).StringGet(key);
if (!string.IsNullOrWhiteSpace(str) && str.Length > 2)
{
return JsonPack.GetData<Dictionary<int, List<string>>>(str);
}
else
{
return new Dictionary<int, List<string>>();
}
}
static string GetClubFightRecordKey()
{
return "GetClubFightRecordKey";
}
/// <summary>
/// 游戏报错战斗结束数据到reids俱乐部服务器去redis里面去拿
/// </summary>
/// <param name="jsonData"></param>
/// <returns>true保存成功 false保存失败</returns>
public static bool SaveClubFightRecord(string jsonData)
{
if (string.IsNullOrWhiteSpace(jsonData)) return true;
try
{
redisManager.Getdb(9).ListRightPush(GetClubFightRecordKey(), jsonData); //从尾部添加
}
catch (Exception e)
{
Debug.Error($"保存战绩数据失败msg:{e.Message},code:{e.StackTrace}");
return false;
}
return true;
}
public static string GetOneClubFightRecord()
{
return redisManager.Getdb(9).ListLeftPop(GetClubFightRecordKey()); //从头部取
}
}
}

Some files were not shown because too many files have changed in this diff Show More