Repository: AlianBlank/GameFrameX
Branch: main
Commit: a6edd582a08e
Files: 140
Total size: 272.1 KB
Directory structure:
gitextract_k8aqoslt/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ └── workflows/
│ ├── contributors-readme-action.yml
│ └── sync.yml
├── .gitignore
├── Config/
│ ├── Defines/
│ │ └── builtin.xml
│ ├── Excels/
│ │ ├── Local/
│ │ │ ├── L-Localization-UI.xlsx
│ │ │ ├── L-Localization-成就.xlsx
│ │ │ └── L-Localization-文本.xlsx
│ │ ├── Tables/
│ │ │ ├── C-AchievementConfig-成就表.xlsx
│ │ │ ├── D-ItemConfig-道具表-道具-1001.xlsx
│ │ │ └── S-SoundsConfig-声音表.xlsx
│ │ ├── __beans__.xlsx
│ │ ├── __enums__.xlsx
│ │ └── __tables__.xlsx
│ ├── Tools/
│ │ ├── Luban.CSharp.pdb
│ │ ├── Luban.Core.pdb
│ │ ├── Luban.DataLoader.Builtin.pdb
│ │ ├── Luban.DataTarget.Builtin.pdb
│ │ ├── Luban.DataValidator.Builtin.pdb
│ │ ├── Luban.L10N.pdb
│ │ ├── Luban.Schema.Builtin.pdb
│ │ ├── Luban.deps.json
│ │ ├── Luban.pdb
│ │ ├── Luban.runtimeconfig.json
│ │ ├── Templates/
│ │ │ ├── common/
│ │ │ │ ├── cs/
│ │ │ │ │ └── enum.sbn
│ │ │ │ └── ts/
│ │ │ │ └── enum.sbn
│ │ │ ├── cs-bin/
│ │ │ │ ├── bean.sbn
│ │ │ │ ├── table.sbn
│ │ │ │ └── tables.sbn
│ │ │ ├── cs-code/
│ │ │ │ ├── bean.sbn
│ │ │ │ ├── table.sbn
│ │ │ │ ├── tabledata.sbn
│ │ │ │ └── tables.sbn
│ │ │ ├── cs-dotnet-bin/
│ │ │ │ ├── bean.sbn
│ │ │ │ ├── table.sbn
│ │ │ │ └── tables.sbn
│ │ │ ├── cs-dotnet-json/
│ │ │ │ ├── bean.sbn
│ │ │ │ ├── table.sbn
│ │ │ │ └── tables.sbn
│ │ │ └── cs-simple-json/
│ │ │ ├── bean.sbn
│ │ │ ├── table.sbn
│ │ │ └── tables.sbn
│ │ └── nlog.xml
│ ├── gen-client-bin.bat
│ ├── gen-client-bin.sh
│ ├── gen-client-json.bat
│ ├── gen-client-json.sh
│ ├── gen-server-bin.bat
│ ├── gen-server-bin.sh
│ ├── gen-server-json.bat
│ ├── gen-server-json.sh
│ └── luban.conf
├── Docs/
│ ├── 1.Actor模型.md
│ ├── 2.Actor&Component&State.md
│ ├── Actor入队.md
│ ├── 事件Event-timer.md
│ ├── 关于协议.md
│ ├── 十分钟.md
│ ├── 定时器&计划任务Timer.md
│ ├── 最后补充.md
│ ├── 热更hotfix.md
│ └── 网络Net(tcp&http).md
├── FairyGUIProject/
│ ├── Game.fairy
│ ├── assets/
│ │ ├── UIBag/
│ │ │ ├── UIBag.xml
│ │ │ ├── UIBagContent.xml
│ │ │ ├── UIBagItemInfo.xml
│ │ │ ├── package.xml
│ │ │ └── 组件/
│ │ │ ├── UIBagItem.xml
│ │ │ └── UIBagTypeItem.xml
│ │ ├── UICommon/
│ │ │ ├── package.xml
│ │ │ ├── 字体/
│ │ │ │ ├── RedNumberFont.fnt
│ │ │ │ └── YellowNumberFont.fnt
│ │ │ └── 组件/
│ │ │ ├── Dialog/
│ │ │ │ ├── UIDialogMessageBox.xml
│ │ │ │ └── UIDialogWithoutButton.xml
│ │ │ ├── Goods/
│ │ │ │ └── UIGoodItem.xml
│ │ │ ├── UIYellowProgresssBar.xml
│ │ │ └── button/
│ │ │ ├── UIBackButton.xml
│ │ │ ├── UIBlueCheckButton.xml
│ │ │ ├── UIBlueNormalButton.xml
│ │ │ ├── UIBlueSingleButton.xml
│ │ │ ├── UICloseButton.xml
│ │ │ ├── UIWhiteCheckButton.xml
│ │ │ ├── UIWhiteNormalButton.xml
│ │ │ ├── UIWhiteSingleButton.xml
│ │ │ ├── UIYellowCheckButton.xml
│ │ │ ├── UIYellowNormalButton.xml
│ │ │ ├── UIYellowSingleButton.xml
│ │ │ └── switch_btn.xml
│ │ ├── UICommonAvatar/
│ │ │ └── package.xml
│ │ ├── UILauncher/
│ │ │ ├── Scene/
│ │ │ │ ├── UILauncher.xml
│ │ │ │ ├── UILauncherUpgrade.xml
│ │ │ │ └── UILauncherUpgradeContent.xml
│ │ │ ├── Widget/
│ │ │ │ ├── UILauncherEnterButton.xml
│ │ │ │ └── UILoadingMainProgressBar.xml
│ │ │ └── package.xml
│ │ ├── UILoading/
│ │ │ ├── Scene/
│ │ │ │ └── UILoadingScene.xml
│ │ │ ├── Widget/
│ │ │ │ └── UILoadingCenterBox.xml
│ │ │ └── package.xml
│ │ ├── UILogin/
│ │ │ ├── Scene/
│ │ │ │ ├── UIAnnouncement.xml
│ │ │ │ ├── UIAnnouncementContent.xml
│ │ │ │ ├── UILogin.xml
│ │ │ │ ├── UIPlayerCreate.xml
│ │ │ │ ├── UIPlayerList.xml
│ │ │ │ ├── UIPlayerListItem.xml
│ │ │ │ └── UIPlayerListItemLoginButton.xml
│ │ │ ├── Widget/
│ │ │ │ └── UILoginButton.xml
│ │ │ └── package.xml
│ │ ├── UIMain/
│ │ │ ├── BagButton.xml
│ │ │ ├── UIMain.xml
│ │ │ └── package.xml
│ │ └── UIPlayer/
│ │ └── package.xml
│ ├── plugins/
│ │ ├── gencode/
│ │ │ ├── GenCode_CSharp.lua
│ │ │ ├── main.lua
│ │ │ └── package.json
│ │ └── plugins.iml
│ └── settings/
│ ├── Adaptation.json
│ ├── Common.json
│ ├── CustomProperties.json
│ ├── PackageGroup.json
│ ├── Publish.json
│ └── i18n.json
├── LICENSE.md
├── Protobuf/
│ ├── Bag_100.proto
│ ├── Basic_10.proto
│ ├── Common_20.proto
│ ├── Inner_Basic_2.proto
│ ├── Proto2CsExport-All.bat
│ ├── Proto2CsExport_Client.bat
│ ├── Proto2CsExport_Client.sh
│ ├── Proto2CsExport_Server.bat
│ ├── Proto2CsExport_Server.sh
│ ├── User_300.proto
│ ├── _-120_InnerSocial_s.proto
│ ├── _120_Social.proto
│ └── readme.txt
├── README.md
└── docker/
├── mongo/
│ └── docker-compose.yml
└── redis/
├── docker-compose.yml
└── redis.conf
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .github/workflows/contributors-readme-action.yml
================================================
# This is a basic workflow to help you get started with Actions
# https://github.com/akhilmhdh/contributors-readme-action
name: contributors
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
contrib-readme-job:
runs-on: ubuntu-latest
name: A job to automate contrib in readme
permissions:
contents: write
pull-requests: write
steps:
- name: Contribute List
uses: akhilmhdh/contributors-readme-action@v2.3.10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .github/workflows/sync.yml
================================================
name: Sync Github To Image
on:
push:
branches: [main]
#schedule:
# 定时任务,每天 UTC 时间 0 点运行
#- cron: "0 0 * * *"
#workflow_dispatch:
jobs:
sync-gitlink:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
- name: Set up Git user
run: |
git config --global user.email "wangfj11@foxmail.com"
git config --global user.name "AlianBlank"
- name: Set SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITLINK_ID_RSA }}" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
# 信任域名
ssh-keyscan -H code.gitlink.org.cn >> ~/.ssh/known_hosts
# 查看当前分支
- name: Check current branch
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
# 查看远端 地址
- name: echo git url
run: echo git@code.gitlink.org.cn:${{ github.Repository }}.git
# 添加远端
- name: add remote url
run: git remote add gitlink "git@code.gitlink.org.cn:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune gitlink --tags --verbose
# 拉取
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase gitlink ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u gitlink ${{ github.ref_name }} --tags --verbose
fi
sync-gitlab:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
- name: Set up Git user
run: |
git config --global user.email "wangfj11@foxmail.com"
git config --global user.name "AlianBlank"
- name: Set SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITLAB_ID_RSA }}" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
# 信任域名
ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts
# 查看当前分支
- name: Check current branch
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
# 查看远端 地址
- name: echo git url
run: echo git@gitlab.com:${{ github.Repository }}.git
# 添加远端
- name: add remote url
run: git remote add gitlab "git@gitlab.com:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune gitlab --tags --verbose
# 拉取
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase gitlab ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u gitlab ${{ github.ref_name }} --tags --verbose
fi
sync-gitee:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
- name: Set up Git user
run: |
git config --global user.email "wangfj11@foxmail.com"
git config --global user.name "AlianBlank"
- name: Set SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITEE_ID_RSA }}" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
# 信任域名
ssh-keyscan -H gitee.com >> ~/.ssh/known_hosts
# 查看当前分支
- name: Check current branch
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
# 查看远端 地址
- name: echo git url
run: echo git@gitee.com:${{ github.Repository }}.git
# 添加远端
- name: add remote url
run: git remote add gitee "git@gitee.com:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune gitee --tags --verbose
# 拉取
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase gitee ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u gitee ${{ github.ref_name }} --tags --verbose
fi
sync-atomgit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
- name: Set up Git user
run: |
git config --global user.email "wangfj11@foxmail.com"
git config --global user.name "AlianBlank"
- name: Set SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.ATOMGIT_ID_RSA }}" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
# 信任域名
ssh-keyscan -H atomgit.com >> ~/.ssh/known_hosts
# 查看当前分支
- name: Check current branch
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
# 查看远端 地址
- name: echo git url
run: echo git@atomgit.com:${{ github.Repository }}.git
# 添加远端
- name: add remote url
run: git remote add atomgit "git@atomgit.com:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune atomgit --tags --verbose
# 拉取
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase atomgit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u atomgit ${{ github.ref_name }} --tags --verbose
fi
sync-gitcode:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
- name: Set up Git user
run: |
git config --global user.email "wangfj11@foxmail.com"
git config --global user.name "AlianBlank"
- name: Set SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITCODE_ID_RSA }}" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
# 信任域名
ssh-keyscan -H gitcode.net >> ~/.ssh/known_hosts
# 查看当前分支
- name: Check current branch
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
# 查看远端 地址
- name: echo git url
run: echo git@gitcode.net:${{ github.Repository }}.git
# 添加远端
- name: add remote url
run: git remote add gitcode "git@gitcode.net:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune gitcode --tags --verbose
# 拉取
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase gitcode ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u gitcode ${{ github.ref_name }} --tags --verbose
fi
sync-framagit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
- name: Set up Git user
run: |
git config --global user.email "wangfj11@foxmail.com"
git config --global user.name "AlianBlank"
- name: Set SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.FRAMAGIT_ID_RSA }}" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
# 信任域名
ssh-keyscan -H framagit.org >> ~/.ssh/known_hosts
# 查看当前分支
- name: Check current branch
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
# 查看远端 地址
- name: echo git url
run: echo git@framagit.org:${{ github.Repository }}.git
# 添加远端
- name: add remote url
run: git remote add framagit "git@framagit.org:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune framagit --tags --verbose
# 拉取
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase framagit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u framagit ${{ github.ref_name }} --tags --verbose
fi
================================================
FILE: .gitignore
================================================
Unity/.idea
Unity/Bundles
Unity/Library
Unity/obj
GeekConfig/.idea
GeekConfig/Test
Server/.idea
Server/database
Server/bin
Server/**/obj
Unity/*.csproj
FairyGUIProject/.objs
FairyGUIProject/plugins/.idea
Unity/Sandbox
Unity/Temp
Unity/Assets/Bundles/Code
Unity/HybridCLRData/HotUpdateDlls
Unity/HybridCLRData/LocalIl2CppData-WindowsEditor
Unity/HybridCLRData/hybridclr_repo
Unity/HybridCLRData/il2cpp_plus_repo
Tools/Geek.MsgPackTool-src/.idea
Server/**/bin
Unity/.cache.meta
docker/mongo/database
Unity/Packages/packages-lock.json
Unity/Unity.sln.DotSettings.user
Unity/Unity.sln
docker/redis/apps/datadir
.DS_Store
Unity/HybridCLRData
Unity/Builds
Unity/Logs
Unity/Android_Symbols
Proto2CSApp/.idea
Proto2CSApp/obj
Proto2CSApp/bin
================================================
FILE: Config/Defines/builtin.xml
================================================
================================================
FILE: Config/Tools/Luban.deps.json
================================================
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"Luban/3.12.0": {
"dependencies": {
"CommandLineParser": "2.9.1",
"Luban.Bson": "1.0.0",
"Luban.CSharp": "1.0.0",
"Luban.Core": "1.0.0",
"Luban.Cpp": "1.0.0",
"Luban.DataLoader.Builtin": "1.0.0",
"Luban.DataTarget.Builtin": "1.0.0",
"Luban.DataValidator.Builtin": "1.0.0",
"Luban.FlatBuffers": "1.0.0",
"Luban.Gdscript": "1.0.0",
"Luban.Golang": "1.0.0",
"Luban.Java": "1.0.0",
"Luban.L10N": "1.0.0",
"Luban.Lua": "1.0.0",
"Luban.MsgPack": "1.0.0",
"Luban.PHP": "1.0.0",
"Luban.Protobuf": "1.0.0",
"Luban.Python": "1.0.0",
"Luban.Rust": "1.0.0",
"Luban.Schema.Builtin": "1.0.0",
"Luban.Typescript": "1.0.0",
"YamlDotNet.NetCore": "1.0.0"
},
"runtime": {
"Luban.dll": {}
}
},
"CommandLineParser/2.9.1": {
"runtime": {
"lib/netstandard2.0/CommandLine.dll": {
"assemblyVersion": "2.9.1.0",
"fileVersion": "2.9.1.0"
}
}
},
"ExcelDataReader/3.7.0": {
"runtime": {
"lib/netstandard2.1/ExcelDataReader.dll": {
"assemblyVersion": "3.7.0.0",
"fileVersion": "3.7.0.0"
}
}
},
"Google.Protobuf/3.29.0": {
"runtime": {
"lib/net5.0/Google.Protobuf.dll": {
"assemblyVersion": "3.29.0.0",
"fileVersion": "3.29.0.0"
}
}
},
"MessagePack/2.5.192": {
"dependencies": {
"MessagePack.Annotations": "2.5.192",
"Microsoft.NET.StringTools": "17.6.3"
},
"runtime": {
"lib/net6.0/MessagePack.dll": {
"assemblyVersion": "2.5.0.0",
"fileVersion": "2.5.192.54228"
}
}
},
"MessagePack.Annotations/2.5.192": {
"runtime": {
"lib/netstandard2.0/MessagePack.Annotations.dll": {
"assemblyVersion": "2.5.0.0",
"fileVersion": "2.5.192.54228"
}
}
},
"Microsoft.CSharp/4.5.0": {},
"Microsoft.NET.StringTools/17.6.3": {
"runtime": {
"lib/net7.0/Microsoft.NET.StringTools.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "17.6.3.22601"
}
}
},
"Microsoft.NETCore.Platforms/1.0.1": {},
"Microsoft.NETCore.Targets/1.0.1": {},
"NeoLua/1.3.14": {
"dependencies": {
"Microsoft.CSharp": "4.5.0"
},
"runtime": {
"lib/net5.0/Neo.Lua.dll": {
"assemblyVersion": "5.3.0.0",
"fileVersion": "1.3.14.0"
}
},
"resources": {
"lib/net5.0/de/Neo.Lua.resources.dll": {
"locale": "de"
}
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
},
"Newtonsoft.Json.Bson/1.0.3": {
"dependencies": {
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.Bson.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.3.29904"
}
}
},
"NLog/5.3.4": {
"runtime": {
"lib/netstandard2.0/NLog.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.3.4.2778"
}
}
},
"Scriban/5.12.0": {
"runtime": {
"lib/net7.0/Scriban.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.12.0.0"
}
}
},
"System.Collections/4.0.11": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Diagnostics.Debug/4.0.11": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Diagnostics.Tools/4.0.1": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Globalization/4.0.11": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0"
}
},
"System.IO/4.1.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0",
"System.Text.Encoding": "4.0.11",
"System.Threading.Tasks": "4.0.11"
}
},
"System.Linq/4.1.0": {
"dependencies": {
"System.Collections": "4.0.11",
"System.Diagnostics.Debug": "4.0.11",
"System.Resources.ResourceManager": "4.0.1",
"System.Runtime": "4.1.0",
"System.Runtime.Extensions": "4.1.0"
}
},
"System.Linq.Expressions/4.1.0": {
"dependencies": {
"System.Collections": "4.0.11",
"System.Diagnostics.Debug": "4.0.11",
"System.Globalization": "4.0.11",
"System.IO": "4.1.0",
"System.Linq": "4.1.0",
"System.ObjectModel": "4.0.12",
"System.Reflection": "4.1.0",
"System.Reflection.Emit": "4.0.1",
"System.Reflection.Emit.ILGeneration": "4.0.1",
"System.Reflection.Emit.Lightweight": "4.0.1",
"System.Reflection.Extensions": "4.0.1",
"System.Reflection.Primitives": "4.0.1",
"System.Reflection.TypeExtensions": "4.1.0",
"System.Resources.ResourceManager": "4.0.1",
"System.Runtime": "4.1.0",
"System.Runtime.Extensions": "4.1.0",
"System.Threading": "4.0.11"
}
},
"System.ObjectModel/4.0.12": {
"dependencies": {
"System.Collections": "4.0.11",
"System.Diagnostics.Debug": "4.0.11",
"System.Resources.ResourceManager": "4.0.1",
"System.Runtime": "4.1.0",
"System.Threading": "4.0.11"
}
},
"System.Reflection/4.1.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.IO": "4.1.0",
"System.Reflection.Primitives": "4.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Reflection.Emit/4.0.1": {
"dependencies": {
"System.IO": "4.1.0",
"System.Reflection": "4.1.0",
"System.Reflection.Emit.ILGeneration": "4.0.1",
"System.Reflection.Primitives": "4.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Reflection.Emit.ILGeneration/4.0.1": {
"dependencies": {
"System.Reflection": "4.1.0",
"System.Reflection.Primitives": "4.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Reflection.Emit.Lightweight/4.0.1": {
"dependencies": {
"System.Reflection": "4.1.0",
"System.Reflection.Emit.ILGeneration": "4.0.1",
"System.Reflection.Primitives": "4.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Reflection.Extensions/4.0.1": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Reflection": "4.1.0",
"System.Runtime": "4.1.0"
}
},
"System.Reflection.Primitives/4.0.1": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Reflection.TypeExtensions/4.1.0": {
"dependencies": {
"System.Reflection": "4.1.0",
"System.Runtime": "4.1.0"
}
},
"System.Resources.ResourceManager/4.0.1": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Globalization": "4.0.11",
"System.Reflection": "4.1.0",
"System.Runtime": "4.1.0"
}
},
"System.Runtime/4.1.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1"
}
},
"System.Runtime.Extensions/4.1.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Runtime.Serialization.Primitives/4.1.1": {
"dependencies": {
"System.Resources.ResourceManager": "4.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Text.Encoding/4.0.11": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0"
}
},
"System.Text.Encoding.Extensions/4.0.11": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0",
"System.Text.Encoding": "4.0.11"
}
},
"System.Text.RegularExpressions/4.1.0": {
"dependencies": {
"System.Collections": "4.0.11",
"System.Globalization": "4.0.11",
"System.Resources.ResourceManager": "4.0.1",
"System.Runtime": "4.1.0",
"System.Runtime.Extensions": "4.1.0",
"System.Threading": "4.0.11"
}
},
"System.Threading/4.0.11": {
"dependencies": {
"System.Runtime": "4.1.0",
"System.Threading.Tasks": "4.0.11"
}
},
"System.Threading.Tasks/4.0.11": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
"System.Runtime": "4.1.0"
}
},
"Ude.NetStandard/1.2.0": {
"runtime": {
"lib/netstandard2.0/Ude.NetStandard.dll": {
"assemblyVersion": "1.0.2.0",
"fileVersion": "1.0.2.0"
}
}
},
"YamlDotNet.NetCore/1.0.0": {
"dependencies": {
"System.Collections": "4.0.11",
"System.Diagnostics.Debug": "4.0.11",
"System.Diagnostics.Tools": "4.0.1",
"System.Globalization": "4.0.11",
"System.Linq": "4.1.0",
"System.Linq.Expressions": "4.1.0",
"System.ObjectModel": "4.0.12",
"System.Reflection.Extensions": "4.0.1",
"System.Runtime.Extensions": "4.1.0",
"System.Runtime.Serialization.Primitives": "4.1.1",
"System.Text.Encoding.Extensions": "4.0.11",
"System.Text.RegularExpressions": "4.1.0"
},
"runtime": {
"lib/netstandard1.0/YamlDotNet.NetCore.dll": {
"assemblyVersion": "0.0.1.0",
"fileVersion": "0.0.0.0"
}
}
},
"Luban.Bson/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Newtonsoft.Json.Bson": "1.0.3"
},
"runtime": {
"Luban.Bson.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Core/1.0.0": {
"dependencies": {
"NLog": "5.3.4",
"Scriban": "5.12.0"
},
"runtime": {
"Luban.Core.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Cpp/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0"
},
"runtime": {
"Luban.Cpp.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.CSharp/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Luban.DataValidator.Builtin": "1.0.0"
},
"runtime": {
"Luban.CSharp.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.DataLoader.Builtin/1.0.0": {
"dependencies": {
"ExcelDataReader": "3.7.0",
"Luban.Core": "1.0.0",
"NeoLua": "1.3.14",
"Ude.NetStandard": "1.2.0",
"YamlDotNet.NetCore": "1.0.0"
},
"runtime": {
"Luban.DataLoader.Builtin.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.DataTarget.Builtin/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Luban.DataLoader.Builtin": "1.0.0"
},
"runtime": {
"Luban.DataTarget.Builtin.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.DataValidator.Builtin/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0"
},
"runtime": {
"Luban.DataValidator.Builtin.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.FlatBuffers/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Luban.DataTarget.Builtin": "1.0.0"
},
"runtime": {
"Luban.FlatBuffers.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Gdscript/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Luban.DataTarget.Builtin": "1.0.0"
},
"runtime": {
"Luban.Gdscript.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Golang/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0"
},
"runtime": {
"Luban.Golang.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Java/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0"
},
"runtime": {
"Luban.Java.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.L10N/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Luban.DataLoader.Builtin": "1.0.0"
},
"runtime": {
"Luban.L10N.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Lua/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0"
},
"runtime": {
"Luban.Lua.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.MsgPack/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"MessagePack": "2.5.192"
},
"runtime": {
"Luban.MsgPack.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.PHP/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Luban.DataTarget.Builtin": "1.0.0"
},
"runtime": {
"Luban.PHP.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Protobuf/1.0.0": {
"dependencies": {
"Google.Protobuf": "3.29.0",
"Luban.Core": "1.0.0",
"Luban.DataTarget.Builtin": "1.0.0"
},
"runtime": {
"Luban.Protobuf.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Python/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Luban.DataTarget.Builtin": "1.0.0"
},
"runtime": {
"Luban.Python.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Rust/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0"
},
"runtime": {
"Luban.Rust.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Schema.Builtin/1.0.0": {
"dependencies": {
"Luban.Core": "1.0.0",
"Luban.DataLoader.Builtin": "1.0.0"
},
"runtime": {
"Luban.Schema.Builtin.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Luban.Typescript/1.0.0": {
"dependencies": {
"Luban.CSharp": "1.0.0",
"Luban.Core": "1.0.0",
"Luban.DataTarget.Builtin": "1.0.0"
},
"runtime": {
"Luban.Typescript.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
}
}
},
"libraries": {
"Luban/3.12.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"CommandLineParser/2.9.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-OE0sl1/sQ37bjVsPKKtwQlWDgqaxWgtme3xZz7JssWUzg5JpMIyHgCTY9MVMxOg48fJ1AgGT3tgdH5m/kQ5xhA==",
"path": "commandlineparser/2.9.1",
"hashPath": "commandlineparser.2.9.1.nupkg.sha512"
},
"ExcelDataReader/3.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-AMv3oDETRHSRyXC17rBtKH45qIfFyo433LMeaMB3u4RNr/c9Luuc0Z+JMP6+3Cx9n4wXqFqcrEIVxrf/GgYnZg==",
"path": "exceldatareader/3.7.0",
"hashPath": "exceldatareader.3.7.0.nupkg.sha512"
},
"Google.Protobuf/3.29.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-l1012jd1Y2XsLQ+h9cXE7Bo3WruXql3Xc3KP/z+yZDJMSkfb2guslHCxwFsqd2ScHB0h2J7Yuy255RrBD/DGBw==",
"path": "google.protobuf/3.29.0",
"hashPath": "google.protobuf.3.29.0.nupkg.sha512"
},
"MessagePack/2.5.192": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Jtle5MaFeIFkdXtxQeL9Tu2Y3HsAQGoSntOzrn6Br/jrl6c8QmG22GEioT5HBtZJR0zw0s46OnKU8ei2M3QifA==",
"path": "messagepack/2.5.192",
"hashPath": "messagepack.2.5.192.nupkg.sha512"
},
"MessagePack.Annotations/2.5.192": {
"type": "package",
"serviceable": true,
"sha512": "sha512-jaJuwcgovWIZ8Zysdyf3b7b34/BrADw4v82GaEZymUhDd3ScMPrYd/cttekeDteJJPXseJxp04yTIcxiVUjTWg==",
"path": "messagepack.annotations/2.5.192",
"hashPath": "messagepack.annotations.2.5.192.nupkg.sha512"
},
"Microsoft.CSharp/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kaj6Wb4qoMuH3HySFJhxwQfe8R/sJsNJnANrvv8WdFPMoNbKY5htfNscv+LHCu5ipz+49m2e+WQXpLXr9XYemQ==",
"path": "microsoft.csharp/4.5.0",
"hashPath": "microsoft.csharp.4.5.0.nupkg.sha512"
},
"Microsoft.NET.StringTools/17.6.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-N0ZIanl1QCgvUumEL1laasU0a7sOE5ZwLZVTn0pAePnfhq8P7SvTjF8Axq+CnavuQkmdQpGNXQ1efZtu5kDFbA==",
"path": "microsoft.net.stringtools/17.6.3",
"hashPath": "microsoft.net.stringtools.17.6.3.nupkg.sha512"
},
"Microsoft.NETCore.Platforms/1.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-2G6OjjJzwBfNOO8myRV/nFrbTw5iA+DEm0N+qUqhrOmaVtn4pC77h38I1jsXGw5VH55+dPfQsqHD0We9sCl9FQ==",
"path": "microsoft.netcore.platforms/1.0.1",
"hashPath": "microsoft.netcore.platforms.1.0.1.nupkg.sha512"
},
"Microsoft.NETCore.Targets/1.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-rkn+fKobF/cbWfnnfBOQHKVKIOpxMZBvlSHkqDWgBpwGDcLRduvs3D9OLGeV6GWGvVwNlVi2CBbTjuPmtHvyNw==",
"path": "microsoft.netcore.targets/1.0.1",
"hashPath": "microsoft.netcore.targets.1.0.1.nupkg.sha512"
},
"NeoLua/1.3.14": {
"type": "package",
"serviceable": true,
"sha512": "sha512-BXIUN+ePY2wx3ZGiSmR8KZKD85s01pXI690orrB3u/biB8R0nalziGw+iGbPBq1Cuz8Upggpw2ERF84POXWTCQ==",
"path": "neolua/1.3.14",
"hashPath": "neolua.1.3.14.nupkg.sha512"
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
},
"Newtonsoft.Json.Bson/1.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-bCcwagnHfYnhwQfY1criEcn6Hy9PtBuVnZu0pA8hmRhuR3jI/8WxVgoVAdNw9BJ3JHkxmWJzpj/AQy+PMMLqxg==",
"path": "newtonsoft.json.bson/1.0.3",
"hashPath": "newtonsoft.json.bson.1.0.3.nupkg.sha512"
},
"NLog/5.3.4": {
"type": "package",
"serviceable": true,
"sha512": "sha512-gLy7+O1hEYJXIlcTr1/VWjGXrZTQFZzYNO18IWasD64pNwz0BreV+nHLxWKXWZzERRzoKnsk2XYtwLkTVk7J1A==",
"path": "nlog/5.3.4",
"hashPath": "nlog.5.3.4.nupkg.sha512"
},
"Scriban/5.12.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/YTTCxjBIpfwX3MKMT4JMFVl1jX4IHW7zih+Bg3cTIkzGnbFt+B3l/k90ILDw6DRiFE7T+VxEyls7zk4p029ng==",
"path": "scriban/5.12.0",
"hashPath": "scriban.5.12.0.nupkg.sha512"
},
"System.Collections/4.0.11": {
"type": "package",
"serviceable": true,
"sha512": "sha512-YUJGz6eFKqS0V//mLt25vFGrrCvOnsXjlvFQs+KimpwNxug9x0Pzy4PlFMU3Q2IzqAa9G2L4LsK3+9vCBK7oTg==",
"path": "system.collections/4.0.11",
"hashPath": "system.collections.4.0.11.nupkg.sha512"
},
"System.Diagnostics.Debug/4.0.11": {
"type": "package",
"serviceable": true,
"sha512": "sha512-w5U95fVKHY4G8ASs/K5iK3J5LY+/dLFd4vKejsnI/ZhBsWS9hQakfx3Zr7lRWKg4tAw9r4iktyvsTagWkqYCiw==",
"path": "system.diagnostics.debug/4.0.11",
"hashPath": "system.diagnostics.debug.4.0.11.nupkg.sha512"
},
"System.Diagnostics.Tools/4.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-xBfJ8pnd4C17dWaC9FM6aShzbJcRNMChUMD42I6772KGGrqaFdumwhn9OdM68erj1ueNo3xdQ1EwiFjK5k8p0g==",
"path": "system.diagnostics.tools/4.0.1",
"hashPath": "system.diagnostics.tools.4.0.1.nupkg.sha512"
},
"System.Globalization/4.0.11": {
"type": "package",
"serviceable": true,
"sha512": "sha512-B95h0YLEL2oSnwF/XjqSWKnwKOy/01VWkNlsCeMTFJLLabflpGV26nK164eRs5GiaRSBGpOxQ3pKoSnnyZN5pg==",
"path": "system.globalization/4.0.11",
"hashPath": "system.globalization.4.0.11.nupkg.sha512"
},
"System.IO/4.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-3KlTJceQc3gnGIaHZ7UBZO26SHL1SHE4ddrmiwumFnId+CEHP+O8r386tZKaE6zlk5/mF8vifMBzHj9SaXN+mQ==",
"path": "system.io/4.1.0",
"hashPath": "system.io.4.1.0.nupkg.sha512"
},
"System.Linq/4.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-bQ0iYFOQI0nuTnt+NQADns6ucV4DUvMdwN6CbkB1yj8i7arTGiTN5eok1kQwdnnNWSDZfIUySQY+J3d5KjWn0g==",
"path": "system.linq/4.1.0",
"hashPath": "system.linq.4.1.0.nupkg.sha512"
},
"System.Linq.Expressions/4.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-I+y02iqkgmCAyfbqOmSDOgqdZQ5tTj80Akm5BPSS8EeB0VGWdy6X1KCoYe8Pk6pwDoAKZUOdLVxnTJcExiv5zw==",
"path": "system.linq.expressions/4.1.0",
"hashPath": "system.linq.expressions.4.1.0.nupkg.sha512"
},
"System.ObjectModel/4.0.12": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tAgJM1xt3ytyMoW4qn4wIqgJYm7L7TShRZG4+Q4Qsi2PCcj96pXN7nRywS9KkB3p/xDUjc2HSwP9SROyPYDYKQ==",
"path": "system.objectmodel/4.0.12",
"hashPath": "system.objectmodel.4.0.12.nupkg.sha512"
},
"System.Reflection/4.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-JCKANJ0TI7kzoQzuwB/OoJANy1Lg338B6+JVacPl4TpUwi3cReg3nMLplMq2uqYfHFQpKIlHAUVAJlImZz/4ng==",
"path": "system.reflection/4.1.0",
"hashPath": "system.reflection.4.1.0.nupkg.sha512"
},
"System.Reflection.Emit/4.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-P2wqAj72fFjpP6wb9nSfDqNBMab+2ovzSDzUZK7MVIm54tBJEPr9jWfSjjoTpPwj1LeKcmX3vr0ttyjSSFM47g==",
"path": "system.reflection.emit/4.0.1",
"hashPath": "system.reflection.emit.4.0.1.nupkg.sha512"
},
"System.Reflection.Emit.ILGeneration/4.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Ov6dU8Bu15Bc7zuqttgHF12J5lwSWyTf1S+FJouUXVMSqImLZzYaQ+vRr1rQ0OZ0HqsrwWl4dsKHELckQkVpgA==",
"path": "system.reflection.emit.ilgeneration/4.0.1",
"hashPath": "system.reflection.emit.ilgeneration.4.0.1.nupkg.sha512"
},
"System.Reflection.Emit.Lightweight/4.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-sSzHHXueZ5Uh0OLpUQprhr+ZYJrLPA2Cmr4gn0wj9+FftNKXx8RIMKvO9qnjk2ebPYUjZ+F2ulGdPOsvj+MEjA==",
"path": "system.reflection.emit.lightweight/4.0.1",
"hashPath": "system.reflection.emit.lightweight.4.0.1.nupkg.sha512"
},
"System.Reflection.Extensions/4.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-GYrtRsZcMuHF3sbmRHfMYpvxZoIN2bQGrYGerUiWLEkqdEUQZhH3TRSaC/oI4wO0II1RKBPlpIa1TOMxIcOOzQ==",
"path": "system.reflection.extensions/4.0.1",
"hashPath": "system.reflection.extensions.4.0.1.nupkg.sha512"
},
"System.Reflection.Primitives/4.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-4inTox4wTBaDhB7V3mPvp9XlCbeGYWVEM9/fXALd52vNEAVisc1BoVWQPuUuD0Ga//dNbA/WeMy9u9mzLxGTHQ==",
"path": "system.reflection.primitives/4.0.1",
"hashPath": "system.reflection.primitives.4.0.1.nupkg.sha512"
},
"System.Reflection.TypeExtensions/4.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tsQ/ptQ3H5FYfON8lL4MxRk/8kFyE0A+tGPXmVP967cT/gzLHYxIejIYSxp4JmIeFHVP78g/F2FE1mUUTbDtrg==",
"path": "system.reflection.typeextensions/4.1.0",
"hashPath": "system.reflection.typeextensions.4.1.0.nupkg.sha512"
},
"System.Resources.ResourceManager/4.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-TxwVeUNoTgUOdQ09gfTjvW411MF+w9MBYL7AtNVc+HtBCFlutPLhUCdZjNkjbhj3bNQWMdHboF0KIWEOjJssbA==",
"path": "system.resources.resourcemanager/4.0.1",
"hashPath": "system.resources.resourcemanager.4.0.1.nupkg.sha512"
},
"System.Runtime/4.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-v6c/4Yaa9uWsq+JMhnOFewrYkgdNHNG2eMKuNqRn8P733rNXeRCGvV5FkkjBXn2dbVkPXOsO0xjsEeM1q2zC0g==",
"path": "system.runtime/4.1.0",
"hashPath": "system.runtime.4.1.0.nupkg.sha512"
},
"System.Runtime.Extensions/4.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-CUOHjTT/vgP0qGW22U4/hDlOqXmcPq5YicBaXdUR2UiUoLwBT+olO6we4DVbq57jeX5uXH2uerVZhf0qGj+sVQ==",
"path": "system.runtime.extensions/4.1.0",
"hashPath": "system.runtime.extensions.4.1.0.nupkg.sha512"
},
"System.Runtime.Serialization.Primitives/4.1.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==",
"path": "system.runtime.serialization.primitives/4.1.1",
"hashPath": "system.runtime.serialization.primitives.4.1.1.nupkg.sha512"
},
"System.Text.Encoding/4.0.11": {
"type": "package",
"serviceable": true,
"sha512": "sha512-U3gGeMlDZXxCEiY4DwVLSacg+DFWCvoiX+JThA/rvw37Sqrku7sEFeVBBBMBnfB6FeZHsyDx85HlKL19x0HtZA==",
"path": "system.text.encoding/4.0.11",
"hashPath": "system.text.encoding.4.0.11.nupkg.sha512"
},
"System.Text.Encoding.Extensions/4.0.11": {
"type": "package",
"serviceable": true,
"sha512": "sha512-jtbiTDtvfLYgXn8PTfWI+SiBs51rrmO4AAckx4KR6vFK9Wzf6tI8kcRdsYQNwriUeQ1+CtQbM1W4cMbLXnj/OQ==",
"path": "system.text.encoding.extensions/4.0.11",
"hashPath": "system.text.encoding.extensions.4.0.11.nupkg.sha512"
},
"System.Text.RegularExpressions/4.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-i88YCXpRTjCnoSQZtdlHkAOx4KNNik4hMy83n0+Ftlb7jvV6ZiZWMpnEZHhjBp6hQVh8gWd/iKNPzlPF7iyA2g==",
"path": "system.text.regularexpressions/4.1.0",
"hashPath": "system.text.regularexpressions.4.1.0.nupkg.sha512"
},
"System.Threading/4.0.11": {
"type": "package",
"serviceable": true,
"sha512": "sha512-N+3xqIcg3VDKyjwwCGaZ9HawG9aC6cSDI+s7ROma310GQo8vilFZa86hqKppwTHleR/G0sfOzhvgnUxWCR/DrQ==",
"path": "system.threading/4.0.11",
"hashPath": "system.threading.4.0.11.nupkg.sha512"
},
"System.Threading.Tasks/4.0.11": {
"type": "package",
"serviceable": true,
"sha512": "sha512-k1S4Gc6IGwtHGT8188RSeGaX86Qw/wnrgNLshJvsdNUOPP9etMmo8S07c+UlOAx4K/xLuN9ivA1bD0LVurtIxQ==",
"path": "system.threading.tasks/4.0.11",
"hashPath": "system.threading.tasks.4.0.11.nupkg.sha512"
},
"Ude.NetStandard/1.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-zRWpPAxBg3lNdm4UiKixTe+DFPoNid9CILggTCy/0WR2WKETe17kTWhiiIpLB2k5IEgnvA0QLfKlvd6Tvu0pzA==",
"path": "ude.netstandard/1.2.0",
"hashPath": "ude.netstandard.1.2.0.nupkg.sha512"
},
"YamlDotNet.NetCore/1.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-vPiKF4Yf02MS96Nzwcr8+WrvlhTx+camOgUzxhazU0hCzs2ESetWDCxaIT/MYdAw2oONYem1ow9PXWJjHkRUDw==",
"path": "yamldotnet.netcore/1.0.0",
"hashPath": "yamldotnet.netcore.1.0.0.nupkg.sha512"
},
"Luban.Bson/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Core/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Cpp/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.CSharp/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.DataLoader.Builtin/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.DataTarget.Builtin/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.DataValidator.Builtin/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.FlatBuffers/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Gdscript/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Golang/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Java/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.L10N/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Lua/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.MsgPack/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.PHP/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Protobuf/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Python/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Rust/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Schema.Builtin/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Luban.Typescript/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
================================================
FILE: Config/Tools/Luban.runtimeconfig.json
================================================
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
================================================
FILE: Config/Tools/Templates/common/cs/enum.sbn
================================================
{{~
comment = __enum.comment
items = __enum.items
~}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if comment != '' ~}}
///
/// {{escape_comment comment}}
///
{{~end~}}
{{~if __enum.is_flags~}}
[System.Flags]
{{~end~}}
public enum {{__name}}
{
{{~ for item in items ~}}
{{~if item.comment != '' ~}}
///
/// {{escape_comment item.comment_or_alias}}
///
{{~end~}}
{{format_enum_item_name __code_style item.name}} = {{item.value}},
{{~end~}}
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/common/ts/enum.sbn
================================================
================================================
FILE: Config/Tools/Templates/cs-bin/bean.sbn
================================================
using LuBan.Runtime;
using GameFrameX.Config;
{{
parent_def_type = __bean.parent_def_type
export_fields = __bean.export_fields
hierarchy_export_fields = __bean.hierarchy_export_fields
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __bean.comment != '' ~}}
///
/// {{escape_comment __bean.comment}}
///
{{~end~}}
{{~
func get_ref_name
ret (format_property_name __code_style $0.name) + '_Ref'
end
func get_index_var_name
ret (format_property_name __code_style $0.name) + '_Index'
end
func generate_resolve_field_ref
field = $0
fieldName = format_property_name __code_style field.name
refTable = get_ref_table field
if can_generate_ref field
tableName = format_property_name __code_style refTable.name
if field.is_nullable
ret (get_ref_name field) + ' = ' + fieldName + '!= null ? tables.' + tableName + '.Get(' + (get_value_of_nullable_type field.ctype fieldName) + ') : null;'
else
ret (get_ref_name field) + ' = tables.' + tableName + '.Get(' + fieldName + ');'
end
else if can_generate_collection_ref field
collection_ref_table = get_collection_ref_table field
tableName = format_property_name __code_style collection_ref_table.name
if field.ctype.type_name == 'list' || field.ctype.type_name == 'set'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var _v in ' + fieldName + ') { ' + (get_ref_name field) + '.Add(tables.' + tableName + '.Get(_v)); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'array'
line1 = (get_ref_name field) + ' = new ' + (declaring_type_name collection_ref_table.value_ttype) + '[' + fieldName + '.Length];' + '\n'
line2 = 'for (int _i = 0; _i < ' + fieldName + '.Length; _i++) { ' + (get_ref_name field) + '[_i] = tables.' + tableName + '.Get(' + fieldName + '[_i]); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'map'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var (_k,_v) in ' + fieldName + ') { ' + (get_ref_name field) + '.Add(_k, tables.' + tableName + '.GetOrDefault(_v)); }' + '\n'
ret line1 + line2
else
ret ''
end
else
if (is_field_bean_need_resolve_ref field)
ret fieldName + '?.ResolveRef(tables);'
else if (is_field_array_like_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + ') { _e?.ResolveRef(tables); }'
else if (is_field_map_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + '.Values) { _e?.ResolveRef(tables); }'
else
ret ''
end
end
end
func get_param_def_list(bean)
paramList = []
while bean
tempList = bean.export_fields |array.each do; ret (declaring_type_name $0.ctype) + ' ' + (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
func get_param_name_list(bean)
paramList = []
index = 0
while bean
tempList = bean.export_fields |array.each do; ret (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
~}}
{{~if __bean.is_value_type~}}
public partial struct {{__name}}
{{~else~}}
public {{class_modifier __bean}} partial class {{__name}} : {{if parent_def_type}}{{__bean.parent}}{{else}}LuBan.Runtime.BeanBase{{end}}
{{~end~}}
{
public {{__name}}({{get_param_def_list(__bean)}}) {{if parent_def_type}} : base({{get_param_name_list(__bean.parent_def_type)}}) {{end}}
{
{{~ for field in export_fields
fieldName = format_property_name __code_style field.name
~}}
this.{{fieldName}} = {{fieldName}};
{{~if can_generate_ref field~}}
this.{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
this.{{get_index_var_name field}} = new {{declaring_type_name (get_index_map_type field)}}({{field.size}});
foreach(var _v in {{fieldName}})
{
this.{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
PostInit();
}
public {{__name}}(ByteBuf _buf) {{if parent_def_type}} : base(_buf) {{end}}
{
{{~ for field in export_fields
this.fieldName = format_property_name __code_style field.name
~}}
{{deserialize '_buf' fieldName field.ctype}}
{{~if can_generate_ref field~}}
{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
foreach(var _v in {{fieldName}})
{
{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
// Localization Key Begin
{{~ for field in export_fields ~}}
{{~if field.type =='text'~}}
{{format_property_name __code_style field.name}}_Localization_Key = {{format_property_name __code_style field.name}};
{{~end~}}
{{~end~}}
// Localization Key End
PostInit();
}
public static {{__name}} Deserialize{{__name}}(ByteBuf _buf)
{
{{~if __bean.is_abstract_type~}}
switch (_buf.ReadInt())
{
{{~for child in __bean.hierarchy_not_abstract_children~}}
case {{child.full_name}}.__ID__: return new {{child.full_name}}(_buf);
{{~end~}}
default: throw new SerializationException();
}
{{~else~}}
return new {{__bean.full_name}}(_buf);
{{~end~}}
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} { private set; get; }
{{~if field.type =='text'~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}} 的多语言Key
///
{{~end~}}
public readonly string {{format_property_name __code_style field.name}}_Localization_Key;
{{~end~}}
{{~if can_generate_ref field~}}
public {{declaring_type_name (get_ref_type field)}} {{get_ref_name field}} { private set; get; }
{{~else if can_generate_collection_ref field~}}
public {{declaring_collection_ref_name field.ctype}} {{get_ref_name field}} { private set; get; }
{{~end~}}
{{~if has_index field
indexMapType = get_index_map_type field
~}}
public readonly {{declaring_type_name indexMapType}} {{get_index_var_name field}} = new {{declaring_type_name indexMapType}}();
{{~end~}}
{{~end~}}
{{~if !__bean.is_abstract_type && !__bean.is_value_type~}}
public const int __ID__ = {{__bean.id}};
public override int GetTypeId() => __ID__;
{{~end~}}
public {{method_modifier __bean}} void ResolveRef({{__manager_name}} tables)
{
{{~if parent_def_type~}}
base.ResolveRef(tables);
{{~end~}}
{{~for field in export_fields~}}
{{generate_resolve_field_ref field}}
{{~end~}}
PostResolveRef();
}
public void TranslateText(System.Func translator)
{
{{~if parent_def_type~}}
base.TranslateText(translator);
{{~end~}}
{{~ for field in export_fields ~}}
{{~if field.type =='text'~}}
{{format_property_name __code_style field.name}} = translator({{format_property_name __code_style field.name}}_Localization_Key, {{format_property_name __code_style field.name}});
{{~end~}}
{{~end~}}
}
public override string ToString()
{
return "{{full_name}}{ "
{{~for field in hierarchy_export_fields ~}}
+ "{{format_field_name __code_style field.name}}:" + {{to_pretty_string (format_property_name __code_style field.name) field.ctype}} + ","
{{~end~}}
+ "}";
}
partial void PostInit();
partial void PostResolveRef();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-bin/table.sbn
================================================
using LuBan.Runtime;
using GameFrameX.Config.Runtime;
{{
key_type = __table.key_ttype
value_type = __table.value_ttype
func index_type_name
ret (declaring_type_name $0.type)
end
func table_union_map_type_name
ret 'System.Collections.Generic.Dictionary<(' + (array.each __table.index_list @index_type_name | array.join ', ') + '), ' + (declaring_type_name value_type) + '>'
end
func table_key_list
varName = $0
indexList = __table.index_list |array.each do; ret varName + '.' + (format_property_name __code_style $0.index_field.name); end;
ret array.join indexList ', '
end
func table_param_def_list
paramList = __table.index_list |array.each do; ret (declaring_type_name $0.type) + ' ' + $0.index_field.name; end
ret array.join paramList ', '
end
func table_param_name_list
paramList = __table.index_list |array.each do; ret $0.index_field.name; end
ret array.join paramList ', '
end
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __table.comment != '' ~}}
///
/// {{escape_comment __table.comment}}
///
{{~end~}}
public partial class {{__name}} : BaseDataTable<{{declaring_type_name __value_type}}>
{
{{~if __table.is_map_table ~}}
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
}
public override async System.Threading.Tasks.Task LoadAsync()
{
ByteBuf _buf = await _loadFunc();
StringDataMaps.Clear();
DataList.Clear();
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
{{declaring_type_name value_type}} _v;
{{deserialize '_buf' '_v' value_type}}
DataList.Add(_v);
{{~if __key_type.type_name != 'string' ~}}
LongDataMaps.Add(_v.{{format_property_name __code_style __table.index_field.name}}, _v);
{{~end~}}
StringDataMaps.Add(_v.{{format_property_name __code_style __table.index_field.name}}.ToString(), _v);
}
PostInit();
}
{{~if value_type.is_dynamic~}}
//public T GetOrDefaultAs({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
//public T GetAs({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => (T)_dataMap[key];
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var value in DataList)
{
value.ResolveRef(tables);
}
PostResolveRef();
}
public void TranslateText(System.Func translator)
{
foreach(var v in DataList)
{
v.TranslateText(translator);
}
}
{{~else if __table.is_list_table ~}}
{{~if __table.is_union_index~}}
private {{table_union_map_type_name}} _dataMapUnion;
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
private System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}> _dataMap_{{idx.index_field.name}};
{{~end~}}
{{~end~}}
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
{{~if __table.is_union_index~}}
_dataMapUnion = new {{table_union_map_type_name}}();
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}} = new System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}>();
{{~end~}}
{{~end~}}
}
public override async System.Threading.Tasks.Task LoadAsync()
{
ByteBuf _buf = await _loadFunc();
DataList.Clear();
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
{{declaring_type_name value_type}} _v;
{{deserialize '_buf' '_v' value_type}}
DataList.Add(_v);
}
{{~if __table.is_union_index~}}
_dataMapUnion.Clear();
foreach(var _v in DataList)
{
_dataMapUnion.Add(({{table_key_list "_v"}}), _v);
}
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Clear();
{{~end~}}
foreach(var _v in DataList)
{
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Add(_v.{{format_property_name __code_style idx.index_field.name}}, _v);
{{~end~}}
}
{{~end~}}
PostInit();
}
{{~if __table.is_union_index~}}
public {{declaring_type_name value_type}} Get({{table_param_def_list}}) => _dataMapUnion.TryGetValue(({{table_param_name_list}}), out {{declaring_type_name value_type}} __v) ? __v : null;
{{~else if !__table.index_list.empty? ~}}
{{~for idx in __table.index_list~}}
public {{declaring_type_name value_type}} GetBy{{format_property_name __code_style idx.index_field.name}}({{declaring_type_name idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{declaring_type_name value_type}} __v) ? __v : null;
{{~end~}}
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var _v in DataList)
{
_v.ResolveRef(tables);
}
PostResolveRef();
}
public void TranslateText(System.Func translator)
{
foreach(var v in DataList)
{
v.TranslateText(translator);
}
}
{{~else~}}
private {{declaring_type_name value_type}} _data;
public {{declaring_type_name value_type}} Data => _data;
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
}
public async System.Threading.Tasks.Task LoadAsync()
{
ByteBuf _buf = await _loadFunc();
int n = _buf.ReadSize();
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
{{deserialize '_buf' '_data' value_type}}
PostInit();
}
{{~ for field in value_type.def_bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} => _data.{{format_property_name __code_style field.name}};
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
_data.ResolveRef(tables);
PostResolveRef();
}
public void TranslateText(System.Func translator)
{
_data.TranslateText(translator);
}
{{~end~}}
partial void PostInit();
partial void PostResolveRef();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-bin/tables.sbn
================================================
using System;
using LuBan.Runtime;
using GameFrameX.Config.Runtime;
{{namespace_with_grace_begin __namespace}}
public partial class {{__name}}
{
{{~for table in __tables ~}}
{{~if table.comment != '' ~}}
///
/// {{escape_comment table.comment}}
///
{{~end~}}
internal {{table.full_name}} {{format_property_name __code_style table.name}} { private set; get; }
{{~end~}}
private ConfigComponent m_ConfigComponent;
public void Init(ConfigComponent configComponent)
{
m_ConfigComponent = configComponent;
configComponent.RemoveAllConfigs();
}
///
/// 是否加载完成
///
public bool IsLoaded { get; private set; }
///
/// 异步加载配置文件
///
/// 加载器
public async System.Threading.Tasks.Task LoadAsync(System.Func> loader)
{
if (IsLoaded)
{
return;
}
IsLoaded = false;
m_ConfigComponent.RemoveAllConfigs();
var loadTasks = new System.Collections.Generic.List();
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}} = new {{table.full_name}}(() => loader("{{table.output_data_file}}"));
loadTasks.Add({{format_property_name __code_style table.name}}.LoadAsync());
m_ConfigComponent.Add(nameof({{table.full_name}}), {{format_property_name __code_style table.name}});
{{~end~}}
await System.Threading.Tasks.Task.WhenAll(loadTasks);
Refresh();
IsLoaded = true;
}
///
/// 设置本地化的适配器
///
/// 适配器对象
/// 如果未加载完成将抛出此异常
public void SetTranslateText(System.Func translator)
{
if (IsLoaded == false)
{
throw new InvalidOperationException("Table is not loaded!");
}
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}}.TranslateText(translator);
{{~end~}}
}
private void ResolveRef()
{
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}}.ResolveRef(this);
{{~end~}}
PostResolveRef();
}
public void Refresh()
{
PostInit();
ResolveRef();
}
partial void PostInit();
partial void PostResolveRef();
}
{{namespace_with_grace_end __namespace}}
================================================
FILE: Config/Tools/Templates/cs-code/bean.sbn
================================================
using Luban;
{{
parent_def_type = __bean.parent_def_type
export_fields = __bean.export_fields
hierarchy_export_fields = __bean.hierarchy_export_fields
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __bean.comment != '' ~}}
///
/// {{escape_comment __bean.comment}}
///
{{~end~}}
{{~
func get_ref_name
ret (format_property_name __code_style $0.name) + '_Ref'
end
func get_index_var_name
ret (format_property_name __code_style $0.name) + '_Index'
end
func generate_resolve_field_ref
field = $0
fieldName = format_property_name __code_style field.name
refTable = get_ref_table field
if can_generate_ref field
tableName = format_property_name __code_style refTable.name
if field.is_nullable
ret (get_ref_name field) + ' = ' + fieldName + '!= null ? tables.' + tableName + '.Get(' + (get_value_of_nullable_type field.ctype fieldName) + ') : null;'
else
ret (get_ref_name field) + ' = tables.' + tableName + '.Get(' + fieldName + ');'
end
else if can_generate_collection_ref field
collection_ref_table = get_collection_ref_table field
tableName = format_property_name __code_style collection_ref_table.name
if field.ctype.type_name == 'list' || field.ctype.type_name == 'set'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var _v in ' + fieldName + ') { ' + (get_ref_name field) + '.Add(tables.' + tableName + '.Get(_v)); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'array'
line1 = (get_ref_name field) + ' = new ' + (declaring_type_name collection_ref_table.value_ttype) + '[' + fieldName + '.Length];' + '\n'
line2 = 'for (int _i = 0; _i < ' + fieldName + '.Length; _i++) { ' + (get_ref_name field) + '[_i] = tables.' + tableName + '.Get(' + fieldName + '[_i]); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'map'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var (_k,_v) in ' + fieldName + ') { ' + (get_ref_name field) + '.Add(_k, tables.' + tableName + '.Get(_v)); }' + '\n'
ret line1 + line2
else
ret ''
end
else
if (is_field_bean_need_resolve_ref field)
ret fieldName + '?.ResolveRef(tables);'
else if (is_field_array_like_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + ') { _e?.ResolveRef(tables); }'
else if (is_field_map_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + '.Values) { _e?.ResolveRef(tables); }'
else
ret ''
end
end
end
func get_param_def_list(bean)
paramList = []
while bean
tempList = bean.export_fields |array.each do; ret (declaring_type_name $0.ctype) + ' ' + (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
func get_param_name_list(bean)
paramList = []
index = 0
while bean
tempList = bean.export_fields |array.each do; ret (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
~}}
{{~if __bean.is_value_type~}}
public partial struct {{__name}}
{{~else~}}
public {{class_modifier __bean}} partial class {{__name}} : {{if parent_def_type}}{{__bean.parent}}{{else}}Luban.BeanBase{{end}}
{{~end~}}
{
public {{__name}}({{get_param_def_list(__bean)}}) {{if parent_def_type}} : base({{get_param_name_list(__bean.parent_def_type)}}) {{end}}
{
{{~ for field in export_fields
fieldName = format_property_name __code_style field.name
~}}
this.{{fieldName}} = {{fieldName}};
{{~if can_generate_ref field~}}
this.{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
this.{{get_index_var_name field}} = new {{declaring_type_name (get_index_map_type field)}}({{field.size}});
foreach(var _v in {{fieldName}})
{
this.{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
PostInit();
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public readonly {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}};
{{~if can_generate_ref field~}}
public {{declaring_type_name (get_ref_type field)}} {{get_ref_name field}} { private set; get; }
{{~else if can_generate_collection_ref field~}}
public {{declaring_collection_ref_name field.ctype}} {{get_ref_name field}} { private set; get; }
{{~end~}}
{{~if has_index field
indexMapType = get_index_map_type field
~}}
public readonly {{declaring_type_name indexMapType}} {{get_index_var_name field}};
{{~end~}}
{{~end~}}
{{~if !__bean.is_abstract_type && !__bean.is_value_type~}}
public const int __ID__ = {{__bean.id}};
public override int GetTypeId() => __ID__;
{{~end~}}
public {{method_modifier __bean}} void ResolveRef({{__manager_name}} tables)
{
{{~if parent_def_type~}}
base.ResolveRef(tables);
{{~end~}}
{{~for field in export_fields~}}
{{generate_resolve_field_ref field}}
{{~end~}}
}
public override string ToString()
{
return "{{full_name}}{ "
{{~for field in hierarchy_export_fields ~}}
+ "{{format_field_name __code_style field.name}}:" + {{to_pretty_string (format_property_name __code_style field.name) field.ctype}} + ","
{{~end~}}
+ "}";
}
partial void PostInit();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-code/table.sbn
================================================
using Luban;
{{
key_type = __table.key_ttype
value_type = __table.value_ttype
func index_type_name
ret (declaring_type_name $0.type)
end
func table_union_map_type_name
ret 'System.Collections.Generic.Dictionary<(' + (array.each __table.index_list @index_type_name | array.join ', ') + '), ' + (declaring_type_name value_type) + '>'
end
func table_key_list
varName = $0
indexList = __table.index_list |array.each do; ret varName + '.' + (format_property_name __code_style $0.index_field.name); end;
ret array.join indexList ', '
end
func table_param_def_list
paramList = __table.index_list |array.each do; ret (declaring_type_name $0.type) + ' ' + $0.index_field.name; end
ret array.join paramList ', '
end
func table_param_name_list
paramList = __table.index_list |array.each do; ret $0.index_field.name; end
ret array.join paramList ', '
end
func table_param_type_list
paramList = __table.index_list |array.each do; ret (declaring_type_name $0.type); end
ret array.join paramList ', '
end
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __table.comment != '' ~}}
///
/// {{escape_comment __table.comment}}
///
{{~end~}}
public partial class {{__name}}
{
{{~if __table.is_map_table ~}}
private readonly System.Collections.Generic.Dictionary<{{declaring_type_name key_type}}, {{declaring_type_name value_type}}> _dataMap;
private readonly System.Collections.Generic.List<{{declaring_type_name value_type}}> _dataList;
public System.Collections.Generic.Dictionary<{{declaring_type_name key_type}}, {{declaring_type_name value_type}}> DataMap => _dataMap;
public System.Collections.Generic.List<{{declaring_type_name value_type}}> DataList => _dataList;
{{~if value_type.is_dynamic~}}
public T GetOrDefaultAs({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
public T GetAs({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => (T)_dataMap[key];
{{~end~}}
public {{declaring_type_name value_type}} GetOrDefault({{declaring_type_name key_type}} key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public {{declaring_type_name value_type}} Get({{declaring_type_name key_type}} key) => _dataMap[key];
public {{declaring_type_name value_type}} this[{{declaring_type_name key_type}} key] => _dataMap[key];
public void ResolveRef({{__manager_name}} tables)
{
foreach(var _v in _dataList)
{
_v.ResolveRef(tables);
}
}
{{~else if __table.is_list_table ~}}
private readonly System.Collections.Generic.List<{{declaring_type_name value_type}}> _dataList;
{{~if __table.is_union_index~}}
private {{table_union_map_type_name}} _dataMapUnion;
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
private System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}> _dataMap_{{idx.index_field.name}};
{{~end~}}
{{~end~}}
public System.Collections.Generic.List<{{declaring_type_name value_type}}> DataList => _dataList;
{{~if __table.is_union_index~}}
public {{declaring_type_name value_type}} Get({{table_param_def_list}}) => _dataMapUnion.TryGetValue(({{table_param_name_list}}), out {{declaring_type_name value_type}} __v) ? __v : null;
{{~else if !__table.index_list.empty? ~}}
{{~for idx in __table.index_list~}}
public {{declaring_type_name value_type}} GetBy{{format_property_name __code_style idx.index_field.name}}({{declaring_type_name idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{declaring_type_name value_type}} __v) ? __v : null;
{{~end~}}
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var _v in _dataList)
{
_v.ResolveRef(tables);
}
}
{{~else~}}
private readonly {{declaring_type_name value_type}} _data;
public {{declaring_type_name value_type}} Data => _data;
{{~ for field in value_type.def_bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} => _data.{{format_property_name __code_style field.name}};
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
_data.ResolveRef(tables);
}
{{~end~}}
partial void PostInit();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-code/tabledata.sbn
================================================
using Luban;
{{
key_type = __table.key_ttype
value_type = __table.value_ttype
func index_type_name
ret (declaring_type_name $0.type)
end
func table_union_map_type_name
ret 'System.Collections.Generic.Dictionary<(' + (array.each __table.index_list @index_type_name | array.join ', ') + '), ' + (declaring_type_name value_type) + '>'
end
func table_key_list
varName = $0
indexList = __table.index_list |array.each do; ret varName + '.' + (format_property_name __code_style $0.index_field.name); end;
ret array.join indexList ', '
end
func table_data_list
dataList = __records |array.each do; ret (apply_value $0); end
ret array.join dataList ',\n'
end
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __table.comment != '' ~}}
///
/// {{escape_comment __table.comment}}
///
{{~end~}}
public partial class {{__name}}
{
{{~if __table.is_map_table ~}}
public {{__name}}()
{
_dataList = new System.Collections.Generic.List<{{declaring_type_name value_type}}> ()
{
{{table_data_list}}
};
_dataMap = new System.Collections.Generic.Dictionary<{{declaring_type_name key_type}}, {{declaring_type_name value_type}}> (_dataList.Count);
foreach(var _v in _dataList)
{
_dataMap.Add(_v.{{format_property_name __code_style __table.index_field.name}}, _v);
}
PostInit();
}
{{~else if __table.is_list_table ~}}
public {{__name}}()
{
_dataList = new System.Collections.Generic.List<{{declaring_type_name value_type}}> ()
{
{{table_data_list}}
};
{{~if __table.is_union_index~}}
_dataMapUnion = new {{table_union_map_type_name}} (_dataList.Count);
foreach(var _v in _dataList)
{
_dataMapUnion.Add(({{table_key_list "_v"}}), _v);
}
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}} = new System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}> (_dataList.Count);
{{~end~}}
foreach(var _v in _dataList)
{
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Add(_v.{{format_property_name __code_style idx.index_field.name}}, _v);
{{~end~}}
}
{{~end~}}
PostInit();
}
{{~else~}}
public {{__name}}()
{
_data = {{table_data_list}};
PostInit();
}
{{~end~}}
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-code/tables.sbn
================================================
using Luban;
{{namespace_with_grace_begin __namespace}}
public partial class {{__name}}
{
{{~for table in __tables ~}}
{{~if table.comment != '' ~}}
///
/// {{escape_comment table.comment}}
///
{{~end~}}
internal {{table.full_name}} {{format_property_name __code_style table.name}} { private set; get; }
{{~end~}}
public {{__name}}()
{
TablesMemory.BeginRecord();
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}} = new {{table.full_name}}();
{{~end~}}
PostInit();
ResolveRef();
TablesMemory.EndRecord();
}
private void ResolveRef()
{
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}}.ResolveRef(this);
{{~end~}}
}
partial void PostInit();
}
{{namespace_with_grace_end __namespace}}
================================================
FILE: Config/Tools/Templates/cs-dotnet-bin/bean.sbn
================================================
using GameFrameX.Core.Config;
{{
parent_def_type = __bean.parent_def_type
export_fields = __bean.export_fields
hierarchy_export_fields = __bean.hierarchy_export_fields
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __bean.comment != '' ~}}
///
/// {{escape_comment __bean.comment}}
///
{{~end~}}
{{~
func get_ref_name
ret (format_property_name __code_style $0.name) + '_Ref'
end
func get_index_var_name
ret (format_property_name __code_style $0.name) + '_Index'
end
func generate_resolve_field_ref
field = $0
fieldName = format_property_name __code_style field.name
refTable = get_ref_table field
if can_generate_ref field
tableName = format_property_name __code_style refTable.name
if field.is_nullable
ret (get_ref_name field) + ' = ' + fieldName + '!= null ? tables.' + tableName + '.Get(' + (get_value_of_nullable_type field.ctype fieldName) + ') : null;'
else
ret (get_ref_name field) + ' = tables.' + tableName + '.Get(' + fieldName + ');'
end
else if can_generate_collection_ref field
collection_ref_table = get_collection_ref_table field
tableName = format_property_name __code_style collection_ref_table.name
if field.ctype.type_name == 'list' || field.ctype.type_name == 'set'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var _v in ' + fieldName + ') { ' + (get_ref_name field) + '.Add(tables.' + tableName + '.Get(_v)); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'array'
line1 = (get_ref_name field) + ' = new ' + (declaring_type_name collection_ref_table.value_ttype) + '[' + fieldName + '.Length];' + '\n'
line2 = 'for (int _i = 0; _i < ' + fieldName + '.Length; _i++) { ' + (get_ref_name field) + '[_i] = tables.' + tableName + '.Get(' + fieldName + '[_i]); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'map'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var (_k,_v) in ' + fieldName + ') { ' + (get_ref_name field) + '.Add(_k, tables.' + tableName + '.GetOrDefault(_v)); }' + '\n'
ret line1 + line2
else
ret ''
end
else
if (is_field_bean_need_resolve_ref field)
ret fieldName + '?.ResolveRef(tables);'
else if (is_field_array_like_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + ') { _e?.ResolveRef(tables); }'
else if (is_field_map_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + '.Values) { _e?.ResolveRef(tables); }'
else
ret ''
end
end
end
func get_param_def_list(bean)
paramList = []
while bean
tempList = bean.export_fields |array.each do; ret (declaring_type_name $0.ctype) + ' ' + (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
func get_param_name_list(bean)
paramList = []
index = 0
while bean
tempList = bean.export_fields |array.each do; ret (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
~}}
{{~if __bean.is_value_type~}}
public partial struct {{__name}}
{{~else~}}
public {{class_modifier __bean}} partial class {{__name}} : {{if parent_def_type}}{{__bean.parent}}{{else}}BeanBase{{end}}
{{~end~}}
{
public {{__name}}({{get_param_def_list(__bean)}}) {{if parent_def_type}} : base({{get_param_name_list(__bean.parent_def_type)}}) {{end}}
{
{{~ for field in export_fields
fieldName = format_property_name __code_style field.name
~}}
this.{{fieldName}} = {{fieldName}};
{{~if can_generate_ref field~}}
this.{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
this.{{get_index_var_name field}} = new {{declaring_type_name (get_index_map_type field)}}({{field.size}});
foreach(var _v in {{fieldName}})
{
this.{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
PostInit();
}
public {{__name}}(ByteBuf _buf) {{if parent_def_type}} : base(_buf) {{end}}
{
{{~ for field in export_fields
this.fieldName = format_property_name __code_style field.name
~}}
{{deserialize '_buf' fieldName field.ctype}}
{{~if can_generate_ref field~}}
{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
foreach(var _v in {{fieldName}})
{
{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
// Localization Key Begin
{{~ for field in export_fields ~}}
{{~if field.type =='text'~}}
{{format_property_name __code_style field.name}}_Localization_Key = {{format_property_name __code_style field.name}};
{{~end~}}
{{~end~}}
// Localization Key End
PostInit();
}
public static {{__name}} Deserialize{{__name}}(ByteBuf _buf)
{
{{~if __bean.is_abstract_type~}}
switch (_buf.ReadInt())
{
{{~for child in __bean.hierarchy_not_abstract_children~}}
case {{child.full_name}}.__ID__: return new {{child.full_name}}(_buf);
{{~end~}}
default: throw new SerializationException();
}
{{~else~}}
return new {{__bean.full_name}}(_buf);
{{~end~}}
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} { private set; get; }
{{~if field.type =='text'~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}} 的多语言Key
///
{{~end~}}
public readonly string {{format_property_name __code_style field.name}}_Localization_Key;
{{~end~}}
{{~if can_generate_ref field~}}
public {{declaring_type_name (get_ref_type field)}} {{get_ref_name field}} { private set; get; }
{{~else if can_generate_collection_ref field~}}
public {{declaring_collection_ref_name field.ctype}} {{get_ref_name field}} { private set; get; }
{{~end~}}
{{~if has_index field
indexMapType = get_index_map_type field
~}}
public readonly {{declaring_type_name indexMapType}} {{get_index_var_name field}} = new {{declaring_type_name indexMapType}}();
{{~end~}}
{{~end~}}
{{~if !__bean.is_abstract_type && !__bean.is_value_type~}}
public const int __ID__ = {{__bean.id}};
public override int GetTypeId() => __ID__;
{{~end~}}
public {{method_modifier __bean}} void ResolveRef({{__manager_name}} tables)
{
{{~if parent_def_type~}}
base.ResolveRef(tables);
{{~end~}}
{{~for field in export_fields~}}
{{generate_resolve_field_ref field}}
{{~end~}}
PostResolveRef();
}
public void TranslateText(System.Func translator)
{
{{~if parent_def_type~}}
base.TranslateText(translator);
{{~end~}}
{{~ for field in export_fields ~}}
{{~if field.type =='text'~}}
{{format_property_name __code_style field.name}} = translator({{format_property_name __code_style field.name}}_Localization_Key, {{format_property_name __code_style field.name}});
{{~end~}}
{{~end~}}
}
public override string ToString()
{
return "{{full_name}}{ "
{{~for field in hierarchy_export_fields ~}}
+ "{{format_field_name __code_style field.name}}:" + {{to_pretty_string (format_property_name __code_style field.name) field.ctype}} + ","
{{~end~}}
+ "}";
}
partial void PostInit();
partial void PostResolveRef();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-dotnet-bin/table.sbn
================================================
using GameFrameX.Core.Config;
{{
key_type = __table.key_ttype
value_type = __table.value_ttype
func index_type_name
ret (declaring_type_name $0.type)
end
func table_union_map_type_name
ret 'System.Collections.Generic.Dictionary<(' + (array.each __table.index_list @index_type_name | array.join ', ') + '), ' + (declaring_type_name value_type) + '>'
end
func table_key_list
varName = $0
indexList = __table.index_list |array.each do; ret varName + '.' + (format_property_name __code_style $0.index_field.name); end;
ret array.join indexList ', '
end
func table_param_def_list
paramList = __table.index_list |array.each do; ret (declaring_type_name $0.type) + ' ' + $0.index_field.name; end
ret array.join paramList ', '
end
func table_param_name_list
paramList = __table.index_list |array.each do; ret $0.index_field.name; end
ret array.join paramList ', '
end
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __table.comment != '' ~}}
///
/// {{escape_comment __table.comment}}
///
{{~end~}}
public partial class {{__name}} : BaseDataTable<{{declaring_type_name __value_type}}>
{
{{~if __table.is_map_table ~}}
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
}
public override async System.Threading.Tasks.Task LoadAsync()
{
ByteBuf _buf = await _loadFunc();
StringDataMaps.Clear();
DataList.Clear();
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
{{declaring_type_name value_type}} _v;
{{deserialize '_buf' '_v' value_type}}
DataList.Add(_v);
{{~if __key_type.type_name != 'string' ~}}
LongDataMaps.Add(_v.{{format_property_name __code_style __table.index_field.name}}, _v);
{{~end~}}
StringDataMaps.Add(_v.{{format_property_name __code_style __table.index_field.name}}.ToString(), _v);
}
PostInit();
}
{{~if value_type.is_dynamic~}}
//public T GetOrDefaultAs({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
//public T GetAs({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => (T)_dataMap[key];
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var value in DataList)
{
value.ResolveRef(tables);
}
PostResolveRef();
}
public void TranslateText(System.Func translator)
{
foreach(var v in DataList)
{
v.TranslateText(translator);
}
}
{{~else if __table.is_list_table ~}}
private readonly System.Collections.Generic.List<{{declaring_type_name value_type}}> _dataList;
{{~if __table.is_union_index~}}
private {{table_union_map_type_name}} _dataMapUnion;
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
private System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}> _dataMap_{{idx.index_field.name}};
{{~end~}}
{{~end~}}
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
_dataList = new System.Collections.Generic.List<{{declaring_type_name value_type}}>();
{{~if __table.is_union_index~}}
_dataMapUnion = new {{table_union_map_type_name}}();
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}} = new System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}>();
{{~end~}}
{{~end~}}
}
public async System.Threading.Tasks.Task LoadAsync()
{
ByteBuf _buf = await _loadFunc();
_dataList.Clear();
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
{{declaring_type_name value_type}} _v;
{{deserialize '_buf' '_v' value_type}}
_dataList.Add(_v);
}
{{~if __table.is_union_index~}}
_dataMapUnion.Clear();
foreach(var _v in _dataList)
{
_dataMapUnion.Add(({{table_key_list "_v"}}), _v);
}
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Clear();
{{~end~}}
foreach(var _v in _dataList)
{
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Add(_v.{{format_property_name __code_style idx.index_field.name}}, _v);
{{~end~}}
}
{{~end~}}
PostInit();
}
public System.Collections.Generic.List<{{declaring_type_name value_type}}> DataList => _dataList;
{{~if __table.is_union_index~}}
public {{declaring_type_name value_type}} Get({{table_param_def_list}}) => _dataMapUnion.TryGetValue(({{table_param_name_list}}), out {{declaring_type_name value_type}} __v) ? __v : null;
{{~else if !__table.index_list.empty? ~}}
{{~for idx in __table.index_list~}}
public {{declaring_type_name value_type}} GetBy{{format_property_name __code_style idx.index_field.name}}({{declaring_type_name idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{declaring_type_name value_type}} __v) ? __v : null;
{{~end~}}
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var _v in _dataList)
{
_v.ResolveRef(tables);
}
PostResolveRef();
}
public void TranslateText(System.Func translator)
{
foreach(var v in DataList)
{
v.TranslateText(translator);
}
}
{{~else~}}
private {{declaring_type_name value_type}} _data;
public {{declaring_type_name value_type}} Data => _data;
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
}
public async System.Threading.Tasks.Task LoadAsync()
{
ByteBuf _buf = await _loadFunc();
int n = _buf.ReadSize();
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
{{deserialize '_buf' '_data' value_type}}
PostInit();
}
{{~ for field in value_type.def_bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} => _data.{{format_property_name __code_style field.name}};
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
_data.ResolveRef(tables);
PostResolveRef();
}
public void TranslateText(System.Func translator)
{
_data.TranslateText(translator);
}
{{~end~}}
partial void PostInit();
partial void PostResolveRef();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-dotnet-bin/tables.sbn
================================================
using System;
using GameFrameX.Core.Config;
{{namespace_with_grace_begin __namespace}}
public partial class {{__name}}
{
{{~for table in __tables ~}}
{{~if table.comment != '' ~}}
///
/// {{escape_comment table.comment}}
///
{{~end~}}
internal {{table.full_name}} {{format_property_name __code_style table.name}} { private set; get; }
{{~end~}}
private ConfigComponent m_ConfigComponent;
public void Init(ConfigComponent configComponent)
{
m_ConfigComponent = configComponent;
configComponent.RemoveAllConfigs();
}
///
/// 是否加载完成
///
public bool IsLoaded { get; private set; }
///
/// 异步加载配置文件
///
/// 加载器
public async System.Threading.Tasks.Task LoadAsync(System.Func> loader)
{
if (IsLoaded)
{
return;
}
IsLoaded = false;
m_ConfigComponent.RemoveAllConfigs();
var loadTasks = new System.Collections.Generic.List();
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}} = new {{table.full_name}}(() => loader("{{table.output_data_file}}", true));
loadTasks.Add({{format_property_name __code_style table.name}}.LoadAsync());
m_ConfigComponent.Add(nameof({{table.full_name}}), {{format_property_name __code_style table.name}});
{{~end~}}
await System.Threading.Tasks.Task.WhenAll(loadTasks);
Refresh();
IsLoaded = true;
}
///
/// 设置本地化的适配器
///
/// 适配器对象
/// 如果未加载完成将抛出此异常
public void SetTranslateText(System.Func translator)
{
if (IsLoaded == false)
{
throw new InvalidOperationException("Table is not loaded!");
}
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}}.TranslateText(translator);
{{~end~}}
}
private void ResolveRef()
{
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}}.ResolveRef(this);
{{~end~}}
PostResolveRef();
}
public void Refresh()
{
PostInit();
ResolveRef();
}
partial void PostInit();
partial void PostResolveRef();
}
{{namespace_with_grace_end __namespace}}
================================================
FILE: Config/Tools/Templates/cs-dotnet-json/bean.sbn
================================================
using System.Text.Json;
using GameFrameX.Core.Config;
{{
parent_def_type = __bean.parent_def_type
export_fields = __bean.export_fields
hierarchy_export_fields = __bean.hierarchy_export_fields
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __bean.comment != '' ~}}
///
/// {{escape_comment __bean.comment}}
///
{{~end~}}
{{~
func get_ref_name
ret (format_property_name __code_style $0.name) + '_Ref'
end
func get_index_var_name
ret (format_property_name __code_style $0.name) + '_Index'
end
func generate_resolve_field_ref
field = $0
fieldName = format_property_name __code_style field.name
refTable = get_ref_table field
if can_generate_ref field
tableName = format_property_name __code_style refTable.name
if field.is_nullable
ret (get_ref_name field) + ' = ' + fieldName + '!= null ? tables.' + tableName + '.Get(' + (get_value_of_nullable_type field.ctype fieldName) + ') : null;'
else
ret (get_ref_name field) + ' = tables.' + tableName + '.Get(' + fieldName + ');'
end
else if can_generate_collection_ref field
collection_ref_table = get_collection_ref_table field
tableName = format_property_name __code_style collection_ref_table.name
if field.ctype.type_name == 'list' || field.ctype.type_name == 'set'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var _v in ' + fieldName + ') { ' + (get_ref_name field) + '.Add(tables.' + tableName + '.Get(_v)); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'array'
line1 = (get_ref_name field) + ' = new ' + (declaring_type_name collection_ref_table.value_ttype) + '[' + fieldName + '.Length];' + '\n'
line2 = 'for (int _i = 0; _i < ' + fieldName + '.Length; _i++) { ' + (get_ref_name field) + '[_i] = tables.' + tableName + '.Get(' + fieldName + '[_i]); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'map'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var (_k,_v) in ' + fieldName + ') { ' + (get_ref_name field) + '.Add(_k, tables.' + tableName + '.Get(_v)); }' + '\n'
ret line1 + line2
else
ret ''
end
else
if (is_field_bean_need_resolve_ref field)
ret fieldName + '?.ResolveRef(tables);'
else if (is_field_array_like_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + ') { _e?.ResolveRef(tables); }'
else if (is_field_map_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + '.Values) { _e?.ResolveRef(tables); }'
else
ret ''
end
end
end
func get_param_def_list(bean)
paramList = []
while bean
tempList = bean.export_fields |array.each do; ret (declaring_type_name $0.ctype) + ' ' + (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
func get_param_name_list(bean)
paramList = []
index = 0
while bean
tempList = bean.export_fields |array.each do; ret (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
~}}
{{~if __bean.is_value_type~}}
public partial struct {{__name}}
{{~else~}}
public {{class_modifier __bean}} partial class {{__name}} : {{if parent_def_type}}{{__bean.parent}}{{else}}BeanBase{{end}}
{{~end~}}
{
/*
public {{__name}}({{get_param_def_list(__bean)}}) {{if parent_def_type}} : base({{get_param_name_list(__bean.parent_def_type)}}) {{end}}
{
{{~ for field in export_fields
fieldName = format_property_name __code_style field.name
~}}
this.{{fieldName}} = {{fieldName}};
{{~if can_generate_ref field~}}
this.{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
this.{{get_index_var_name field}} = new {{declaring_type_name (get_index_map_type field)}}({{field.size}});
foreach(var _v in {{fieldName}})
{
this.{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
PostInit();
}
*/
public {{__name}}(JsonElement _buf) {{if parent_def_type}} : base(_buf) {{end}}
{
{{~ for field in export_fields
fieldName = format_property_name __code_style field.name
~}}
{{deserialize_field fieldName '_buf' field.name field.ctype}}
{{~if can_generate_ref field~}}
{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
foreach(var _v in {{fieldName}})
{
{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
}
public static {{__name}} Deserialize{{__name}}(JsonElement _buf)
{
{{~if __bean.is_abstract_type~}}
switch (_buf.GetProperty("$type").GetString())
{
{{~for child in __bean.hierarchy_not_abstract_children~}}
case "{{impl_data_type child __bean}}": return new {{child.full_name}}(_buf);
{{~end~}}
default: throw new SerializationException();
}
{{~else~}}
return new {{__bean.full_name}}(_buf);
{{~end~}}
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} { private set; get; }
{{~if can_generate_ref field~}}
public {{declaring_type_name (get_ref_type field)}} {{get_ref_name field}} { private set; get; }
{{~else if can_generate_collection_ref field~}}
public {{declaring_collection_ref_name field.ctype}} {{get_ref_name field}} { private set; get; }
{{~end~}}
{{~if has_index field
indexMapType = get_index_map_type field
~}}
public {{declaring_type_name indexMapType}} {{get_index_var_name field}} { private set; get; } = new {{declaring_type_name indexMapType}}();
{{~end~}}
{{~end~}}
{{~if !__bean.is_abstract_type && !__bean.is_value_type~}}
private const int __ID__ = {{__bean.id}};
public override int GetTypeId() => __ID__;
{{~end~}}
public {{method_modifier __bean}} void ResolveRef({{__manager_name}} tables)
{
{{~if parent_def_type~}}
base.ResolveRef(tables);
{{~end~}}
{{~for field in export_fields~}}
{{generate_resolve_field_ref field}}
{{~end~}}
}
public override string ToString()
{
return "{{full_name}}{ "
{{~for field in hierarchy_export_fields ~}}
+ "{{format_field_name __code_style field.name}}:" + {{to_pretty_string (format_property_name __code_style field.name) field.ctype}} + ","
{{~end~}}
+ "}";
}
partial void PostInit();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-dotnet-json/table.sbn
================================================
using System.Text.Json;
using GameFrameX.Core.Config;
{{
key_type = __table.key_ttype
value_type = __table.value_ttype
func index_type_name
ret (declaring_type_name $0.type)
end
func table_union_map_type_name
ret 'System.Collections.Generic.Dictionary<(' + (array.each __table.index_list @index_type_name | array.join ', ') + '), ' + (declaring_type_name value_type) + '>'
end
func table_key_list
varName = $0
indexList = __table.index_list |array.each do; ret varName + '.' + (format_property_name __code_style $0.index_field.name); end;
ret array.join indexList ', '
end
func table_param_def_list
paramList = __table.index_list |array.each do; ret (declaring_type_name $0.type) + ' ' + $0.index_field.name; end
ret array.join paramList ', '
end
func table_param_name_list
paramList = __table.index_list |array.each do; ret $0.index_field.name; end
ret array.join paramList ', '
end
func table_param_type_list
paramList = __table.index_list |array.each do; ret (declaring_type_name $0.type); end
ret array.join paramList ', '
end
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __table.comment != '' ~}}
///
/// {{escape_comment __table.comment}}
///
{{~end~}}
public partial class {{__name}} : BaseDataTable<{{declaring_type_name value_type}}>
{
{{~if __table.is_map_table ~}}
//private readonly System.Collections.Generic.Dictionary<{{declaring_type_name key_type}}, {{declaring_type_name value_type}}> _dataMap;
//private readonly System.Collections.Generic.List<{{declaring_type_name value_type}}> _dataList;
//public System.Collections.Generic.Dictionary<{{declaring_type_name key_type}}, {{declaring_type_name value_type}}> DataMap => _dataMap;
//public System.Collections.Generic.List<{{declaring_type_name value_type}}> DataList => _dataList;
{{~if value_type.is_dynamic~}}
//public T GetOrDefaultAs({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
//public T GetAs({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => (T)_dataMap[key];
{{~end~}}
//public {{declaring_type_name value_type}} GetOrDefault({{declaring_type_name key_type}} key) => _dataMap.TryGetValue(key, out var v) ? v : null;
//public {{declaring_type_name value_type}} Get({{declaring_type_name key_type}} key) => _dataMap[key];
//public {{declaring_type_name value_type}} this[{{declaring_type_name key_type}} key] => _dataMap[key];
public override async System.Threading.Tasks.Task LoadAsync()
{
var jsonElement = await _loadFunc();
DataList.Clear();
LongDataMaps.Clear();
StringDataMaps.Clear();
foreach(var element in jsonElement.EnumerateArray())
{
{{declaring_type_name __value_type}} _v;
{{deserialize '_v' 'element' __value_type}}
DataList.Add(_v);
{{~if __key_type.type_name != 'string' ~}}
LongDataMaps.Add(_v.{{format_property_name __code_style __table.index_field.name}}, _v);
{{~end~}}
StringDataMaps.Add(_v.{{format_property_name __code_style __table.index_field.name}}.ToString(), _v);
}
PostInit();
}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var element in DataList)
{
element.ResolveRef(tables);
}
}
{{~else if __table.is_list_table ~}}
//private readonly System.Collections.Generic.List<{{declaring_type_name value_type}}> _dataList;
{{~if __table.is_union_index~}}
private {{table_union_map_type_name}} _dataMapUnion;
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
private System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}> _dataMap_{{idx.index_field.name}};
{{~end~}}
{{~end~}}
//public System.Collections.Generic.List<{{declaring_type_name value_type}}> DataList => _dataList;
{{~if __table.is_union_index~}}
public {{declaring_type_name value_type}} Get({{table_param_def_list}}) => _dataMapUnion.TryGetValue(({{table_param_name_list}}), out {{declaring_type_name value_type}} __v) ? __v : null;
{{~else if !__table.index_list.empty? ~}}
{{~for idx in __table.index_list~}}
public {{declaring_type_name value_type}} GetBy{{format_property_name __code_style idx.index_field.name}}({{declaring_type_name idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{declaring_type_name value_type}} __v) ? __v : null;
{{~end~}}
{{~end~}}
public override async System.Threading.Tasks.Task LoadAsync()
{
var jsonElement = await _loadFunc();
DataList.Clear();
LongDataMaps.Clear();
StringDataMaps.Clear();
foreach(var element in jsonElement.EnumerateArray())
{
{{declaring_type_name __value_type}} _v;
{{deserialize '_v' 'element' __value_type}}
DataList.Add(_v);
}
{{~if __table.is_union_index~}}
_dataMapUnion = new {{table_union_map_type_name}}();
_dataMapUnion.Clear();
foreach(var element in DataList)
{
_dataMapUnion.Add(({{table_key_list "element"}}), element);
}
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}} = new System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name __value_type}}>();
{{~end~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Clear();
{{~end~}}
foreach(var element in DataList)
{
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Add(element.{{format_property_name __code_style idx.index_field.name}}, element);
{{~end~}}
}
{{~end~}}
PostInit();
}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var element in DataList)
{
element.ResolveRef(tables);
}
}
{{~else~}}
private {{declaring_type_name value_type}} _data;
public {{declaring_type_name value_type}} Data => _data;
{{~ for field in value_type.def_bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} => _data.{{format_property_name __code_style field.name}};
{{~end~}}
public override async Task LoadAsync()
{
var jsonElement = await _loadFunc();
int n = jsonElement.GetArrayLength();
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
{{deserialize '_data' 'jsonElement[0]' __value_type}}
}
public void ResolveRef({{__manager_name}} tables)
{
_data.ResolveRef(tables);
}
{{~end~}}
partial void PostInit();
public {{__name}}(Func> loadFunc) : base(loadFunc)
{
}
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-dotnet-json/tables.sbn
================================================
using System.Text.Json;
using GameFrameX.Core.Config;
using GameFrameX.Config;
{{namespace_with_grace_begin __namespace}}
public partial class {{__name}}
{
{{~for table in __tables ~}}
{{~if table.comment != '' ~}}
///
/// {{escape_comment table.comment}}
///
{{~end~}}
internal {{table.full_name}} {{format_property_name __code_style table.name}} { private set; get; }
{{~end~}}
private ConfigComponent m_ConfigComponent;
public void Init(ConfigComponent configComponent)
{
m_ConfigComponent = configComponent;
configComponent.RemoveAllConfigs();
}
public async System.Threading.Tasks.Task LoadAsync(System.Func> loader)
{
//m_ConfigComponent.RemoveAllConfigs();
var loadTasks = new System.Collections.Generic.List();
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}} = new {{table.full_name}}(() => loader("{{table.output_data_file}}"));
loadTasks.Add({{format_property_name __code_style table.name}}.LoadAsync());
m_ConfigComponent.Add(nameof({{table.full_name}}), {{format_property_name __code_style table.name}});
{{~end~}}
await System.Threading.Tasks.Task.WhenAll(loadTasks);
Refresh();
}
public {{__name}}()
{
//TablesMemory.BeginRecord();
{{~for table in __tables ~}}
// {{format_property_name __code_style table.name}} = new {{table.full_name}}();
{{~end~}}
//TablesMemory.EndRecord();
}
public void Refresh()
{
PostInit();
ResolveRef();
}
private void ResolveRef()
{
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}}.ResolveRef(this);
{{~end~}}
}
partial void PostInit();
}
{{namespace_with_grace_end __namespace}}
================================================
FILE: Config/Tools/Templates/cs-simple-json/bean.sbn
================================================
using LuBan.Runtime;
using GameFrameX.Config;
using SimpleJSON;
{{
parent_def_type = __bean.parent_def_type
export_fields = __bean.export_fields
hierarchy_export_fields = __bean.hierarchy_export_fields
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __bean.comment != '' ~}}
///
/// {{escape_comment __bean.comment}}
///
{{~end~}}
{{~
func get_ref_name
ret (format_property_name __code_style $0.name) + '_Ref'
end
func get_index_var_name
ret (format_property_name __code_style $0.name) + '_Index'
end
func generate_resolve_field_ref
field = $0
fieldName = format_property_name __code_style field.name
refTable = get_ref_table field
if can_generate_ref field
tableName = format_property_name __code_style refTable.name
if field.is_nullable
ret (get_ref_name field) + ' = ' + fieldName + '!= null ? tables.' + tableName + '.Get(' + (get_value_of_nullable_type field.ctype fieldName) + ') : null;'
else
ret (get_ref_name field) + ' = tables.' + tableName + '.Get(' + fieldName + ');'
end
else if can_generate_collection_ref field
collection_ref_table = get_collection_ref_table field
tableName = format_property_name __code_style collection_ref_table.name
if field.ctype.type_name == 'list' || field.ctype.type_name == 'set'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var _v in ' + fieldName + ') ' + '\n{\n'
line3 = '\t' + (get_ref_name field) + '.Add(tables.' + tableName + '.Get(_v)); '
line3 = line3 + '\n' + '}' + '\n'
ret line1 + line2 + line3
else if field.ctype.type_name == 'array'
line1 = (get_ref_name field) + ' = new ' + (declaring_type_name collection_ref_table.value_ttype) + '[' + fieldName + '.Length];' + '\n'
line2 = 'for (int _i = 0; _i < ' + fieldName + '.Length; _i++) { ' + (get_ref_name field) + '[_i] = tables.' + tableName + '.Get(' + fieldName + '[_i]); }' + '\n'
ret line1 + line2
else if field.ctype.type_name == 'map'
line1 = (get_ref_name field) + ' = new ' + (declaring_collection_ref_name field.ctype) + '();' + '\n'
line2 = 'foreach (var _kv in ' + fieldName + ') { ' + '\n'
line3 = ' ' + (get_ref_name field) + '.Add(_kv.Key, tables.' + tableName + '.Get(_kv.Value));' + '\n'
line3 = line3 + '}' + '\n'
ret line1 + line2 + line3
else
ret ''
end
else
if (is_field_bean_need_resolve_ref field)
ret fieldName + '?.ResolveRef(tables);'
else if (is_field_array_like_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + ') \n{\n \t_e?.ResolveRef(tables);\n}'
else if (is_field_map_need_resolve_ref field)
ret 'foreach (var _e in ' + fieldName + '.Values) \n{\n \t_e?.ResolveRef(tables);\n}'
else
ret ''
end
end
end
func get_param_def_list(bean)
paramList = []
while bean
tempList = bean.export_fields |array.each do; ret (declaring_type_name $0.ctype) + ' ' + (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
func get_param_name_list(bean)
paramList = []
index = 0
while bean
tempList = bean.export_fields |array.each do; ret (format_property_name __code_style $0.name); end
paramList = tempList + paramList
bean = bean.parent_def_type
end
ret array.join paramList ', '
end
~}}
{{~if __bean.is_value_type~}}
public partial struct {{__name}}
{{~else~}}
public {{class_modifier __bean}} partial class {{__name}} : {{if parent_def_type}}{{__bean.parent}}{{else}}LuBan.Runtime.BeanBase{{end}}
{{~end~}}
{
public {{__name}}({{get_param_def_list(__bean)}}) {{if parent_def_type}} : base({{get_param_name_list(__bean.parent_def_type)}}) {{end}}
{
{{~ for field in export_fields
fieldName = format_property_name __code_style field.name
~}}
this.{{fieldName}} = {{fieldName}};
{{~if can_generate_ref field~}}
this.{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
this.{{get_index_var_name field}} = new {{declaring_type_name (get_index_map_type field)}}({{field.size}});
foreach(var _v in {{fieldName}})
{
this.{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
PostInit();
}
public {{__name}}(JSONNode _buf){{if parent_def_type}} : base(_buf) {{end}}
{
{{~ for field in export_fields
fieldName = format_property_name __code_style field.name
~}}
{{deserialize_field fieldName '_buf' field.name field.ctype}}
{{~if can_generate_ref field~}}
{{get_ref_name field}} = null;
{{~end~}}
{{~if has_index field~}}
foreach(var _v in {{fieldName}})
{
{{get_index_var_name field}}.Add(_v.{{format_property_name __code_style (get_index_field field).name}}, _v);
}
{{~end~}}
{{~end~}}
// Localization Key Begin
{{~ for field in export_fields ~}}
{{~if field.type =='text'~}}
{{format_property_name __code_style field.name}}_Localization_Key = {{format_property_name __code_style field.name}};
{{~end~}}
{{~end~}}
// Localization Key End
PostInit();
}
public static {{__name}} Deserialize{{__name}}(JSONNode _buf)
{
{{~if __bean.is_abstract_type~}}
switch ((string)_buf["$type"])
{
{{~for child in __bean.hierarchy_not_abstract_children~}}
case "{{impl_data_type child __bean}}": return new {{child.full_name}}(_buf);
{{~end~}}
default: throw new SerializationException();
}
{{~else~}}
return new {{__bean.full_name}}(_buf);
{{~end~}}
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} { private set; get; }
{{~if field.type =='text'~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}} 的多语言Key
///
{{~end~}}
private readonly string {{format_property_name __code_style field.name}}_Localization_Key;
{{~end~}}
{{~if can_generate_ref field~}}
public {{declaring_type_name (get_ref_type field)}} {{get_ref_name field}} { private set; get; }
{{~else if can_generate_collection_ref field~}}
public {{declaring_collection_ref_name field.ctype}} {{get_ref_name field}} { private set; get; }
{{~end~}}
{{~if has_index field
indexMapType = get_index_map_type field
~}}
public readonly {{declaring_type_name indexMapType}} {{get_index_var_name field}} = new {{declaring_type_name indexMapType}}();
{{~end~}}
{{~end~}}
{{~if !__bean.is_abstract_type && !__bean.is_value_type~}}
public const int __ID__ = {{__bean.id}};
public override int GetTypeId() => __ID__;
{{~end~}}
public {{method_modifier __bean}} void ResolveRef({{__manager_name}} tables)
{
{{~if parent_def_type~}}
base.ResolveRef(tables);
{{~end~}}
{{~for field in export_fields~}}
{{generate_resolve_field_ref field}}
{{~end~}}
}
public void TranslateText(System.Func translator)
{
{{~if parent_def_type~}}
base.TranslateText(translator);
{{~end~}}
{{~ for field in export_fields ~}}
{{~if field.type =='text'~}}
{{format_property_name __code_style field.name}} = translator({{format_property_name __code_style field.name}}_Localization_Key, {{format_property_name __code_style field.name}});
{{~end~}}
{{~end~}}
}
public override string ToString()
{
return "{{full_name}}{ "
{{~for field in hierarchy_export_fields ~}}
+ "{{format_field_name __code_style field.name}}:" + {{to_pretty_string (format_property_name __code_style field.name) field.ctype}} + ","
{{~end~}}
+ "}";
}
partial void PostInit();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-simple-json/table.sbn
================================================
using LuBan.Runtime;
using GameFrameX.Config.Runtime;
using SimpleJSON;
{{
func index_type_name
ret (declaring_type_name $0.type)
end
func table_union_map_type_name
ret 'System.Collections.Generic.Dictionary<(' + (array.each __table.index_list @index_type_name | array.join ', ') + '), ' + (declaring_type_name __value_type) + '>'
end
func table_key_list
varName = $0
indexList = __table.index_list |array.each do; ret varName + '.' + (format_property_name __code_style $0.index_field.name); end;
ret array.join indexList ', '
end
func table_param_def_list
paramList = __table.index_list |array.each do; ret (declaring_type_name $0.type) + ' ' + $0.index_field.name; end
ret array.join paramList ', '
end
func table_param_name_list
paramList = __table.index_list |array.each do; ret $0.index_field.name; end
ret array.join paramList ', '
end
}}
{{namespace_with_grace_begin __namespace_with_top_module}}
{{~if __table.comment != '' ~}}
///
/// {{escape_comment __table.comment}}
///
{{~end~}}
public partial class {{__name}} : BaseDataTable<{{declaring_type_name __value_type}}>
{
{{~if __table.is_map_table ~}}
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
}
public override async System.Threading.Tasks.Task LoadAsync()
{
var jsonNode = await _loadFunc();
StringDataMaps.Clear();
DataList.Clear();
foreach(var _ele in jsonNode.Children)
{
{{declaring_type_name __value_type}} _v;
{{deserialize '_v' '_ele' __value_type}}
DataList.Add(_v);
{{~if __key_type.type_name != 'string' ~}}
LongDataMaps.Add(_v.{{format_property_name __code_style __table.index_field.name}}, _v);
{{~end~}}
StringDataMaps.Add(_v.{{format_property_name __code_style __table.index_field.name}}.ToString(), _v);
}
PostInit();
}
{{~if __value_type.is_dynamic~}}
//public T GetOrDefaultAs({{declaring_type_name __key_type}} key) where T : {{declaring_type_name __value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
//public T GetAs({{declaring_type_name __key_type}} key) where T : {{declaring_type_name __value_type}} => (T)_dataMap[key];
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var value in DataList)
{
value.ResolveRef(tables);
}
}
public void TranslateText(System.Func translator)
{
foreach(var v in DataList)
{
v.TranslateText(translator);
}
}
{{~else if __table.is_list_table ~}}
{{~if __table.is_union_index~}}
private {{table_union_map_type_name}} _dataMapUnion;
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
private System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name __value_type}}> _dataMap_{{idx.index_field.name}};
{{~end~}}
{{~end~}}
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
{{~if __table.is_union_index~}}
_dataMapUnion = new {{table_union_map_type_name}}();
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}} = new System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name __value_type}}>();
{{~end~}}
{{~end~}}
}
public override async System.Threading.Tasks.Task LoadAsync()
{
JSONNode _json = await _loadFunc();
DataList.Clear();
foreach(var _ele in _json.Children)
{
{{declaring_type_name __value_type}} _v;
{{deserialize '_v' '_ele' __value_type}}
DataList.Add(_v);
}
{{~if __table.is_union_index~}}
_dataMapUnion.Clear();
foreach(var _v in DataList)
{
_dataMapUnion.Add(({{table_key_list "_v"}}), _v);
}
{{~else if !__table.index_list.empty?~}}
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Clear();
{{~end~}}
foreach(var _v in DataList)
{
{{~for idx in __table.index_list~}}
_dataMap_{{idx.index_field.name}}.Add(_v.{{format_property_name __code_style idx.index_field.name}}, _v);
{{~end~}}
}
{{~end~}}
PostInit();
}
//public System.Collections.Generic.List<{{declaring_type_name __value_type}}> DataList => DataList;
{{~if __table.is_union_index~}}
public {{declaring_type_name __value_type}} Get({{table_param_def_list}}) => _dataMapUnion.TryGetValue(({{table_param_name_list}}), out {{declaring_type_name __value_type}} __v) ? __v : null;
{{~else if !__table.index_list.empty? ~}}
{{~for idx in __table.index_list~}}
public {{declaring_type_name __value_type}} GetBy{{format_property_name __code_style idx.index_field.name}}({{declaring_type_name idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{declaring_type_name __value_type}} __v) ? __v : null;
{{~end~}}
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
foreach(var _v in DataList)
{
_v.ResolveRef(tables);
}
}
public void TranslateText(System.Func translator)
{
foreach(var v in DataList)
{
v.TranslateText(translator);
}
}
{{~else~}}
private {{declaring_type_name __value_type}} _data;
public {{declaring_type_name __value_type}} Data => _data;
private readonly System.Func> _loadFunc;
public {{__name}}(System.Func> loadFunc)
{
_loadFunc = loadFunc;
}
public override async System.Threading.Tasks.Task LoadAsync()
{
JSONNode _json = await _loadFunc();
int n = _json.Count;
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
{{deserialize '_data' '_json[0]' __value_type}}
}
{{~ for field in __value_type.def_bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
///
/// {{escape_comment field.comment}}
///
{{~end~}}
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} => _data.{{format_property_name __code_style field.name}};
{{~end~}}
public void ResolveRef({{__manager_name}} tables)
{
_data.ResolveRef(tables);
}
public void TranslateText(System.Func translator)
{
_data.TranslateText(translator);
}
{{~end~}}
partial void PostInit();
}
{{namespace_with_grace_end __namespace_with_top_module}}
================================================
FILE: Config/Tools/Templates/cs-simple-json/tables.sbn
================================================
using System;
using LuBan.Runtime;
using GameFrameX.Config.Runtime;
using SimpleJSON;
{{namespace_with_grace_begin __namespace}}
public partial class {{__name}}
{
{{~for table in __tables ~}}
{{~if table.comment != '' ~}}
///
/// {{escape_comment table.comment}}
///
{{~end~}}
internal {{table.full_name}} {{format_property_name __code_style table.name}} { private set; get; }
{{~end~}}
private ConfigComponent m_ConfigComponent;
public void Init(ConfigComponent configComponent)
{
m_ConfigComponent = configComponent;
configComponent.RemoveAllConfigs();
}
///
/// 是否加载完成
///
public bool IsLoaded { get; private set; }
///
/// 异步加载配置文件
///
/// 加载器
public async System.Threading.Tasks.Task LoadAsync(System.Func> loader)
{
if (IsLoaded)
{
return;
}
IsLoaded = false;
m_ConfigComponent.RemoveAllConfigs();
var loadTasks = new System.Collections.Generic.List();
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}} = new {{table.full_name}}(() => loader("{{table.output_data_file}}"));
loadTasks.Add({{format_property_name __code_style table.name}}.LoadAsync());
m_ConfigComponent.Add(nameof({{table.full_name}}), {{format_property_name __code_style table.name}});
{{~end~}}
await System.Threading.Tasks.Task.WhenAll(loadTasks);
Refresh();
IsLoaded = true;
}
///
/// 设置本地化的适配器
///
/// 适配器对象
/// 如果未加载完成将抛出此异常
public void SetTranslateText(System.Func translator)
{
if (IsLoaded == false)
{
throw new InvalidOperationException("Table is not loaded!");
}
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}}.TranslateText(translator);
{{~end~}}
}
private void ResolveRef()
{
{{~for table in __tables ~}}
{{format_property_name __code_style table.name}}.ResolveRef(this);
{{~end~}}
}
public void Refresh()
{
PostInit();
ResolveRef();
}
partial void PostInit();
}
{{namespace_with_grace_end __namespace}}
================================================
FILE: Config/Tools/nlog.xml
================================================
================================================
FILE: Config/gen-client-bin.bat
================================================
dotnet.exe ./Tools/Luban.dll --target client --dataTarget bin --codeTarget cs-bin --xargs outputDataDir=../Unity/Assets//Bundles/Config --xargs outputCodeDir=../Unity/Assets//Hotfix/Config/Generate --xargs tableImporter.name=gameframex -x l10n.provider=gameframex -x l10n.textFile.keyFieldName=key -x l10n.textFile.path=./Excels/Local/ --conf ./Luban.conf
pause
================================================
FILE: Config/gen-client-bin.sh
================================================
dotnet ./Tools/Luban.dll --target client --dataTarget bin --codeTarget cs-bin --xargs outputDataDir=../Unity/Assets//Bundles/Config --xargs outputCodeDir=../Unity/Assets//Hotfix/Config/Generate --xargs tableImporter.name=gameframex -x l10n.provider=gameframex -x l10n.textFile.keyFieldName=key -x l10n.textFile.path=./Excels/Local/ --conf ./Luban.conf
pause
================================================
FILE: Config/gen-client-json.bat
================================================
dotnet.exe ./Tools/Luban.dll --target client --dataTarget json --codeTarget cs-simple-json --xargs outputDataDir=../Unity/Assets//Bundles/Config --xargs outputCodeDir=../Unity/Assets//Hotfix/Config/Generate --xargs tableImporter.name=gameframex -x l10n.provider=gameframex -x l10n.textFile.keyFieldName=key -x l10n.textFile.path=./Excels/Local/ --conf ./Luban.conf
pause
================================================
FILE: Config/gen-client-json.sh
================================================
dotnet ./Tools/Luban.dll --target client --dataTarget json --codeTarget cs-simple-json --xargs outputDataDir=../Unity/Assets//Bundles/Config --xargs outputCodeDir=../Unity/Assets//Hotfix/Config/Generate --xargs tableImporter.name=gameframex -x l10n.provider=gameframex -x l10n.textFile.keyFieldName=key -x l10n.textFile.path=./Excels/Local/ --conf ./Luban.conf
pause
================================================
FILE: Config/gen-server-bin.bat
================================================
dotnet.exe ./Tools/Luban.dll --target server --dataTarget bin --codeTarget cs-dotnet-bin --xargs outputDataDir=../Server/GameFrameX.Config/Json --xargs tableImporter.name=gameframex --xargs outputCodeDir=../Server/GameFrameX.Config/Config --conf ./Luban.conf
pause
================================================
FILE: Config/gen-server-bin.sh
================================================
dotnet ./Tools/Luban.dll --target server --dataTarget bin --codeTarget cs-dotnet-bin --xargs outputDataDir=../Server/GameFrameX.Config/Json --xargs tableImporter.name=gameframex --xargs outputCodeDir=../Server/GameFrameX.Config/Config --conf ./Luban.conf
pause
================================================
FILE: Config/gen-server-json.bat
================================================
dotnet.exe ./Tools/Luban.dll --target server --dataTarget json --codeTarget cs-dotnet-json --xargs outputDataDir=../Server/GameFrameX.Config/Json --xargs tableImporter.name=gameframex --xargs outputCodeDir=../Server/GameFrameX.Config/Config --conf ./Luban.conf
pause
================================================
FILE: Config/gen-server-json.sh
================================================
dotnet ./Tools/Luban.dll --target server --dataTarget json --codeTarget cs-dotnet-json --xargs outputDataDir=../Server/GameFrameX.Config/Json --xargs tableImporter.name=gameframex --xargs outputCodeDir=../Server/GameFrameX.Config/Config --conf ./Luban.conf
pause
================================================
FILE: Config/luban.conf
================================================
{
"groups": [
{
"names": [
"c"
],
"default": true
},
{
"names": [
"s"
],
"default": true
}
],
"schemaFiles": [
{
"fileName": "Defines",
"type": ""
},
{
"fileName": "Excels/__tables__.xlsx",
"type": "table"
},
{
"fileName": "Excels/__beans__.xlsx",
"type": "bean"
},
{
"fileName": "Excels/__enums__.xlsx",
"type": "enum"
}
],
"dataDir": "Excels",
"targets": [
{
"name": "server",
"manager": "TablesComponent",
"groups": [
"s"
],
"topModule": "GameFrameX.Config"
},
{
"name": "client",
"manager": "TablesComponent",
"groups": [
"c"
],
"topModule": "Hotfix.Config"
},
{
"name": "all",
"manager": "Tables",
"groups": [
"c",
"s"
],
"topModule": "cfg"
}
],
"description": "描述备注: toolPath: LuBan 工具目录, UNITY_ASSETS_PATH: Unity Assets 全路径, SERVER_PATH: 服务器全目录, commands: 需要执行的命令列表",
"toolPath": "/../Config/Tools/Luban.dll",
"UNITY_ASSETS_PATH": "",
"SERVER_PATH": "",
"commands": [
{
"command": "--target server --dataTarget json --codeTarget cs-dotnet-json --xargs outputDataDir=%SERVER_PATH%/Server.Config/Json --xargs outputCodeDir=%SERVER_PATH%/Server.Config/Config",
"target": "server",
"active": true
},
{
"localizationFileName": "Localization.xlsx",
"command": "--target client --dataTarget json --codeTarget cs-simple-json --xargs outputDataDir=%UNITY_ASSETS_PATH%/Bundles/Config --xargs outputCodeDir=%UNITY_ASSETS_PATH%/Hotfix/Config/Generate ",
"target": "client",
"active": true
},
{
"command": "--target server --dataTarget bin --codeTarget cs-bin --validationFailAsError true --xargs outputDataDir=%SERVER_PATH%/Server.Config/Json --xargs outputCodeDir=%SERVER_PATH%/Server.Config/Config",
"target": "server",
"active": false
},
{
"localizationFileName": "Localization.xlsx",
"command": "--target client --dataTarget bin --codeTarget cs-bin --validationFailAsError true --xargs outputDataDir=%UNITY_ASSETS_PATH%/Bundles/Config --xargs outputCodeDir=%UNITY_ASSETS_PATH%/Hotfix/Config/Generate",
"target": "client",
"active": false
},
{
"command": "luban",
"target": "all",
"active": false
}
]
}
================================================
FILE: Docs/1.Actor模型.md
================================================
## Actor模型 ##
actor模型是什么可以自行查阅一下相关资料;actor模型在一定程度可以说是解决并发的最佳方案。
GeekServer的actor可以简单理解为一个线程(其实用的是线程池),一个actor的逻辑只需保证在自己的队列里面执行即保证可线程安全,无需关心锁的问题。GeekServer的基础就是actor,一切皆可为actor。GeekServer的actor模型构建于强大的TPL DataFlow之上,底层使用内置线程池。GeekServer同时使用异步变成(async/await),让逻辑代码更加清晰明了,符合人类的思维方式。
## Actor死锁 ##
Actor模型本身是存在死锁的情况,且不容易被发现。GeekServer内部可检测环路死锁(即:A->B->C->A),并采用调用链重入机制消除环路死锁(类似与线程的可重入性)。
还有另外一种情况(多路死锁),比如有2个actor,A和B,一段逻辑A调用B,同时有另外一段逻辑发起了B调用A,就会出现A等B,B再等A,此时发生死锁。同理 [A->B->C,C->D->A] [A->B->C,B->C->A],这样的调用路径都可能会存在死锁。
这种死锁无法解决,而且不确定,因为它和调用时间节点有关系,只能从设计上去规避。
```csharp
class ActorA
{
Task A1()
{
await Task.Delay(10);
var b = GetActorB();
return b.SendAsync(b.B1);
}
Task A2()
{
var b = GetActorB();
return b.SendAsync(b.B1);
}
}
class ActorB
{
Task B1()
{
await Task.Delay(5);
var a = GetActorA();
return a.SendAsync(a.A2);
}
}
Task Call()
{
var a = GetActorA();
return a.SendAsync(a.A1);//这里就会触发死锁
}
```
如果得到打印日志【执行超时】很有可能就是触发了死锁。由于Actor设定了超时时间,在断点调试的时候需要手动将超时时间改长,默认10秒,在BaseActor.TIME_OUT修改。**(或者用一个Debug模式的宏来控制)**
## 多路死锁解决方案 ##
由以上的分析可以看出,多路死锁其实是由于**Await**引起的,如果所有调用都不Await则永远不会有死锁。
这里为大家罗列了几种解决方案:(在GeekServer中可以通过ActorLimit来定制自己的检测规则)
1. **跨Actor调用,不能Await**
优点:规则简单,统一,绝对不会发生死锁
缺点:失去了异步语法的优势,所有需要跨Actor获取返回值的,只能使用回调,代码结构散乱,书写代码不方便。
2. **为Actor分配等级,只允许低等级await调用高等级(如:Role->Server 而Server不能等待调用Role, 推荐使用此方案)**
案例:公民可以去政府部门排队等待办理业务员,但是政府部门不可能去等待某个人去处理完自己的私事,再帮下一个人办理业务,顶多发短信或者打电话通知某个人做什么事情。
在方案1的基础上,给了使用者更多的异步调用空间。
3. **提供一个注册接口,注册哪些Actor可以Await调用哪些Actor,并在注册时候进行检测看是否可能存在死锁**
这是方案2的一个更加灵活的变种。
4. **允许交错执行** [了解更多](https://blog.csdn.net/uddiqpl/article/details/86294520)
如果你的某个组件不会操作数据或者对操作顺序不敏感,交错执行是很有用的。GeekServer中的FuncComponent比较符合这个特点,但不绝对,仍需要开发人员自行判断。 (Orleans中有此方案)
5. **允许存在多路死锁的风险,由开发人员保证不会触发死锁**
优点:规则简单,统一,书写代码很方便,全程异步。
缺点:有可能发生死锁,对编码人员能力要求较高
6. **超时规则**
如果发生多路死锁,选择一条调用路径并终止,保证其中一条调用路径正确。(Orleans中有此方案)
优缺点和方案5一样。
7. **使用线程安全容器以及lock等**
但这与无锁化设计的理念冲突
================================================
FILE: Docs/2.Actor&Component&State.md
================================================
# Entity和Component和State
GeekServer的Entity包含1个/多个Component,Component包含0个/1个State,你可以这样理解:Entity=实体,Component=功能系统,State=功能系统的数据。每个Entity都包含一个Actor成员变量,Entity的所有行为调度都有Actor完成,以保证线程安全。
Entity是GeekServer的基础,一切功能都可以作为单独的Entity(比如一个角色,一个公会,一个玩法系统。。。),Component隶属于Entity,State隶属于Component,Component承载各种逻辑,State承载各种数据。Entity拆分方式根据项目的具体需求可以任意规划。
### Entity(Actor)拆分
1. 尽可能独立(一个系统或者玩家的操作尽量不阻塞其他玩家的操作)
2. 在独立的前提下尽可能少(节约管理成本)
3. 一个角色,包含若干个功能系统(背包,宠物,任务。。。)
4. 一个公会,包含多个公会基础系统(基础信息,捐赠,工会副本。。。)
比如有2个全局玩法,世界boss和工会战,如果这2个系统归于一个Actor,那么当一个玩家挑战世界boss时,挑战逻辑到Actor线程中执行,此时另一个玩家要去报名工会战,报名逻辑也需要到Actor线程中执行,此时报名公会战的逻辑则需要等待前一个玩家挑战世界boss逻辑完成后才能执行,客户端表现可能就是更长时间的网络连接中,在cpu够用的情况下就产生了多余的等待时间,这就有些不合理了;这种功能之间没有任何交集的情况下我们建议将世界boss和工会战分别拆分为Actor,各自的逻辑便可以更加顺畅的执行,客户端等待的时间也越短。
### State(对象数据库)
GeekServer支持内嵌模式和MongoDB直连模式,其中内嵌数据库目前为Facebook的RocksDB,读写性能都相当强悍。 可以通过app_config.json中 "DBModel"(0:内嵌 1:mongodb)来指定,默认是使用的内嵌模式。
1.单服结构,**强烈推荐使用内嵌模式**,内嵌数据库没有任何读写压力,数据就在本地磁盘,不受网络因素影响。同时由Geek.Server.RemoteBackup进程来异步远程备份,保证数据的安全。
2.Geek.Server.RemoteBackup 启动后会定期扫描,数据库根目录下的数据库文件,异步同步到远程mongodb。由于此进程和游戏逻辑没有仍和关联,所以此进程是可以随时重启的,即便进程崩溃也不会丢失数据,极大的提高了容错性。
3.不管哪种模式,数据库中存放的数据都是经过Messagepack序列化之后的二进制数据,需要使用Tools/GeekDB.GUI来浏览数据
GeekDB.GUI

================================================
FILE: Docs/Actor入队.md
================================================
## Actor入队透明 ##
GeekServer编译期间会自动注入入队代码(**AgentWeaver**), 开发人员无需入队逻辑, 只需要像调用普通函数一样书写逻辑。
```c#
//编译期间会注入一个继承自xxxCompAgent的wrapper类,来实现自动入队
//同时SendAsync内部自动处理了线程上下文,开发者只需要像调用普通函数一样书写逻辑
public class ServerCompAgentWrapper : ServerCompAgent
{
public override Task CheckCrossDay()
{
return base.Actor.SendAsync((Func)base.CheckCrossDay, isAwait: false, 10000);
}
public override Task GetDaysFromOpenServer()
{
return base.Actor.SendAsync((Func>)base.GetDaysFromOpenServer, isAwait: true, 10000);
}
}
var serverComp = await EntityMgr.GetCompAgent(ActorType.Server);
//使用方式(就像调用普通函数一样,无需关心多线程或入队)
_ = serverComp.CheckCrossDay();
```
## 线程上下文 ##
GeekServer内部会自动处理线程上下文,由RuntimeContext实现,主要用于环路调用检测,以及判断是否需要入队,其内部使用**AsyncLocal**实现
```c#
internal class RuntimeContext
{
internal static long Current => callCtx.Value;
internal static AsyncLocal callCtx = new AsyncLocal();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void SetContext(long callChainId)
{
callCtx.Value = callChainId;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void ResetContext()
{
callCtx.Value = 0;
}
}
```
================================================
FILE: Docs/事件Event-timer.md
================================================
# 事件
GeekServer根据热更新设计方案,事件采用接口方式进行监听和回调。监听或者回调事件方法,自定义类型继承EventListener,实现InitListener初始化监听,实现HandleEvent进行回调处理。需要注意的是,EventListener的泛型参数需要是添加事件的Entity对应的Agent,否则会出现类型转换失败。
```csharp
class RoleEH : EventListener
{
protected override async Task HandleEvent(RoleCompAgent agent, Event evt)
{
switch (evt.EventId)
{
case (int)EventID.OnDisconnected:
await agent.OnDisconnected();
break;
case (int)EventID.OnMsgReceived:
await agent.OnMsgReceived();
break;
}
}
public override Task InitListener(long entityId)
{
GED.AddListener(entityId, EventID.OnDisconnected);
GED.AddListener(entityId, EventID.OnMsgReceived);
return Task.CompletedTask;
}
}
```
# Timer或Schedule
```csharp
public override async Task Active()
{
await base.Active();
this.Schedule(ServerComp.CrossDayHour, 0);
}
class CorssDayTimerHandler : TimerHandler
{
protected override async Task HandleTimer(ServerCompAgent agent, Param param)
{
//排除时间精度问题,Quartz可能产生1,2毫秒误差
await Task.Delay(100);
_ = agent.CheckCrossDay();
}
}
```
================================================
FILE: Docs/关于协议.md
================================================
# GeekProto
### 特点
基于MessagePack,序列化和反序列化效率极高,同时序列化之后的数据极小,数据传输效率很高。[MessagePack-CSharp](https://github.com/neuecc/MessagePack-CSharp) 【Super Fast Binary Serialization Library】
### 定义方式
```csharp
///
/// 请求登录
///
[MessagePackObject(true)]
public class ReqLogin : Message
{
public string UserName { get; set; }
public string Platform { get; set; }
public int SdkType { get; set; }
public string SdkToken { get; set; }
public string Device { get; set; }
}
```
1.Geek.MsgPackTool为每个可序列化类自动分配唯一ID(FullName的hashcode),如果存在hash冲突(概率很小),工具会提示你进行修改类名。
2.MessagePackObject注解,所有需要序列化的类都要标记,为了更好的兼容性和便捷性messagepack使用map模式,即MessagePackObject(true)
3.仅作为消息头的类需要继承自Message,其他不用
4.**请勿将协议中的类,存入State中(为支持协议的热更新)**
### 限制
兼容限制:不能修改字段类型(如从bool改为long)
[了解更多 MessagePack-CSharp](https://github.com/neuecc/MessagePack-CSharp)
### 多态支持
MessagePack对多态支持不友好,Geek.MessagePackTool工具会在代码生成时,生成多态绑定关系来解决此问题!
```csharp
public partial class PolymorphicRegister
{
static PolymorphicRegister()
{
System.Console.WriteLine("***PolymorphicRegister Init***");
Init();
Register();
}
public static void Register()
{
settings.RegisterType(112001);
settings.RegisterType(112002);
settings.RegisterType(112003);
settings.RegisterType(112004);
settings.RegisterType(112005);
settings.RegisterType(111112);
settings.RegisterType(111001);
settings.RegisterType(111002);
settings.RegisterType(111003);
settings.RegisterType(111004);
settings.RegisterType(111005);
}
}
```
### 最佳实践
1.可以将Geek.MessagePackTool.exe添加到vs studio的外部工具


2.Geek.MessagePackTool工作时仅需要依赖GeekServer.Proto工程,所以其他工程编译不过时,不影响导出协议
================================================
FILE: Docs/十分钟.md
================================================
# 十分钟上手GeekServer
# 运行
1. 安装[.NetCore6.0](https://dotnet.microsoft.com/download/dotnet/6.0)
2. 安装[mongodb4.x](https://www.mongodb.com/try/download/community)
3. 打开git clone本项目https://github.com/leeveel/GeekServer.git
4. 运行Tools/ExcelGen/ExcelToCode.exe 点击[服务器-ALL]导出配置表
5. 用VisualStudio2022打开GeekServer.sln 启动GeekServer.App
6. 启动GeekServer.TestPressure (一个1000人登录的demo)
7. 打开UnityDemo工程,打开SampleScene,运行查看日志(**检查Main Camera上是否有脚本丢失,如果有请挂载GameMain.cs**)
## 如何添加新功能
### 1.规划线程模型
以demo为例,demo中有两个Actor(可以理解为逻辑上的线程),一个是Server,另外一个是Role,Server线程是全局的一个服务器只会存在一个,而Role则是一个玩家一个线程。在demo中Server线程负责了登录以及世界等级相关逻辑(实际开发中规划一个LoginActor比较合理),于是为Server注册了LoginComp和ServerComp两个组件。对于Role来说,一个玩家会存在很多功能系统,如角色模块,背包模块,宠物模块,所有为Role注册RoleComp,BagComp,PetComp。
**也就是说一个功能系统的逻辑是运行在哪个线程上,取决于你把这个功能系统的组件注册在哪个Actor上。**
### 2.如何为Actor注册组件
通过Comp注解为Actor注册组件
[Comp(ActorType.Role)]
public class BagComp : StateComp
### 3.如何绑定组件状态(数据)
一个功能系统由两部分组成,1是逻辑代码(xxxCompAgent),2是数据(xxxState),为了实现逻辑代码的热更新,GeekServer使用了代理的方式将逻辑与数据分离。以下代码展示组件和数据的绑定方式:
[Comp(ActorType.Role)]
public class BagComp : StateComp
public class BagCompAgent : StateCompAgent
### 4.如何监听事件
请参见Geek.Server.Role.PetCompAgent
### 5.如何添加定时器
请参见Server.Logic.Logic.ServerCompAgent
### 6.为需给外部提供服务的接口添加[Api]注解
请参见Server.Logic.Logic.ServerCompAgent.GetWorldLevel()接口,此接口是获取服务器世界等级,由于这个接口会对外部提供服务,即其他Actor都有可能访它,所以需要添加[Api]注解
## 方法注解
**[Api]**:代表此接口需要被其他Actor调用
**[Discard]**:代表在调用此接口的时候,会使用弃元运算符(_ = DoSomething()),**因为弃元运算符会导致执行此异步函数逻辑的线程不可确定,所以GeekServer对标记了[Discard]注解的处理方式是,强制插入队列末端执行。**
**[ThreadSafe]**:代表此接口是线程安全的,不是必须的,而且应该尽量少用(1.让逻辑开发人员尽量少关注多线程 2.如果标注的接口逻辑很复杂,再代码多次迭代之后,很容易误判)
**[TimeOut(30000)]**:可以自定义接口的超时时间
具体代码请参见Server.Logic.Logic.ServerCompAgent
## 关于Message.Unid
在demo中可以看到客户端的ReqXXX消息,在服务器回包当中,都带上了ReqXXX传过来的Unid。demo中这个设计为了解决自动处理客户端(发送消息->锁屏->收到回包->解锁屏)的逻辑。**如果你有自己的方案或者不需要此设计忽略它**。
### 至此已经足够你基于GeekServer开发自己的游戏功能
================================================
FILE: Docs/定时器&计划任务Timer.md
================================================
# 定时器&计划任务
GeekServer中没有使用传统意义中的Update,除MMO项目,其他大部分游戏类型的服务器基本没有必要使用Update,需要Update的模块添加一个Timer也可以实现
根据热更新设计方案,定时器和计划任务采用接口方式进行回调,任务使用扩展方法实现,[源码参考](https://github.com/leeveel/GeekServer/tree/master/GeekServer.Hotfix/Logic/Common/TimerExt.cs)
定时器支持:1次性delay,周期性timer。
计划任务:指定时间1次性任务,每天任务,每周任务,每周几任务,每月任务。
GeekServer中没有对定时器&计划任务做持久化,所以你可能需要在开服后、玩家上线或者Component激活时考虑一下计划任务逻辑是否需要被处理了。
回调函数继承TimerHandler<>,重写HandleTimer,里面处理定时器回调逻辑即可。
需要注意的是定时器是接入的Quartz,由于硬件精度问题(windows时间实际精度为10毫秒左右),回调时间可能会提前1-2毫秒,如果对时间依赖特别大的可能需要特殊处理下,比如在Timer回调后延时50毫秒再执行回调逻辑。
================================================
FILE: Docs/最后补充.md
================================================
# 补充
### server_config.json配置
server_config.json中的配置在[Settings](https://github.com/leeveel/GeekServer/tree/master/GeekServer.Core/Utils/Settings.cs) 中解析,每个字段的作用参考[Settings](https://github.com/leeveel/GeekServer/tree/master/GeekServer.Core/Utils/Settings.cs)注释
### 唯一Id生成
GeekServer提供的[IdGenerator](https://github.com/leeveel/GeekServer/tree/master/GeekServer.Core/Utils/IdGenerator.cs) 可用于全局id生成,比如roleId,公会id等;给定服务器id,保证全局唯一(30年内)。GeekServer为serverId预留了16位,即0-65535有效,我们推荐serverId从10000起。
### 日志
GeekServer使用NLog采集日志,采集方式包含控制台和文件。由于控制台占用IO,会占用大量资源,只在debug模式下输出。特殊的,LOOGER.DEBUG()只会在debug模式下打印在控制台,不会采集到日志文件。
### 温馨提示
1. 服务器区别于客户端,服务器在非重大问题的情况下,是不能直接退出的,更不能出现闪退。GeekServer做了异常处理,在监听到没处理的异常时会自动走关服流程(actor回收,回存数据。。。)。理论上开发者应该确保所有的逻辑异常都能被try/catch到,然后视情况判断是丢弃异常还是关服。
================================================
FILE: Docs/热更hotfix.md
================================================
# 热更新
GeekServer支持不停服热更新逻辑。
#### 热更思路
游戏中的所有状态放在App工程中,始终存在于内存,不能热更。Actor和Component的逻辑使用代理模式(Agent)放到Hotfix工程。热更时载入新的dll(GeekServer.Hotfix.dll),清除所有老的Agent,所有新逻辑重新从Actor/Component获取新的Agent汇入新dll中执行热更后的逻辑,达到热更目的。正在执行老dll逻辑的代码获取的Agent依然来自热更前的老Dll中,等待老dll中的逻辑执行完后清理掉内存中老的dll。底层使用接口驱动热更dll中的逻辑。
需要注意的是,热更时新的dll需要放在新的目录下面,然后再载入内存,因为老的dll可能正在运行,是无法直接覆盖的。参考代码[HotfixModule.Load](https://github.com/leeveel/GeekServer/tree/master/GeekServer.Core/Hotfix/HotfixModule.cs)
#### 可以热更部分
可以热更的逻辑都应该放在GeekServer.Hotfix工程中
1. 所有Actor/Component的Agent,Agent中只有逻辑没有状态,状态全部放到Component的State
2. HttpHandler
3. TcpHandler
4. 协议
5. 配置表/配置表代码
#### 热更新流程
1. 游戏后台将新的GeekServer.Hotfix.dll及相关文件(对应pdb,json等)拷贝到游戏服特定目录下
2. 游戏后台向游戏服发送http命令,通知进行热更,并告知dll目录,md5等信息
3. 游戏服中热更HttpHandler根据后台信息,验证热更dll完整性,合法性,修改dllVersion.txt,发起热更调用
================================================
FILE: Docs/网络Net(tcp&http).md
================================================
# 网络
GeekServer网络层使用kestrel,GeekServer目前只接入了tcp和http,但是kestrel是支持UDP,websocket,Http123,singalr等几乎所有的常见协议的,如有所需请自行接入(工作量很小)。
### donetty vs kestrel


### http
创建任意脚本名字Handler,继承BaseHttpHandler,使用HttpMsgMapping标记指令,实现Action函数即可使用。Action中调用或者实现对应指令的逻辑,并返回结果给客户端。此外httpHandler还有2个字段可以重写标示是否验证,CheckSign是否验证,Inner是否使用内部验证方式。GeekServer支持post和get方式访问。
###### 特殊key不要占用
1. cmd:指令,自己定义的任意字符串
2. time:用于安全验证,当前utc时间tick(DateTime.UtcNow.Ticks),同时也做时间校验,客户端时间需要和服务器时间基本一致(超前/延后10秒左右)
3. sign:用于安全验证,安全验证算法后的结果
###### 安全验证算法
验证算法见[BaseHttpHandler](https://github.com/leeveel/GeekServer/tree/master/GeekServer.Core/Net/Http/BaseHttpHandler.cs) GetStringSign函数
sign = 算法函数(code + time),其中sign和time在客户端发送到服务器的参数里面,code是[server_config.json](https://github.com/leeveel/GeekServer/tree/master/GeekServer.App/Config/server_config.json) 中配置的HttpCode(非inner验证)/HttpInnerCode(inner验证)
注意,上线的商业项目记得修改HttpCode和HttpInnerCode,否则可能被他人利用。
一般的,非Inner验证用于提供给第3放使用(运营/sdk。。。),Inner验证用于内部游戏后台(发邮件,封号。。。)
```csharp
//在浏览器中访问地址即可验证:http://localhost:20000/geek/server/logic?cmd=test
//带安全验证的url:http://localhost:20000/geek/server/logic?cmd=test&time=637574338045380003&sign=ad762402fc9c5275bbb68464cf30aac888
[HttpMsgMapping("test")] //指令为test
public class TestHttpHandler : BaseHttpHandler
{
//不使用内部验证算法
public override bool Inner => false;
//是否验证参数,debug模式下始终不验证(debug模式在server_config.json中修改)
public override bool CheckSign => false;
public override Task Action(string ip, string url, Dictionary paramMap)
{
return Task.FromResult((string)HttpResult.Success);
}
}
```
### tcp
GeekServer的tcp协议为自定义协议,区别于google的protocolBuffer和flatBuffer,但是序列化和反序列化都要优于2者。
###### tcp使用步骤
1. [协议工具目录](https://github.com/leeveel/GeekServer/tree/master/Tools/GeekProto)
2. 运行Geek.Proto.exe生成协议导
3. 创建任意脚本名字Handler,继承FixedIdEntityHandler/TcpCompHandler,使用MsgMapping标记消息类型,实现ActionAsync函数即可。BaseTcpHandler中的Msg即为解析好的当前类型协议数据
```csharp
[MsgMapping(typeof(ReqBagInfo))]
public class ReqBagInfoHandler : TcpCompHandler
{
public override Task ActionAsync()
{
var req = (ReqBagInfo)Msg;
//your logic here...
return Task.CompletedTask;
}
}
```
###### [GeekProto协议](https://github.com/leeveel/GeekServer/blob/main/Docs/%E5%85%B3%E4%BA%8E%E5%8D%8F%E8%AE%AE.md)
================================================
FILE: FairyGUIProject/Game.fairy
================================================
================================================
FILE: FairyGUIProject/assets/UIBag/UIBag.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIBag/UIBagContent.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIBag/UIBagItemInfo.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIBag/package.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIBag/组件/UIBagItem.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIBag/组件/UIBagTypeItem.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/package.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/字体/RedNumberFont.fnt
================================================
char id=46 img=flr4u xoffset=0 yoffset=0 xadvance=0
char id=48 img=flr4o xoffset=0 yoffset=0 xadvance=0
char id=49 img=flr4v xoffset=0 yoffset=0 xadvance=0
char id=50 img=flr4w xoffset=0 yoffset=0 xadvance=0
char id=51 img=flr4x xoffset=0 yoffset=0 xadvance=0
char id=52 img=flr4n xoffset=0 yoffset=0 xadvance=0
char id=53 img=flr4s xoffset=0 yoffset=0 xadvance=0
char id=54 img=flr4r xoffset=0 yoffset=0 xadvance=0
char id=55 img=flr4q xoffset=0 yoffset=0 xadvance=0
char id=56 img=flr4t xoffset=0 yoffset=0 xadvance=0
char id=57 img=flr4p xoffset=0 yoffset=0 xadvance=0
================================================
FILE: FairyGUIProject/assets/UICommon/字体/YellowNumberFont.fnt
================================================
info size=24 resizable=true colored=false
char id=46 img=flr418 xoffset=0 yoffset=0 xadvance=0
char id=48 img=flr413 xoffset=0 yoffset=0 xadvance=0
char id=49 img=flr4z xoffset=0 yoffset=0 xadvance=0
char id=50 img=flr416 xoffset=0 yoffset=0 xadvance=0
char id=51 img=flr417 xoffset=0 yoffset=0 xadvance=0
char id=52 img=flr4y xoffset=0 yoffset=0 xadvance=0
char id=53 img=flr414 xoffset=0 yoffset=0 xadvance=0
char id=54 img=flr412 xoffset=0 yoffset=0 xadvance=0
char id=55 img=flr411 xoffset=0 yoffset=0 xadvance=0
char id=56 img=flr415 xoffset=0 yoffset=0 xadvance=0
char id=57 img=flr410 xoffset=0 yoffset=0 xadvance=0
================================================
FILE: FairyGUIProject/assets/UICommon/组件/Dialog/UIDialogMessageBox.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/Dialog/UIDialogWithoutButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/Goods/UIGoodItem.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/UIYellowProgresssBar.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIBackButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIBlueCheckButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIBlueNormalButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIBlueSingleButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UICloseButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIWhiteCheckButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIWhiteNormalButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIWhiteSingleButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIYellowCheckButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIYellowNormalButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/UIYellowSingleButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommon/组件/button/switch_btn.xml
================================================
================================================
FILE: FairyGUIProject/assets/UICommonAvatar/package.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILauncher/Scene/UILauncher.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILauncher/Scene/UILauncherUpgrade.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILauncher/Scene/UILauncherUpgradeContent.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILauncher/Widget/UILauncherEnterButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILauncher/Widget/UILoadingMainProgressBar.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILauncher/package.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILoading/Scene/UILoadingScene.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILoading/Widget/UILoadingCenterBox.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILoading/package.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/Scene/UIAnnouncement.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/Scene/UIAnnouncementContent.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/Scene/UILogin.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/Scene/UIPlayerCreate.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/Scene/UIPlayerList.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/Scene/UIPlayerListItem.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/Scene/UIPlayerListItemLoginButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/Widget/UILoginButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UILogin/package.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIMain/BagButton.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIMain/UIMain.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIMain/package.xml
================================================
================================================
FILE: FairyGUIProject/assets/UIPlayer/package.xml
================================================
================================================
FILE: FairyGUIProject/plugins/gencode/GenCode_CSharp.lua
================================================
local CreateTemplate = [[
private static GObject CreateGObject()
{
return UIPackage.CreateObject(UIPackageName, UIResName);
}
private static void CreateGObjectAsync(UIPackage.CreateObjectCallback result)
{
UIPackage.CreateObjectAsync(UIPackageName, UIResName, result);
}
public static {className} CreateInstance()
{
return Create(CreateGObject());
}
public static UniTask<{className}> CreateInstanceAsync(Entity domain)
{
UniTaskCompletionSource<{className}> tcs = new UniTaskCompletionSource<{className}>();
CreateGObjectAsync((go) =>
{
tcs.TrySetResult(Create(go));
});
return tcs.Task;
}
]]
---@type string UI代码模板
local FUITemplate = [[
#if ENABLE_UI_FAIRYGUI
using FairyGUI;
using Cysharp.Threading.Tasks;
using FairyGUI.Utils;
using GameFrameX.Entity.Runtime;
using GameFrameX.UI.Runtime;
using GameFrameX.UI.FairyGUI.Runtime;
using GameFrameX.Runtime;
using UnityEngine;
namespace {namespaceName}
{
public sealed partial class {className} : FUI
{
public const string UIPackageName = "{codePkgName}";
public const string UIResName = "{resName}";
public const string URL = "{URL}";
///
/// {uiResName}的组件类型(GComponent、GButton、GProcessBar等),它们都是GObject的子类。
///
public {superClassName} self { get; private set; }
__PROPERTY__
__CREATETEMPLATE__
public static {className} Create(GObject go)
{
var fui = go.displayObject.gameObject.GetOrAddComponent<{className}>();
fui?.SetGObject(go);
fui?.InitView();
return fui;
}
///
/// 通过此方法获取的FUI,在Dispose时不会释放GObject,需要自行管理(一般在配合FGUI的Pool机制时使用)。
///
public static {className} GetFormPool(GObject go)
{
var fui = go.Get<{className}>();
if (fui == null)
{
fui = Create(go);
}
fui.IsFromPool = true;
return fui;
}
protected override void InitView()
{
if(GObject == null)
{
return;
}
self = ({superClassName})GObject;
self.Add(this);
{comAdd}
var com = GObject.asCom;
if (com != null)
{
__AWAKE__
}
}
public override void Dispose()
{
if (IsDisposed)
{
return;
}
base.Dispose();
self.Remove();
__DISPOSE__
self = null;
}
private {className}(GObject gObject) : base(gObject)
{
// Awake(gObject);
}
}
}
#endif]]
---@type string UI包资源模板
local FUIPackageTemplate = [[
#if ENABLE_UI_FAIRYGUI
namespace {namespaceName}
{
public static partial class FUIPackage
{
__PKGNAMES__
}
}
#endif]]
--- 将输入字符串按指定分隔符分割成数组
---@param input: 输入的字符串
---@param delimiter: 分隔符
local function split(input, delimiter)
-- 检查分隔符是否为字符串且长度大于0
if type(delimiter) ~= "string" or #delimiter <= 0 then
return -- 如果不是,返回空
end
local start = 1 -- 定义起始位置
local arr = {} -- 创建空数组
while true do -- 进入循环
local pos = string.find(input, delimiter, start, true) -- 查找分隔符位置
if not pos then -- 如果没有找到
break -- 退出循环
end
table.insert(arr, string.sub(input, start, pos - 1)) -- 将分隔符之前的部分插入数组
start = pos + string.len(delimiter) -- 更新起始位置
end
table.insert(arr, string.sub(input, start)) -- 插入剩余部分到数组
return arr -- 返回数组
end
--- 判断是否为自定义组件
--- @param classes table 包含类信息的表
--- @param typeName string 待检查的类型名称
--- @return boolean 如果是自定义组件则返回true,否则返回false
local function IsCustomComponent(classes, typeName)
local classCnt = classes.Count; -- 获取类的数量
for i = 0, classCnt - 1 do -- 遍历类表
local classInfo = classes[i] -- 获取当前类信息
if typeName == classInfo.className then -- 检查类型名称是否匹配
return true; -- 如果匹配则返回true
end
end
return false; -- 类型名称未匹配则返回false
end
--- 生成代码
--- @param handler table 处理程序
local function genCode(handler)
local settings = handler.project:GetSettings("Publish").codeGeneration -- 获取发布设置中的代码生成选项
local codePkgName = handler:ToFilename(handler.pkg.name); -- 将包名转换为文件名格式(拼音),去除特殊字符等
---@type string
local exportCodePath = handler.exportCodePath; -- 导出代码路径
-- 规范化路径
exportCodePath = string.gsub(exportCodePath, '\\', '/') -- 将路径中的反斜杠替换为斜杠
-- UI组件
local exportCodeComponentPath = handler.exportCodePath .. '/' .. codePkgName .. '/Components'; -- 导出代码的组件路径
handler:SetupCodeFolder(exportCodeComponentPath, "cs") -- 设置代码文件夹
local namespaceName = codePkgName -- 命名空间名称
if settings.packageName ~= nil and settings.packageName ~= '' then
namespaceName = settings.packageName .. '.' .. namespaceName; -- 如果设置中有包名,则使用设置中的包名
end
namespaceName = "Hotfix.UI"; -- 命名空间名称为"Hotfix.UI"
if string.find(exportCodePath, "Unity/Assets/Scripts") then
namespaceName = "Unity.Startup"; -- 如果导出路径包含"Unity/Assets/Scripts",则命名空间名称为"Unity.Startup"
end
-- CollectClasses(stripeMemeber, stripeClass, fguiNamespace)
local classes = handler:CollectClasses(settings.ignoreNoname, settings.ignoreNoname, nil) -- 收集类信息(忽略无名称的类)
-- 检查目标文件夹是否存在,并删除旧文件
local templeteString = FUITemplate; -- 模板字符串
local classCnt = classes.Count -- 类的数量
local writer = CodeWriter.new() -- 代码写入器
for i = 0, classCnt - 1 do
local classInfo = classes[i] -- 获取类信息
local members = classInfo.members -- 成员变量
local memberInfoExported = classInfo.res.exported; -- 成员信息是否导出
writer:reset() -- 重置写入器
local genCreateString = CreateTemplate; -- 生成创建字符串
local genCodeString = templeteString; -- 生成代码字符串
--- 处理导出的差异
if memberInfoExported then
genCodeString = string.gsub(genCodeString, '__CREATETEMPLATE__', genCreateString) -- 如果成员信息导出,则替换模板字符串中的__CREATETEMPLATE__
else
genCodeString = string.gsub(genCodeString, '__CREATETEMPLATE__', '') -- 否则移除__CREATETEMPLATE__
end
genCodeString = string.gsub(genCodeString, '{namespaceName}', namespaceName) -- 替换命名空间名称
genCodeString = string.gsub(genCodeString, '{className}', classInfo.className) -- 替换类名
genCodeString = string.gsub(genCodeString, '{superClassName}', classInfo.superClassName) -- 替换父类名
genCodeString = string.gsub(genCodeString, '{codePkgName}', handler.pkg.name) -- 替换包名
genCodeString = string.gsub(genCodeString, '{resName}', classInfo.resName) -- 替换资源名
genCodeString = string.gsub(genCodeString, '{URL}', 'ui://' .. handler.pkg.id .. classInfo.resId) -- 替换资源URL
local propertyStr = ""; -- 属性字符串
local propertyTable = {}; -- 属性表
local AwakeStr = ""; -- Awake字符串
local AwakeTable = {}; -- Awake表
local DisposeStr = ""; -- Dispose字符串
local disposeTable = {}; -- Dispose表
local memberCnt = members.Count -- 成员数量
for j = 0, memberCnt - 1 do
local memberInfo = members[j] -- 获取成员信息
local typeName = memberInfo.type -- 类型名称
local varName = memberInfo.varName -- 变量名
local memberInfoName = memberInfo.name; -- 成员信息名称
-- 这里查找组件是否是其他包里的资源
local isWhetherToCrossPackages = false; -- 是否跨包引用
if memberInfo.res ~= nil then
if memberInfo.res.owner.name ~= handler.pkg.name then -- 判断是不是本包的资源
local memberResName = memberInfo.res.name; -- 获取跨包的组件名称
if IsCustomComponent(classes, typeName) then -- 判断是不是自定义类型组件
typeName = memberResName; -- 替换类型名称为跨包的组件名称
end
isWhetherToCrossPackages = true;
end
end
table.insert(propertyTable, '\t\tpublic ' .. typeName .. ' ' .. varName .. ' { get; private set; }'); -- 插入属性表
if string.find(typeName, "Scene") then
table.insert(disposeTable, '\t\t\t' .. varName .. '.Dispose();'); -- 如果类型名称中包含"Scene",则插入Dispose表
end
table.insert(disposeTable, '\t\t\t' .. varName .. ' = null;'); -- 插入Dispose表
if memberInfo.group == 0 then
-- 判断是不是自定义类型组件 和跨包引用
if IsCustomComponent(classes, typeName) then
table.insert(AwakeTable, '\t\t\t\t' .. varName .. ' = ' .. typeName .. '.Create(com.GetChild("' ..
memberInfoName .. '"));'); -- 如果是自定义类型组件且是跨包引用,则插入Awake表
else
table.insert(AwakeTable, '\t\t\t\t' .. varName .. ' = (' .. typeName .. ')com.GetChild("' ..
memberInfoName .. '");'); -- 否则插入Awake表
end
elseif memberInfo.group == 1 then
table.insert(AwakeTable, '\t\t\t\t' .. varName .. ' = com.GetController("' .. memberInfoName .. '");'); -- 插入Awake表
else
table.insert(AwakeTable, '\t\t\t\t' .. varName .. ' = com.GetTransition("' .. memberInfoName .. '");'); -- 插入Awake表
end
end
propertyStr = table.concat(propertyTable, '\n') -- 属性字符串连接
DisposeStr = table.concat(disposeTable, '\n') -- Dispose字符串连接
AwakeStr = table.concat(AwakeTable, '\n') -- Awake字符串连接
genCodeString = string.gsub(genCodeString, '__PROPERTY__', propertyStr) -- 替换属性字符串
genCodeString = string.gsub(genCodeString, '__AWAKE__', AwakeStr) -- 替换Awake字符串
genCodeString = string.gsub(genCodeString, '__DISPOSE__', DisposeStr) -- 替换Dispose字符串
if string.find(namespaceName, ".Model") then
genCodeString = string.gsub(genCodeString, '{comB}', '/***') -- 替换字符串
genCodeString = string.gsub(genCodeString, '{comE}', '***/') -- 替换字符串
genCodeString = string.gsub(genCodeString, '{comAdd}', '') -- 替换字符串
-- genCodeString = string.gsub(genCodeString, '{comRemove}', '') -- 替换字符串
else
genCodeString = string.gsub(genCodeString, '{comB}', '') -- 替换字符串
genCodeString = string.gsub(genCodeString, '{comE}', '') -- 替换字符串
genCodeString = string.gsub(genCodeString, '{comAdd}', '') -- 替换字符串
-- genCodeString = string.gsub(genCodeString, '{comRemove}', '') -- 替换字符串
end
writer:writeln(genCodeString); -- 写入生成的代码字符串
writer:save(exportCodeComponentPath .. '/' .. classInfo.className .. '.cs'); -- 保存生成的代码文件
end
writer:reset() -- 重置写入器
local packageTempleteString = FUIPackageTemplate; -- 包模板字符串
local pkgNamesStr = ""; -- 包名字符串
local pkgNamesTable = {}; -- 包名表
packageTempleteString = string.gsub(packageTempleteString, '{namespaceName}', namespaceName) -- 替换命名空间名称
table.insert(pkgNamesTable, '\t\tpublic const string ' .. codePkgName .. ' = "' .. codePkgName .. '";'); -- 插入包名表
-- for i = 0, classCnt - 1 do
-- local classInfo = classes[i];
-- table.insert(pkgNamesTable,'\t\tpublic const string ' .. codePkgName .. '_' .. classInfo.resName .. ' = "ui://' .. codePkgName .. '/' .. classInfo.resName .. '";'); -- 插入包名表
-- end
pkgNamesStr = table.concat(pkgNamesTable, '\n'); -- 包名字符串连接
packageTempleteString = string.gsub(packageTempleteString, '__PKGNAMES__', pkgNamesStr) -- 替换包名字符串
local binderName = 'Package' .. codePkgName; -- 绑定器名称
writer:writeln(packageTempleteString); -- 写入包模板字符串
writer:save(exportCodeComponentPath .. '/' .. binderName .. '.cs'); -- 保存包绑定器文件
end
return genCode
================================================
FILE: FairyGUIProject/plugins/gencode/main.lua
================================================
--FYI: https://github.com/Tencent/xLua/blob/master/Assets/XLua/Doc/XLua_Tutorial_EN.md
local genCode = require(PluginPath .. '/GenCode_CSharp')
function onPublish(publishHandler)
fprint(' 导出前目录 ' .. publishHandler.exportPath)
publishHandler.exportPath = publishHandler.exportPath .. '/' .. publishHandler.pkg.name
local isExists = CS.System.IO.Directory.Exists(publishHandler.exportPath)
if not isExists then
CS.System.IO.Directory.CreateDirectory(publishHandler.exportPath)
end
fprint(' 导出后目录 ' .. publishHandler.exportPath)
if not publishHandler.genCode then
return
end
publishHandler.genCode = false --prevent default output
genCode(publishHandler)
end
function onDestroy()
-------do cleanup here-------
end
================================================
FILE: FairyGUIProject/plugins/gencode/package.json
================================================
{
"name": "gencode",
"displayName": "代码生成UI组件代码",
"description": "将标记为导出的组件和使用到的组件导出为C#代码,且自动绑定对象",
"version": "1.0",
"author": {
"name": "AlianBlank",
"url": "https://github.com/GameFrameX"
},
"icon": "logo.png",
"main": "main.lua"
}
================================================
FILE: FairyGUIProject/plugins/plugins.iml
================================================
================================================
FILE: FairyGUIProject/settings/Adaptation.json
================================================
{
"scaleMode": "ScaleWithScreenSize",
"screenMathMode": "MatchWidthOrHeight",
"designResolutionX": 1080,
"designResolutionY": 2160,
"devices": [
{
"name": "noname",
"resolutionX": 2160,
"resolutionY": 1080
}
],
"fileName": "Adaptation"
}
================================================
FILE: FairyGUIProject/settings/Common.json
================================================
{
"font": "ui://f59y7iy8udcb2",
"fontSize": 30,
"textColor": "#000000",
"fontAdjustment": false,
"colorScheme": [
"深灰色 #3c3c3c",
"深黑 #101010",
"纯白 #FFFFFF",
"标题白 #d6ecff",
"黑棕色 #241d18",
"深红 #7F2D29",
"灰棕色 #5b453c",
"草绿色 #52753C",
"浅绿色 #A4CE8A",
"浅红 #f56236",
"弹窗正文色 #BBB8B3",
"弹窗标题色 #E1C399"
],
"fontSizeScheme": [
"主标题 72",
"中弹窗标题大小 38",
"弹窗说明字体大小 35",
"说明字体大小 28"
],
"fontScheme": [
"默认数字字体 ui://f59y7iy8rlr0az"
],
"scrollBars": {
"horizontal": "",
"vertical": "ui://s1h25l7xwnkvf",
"defaultDisplay": "visible"
},
"tipsRes": "ui://t2ic63zdoky1x",
"buttonClickSound": "",
"pivot": "default",
"fileName": "Common"
}
================================================
FILE: FairyGUIProject/settings/CustomProperties.json
================================================
{}
================================================
FILE: FairyGUIProject/settings/PackageGroup.json
================================================
[
{
"name": "UI",
"pkgs": [
"rooljsfx",
"8bbilq8f",
"3jlac56o",
"8aovrc7w",
"s1h25l7x",
"goc7xugy",
"gjxko9vn",
"qecztwbp",
"f011l0h9",
"8tna182n",
"rbrjj5v2",
"rlc7tgx2",
"rn5iaqeh",
"fa6npys5",
"gx5ub6fn"
]
},
{
"name": "Res",
"pkgs": [
"f59y7iy8",
"gxmf5wqp",
"gmjkw28i",
"gm3fgmt3"
]
},
{
"name": "Def",
"pkgs": [
"s1h25l7x"
]
}
]
================================================
FILE: FairyGUIProject/settings/Publish.json
================================================
{
"path": "../Unity/Assets/Bundles/UI",
"branchPath": "",
"fileExtension": "bytes",
"packageCount": 2,
"compressDesc": true,
"binaryFormat": true,
"jpegQuality": 80,
"compressPNG": false,
"codeGeneration": {
"allowGenCode": true,
"codePath": "../Unity/Assets/Hotfix/UI/FairyGUI/",
"classNamePrefix": "",
"memberNamePrefix": "m_",
"packageName": null,
"ignoreNoname": true,
"getMemberByName": true,
"codeType": ""
},
"includeHighResolution": 0,
"branchProcessing": 0,
"seperatedAtlasForBranch": false,
"atlasSetting": {
"maxSize": 2048,
"paging": true,
"sizeOption": "pot",
"forceSquare": false,
"allowRotation": true,
"trimImage": true
},
"include2x": false,
"include3x": false,
"include4x": false,
"fileName": "Publish"
}
================================================
FILE: FairyGUIProject/settings/i18n.json
================================================
{
"langFiles": []
}
================================================
FILE: LICENSE.md
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
.
================================================
FILE: Protobuf/Bag_100.proto
================================================
syntax = "proto3";
package Bag;
option module = 100;
message BagItem
{
int32 ItemId = 1; // 道具id
int64 Count = 2; // 道具数量
}
// 请求背包数据
message ReqBagInfo
{
}
// 返回背包数据
message RespBagInfo
{
map ItemDic = 1;
}
message NotifyBagItem
{
int32 ItemId = 1; // 道具id
int64 Count = 2; // 最终道具数量
int64 Value = 3; // 变化的值
}
// 通知背包数据变化
message NotifyBagInfoChanged
{
map ItemDic = 1; // 变化的道具,key:道具id,value:数量
}
// 请求合成宠物
message ReqComposePet
{
int32 FragmentId = 1; // 碎片id
}
// 返回合成宠物
message RespComposePet
{
int32 PetId = 1; // 合成宠物的Id
}
// 请求使用道具
message ReqUseItem
{
int32 ItemId = 1; // 道具id
int64 Count = 2; // 道具数量
}
// 请求使用道具
message RespUseItem
{
int32 ItemId = 1; // 道具id
int64 Count = 2; // 道具数量
}
// 丢弃物品请求
message ReqDiscardItem {
int32 ItemId = 1; // 道具id
int64 Count = 2; // 道具数量
}
// 丢弃物品返回
message RespDiscardItem {
int32 ItemId = 1; // 道具id
int64 Count = 2; // 道具数量
}
// 出售道具
message ReqSellItem
{
int32 ItemId = 1; // 道具id
}
// 出售道具
message RespItemChange
{
map ItemDic = 1; // 变化的道具
}
// 增加道具
message ReqAddItem{
map ItemDic = 1;
}
// 增加道具返回
message RespAddItem{
map ItemDic = 1; // 变化的道具
}
// 减少道具
message ReqRemoveItem{
map ItemDic = 1;
}
// 减少道具返回
message RespRemoveItem{
map ItemDic = 1; // 变化的道具
}
================================================
FILE: Protobuf/Basic_10.proto
================================================
syntax = "proto3";
package Basic;
option module = 10;
// 请求心跳
message ReqHeartBeat
{
int64 Timestamp = 1; // 时间戳
}
// 服务器通知心跳结果,因为有些业务需要对心跳结果做处理所以不做成RPC的方式处理
message NotifyHeartBeat
{
int64 Timestamp = 1; // 时间戳
}
// 通知客户端服务器人数已达上限
message NotifyServerFullyLoaded
{
}
================================================
FILE: Protobuf/Common_20.proto
================================================
syntax = "proto3";
package Common;
option module = 20;
// 返回码
enum ResultCode
{
Success = 0; //成功
Failed = 1; //失败
}
enum PhoneType
{
Mobile = 0; // 手机
Home = 1;
Work = 2; // 工作号码
}
message PhoneNumber
{
string Number = 1;
PhoneType Type = 2;
}
message Person
{
string Name = 1;
int32 Id = 2; // Unique ID number for this person.
string Email = 3;
repeated PhoneNumber Phones = 4;
}
// Our address book file is just one of these.
message AddressBook
{
repeated Person People = 1;
}
// 操作错误代码
enum OperationStatusCode
{
Ok = 0;// 成功
ConfigErr = 1;// 配置表错误
ParamErr = 2;// 客户端传递参数错误
CostNotEnough = 3;// 消耗不足
Forbidden = 4;// 未开通服务
NotFound = 5;// 不存在
HasExist = 6;// 已经存在
AccountCannotBeNull = 7;// 账号不存在或为空
Unprocessable = 8;// 无法执行数据库修改
UnknownPlatform = 9;// 未知平台
Notice = 10;// 正常通知
FuncNotOpen = 11;// 功能未开启,主消息屏蔽
Other = 12;// 其他
InternalServerError = 13; // 内部服务错误
ServerFullyLoaded = 14; // 通知客户端服务器人数已达上限
}
================================================
FILE: Protobuf/Inner_Basic_2.proto
================================================
syntax = "proto3";
package Inner_Basic;
option module = 2;
================================================
FILE: Protobuf/Proto2CsExport-All.bat
================================================
@echo off
start Proto2CsExport_Client.bat
start Proto2CsExport_Server.bat
================================================
FILE: Protobuf/Proto2CsExport_Client.bat
================================================
cd /d ../Tools/ProtoExport\bin\Debug\net8.0
call dotnet ProtoExport.dll --mode unity --inputPath ./../../../../../Protobuf --outputPath ./../../../../../Unity/Assets/Hotfix/Proto --namespaceName Hotfix.Proto --isGenerateErrorCode true
pause
================================================
FILE: Protobuf/Proto2CsExport_Client.sh
================================================
#!/bin/bash
# 切换目录,-P 选项是用来处理符号链接的
cd -P ../Tools/ProtoExport/bin/Debug/net8.0
# 启动应用程序,& 表示在后台运行
dotnet ProtoExport.dll --mode unity --inputPath ./../../../../../Protobuf --outputPath ./../../../../../Unity/Assets/Hotfix/Proto --namespaceName Hotfix.Proto --isGenerateErrorCode true &
# 暂停,等待用户按任意键继续,由于 shell 环境没有直接的 pause 命令,使用 read 模拟
read -p "Press any key to continue . . . " -n1 -s
echo "" # 输出一个新行
================================================
FILE: Protobuf/Proto2CsExport_Server.bat
================================================
cd /d ../Tools/ProtoExport\bin\Debug\net8.0
call dotnet ProtoExport.dll --mode server --inputPath ./../../../../../Protobuf --outputPath ./../../../../../Server/GameFrameX.Proto/Proto --namespaceName GameFrameX.Proto.Proto --isGenerateErrorCode true
pause
================================================
FILE: Protobuf/Proto2CsExport_Server.sh
================================================
#!/bin/bash
# 切换目录,-P 选项是用来处理符号链接的
cd -P ../Tools/ProtoExport/bin/Debug/net8.0
# 启动应用程序,并将其放入后台执行
dotnet ProtoExport.dll --mode server --inputPath ./../../../../../Protobuf --outputPath ./../../../../../Server/GameFrameX.Proto/Proto --namespaceName GameFrameX.Proto.Proto --isGenerateErrorCode true &
# 输出提示信息
echo "Press any key to continue . . ."
# 等待用户按下任意键
read -n 1 -s -r -p ""
================================================
FILE: Protobuf/User_300.proto
================================================
syntax = "proto3";
package User;
option module = 300;
// 请求账号登录
message ReqLogin
{
string UserName = 1;
string Platform = 2;
int32 SdkType = 3;
string SdkToken = 4;
string Device = 5;
string Password = 6; // 密码
}
// 请求账号登录返回
message RespLogin
{
int32 Code = 1;
string RoleName = 2; // 账号名
int64 Id = 3; // 账号ID
uint32 Level = 4; // 账号等级
int64 CreateTime = 5; // 创建时间
}
// 请求角色创建
message ReqPlayerCreate
{
int64 Id = 1; // 账号ID
string Name = 2; // 角色名
}
// 请求角色创建返回
message RespPlayerCreate
{
PlayerInfo PlayerInfo = 1; // 角色信息
}
// 请求角色列表
message ReqPlayerList
{
int64 Id = 1; // 账号ID
}
// 请求角色列表返回
message RespPlayerList
{
repeated PlayerInfo PlayerList = 1; // 角色列表
}
message PlayerInfo
{
int64 Id = 1; // 角色ID
string Name = 2; // 角色名
uint32 Level = 3; // 角色等级
int32 State = 4; // 角色状态
uint32 Avatar = 5; // 角色头像
uint64 CurrentExp = 6; // 角色当前经验
}
// 请求玩家登录
message ReqPlayerLogin
{
int64 Id = 1; // 角色ID
}
// 请求玩家登录返回
message RespPlayerLogin
{
int32 Code = 1;
int64 CreateTime = 2; // 创建时间
PlayerInfo PlayerInfo = 3; // 角色信息
}
// 客户端每次请求都会回复错误码
message RespErrorCode
{
int64 ErrCode = 1; // 0:表示无错误
string Desc = 2; // 错误描述(不为0时有效)
}
message RespPrompt
{
int32 Type = 1; // 提示信息类型(1Tip提示,2跑马灯,3插队跑马灯,4弹窗,5弹窗回到登陆,6弹窗退出游戏)
string Content = 2; // 提示内容
}
================================================
FILE: Protobuf/_-120_InnerSocial_s.proto
================================================
syntax = "proto3";
package InnerSocial;
option module = -120;
// 请求添加好友
message ReqInnerFriendByAdd
{
int64 PlayerId = 1; // 玩家ID
}
// 响应添加好友
message RespInnerFriendByAdd
{
bool Success = 1; // 是否成功
}
message InnerFriendInfo
{
int64 PlayerId = 1; // 玩家ID
string PlayerName = 2; // 玩家名称
}
// 请求删除好友
message ReqInnerFriendByDelete
{
int64 PlayerId = 1; // 玩家ID
}
// 响应删除好友
message RespInnerFriendByDelete
{
bool Success = 1; // 是否成功
}
// 请求好友列表
message ReqInnerFriendList
{
int64 PlayerId = 1; // 玩家ID
}
// 响应好友列表
message RespInnerFriendList
{
repeated FriendInfo Friends = 1; // 好友列表
}
================================================
FILE: Protobuf/_120_Social.proto
================================================
syntax = "proto3";
package Social;
option module = 120;
message FriendInfo
{
int64 PlayerId = 1; // 玩家ID
string PlayerName = 2; // 玩家名称
}
// 请求社交信息
message ReqSocialInfo
{
}
// 响应社交信息
message RespSocialInfo
{
}
// 请求删除好友
message ReqDeleteFriend
{
int64 PlayerId = 1; // 玩家ID
}
// 响应删除好友
message RespDeleteFriend
{
bool Success = 1; // 是否成功
}
// 请求好友列表
message ReqFriendList
{
}
// 响应好友列表
message RespFriendList
{
repeated FriendInfo Friends = 1; // 好友列表
}
// 请求添加好友
message ReqFriendByAdd
{
int64 PlayerId = 1; // 玩家ID
}
// 响应添加好友
message RespFriendByAdd
{
bool Success = 1; // 是否成功
}
================================================
FILE: Protobuf/readme.txt
================================================
https://gameframex.doc.alianblank.com/protobuf/require
================================================
FILE: README.md
================================================