模板添加通用账号模块

This commit is contained in:
donggang
2024-02-27 14:07:47 +08:00
parent 207cebe4dc
commit 4d435bdc55
16 changed files with 212 additions and 5 deletions

View File

@@ -29,10 +29,13 @@
},
{
"__id__": 10
},
{
"__id__": 12
}
],
"_prefab": {
"__id__": 12
"__id__": 14
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -127,7 +130,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 280,
"width": 279.9999541519953,
"height": 50.4
},
"_anchorPoint": {
@@ -166,7 +169,7 @@
"_string": "自定义游戏内容",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 40,
"_actualFontSize": 42.599999999999994,
"_fontSize": 40,
"_fontFamily": "Arial",
"_lineHeight": 40,
@@ -180,6 +183,29 @@
"_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": ""
},
{
@@ -263,6 +289,24 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "a9Eh9hnWBPCZvjFwuFLNVw"
},
{
"__type__": "78b5dVjj81IxoHGx2PAK8bT",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "97BmmGMLZJ/LFADpl1Lm1t"
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@@ -9,6 +9,7 @@ import { DEBUG } from 'cc/env';
import { oops } from '../../extensions/oops-plugin-framework/assets/core/Oops';
import { Root } from '../../extensions/oops-plugin-framework/assets/core/Root';
import { ecs } from '../../extensions/oops-plugin-framework/assets/libs/ecs/ECS';
import { Account } from './game/account/Account';
import { smc } from './game/common/SingletonModuleComp';
import { UIConfigData } from './game/common/config/GameUIConfig';
import { Initialize } from './game/initialize/Initialize';
@@ -23,6 +24,7 @@ export class Main extends Root {
protected run() {
smc.initialize = ecs.getEntity<Initialize>(Initialize);
smc.account = ecs.getEntity<Account>(Account);
}
protected initGui() {

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "cc7a0ea4-ea6f-4f0f-9f35-c4921e5ab893",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,18 @@
/*
* @Author: dgflash
* @Date: 2021-11-11 17:45:23
* @LastEditors: dgflash
* @LastEditTime: 2022-08-01 13:49:37
*/
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { AccountModelComp } from "./model/AccountModelComp";
/** 账号模块 */
@ecs.register('Account')
export class Account extends ecs.Entity {
AccountModel!: AccountModelComp;
protected init() {
this.addComponents<ecs.Comp>(AccountModelComp);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "33c06a92-3daf-4c45-b4d4-39fd6efbb491",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "8f35d0a4-3ee2-4a90-a175-f49e9515e7f1",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "cd124d00-d854-4283-baf8-9c9d463ef23b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "829c1899-3552-4c56-8e03-5d056c1001f3",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "35161e65-2087-41b4-b51d-1130a52e6207",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,19 @@
/*
* @Author: dgflash
* @Date: 2021-11-12 10:02:31
* @LastEditors: dgflash
* @LastEditTime: 2022-07-25 17:03:45
*/
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
/**
* 游戏帐号数据
*/
@ecs.register('AccountModel')
export class AccountModelComp extends ecs.Comp {
reset() {
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "48e31ef6-0516-40f9-92de-856053566b00",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "2c878291-495b-4425-8c81-d3613cfd5ccc",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,29 @@
import { _decorator } from "cc";
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('DemoViewComp')
@ecs.register('DemoView', false)
export class DemoViewComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "78b5d563-8fcd-48c6-81c6-c763c02bc6d3",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -6,6 +6,7 @@
*/
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Account } from "../account/Account";
import { Initialize } from "../initialize/Initialize";
/** 游戏单例业务模块 */
@@ -13,6 +14,8 @@ import { Initialize } from "../initialize/Initialize";
export class SingletonModuleComp extends ecs.Comp {
/** 游戏初始化模块 */
initialize: Initialize = null!;
/** 游戏账号模块 */
account: Account = null!;
reset() { }
}

View File

@@ -8,8 +8,10 @@ import { _decorator } from "cc";
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCVMParentComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCVMParentComp";
import { UIID } from "../../common/config/GameUIConfig";
import { ModuleUtil } from "../../../../../extensions/oops-plugin-framework/assets/module/common/ModuleUtil";
import { UIID } from "../../common/config/GameUIConfig";
import { smc } from "../../common/SingletonModuleComp";
import { DemoViewComp } from "../../account/view/DemoViewComp";
const { ccclass, property } = _decorator;
@@ -76,7 +78,7 @@ export class LoadingViewComp extends CCVMParentComp {
// 获取用户信息的多语言提示文本
this.data.prompt = oops.language.getLangByID("loading_load_player");
ModuleUtil.removeView(this.ent, LoadingViewComp, UIID.Loading);
oops.gui.open(UIID.Demo);
ModuleUtil.addView(smc.account, DemoViewComp, UIID.Demo);
}
reset(): void { }