diff --git a/DataTables/Datas/__enums__.xlsx b/DataTables/Datas/__enums__.xlsx index a0056988..69439db6 100644 Binary files a/DataTables/Datas/__enums__.xlsx and b/DataTables/Datas/__enums__.xlsx differ diff --git a/DataTables/Datas/__tables__.xlsx b/DataTables/Datas/__tables__.xlsx index e2d7a261..11befc16 100644 Binary files a/DataTables/Datas/__tables__.xlsx and b/DataTables/Datas/__tables__.xlsx differ diff --git a/DataTables/Datas/girls.xlsx b/DataTables/Datas/girls.xlsx new file mode 100644 index 00000000..7f055adf Binary files /dev/null and b/DataTables/Datas/girls.xlsx differ diff --git a/DataTables/output/tbgirls.json b/DataTables/output/tbgirls.json new file mode 100644 index 00000000..f6c3cf9a --- /dev/null +++ b/DataTables/output/tbgirls.json @@ -0,0 +1,12 @@ +[ + { + "id": 10001, + "name": "Anaya Kapoor", + "age": "29", + "category": 0, + "tag": [ + "Hot,Horny" + ], + "priceType": 0 + } +] \ No newline at end of file diff --git a/assets/Scenes/MainScene.scene b/assets/Scenes/MainScene.scene index de6104d2..fa7543c2 100644 --- a/assets/Scenes/MainScene.scene +++ b/assets/Scenes/MainScene.scene @@ -18,12 +18,15 @@ "_children": [ { "__id__": 2 + }, + { + "__id__": 32 } ], "_active": true, "_components": [], "_prefab": { - "__id__": 32 + "__id__": 34 }, "_lpos": { "__type__": "cc.Vec3", @@ -54,7 +57,7 @@ }, "autoReleaseAssets": false, "_globals": { - "__id__": 33 + "__id__": 35 }, "_id": "1a23cd3e-e487-4fd1-a415-346c2087464d" }, @@ -98,8 +101,8 @@ "_prefab": null, "_lpos": { "__type__": "cc.Vec3", - "x": 196.5, - "y": 426.00000000000006, + "x": 583.5, + "y": 1266, "z": 0 }, "_lrot": { @@ -580,8 +583,8 @@ "__prefab": null, "_alignFlags": 45, "_target": null, - "_left": 361, - "_right": 361, + "_left": 359.5, + "_right": 359.5, "_top": 978, "_bottom": 978, "_horizontalCenter": 0, @@ -663,8 +666,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 393, - "height": 852.0000000000001 + "width": 1167, + "height": 2532 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -789,8 +792,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 393, - "height": 852.0000000000001 + "width": 1167, + "height": 2532 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -889,8 +892,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 393, - "height": 852.0000000000001 + "width": 1167, + "height": 2532 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -941,8 +944,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 393, - "height": 852.0000000000001 + "width": 1167, + "height": 2532 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1018,6 +1021,63 @@ }, "_id": "98EWBIubZPlZT+LFQb4IYI" }, + { + "__type__": "cc.Node", + "_name": "ConfigManager", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 33 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "67ZXnZeExFXIu59phK6Xjz" + }, + { + "__type__": "fbd43WrI4tK6KXuGCPuxhSR", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 32 + }, + "_enabled": true, + "__prefab": null, + "_id": "57vDjH7bVD4JDeqZChrdP3" + }, { "__type__": "cc.PrefabInfo", "root": null, @@ -1029,29 +1089,29 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 34 - }, - "shadows": { - "__id__": 35 - }, - "_skybox": { "__id__": 36 }, - "fog": { + "shadows": { "__id__": 37 }, - "octree": { + "_skybox": { "__id__": 38 }, - "skin": { + "fog": { "__id__": 39 }, - "lightProbeInfo": { + "octree": { "__id__": 40 }, - "postSettings": { + "skin": { "__id__": 41 }, + "lightProbeInfo": { + "__id__": 42 + }, + "postSettings": { + "__id__": 43 + }, "bakedWithStationaryMainLight": false, "bakedWithHighpLightmap": false }, diff --git a/assets/Scripts/chat18x/manager/ConfigManager.ts b/assets/Scripts/chat18x/manager/ConfigManager.ts index 6f3c5082..4d4a8c47 100644 --- a/assets/Scripts/chat18x/manager/ConfigManager.ts +++ b/assets/Scripts/chat18x/manager/ConfigManager.ts @@ -1,4 +1,11 @@ -import { _decorator, resources, BufferAsset, Component } from "cc"; +import { + _decorator, + resources, + BufferAsset, + Component, + assetManager, + AssetManager, +} from "cc"; import * as cfg from "../../schema/schema"; import ByteBuf from "db://assets/Scripts/luban/ByteBuf"; @@ -22,9 +29,27 @@ export default class ConfigManager extends Component { let promises: Promise[] = []; for (let curFileName of ConfigManager.jsonFileNames) { let promise = new Promise((resolve, reject) => { - resources.load("test/" + curFileName, BufferAsset, (err, data) => { - resolve(data); - }); + let bundle = assetManager.getBundle("DataTable"); + if (bundle) { + bundle.load(curFileName, BufferAsset, (err, data) => { + resolve(data); + }); + } else { + assetManager.loadBundle( + "DataTable", + (err: Error, _bundle: AssetManager.Bundle) => { + if (err) { + console.log(err); + reject && reject(err); + return; + } else { + _bundle.load(curFileName, BufferAsset, (err, data) => { + resolve(data); + }); + } + } + ); + } }); promise.then((data: BufferAsset) => { if (data) { @@ -41,7 +66,7 @@ export default class ConfigManager extends Component { Promise.all(promises).then((values) => { console.log("静态配置加载完成"); ConfigManager.tables = new cfg.Tables(this.getFileData); - for (let item of ConfigManager.tables.Tbitem.getDataList()) { + for (let item of ConfigManager.tables.TbGirls.getDataList()) { console.log(item); } }); diff --git a/assets/Scripts/schema/schema.ts b/assets/Scripts/schema/schema.ts index 33bcdef9..17e7d6f8 100644 --- a/assets/Scripts/schema/schema.ts +++ b/assets/Scripts/schema/schema.ts @@ -10,6 +10,52 @@ import ByteBuf from '../luban/ByteBuf' + +export enum Category { + /** + * 熟女 + */ + shunv = 0, + /** + * 18岁 + */ + eighteen = 1, + /** + * 辣妈 + */ + lama = 2, + /** + * 捆绑 + */ + kunbang = 3, + /** + * 公众野战 + */ + publicfight = 4, + /** + * 卡通 + */ + cartoon = 5, +} + + + +export enum PriceType { + /** + * 免费 + */ + free = 0, + /** + * 试用 + */ + first_time_free = 1, + /** + * 收费 + */ + pay = 2, +} + + @@ -91,6 +137,56 @@ export class Reward { +export class Girls { + + constructor(_buf_: ByteBuf) { + this.id = _buf_.readInt() + this.name = _buf_.readString() + this.age = _buf_.readString() + this.category = _buf_.readInt() + { let n = Math.min(_buf_.readSize(), _buf_.size); this.tag = []; for(let i = 0 ; i < n ; i++) { let _e0 ;_e0 = _buf_.readString(); this.tag.push(_e0);}} + this.priceType = _buf_.readInt() + } + + /** + * id + */ + readonly id: number + /** + * 名称 + */ + readonly name: string + /** + * 年龄 + */ + readonly age: string + /** + * 分类 + */ + readonly category: Category + /** + * 标签 + */ + readonly tag: string[] + /** + * 付费类型 + */ + readonly priceType: PriceType + + resolve(tables:Tables) { + + + + + + + } +} + + + + + export class vector2 { constructor(_buf_: ByteBuf) { @@ -193,6 +289,39 @@ export class TbReward { } + +export class TbGirls { + private _dataMap: Map + private _dataList: Girls[] + constructor(_buf_: ByteBuf) { + this._dataMap = new Map() + this._dataList = [] + for(let n = _buf_.readInt(); n > 0; n--) { + let _v: Girls + _v = new Girls(_buf_) + this._dataList.push(_v) + this._dataMap.set(_v.id, _v) + } + } + + getDataMap(): Map { return this._dataMap; } + getDataList(): Girls[] { return this._dataList; } + + get(key: number): Girls | undefined { + return this._dataMap.get(key); + } + + resolve(tables:Tables) { + for(let data of this._dataList) + { + data.resolve(tables) + } + } + +} + + + export namespace demo { export class Tbitem { private _dataMap: Map @@ -232,21 +361,26 @@ type ByteBufLoader = (file: string) => ByteBuf export class Tables { private _TbReward: demo.TbReward get TbReward(): demo.TbReward { return this._TbReward;} + private _TbGirls: TbGirls + get TbGirls(): TbGirls { return this._TbGirls;} private _Tbitem: demo.Tbitem get Tbitem(): demo.Tbitem { return this._Tbitem;} static getTableNames(): string[] { let names: string[] = []; names.push('demo_tbreward'); + names.push('tbgirls'); names.push('demo_tbitem'); return names; } constructor(loader: ByteBufLoader) { this._TbReward = new demo.TbReward(loader('demo_tbreward')) + this._TbGirls = new TbGirls(loader('tbgirls')) this._Tbitem = new demo.Tbitem(loader('demo_tbitem')) this._TbReward.resolve(this) + this._TbGirls.resolve(this) this._Tbitem.resolve(this) } } diff --git a/assets/bundles/Chat18x/LubanCfg.meta b/assets/bundles/Chat18x/LubanCfg.meta deleted file mode 100644 index 02828a1c..00000000 --- a/assets/bundles/Chat18x/LubanCfg.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "47f49576-c2c9-44fd-a97b-757a0bde9e65", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/DataTable/Music.json b/assets/bundles/DataTable/Music.json deleted file mode 100644 index 791226b5..00000000 --- a/assets/bundles/DataTable/Music.json +++ /dev/null @@ -1,2 +0,0 @@ -[{"id":1,"AssetName":"music_interface"}, -{"id":2,"AssetName":"music_game"}] \ No newline at end of file diff --git a/assets/bundles/DataTable/Music.json.meta b/assets/bundles/DataTable/Music.json.meta deleted file mode 100644 index f0d28565..00000000 --- a/assets/bundles/DataTable/Music.json.meta +++ /dev/null @@ -1,11 +0,0 @@ -{ - "ver": "2.0.1", - "importer": "json", - "imported": true, - "uuid": "0394e147-cf8c-4177-ae8e-509324c5b83f", - "files": [ - ".json" - ], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/DataTable/Sound.json b/assets/bundles/DataTable/Sound.json deleted file mode 100644 index 47f356e1..00000000 --- a/assets/bundles/DataTable/Sound.json +++ /dev/null @@ -1,5 +0,0 @@ -[{"id":10000,"AssetName":"click","Priority":0,"Loop":0,"Volume":1,"SpatialBlend":0,"MaxDistance":100,"MinInterval":0}, -{"id":10001,"AssetName":"defeat","Priority":0,"Loop":0,"Volume":1,"SpatialBlend":0,"MaxDistance":100,"MinInterval":0}, -{"id":10002,"AssetName":"startgame","Priority":0,"Loop":0,"Volume":1,"SpatialBlend":0,"MaxDistance":100,"MinInterval":0}, -{"id":10003,"AssetName":"success","Priority":0,"Loop":0,"Volume":1,"SpatialBlend":0,"MaxDistance":100,"MinInterval":0} -] \ No newline at end of file diff --git a/assets/bundles/DataTable/Sound.json.meta b/assets/bundles/DataTable/Sound.json.meta deleted file mode 100644 index 23c4b19f..00000000 --- a/assets/bundles/DataTable/Sound.json.meta +++ /dev/null @@ -1,11 +0,0 @@ -{ - "ver": "2.0.1", - "importer": "json", - "imported": true, - "uuid": "23b3db89-f554-4f2e-9a97-a82f504572a8", - "files": [ - ".json" - ], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/DataTable/commonGlobal.json b/assets/bundles/DataTable/commonGlobal.json deleted file mode 100644 index 9f1d009b..00000000 --- a/assets/bundles/DataTable/commonGlobal.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - { "id": 1, "type": 0, "value": 8, "para": "" }, - { "id": 100, "type": 0, "value": 10, "para": "" } -] diff --git a/assets/bundles/DataTable/commonGlobal.json.meta b/assets/bundles/DataTable/commonGlobal.json.meta deleted file mode 100644 index a63d9c55..00000000 --- a/assets/bundles/DataTable/commonGlobal.json.meta +++ /dev/null @@ -1,11 +0,0 @@ -{ - "ver": "2.0.1", - "importer": "json", - "imported": true, - "uuid": "ce1d5a04-5bdb-46a4-a347-b41027b9ada2", - "files": [ - ".json" - ], - "subMetas": {}, - "userData": {} -} diff --git a/assets/resources/test/demo_tbitem.bin b/assets/bundles/DataTable/demo_tbitem.bin similarity index 100% rename from assets/resources/test/demo_tbitem.bin rename to assets/bundles/DataTable/demo_tbitem.bin diff --git a/assets/resources/test/demo_tbitem.bin.meta b/assets/bundles/DataTable/demo_tbitem.bin.meta similarity index 74% rename from assets/resources/test/demo_tbitem.bin.meta rename to assets/bundles/DataTable/demo_tbitem.bin.meta index f0a35562..2328ee7b 100644 --- a/assets/resources/test/demo_tbitem.bin.meta +++ b/assets/bundles/DataTable/demo_tbitem.bin.meta @@ -2,7 +2,7 @@ "ver": "1.0.3", "importer": "buffer", "imported": true, - "uuid": "b6344d4c-c476-4680-baab-fc0ad7e822c3", + "uuid": "63fbd1bd-9cb1-4fa3-aca9-15b259a9c421", "files": [ ".bin", ".json" diff --git a/assets/resources/test/demo_tbreward.bin b/assets/bundles/DataTable/demo_tbreward.bin similarity index 100% rename from assets/resources/test/demo_tbreward.bin rename to assets/bundles/DataTable/demo_tbreward.bin diff --git a/assets/resources/test/demo_tbreward.bin.meta b/assets/bundles/DataTable/demo_tbreward.bin.meta similarity index 74% rename from assets/resources/test/demo_tbreward.bin.meta rename to assets/bundles/DataTable/demo_tbreward.bin.meta index aad7c97f..b8ec9c0f 100644 --- a/assets/resources/test/demo_tbreward.bin.meta +++ b/assets/bundles/DataTable/demo_tbreward.bin.meta @@ -2,7 +2,7 @@ "ver": "1.0.3", "importer": "buffer", "imported": true, - "uuid": "f4e901c8-045b-48b6-9dbd-a8e66e836316", + "uuid": "22867eec-f2ee-4997-b2b4-b277af84b625", "files": [ ".bin", ".json" diff --git a/assets/bundles/DataTable/tbgirls.bin b/assets/bundles/DataTable/tbgirls.bin new file mode 100644 index 00000000..30cc4783 Binary files /dev/null and b/assets/bundles/DataTable/tbgirls.bin differ diff --git a/assets/bundles/DataTable/tbgirls.bin.meta b/assets/bundles/DataTable/tbgirls.bin.meta new file mode 100644 index 00000000..59a588b7 --- /dev/null +++ b/assets/bundles/DataTable/tbgirls.bin.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.0.3", + "importer": "buffer", + "imported": true, + "uuid": "08338d0a-99b7-4506-b4ac-a9ffde3bffef", + "files": [ + ".bin", + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/assets/resources/test.meta b/assets/resources/test.meta deleted file mode 100644 index 72ba2a29..00000000 --- a/assets/resources/test.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "9af205c7-55bf-4df1-9349-5916a429f4fe", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/gen_client.bat b/gen_client.bat index cb03b6b4..4259bdd0 100644 --- a/gen_client.bat +++ b/gen_client.bat @@ -9,7 +9,7 @@ dotnet %LUBAN_DLL% ^ -d bin ^ --conf %CONF_ROOT%\luban.conf ^ -x outputCodeDir=assets\scripts\schema ^ - -x outputDataDir=assets\resources\test ^ + -x outputDataDir=assets\bundles\DataTable ^ -x bin.fileExt=bin pause \ No newline at end of file