diff --git a/assets/Scenes/PreloadScene.scene b/assets/Scenes/PreloadScene.scene index 8ad06bed..bab82e7d 100644 --- a/assets/Scenes/PreloadScene.scene +++ b/assets/Scenes/PreloadScene.scene @@ -23,7 +23,7 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 57 + "__id__": 61 }, "_lpos": { "__type__": "cc.Vec3", @@ -54,7 +54,7 @@ }, "autoReleaseAssets": false, "_globals": { - "__id__": 58 + "__id__": 62 }, "_id": "16b0d021-6436-4bbc-ba5e-05ebe3e84ba4" }, @@ -77,13 +77,13 @@ "_active": true, "_components": [ { - "__id__": 54 + "__id__": 58 }, { - "__id__": 55 + "__id__": 59 }, { - "__id__": 56 + "__id__": 60 } ], "_prefab": null, @@ -175,7 +175,7 @@ "_priority": 0, "_fov": 45, "_fovAxis": 0, - "_orthoHeight": 666.9999999999999, + "_orthoHeight": 667, "_near": 0, "_far": 2000, "_color": { @@ -235,13 +235,13 @@ "_active": true, "_components": [ { - "__id__": 51 + "__id__": 55 }, { - "__id__": 52 + "__id__": 56 }, { - "__id__": 53 + "__id__": 57 } ], "_prefab": null, @@ -947,7 +947,7 @@ }, { "__type__": "cc.Node", - "_name": "Node", + "_name": "loginNode", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -957,9 +957,6 @@ { "__id__": 25 }, - { - "__id__": 29 - }, { "__id__": 33 }, @@ -971,15 +968,18 @@ }, { "__id__": 45 + }, + { + "__id__": 49 } ], "_active": false, "_components": [ { - "__id__": 49 + "__id__": 53 }, { - "__id__": 50 + "__id__": 54 } ], "_prefab": null, @@ -1020,24 +1020,31 @@ "_parent": { "__id__": 24 }, - "_children": [], + "_children": [ + { + "__id__": 26 + } + ], "_active": true, "_components": [ { - "__id__": 26 + "__id__": 29 }, { - "__id__": 27 + "__id__": 30 }, { - "__id__": 28 + "__id__": 31 + }, + { + "__id__": 32 } ], "_prefab": null, "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -820, + "y": -249.863, "z": 0 }, "_lrot": { @@ -1063,6 +1070,138 @@ }, "_id": "20XiExjNlNz4WgKxRYVHg4" }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 25 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 27 + }, + { + "__id__": 28 + } + ], + "_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": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "c9QK+QiMdN05iiunOuSORG" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 26 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 60, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "c69JGQfqNFH7wh5os8iwkl" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 26 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "登录", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 30, + "_fontSize": 30, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "14arglROtOO4uXIOOeRmbM" + }, { "__type__": "cc.UITransform", "_name": "", @@ -1075,8 +1214,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 400, - "height": 98 + "width": 200, + "height": 80 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1101,14 +1240,17 @@ "_color": { "__type__": "cc.Color", "r": 255, - "g": 255, - "b": 255, + "g": 218, + "b": 70, "a": 255 }, - "_spriteFrame": null, - "_type": 0, + "_spriteFrame": { + "__uuid__": "d3a6a283-9dd4-4193-b450-46f35eea4a3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 1, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -1131,12 +1273,12 @@ }, "_enabled": true, "__prefab": null, - "_alignFlags": 4, + "_alignFlags": 20, "_target": null, "_left": 0, "_right": 0, "_top": 0, - "_bottom": 397, + "_bottom": 377.137, "_horizontalCenter": 0, "_verticalCenter": 0, "_isAbsLeft": true, @@ -1151,6 +1293,56 @@ "_lockFlags": 0, "_id": "dfdxZQmvFOwrQBo53Z1saZ" }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": null, + "clickEvents": [], + "_interactable": true, + "_transition": 0, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": null, + "_id": "c9KDag5vBLKazTx4FSrM2p" + }, { "__type__": "cc.Node", "_name": "shiling", @@ -1163,20 +1355,20 @@ "_active": true, "_components": [ { - "__id__": 30 + "__id__": 34 }, { - "__id__": 31 + "__id__": 35 }, { - "__id__": 32 + "__id__": 36 } ], "_prefab": null, "_lpos": { "__type__": "cc.Vec3", - "x": -508, - "y": -1156, + "x": -298, + "y": -557, "z": 0 }, "_lrot": { @@ -1208,7 +1400,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 29 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -1230,7 +1422,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 29 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -1269,7 +1461,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 29 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -1305,20 +1497,20 @@ "_active": true, "_components": [ { - "__id__": 34 + "__id__": 38 }, { - "__id__": 35 + "__id__": 39 }, { - "__id__": 36 + "__id__": 40 } ], "_prefab": null, "_lpos": { "__type__": "cc.Vec3", - "x": -225, - "y": -1082, + "x": -15, + "y": -483, "z": 0 }, "_lrot": { @@ -1350,7 +1542,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 33 + "__id__": 37 }, "_enabled": true, "__prefab": null, @@ -1372,7 +1564,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 33 + "__id__": 37 }, "_enabled": true, "__prefab": null, @@ -1434,7 +1626,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 33 + "__id__": 37 }, "_enabled": true, "__prefab": null, @@ -1470,20 +1662,20 @@ "_active": true, "_components": [ { - "__id__": 38 + "__id__": 42 }, { - "__id__": 39 + "__id__": 43 }, { - "__id__": 40 + "__id__": 44 } ], "_prefab": null, "_lpos": { "__type__": "cc.Vec3", - "x": -225, - "y": -1173, + "x": -15, + "y": -574, "z": 0 }, "_lrot": { @@ -1515,7 +1707,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 37 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1537,7 +1729,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 37 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1599,7 +1791,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 37 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1635,20 +1827,20 @@ "_active": true, "_components": [ { - "__id__": 42 + "__id__": 46 }, { - "__id__": 43 + "__id__": 47 }, { - "__id__": 44 + "__id__": 48 } ], "_prefab": null, "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -916, + "y": -317, "z": 0 }, "_lrot": { @@ -1680,7 +1872,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 41 + "__id__": 45 }, "_enabled": true, "__prefab": null, @@ -1702,7 +1894,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 41 + "__id__": 45 }, "_enabled": true, "__prefab": null, @@ -1764,7 +1956,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 41 + "__id__": 45 }, "_enabled": true, "__prefab": null, @@ -1800,20 +1992,20 @@ "_active": true, "_components": [ { - "__id__": 46 + "__id__": 50 }, { - "__id__": 47 + "__id__": 51 }, { - "__id__": 48 + "__id__": 52 } ], "_prefab": null, "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -941, + "y": -342, "z": 0 }, "_lrot": { @@ -1845,7 +2037,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 45 + "__id__": 49 }, "_enabled": true, "__prefab": null, @@ -1867,7 +2059,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 45 + "__id__": 49 }, "_enabled": true, "__prefab": null, @@ -1929,7 +2121,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 45 + "__id__": 49 }, "_enabled": true, "__prefab": null, @@ -1965,8 +2157,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 1170, - "height": 2532 + "width": 750, + "height": 1334 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -2018,7 +2210,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 750, - "height": 1333.9999999999998 + "height": 1334 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -2082,7 +2274,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 750, - "height": 1333.9999999999998 + "height": 1334 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -2148,29 +2340,29 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 59 - }, - "shadows": { - "__id__": 60 - }, - "_skybox": { - "__id__": 61 - }, - "fog": { - "__id__": 62 - }, - "octree": { "__id__": 63 }, - "skin": { + "shadows": { "__id__": 64 }, - "lightProbeInfo": { + "_skybox": { "__id__": 65 }, - "postSettings": { + "fog": { "__id__": 66 }, + "octree": { + "__id__": 67 + }, + "skin": { + "__id__": 68 + }, + "lightProbeInfo": { + "__id__": 69 + }, + "postSettings": { + "__id__": 70 + }, "bakedWithStationaryMainLight": false, "bakedWithHighpLightmap": false }, diff --git a/assets/Scripts/Sub/UI/PreloadUI.ts b/assets/Scripts/Sub/UI/PreloadUI.ts index b179da6c..17710ecf 100644 --- a/assets/Scripts/Sub/UI/PreloadUI.ts +++ b/assets/Scripts/Sub/UI/PreloadUI.ts @@ -29,6 +29,8 @@ import { DataManager } from "../../chat18x/data/DataManager"; import ConfigManager from "../../chat18x/manager/ConfigManager"; import { AppConfig } from "db://assets/Scripts/chat18x/config/env/appConfig"; import DeviceIdService from "db://assets/Scripts/chat18x/foundation/identity/DeviceIdService"; +import { AuthService } from "db://assets/Scripts/chat18x/network/services/AuthService"; +import { ApiCode } from "db://assets/Scripts/chat18x/network/client/types"; const { ccclass, property } = _decorator; @@ -41,7 +43,8 @@ export class PreloadUI extends Component { private jinduBar: Node = null; private jinduFilled: Sprite = null; private LabProgress: Label = null; - //private btnLogin: Sprite = null; //登录按钮 + private loginNode: Node = null; + private btnLogin: Node = null; //登录按钮 start() { //Utils.addInnerEL(InnerMsgCode.UI_ShowPrompt, this, this.resiveShowPrompt) @@ -53,14 +56,16 @@ export class PreloadUI extends Component { this.LabProgress = this.node .getChildByName("LabProgress") .getComponent(Label); - //this.btnLogin = this.node.getChildByName("btnLogin").getComponent(Sprite); + this.loginNode = this.node.getChildByName("loginNode"); + this.btnLogin = this.loginNode.getChildByName("btnLogin"); //适配背景图 let BG = this.node.getChildByName("BG"); Utils.adjustBgPixelRatio(BG, 1); this.jinduFilled.fillRange = 0; - //this.btnLogin.node.active = false; + // 注册监听 + this.registerListener(); // 初始化环境配置 AppConfig.I; @@ -181,7 +186,7 @@ export class PreloadUI extends Component { }); } else { this.preloadFinish = true; - this.onLogin(); + this.enterLoginModule(); } }; preloadFunc(); @@ -192,8 +197,15 @@ export class PreloadUI extends Component { this.jinduFilled.fillRange = percent; } + // 进入登录模块 + private enterLoginModule() { + this.LabProgress.node.active = false; + this.jinduBar.active = false; + this.loginNode.active = true; + } + //登录 - onLogin() { + async onLogin() { //初始化SDK信息 // SDKManager.init(() => { // //检测是否有授权,有授权直接登录,没有授权就先进主界面,到主界面获取权限 @@ -234,7 +246,21 @@ export class PreloadUI extends Component { // } // }) // }) - this.loginFinish = true; + + const reqData = { + GameName: "123", + Identifier: "abc", + IdentityType: 1, + OperateType: 1, + ShareDeposit: "", + MachineIdentifier: "aaa", + SdkUid: "", + }; + let res = await AuthService.I.login(reqData); + console.log("登录响应数据:", res); + if (res && res.code === ApiCode.OK) { + this.loginFinish = true; + }; } enterGame() { @@ -254,4 +280,8 @@ export class PreloadUI extends Component { ResManager.I.goMainScene(); //进入下一个场景 // ResManager.I.goCustomScene("Test2DScene"); //进入自定义场景 } + + private registerListener() { + GButton.BandClick(this.btnLogin, this.onLogin, this); + } } diff --git a/assets/Scripts/chat18x/network/client/ApiClient.ts b/assets/Scripts/chat18x/network/client/ApiClient.ts index ef7fab38..36fdf16d 100644 --- a/assets/Scripts/chat18x/network/client/ApiClient.ts +++ b/assets/Scripts/chat18x/network/client/ApiClient.ts @@ -68,11 +68,11 @@ export class ApiClient { return { code: parsed.code, msg: parsed.msg ?? (parsed.code === 1 ? "ok" : "error"), - data: parsed.data as Res + data: parsed.Data as Res }; } // 否则我们包一层 - return { code: ApiCode.OK, msg: "ok", data: parsed as Res }; + return { code: ApiCode.OK, msg: "ok", data: parsed.Data as Res }; } else if (ep.codec === "proto") { const data = ProtoCodec.decode(ep.resType!, r.body); // proto 场景一般没有 {code,msg} 包装,我们统一包一层