技能ui完成, todo 技能执行
This commit is contained in:
@@ -4,6 +4,8 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { Items } from "../common/config/Items";
|
||||
import { Item } from "./Item";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -13,26 +15,80 @@ const { ccclass, property } = _decorator;
|
||||
export class ShopHomeComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
|
||||
this.get_items();
|
||||
}
|
||||
get_items(){
|
||||
let free = this.node.getChildByName("goods_list").getChildByName("free").getChildByName("items");
|
||||
let goods1 = this.node.getChildByName("goods_list").getChildByName("goods1").getChildByName("items");
|
||||
let goods2 = this.node.getChildByName("goods_list").getChildByName("goods2").getChildByName("items");
|
||||
let goods3 = this.node.getChildByName("goods_list").getChildByName("goods3").getChildByName("items");
|
||||
|
||||
for (let x = 0; x < smc.goods.free.length; x++) {
|
||||
let item=ecs.getEntity<Item>(Item)
|
||||
item.load(smc.goods.free[x].uuid,smc.goods.free[x].num,free)
|
||||
}
|
||||
for (let x = 0; x < smc.goods.goods1.length; x++) {
|
||||
let item=ecs.getEntity<Item>(Item)
|
||||
item.load(smc.goods.goods1[x].uuid,smc.goods.goods1[x].num,goods1)
|
||||
}
|
||||
for (let x = 0; x < smc.goods.goods2.length; x++) {
|
||||
let item=ecs.getEntity<Item>(Item)
|
||||
item.load(smc.goods.goods2[x].uuid,smc.goods.goods2[x].num,goods2)
|
||||
}
|
||||
|
||||
for (let x = 0; x < smc.goods.goods3.length; x++) {
|
||||
let item=ecs.getEntity<Item>(Item)
|
||||
item.load(smc.goods.goods3[x].uuid,smc.goods.goods3[x].num,goods3)
|
||||
}
|
||||
// for (let x = 0; x < smc.goods.goods4.length; x++) {
|
||||
// let item=ecs.getEntity<Item>(Item)
|
||||
// item.load(smc.goods.goods4[x].uuid,smc.goods.goods4[x].num,goods4)
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
item_show(e:any,val:any){
|
||||
oops.gui.open(UIID.ItemInfo, Items[val]);
|
||||
}
|
||||
get_free(){
|
||||
console.log("免费领取")
|
||||
if(smc.vmdata.free.buy <= 0){
|
||||
oops.gui.toast("今日领取次数已用完");
|
||||
return
|
||||
}
|
||||
smc.vmdata.free.buy--
|
||||
}
|
||||
get_goods1(){
|
||||
console.log("购买商品1")
|
||||
if(smc.vmdata.goods1.buy <= 0){
|
||||
oops.gui.toast("今日购买次数已用完");
|
||||
return
|
||||
}
|
||||
smc.vmdata.goods1.buy--
|
||||
}
|
||||
get_goods2(){
|
||||
console.log("购买商品2")
|
||||
if(smc.vmdata.goods2.buy <= 0){
|
||||
oops.gui.toast("今日购买次数已用完");
|
||||
return
|
||||
}
|
||||
smc.vmdata.goods2.buy--
|
||||
}
|
||||
get_goods3(){
|
||||
console.log("购买商品3")
|
||||
if(smc.vmdata.goods3.buy <= 0){
|
||||
oops.gui.toast("今日购买次数已用完");
|
||||
return
|
||||
}
|
||||
smc.vmdata.goods3.buy--
|
||||
}
|
||||
get_goods4(){
|
||||
console.log("购买商品4")
|
||||
if(smc.vmdata.goods4.buy <= 0){
|
||||
oops.gui.toast("今日购买次数已用完");
|
||||
return
|
||||
}
|
||||
smc.vmdata.goods4.buy--
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
|
||||
Reference in New Issue
Block a user