mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
47
JisolGameCocos/assets/script/ui/Debugger/Debugger.ts
Normal file
47
JisolGameCocos/assets/script/ui/Debugger/Debugger.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
|
||||
import { Prefab } from 'cc';
|
||||
import { TD } from '../../App';
|
||||
import { instantiate } from 'cc';
|
||||
import { Button } from 'cc';
|
||||
import { EventHandler } from 'cc';
|
||||
import { Input } from 'cc';
|
||||
import { TB, TbGResource } from '../../config/data/schema';
|
||||
import { API } from '../../consts/API';
|
||||
import { Label } from 'cc';
|
||||
import { EditBox } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('Debugger')
|
||||
export class Debugger extends JNLayerBase {
|
||||
|
||||
@property(EditBox)
|
||||
text:EditBox;
|
||||
|
||||
@property(Node)
|
||||
resources:Node;
|
||||
|
||||
@property(Prefab)
|
||||
debuger:Prefab;
|
||||
|
||||
onJNLoad(data?: any): void {
|
||||
super.onJNLoad();
|
||||
this.onUpdateView();
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
TD.TbGResource.getDataList().forEach(config => {
|
||||
let debuger:Node;
|
||||
this.resources.addChild(debuger = instantiate(this.debuger));
|
||||
debuger.on(Input.EventType.TOUCH_END,async () => await this.onClickResources(config),this);
|
||||
debuger.getComponentInChildren(Label).string = config.name;
|
||||
})
|
||||
}
|
||||
|
||||
async onClickResources(config:TB.TbGResource){
|
||||
await API.DebuggerAddResource(config.id,parseInt(this.text.string) || 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "73341f32-5e98-4e17-ab66-ecdfba295c25",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user