提交示例代码

This commit is contained in:
Bob.Song
2026-03-05 11:39:06 +08:00
commit 25958f58c3
2534 changed files with 209593 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Fantasy-Net.Config" Version="2024.1.4" />
</ItemGroup>
</Project>

Binary file not shown.

View File

@@ -0,0 +1 @@
// 自定义导出配置文件,用于配置自定义导出自定义程序的路径

View File

@@ -0,0 +1 @@
{"WorksheetNames":["MachineConfig","ProcessConfig","WorldConfig","SceneConfig","SceneTypeConfig"],"Tables":{"MachineConfig":1725984682557,"SceneConfig":1726083372000,"WorldConfig":1724007858627,"ProcessConfig":1725195494442}}

View File

@@ -0,0 +1,3 @@
{"List":[
{"Id":1,"OuterIP":"127.0.0.1","OuterBindIP":"127.0.0.1","InnerBindIP":"127.0.0.1"}
]}

View File

@@ -0,0 +1,3 @@
{"List":[
{"Id":1,"MachineId":1,"StartupGroup":0}
]}

View File

@@ -0,0 +1,6 @@
{"List":[
{"Id":1001,"ProcessConfigId":1,"WorldConfigId":1,"SceneRuntimeType":"MultiThread","SceneTypeString":"Addressable","NetworkProtocol":null,"OuterPort":0,"InnerPort":11001,"SceneType":2},
{"Id":1002,"ProcessConfigId":1,"WorldConfigId":1,"SceneRuntimeType":"MultiThread","SceneTypeString":"Gate","NetworkProtocol":"KCP","OuterPort":20000,"InnerPort":11002,"SceneType":3},
{"Id":1003,"ProcessConfigId":1,"WorldConfigId":1,"SceneRuntimeType":"MultiThread","SceneTypeString":"Map","NetworkProtocol":null,"OuterPort":0,"InnerPort":11003,"SceneType":4},
{"Id":1004,"ProcessConfigId":1,"WorldConfigId":1,"SceneRuntimeType":"MultiThread","SceneTypeString":"Chat","NetworkProtocol":null,"OuterPort":0,"InnerPort":11004,"SceneType":8}
]}

View File

@@ -0,0 +1,3 @@
{"List":[
{"Id":1,"WorldName":"测试服","DbConnection":null,"DbName":"fantasy_main","DbType":"MongoDB"}
]}

View File

@@ -0,0 +1,27 @@
syntax = "proto3";
package Sining.Message;
message G2A_TestRequest // IRouteRequest,G2A_TestResponse
{
}
message G2A_TestResponse // IRouteResponse
{
}
message G2M_RequestAddressableId // IRouteRequest,M2G_ResponseAddressableId
{
}
message M2G_ResponseAddressableId // IRouteResponse
{
int64 AddressableId = 1; // Map服务器返回的AddressableId
}
/// 通知Chat服务器创建一个RouteId
message G2Chat_CreateRouteRequest // IRouteRequest,Chat2G_CreateRouteResponse
{
int64 GateRouteId = 1;
}
message Chat2G_CreateRouteResponse // IRouteResponse
{
int64 ChatRouteId = 1;
}

View File

@@ -0,0 +1,64 @@
syntax = "proto3";
package Fantasy.Network.Message;
// 协议分为:
// ProtoBuf:可以在Outer和Inner文件里使用。
// MemoryPack:可以在Outer和Inner文件里使用。
// Bson:仅支持在Inner文件里使用。
// 使用方式:
// 在message协议上方添加// Protocol+空格+协议名字
// 例如:// Protocol ProtoBuf 或 // Protocol MemoryPack
message C2G_TestMessage // IMessage
{
string Tag = 1;
}
message C2G_TestRequest // IRequest,G2C_TestResponse
{
string Tag = 1;
}
message G2C_TestResponse // IResponse
{
string Tag = 1;
}
message C2G_CreateAddressableRequest // IRequest,G2C_CreateAddressableResponse
{
}
message G2C_CreateAddressableResponse // IResponse
{
}
message C2M_TestMessage // IAddressableRouteMessage
{
string Tag = 1;
}
message C2M_TestRequest // IAddressableRouteRequest,M2C_TestResponse
{
string Tag = 1;
}
message M2C_TestResponse // IAddressableRouteResponse
{
string Tag = 1;
}
/// 通知Gate服务器创建一个Chat的Route连接
message C2G_CreateChatRouteRequest // IRequest,G2C_CreateChatRouteResponse
{
}
message G2C_CreateChatRouteResponse // IResponse
{
}
/// 发送一个Route消息给Chat
message C2Chat_TestMessage // ICustomRouteMessage,ChatRoute
{
string Tag = 1;
}
/// 发送一个RPCRoute消息给Chat
message C2Chat_TestMessageRequest // ICustomRouteRequest,Chat2C_TestMessageResponse,ChatRoute
{
string Tag = 1;
}
message Chat2C_TestMessageResponse // ICustomRouteResponse
{
string Tag = 1;
}

View File

@@ -0,0 +1,3 @@
// Route协议定义(需要定义1000以上、因为1000以内的框架预留)
GateRoute = 1001 // Gate
ChatRoute = 1002 // Chat

View File

@@ -0,0 +1,16 @@
# Fantasy-Net.Config
在Config文件夹中存放着Fantasy所需的各种配置文件。这些文件涵盖了多个方面。每个配置文件都有其特定的格式和功能通过精心设计的这些配置文件开发团队能够快速调整框架参数以实现更好的游戏体验从而提升Fantasy的整体质量。
## Excel文件夹
里面存放了Fantasy.Net所需的四个Excel配置文件。用户可以利用Fantasy-Net.Exporter工具依据这四个Excel文件生成相应的JSON文件以供框架使用。这一过程不仅简化了数据处理还确保了不同组件之间的无缝对接使得工作流程更加高效。请确保在导出之前Excel文件的格式和内容符合要求以避免产生错误。
## Json文件夹
在该目录中存放了Fantasy.Net所需的四个JSON配置文件。用户可以根据这四个文件的模板进行添加或修改配置以满足具体需求。每个项目的功能说明在相应的Excel文件中有详细描述方便用户理解和使用这些配置文件。我们建议用户仔细阅读Excel文件中的说明以确保配置的正确性和有效性。
## NetworkProtocol文件夹
存放框架所需定义网络协议的模版和文件夹
### Inner文件夹
定义服务器之间的网络协议
### Outer文件夹
定义客户端和服务器之间的网络协议
### RouteType.Config
定义自定义Route协议的配置文件
## 交流与讨论:
__讨论QQ群 : Fantasy服务器开发交流群 569888673 __

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <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 System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Fantasy.Config")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Fantasy.Config")]
[assembly: System.Reflection.AssemblyTitleAttribute("Fantasy.Config")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@@ -0,0 +1 @@
10b339dabefebaf09b7ba9ea3447b7f3d3308efa4228246ee45a0d671d0fd112

View File

@@ -0,0 +1,15 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Fantasy.Config
build_property.ProjectDir = /Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 8.0
build_property.EnableCodeStyleSeverity =

View File

@@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@@ -0,0 +1,74 @@
{
"format": 1,
"restore": {
"/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj": {}
},
"projects": {
"/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj",
"projectName": "Fantasy.Config",
"projectPath": "/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj",
"packagesPath": "/Users/fantasy/.nuget/packages/",
"outputPath": "/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/fantasy/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"/usr/local/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "all"
},
"SdkAnalysisLevel": "9.0.100"
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"dependencies": {
"Fantasy-Net.Config": {
"target": "Package",
"version": "[2024.1.4, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/9.0.100/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/fantasy/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/fantasy/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.2</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/Users/fantasy/.nuget/packages/" />
</ItemGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgFantasy-Net_Config Condition=" '$(PkgFantasy-Net_Config)' == '' ">/Users/fantasy/.nuget/packages/fantasy-net.config/2024.1.4</PkgFantasy-Net_Config>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)fantasy-net.config/2024.1.4/buildTransitive/Fantasy-Net.Config.targets" Condition="Exists('$(NuGetPackageRoot)fantasy-net.config/2024.1.4/buildTransitive/Fantasy-Net.Config.targets')" />
</ImportGroup>
</Project>

View File

@@ -0,0 +1,126 @@
{
"version": 3,
"targets": {
"net8.0": {
"Fantasy-Net.Config/2024.1.4": {
"type": "package",
"compile": {
"lib/net8.0/Fantasy-Net.Config.dll": {}
},
"runtime": {
"lib/net8.0/Fantasy-Net.Config.dll": {}
},
"build": {
"buildTransitive/Fantasy-Net.Config.targets": {}
}
}
}
},
"libraries": {
"Fantasy-Net.Config/2024.1.4": {
"sha512": "zStTIJq91mx3VjCcU7eAtrExAcv1Zg+dAd8UdDvpHu7kTY8ldDQMp8sCmez2s+vUTmNyH1hlOgEE3rJILAijfQ==",
"type": "package",
"path": "fantasy-net.config/2024.1.4",
"hasTools": true,
"files": [
".nupkg.metadata",
".signature.p7s",
"README.md",
"buildTransitive/Fantasy-Net.Config.targets",
"fantasy-net.config.2024.1.4.nupkg.sha512",
"fantasy-net.config.nuspec",
"icon.png",
"lib/net8.0/Fantasy-Net.Config.dll",
"tools/output/Excel/Custom.txt",
"tools/output/Excel/Server/MachineConfig.xlsx",
"tools/output/Excel/Server/ProcessConfig.xlsx",
"tools/output/Excel/Server/SceneConfig.xlsx",
"tools/output/Excel/Server/WorldConfig.xlsx",
"tools/output/Excel/Version.txt",
"tools/output/Json/Server/MachineConfigData.Json",
"tools/output/Json/Server/ProcessConfigData.Json",
"tools/output/Json/Server/SceneConfigData.Json",
"tools/output/Json/Server/WorldConfigData.Json",
"tools/output/NetworkProtocol/Inner/InnerMessage.proto",
"tools/output/NetworkProtocol/OpCode.Cache",
"tools/output/NetworkProtocol/Outer/OuterMessage.proto",
"tools/output/NetworkProtocol/RouteType.Config",
"tools/output/README.md"
]
}
},
"projectFileDependencyGroups": {
"net8.0": [
"Fantasy-Net.Config >= 2024.1.4"
]
},
"packageFolders": {
"/Users/fantasy/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj",
"projectName": "Fantasy.Config",
"projectPath": "/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj",
"packagesPath": "/Users/fantasy/.nuget/packages/",
"outputPath": "/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/fantasy/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"/usr/local/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "all"
},
"SdkAnalysisLevel": "9.0.100"
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"dependencies": {
"Fantasy-Net.Config": {
"target": "Package",
"version": "[2024.1.4, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/9.0.100/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -0,0 +1,10 @@
{
"version": 2,
"dgSpecHash": "Q4ePIhO2blI=",
"success": true,
"projectFilePath": "/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj",
"expectedPackageFiles": [
"/Users/fantasy/.nuget/packages/fantasy-net.config/2024.1.4/fantasy-net.config.2024.1.4.nupkg.sha512"
],
"logs": []
}

View File

@@ -0,0 +1 @@
"restore":{"projectUniqueName":"/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj","projectName":"Fantasy.Config","projectPath":"/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/Fantasy.Config.csproj","outputPath":"/Users/fantasy/Movies/邮件系统/Lession/NuGet/Fantasy.Config/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"/usr/local/share/dotnet/library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"all"},"SdkAnalysisLevel":"9.0.100"}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Fantasy-Net.Config":{"target":"Package","version":"[2024.1.4, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/local/share/dotnet/sdk/9.0.100/PortableRuntimeIdentifierGraph.json"}}

View File

@@ -0,0 +1 @@
17392438089758258

View File

@@ -0,0 +1 @@
17392438089758258