refactor(game): 移除未使用的数据模块和测试代码
清理不再使用的数据模块文件(data相关)和测试代码(Test.ts),优化项目结构
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
import { oops } from "db://oops-framework/core/Oops"
|
|
||||||
|
|
||||||
export class Test{
|
|
||||||
load_data_from_local() {
|
|
||||||
let local_data = this.get_local_data()
|
|
||||||
if(!local_data.data||!local_data.fight_heros||!local_data.heros||!local_data.items||!local_data.tals||!local_data.equips){
|
|
||||||
return this.init_local_data()
|
|
||||||
}
|
|
||||||
return local_data
|
|
||||||
}
|
|
||||||
get_local_data(){
|
|
||||||
let local_data ={
|
|
||||||
user_id: "local_debug",
|
|
||||||
openid: "local_debug",
|
|
||||||
regist_time: Date.now(),
|
|
||||||
data: JSON.parse(oops.storage.get("data")||null),
|
|
||||||
fight_heros: JSON.parse(oops.storage.get("fight_heros")||null),
|
|
||||||
heros: JSON.parse(oops.storage.get("heros")||null),
|
|
||||||
items: JSON.parse(oops.storage.get("items")||null),
|
|
||||||
tals: JSON.parse(oops.storage.get("tals")||null),
|
|
||||||
equips: JSON.parse(oops.storage.get("equips")||null)
|
|
||||||
}
|
|
||||||
return local_data
|
|
||||||
}
|
|
||||||
init_local_data(){
|
|
||||||
let init_data = {
|
|
||||||
data : { score: 0, mission: 1, gold: 100, diamond: 100, meat: 0, exp: 0,},
|
|
||||||
fight_heros: { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0 },
|
|
||||||
heros: {
|
|
||||||
5001: { uuid: 5001, lv: 1 },
|
|
||||||
5005: { uuid: 5005, lv: 1 },
|
|
||||||
5007: { uuid: 5007, lv: 1 }
|
|
||||||
},
|
|
||||||
items: {},
|
|
||||||
tals: {},
|
|
||||||
equips: {}
|
|
||||||
}
|
|
||||||
oops.storage.set("data", JSON.stringify(init_data.data))
|
|
||||||
oops.storage.set("fight_heros", JSON.stringify(init_data.fight_heros))
|
|
||||||
oops.storage.set("heros", JSON.stringify(init_data.heros))
|
|
||||||
oops.storage.set("items", JSON.stringify(init_data.items))
|
|
||||||
oops.storage.set("tals", JSON.stringify(init_data.tals))
|
|
||||||
oops.storage.set("equips", JSON.stringify(init_data.equips))
|
|
||||||
return this.get_local_data()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.24",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "893646a7-1cf0-4c80-8fe1-39ac111130fc",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { _decorator, Component, Node } from 'cc';
|
|
||||||
import { oops } from 'db://oops-framework/core/Oops';
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
@ccclass('stoast')
|
|
||||||
export class stoast extends Component {
|
|
||||||
|
|
||||||
|
|
||||||
onAdded(args: any) {
|
|
||||||
console.log("toast打开",args)
|
|
||||||
}
|
|
||||||
|
|
||||||
private close() {
|
|
||||||
oops.gui.removeByNode(this.node);
|
|
||||||
}
|
|
||||||
|
|
||||||
onDestroy() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.24",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "d26fa84f-22b4-4136-bb46-d7e978683365",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "7d9b27df-701e-44ee-8732-b53f9d22cca2",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
||||||
import { dataModelComp } from "./dataModelComp";
|
|
||||||
import { dataViewComp } from "./dataViewComp";
|
|
||||||
/** data 模块 */
|
|
||||||
@ecs.register(`data`)
|
|
||||||
export class data extends ecs.Entity {
|
|
||||||
/** ---------- 数据层 ---------- */
|
|
||||||
dataModel!: dataModelComp;
|
|
||||||
|
|
||||||
/** ---------- 业务层 ---------- */
|
|
||||||
// dataBll!: dataBllComp;
|
|
||||||
|
|
||||||
/** ---------- 视图层 ---------- */
|
|
||||||
dataView!: dataViewComp;
|
|
||||||
|
|
||||||
/** 实始添加的数据层组件 */
|
|
||||||
protected init() {
|
|
||||||
this.addComponents<ecs.Comp>(dataViewComp,dataModelComp);
|
|
||||||
}
|
|
||||||
changeHp(min: number, max: number){
|
|
||||||
var data = this.dataModel;
|
|
||||||
}
|
|
||||||
/** 模块资源释放 */
|
|
||||||
destroy() {
|
|
||||||
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
|
|
||||||
super.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** data 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */
|
|
||||||
export class EcsdataSystem extends ecs.System {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
// this.add(new ecs.ComblockSystem());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.24",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "cb9afa42-2112-471e-b86c-79407ba6abd4",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
||||||
import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
|
|
||||||
import { CCVMParentComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCVMParentComp";
|
|
||||||
|
|
||||||
|
|
||||||
/** 数据层对象 */
|
|
||||||
@ecs.register('dataModel')
|
|
||||||
export class dataModelComp extends CCVMParentComp {
|
|
||||||
/** 提供 MVVM 组件使用的数据 */
|
|
||||||
/** VM 组件绑定数据 */
|
|
||||||
vm: any = {
|
|
||||||
name : "数据测试",
|
|
||||||
/** 当前等级 */
|
|
||||||
porwer: 0,
|
|
||||||
/** 当前经验 */
|
|
||||||
def : 0,
|
|
||||||
/** 下级经验 */
|
|
||||||
speed : 0,
|
|
||||||
hp: {
|
|
||||||
min:50,
|
|
||||||
max:100
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 显示数据添加到 MVVM 框架中监视 */
|
|
||||||
vmAdd() {
|
|
||||||
console.log("dataModelComp vmAdd");
|
|
||||||
VM.add(this.vm, "data");
|
|
||||||
}
|
|
||||||
changeHp(min: number, max: number) {
|
|
||||||
this.vm.hp.min =this.vm.hp.min +min
|
|
||||||
this.vm.hp.max =this.vm.hp.max +max
|
|
||||||
}
|
|
||||||
/** 显示数据从 MVVM 框架中移除 */
|
|
||||||
vmRemove() {
|
|
||||||
VM.remove("data");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 数据层组件移除时,重置所有数据为默认值 */
|
|
||||||
reset() {
|
|
||||||
for (var key in this.vm) {
|
|
||||||
delete this.vm[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.24",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "0aefc30a-9392-4ada-b3d0-8c15625e8cfc",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
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('dataViewComp')
|
|
||||||
@ecs.register('dataView', true)
|
|
||||||
export class dataViewComp 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) {
|
|
||||||
console.log(event, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
||||||
reset() {
|
|
||||||
this.node.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.24",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "8ae6d033-ff0f-44d5-9ff7-c57751bd4ea1",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { _decorator } from "cc";
|
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
||||||
import { CCVMParentComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCVMParentComp";
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
/** 视图层对象 - 支持 MVVM 框架的数据绑定 */
|
|
||||||
@ccclass('dataViewVMComp')
|
|
||||||
@ecs.register('dataViewVM', false)
|
|
||||||
export class dataViewVMComp extends CCVMParentComp {
|
|
||||||
/** 脚本控制的界面 MVVM 框架绑定数据 */
|
|
||||||
data: any = {};
|
|
||||||
|
|
||||||
/** 视图层逻辑代码分离演示 */
|
|
||||||
start() {
|
|
||||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
||||||
reset() {
|
|
||||||
this.node.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.24",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "4209bcee-3867-4c0b-83c9-a4eeee989328",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -14,9 +14,6 @@ import { LoadingViewComp } from "./view/LoadingViewComp";
|
|||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
||||||
|
|
||||||
import { Test } from "../common/Test";
|
|
||||||
|
|
||||||
// import {data} from "../data/data";
|
|
||||||
/**
|
/**
|
||||||
* 游戏进入初始化模块
|
* 游戏进入初始化模块
|
||||||
* 1、热更新
|
* 1、热更新
|
||||||
@@ -26,11 +23,7 @@ import { Test } from "../common/Test";
|
|||||||
export class Initialize extends ecs.Entity {
|
export class Initialize extends ecs.Entity {
|
||||||
LoadingView!: LoadingViewComp;
|
LoadingView!: LoadingViewComp;
|
||||||
|
|
||||||
// data:data=null!;
|
|
||||||
protected init() {
|
protected init() {
|
||||||
|
|
||||||
// this.data=ecs.getEntity<data>(data);
|
|
||||||
// this.data.dataModel.vmAdd();
|
|
||||||
var queue: AsyncQueue = new AsyncQueue();
|
var queue: AsyncQueue = new AsyncQueue();
|
||||||
// 加载自定义资
|
// 加载自定义资
|
||||||
this.loadCustom(queue);
|
this.loadCustom(queue);
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "46a59ed4-e4fc-48ef-9afe-fcd7a47e6665",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user