重做 局内经验的利用,加攻 加血,特殊技能,todo:先完成物品设定
This commit is contained in:
@@ -10,6 +10,7 @@ import { BossViewComp } from "../Boss/BossViewComp";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { MissionReward } from "../common/config/MissionSet";
|
||||
import { Items } from "../common/config/Items";
|
||||
import { Item } from "./Item";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -20,38 +21,42 @@ export class VictoryComp extends CCComp {
|
||||
reward_lv:number=1
|
||||
reward_num:number=2
|
||||
rerawd_item:any={}
|
||||
if_show:boolean=false
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
}
|
||||
private do_victiry() {
|
||||
if(this.if_show) return
|
||||
this.node.getChildByName("Node").active = true;
|
||||
this.getReward()
|
||||
this.getReward(true)
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = false
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = true;
|
||||
}
|
||||
private do_defeat() {
|
||||
if(this.if_show) return
|
||||
this.node.getChildByName("Node").active = true;
|
||||
this.getReward()
|
||||
this.getReward(false)
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = false;
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = true
|
||||
}
|
||||
getReward(){
|
||||
let reward1:any = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], 1);
|
||||
let reward2:any = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], 1);
|
||||
let item1 =Items[reward1[0]]
|
||||
let item2 =Items[reward2[1]]
|
||||
let r1_num=0
|
||||
let r2_num=0
|
||||
console.log("getReward:",item1,item2)
|
||||
this.node.getChildByName("Node").getChildByName("item2").getChildByName("num").getComponent(Label).string=item1.r_num.toString()
|
||||
this.node.getChildByName("Node").getChildByName("item2").getChildByName("name").getComponent(Label).string=item1.name.toString()
|
||||
this.node.getChildByName("Node").getChildByName("item3").getChildByName("num").getComponent(Label).string=item2.r_num.toString()
|
||||
this.node.getChildByName("Node").getChildByName("item3").getChildByName("name").getComponent(Label).string=item2.r_num.toString()
|
||||
|
||||
|
||||
getReward(is_victory:boolean){
|
||||
let conut =2
|
||||
if(is_victory) conut=1
|
||||
let item1=ecs.getEntity<Item>(Item)
|
||||
let gold: number = Math.floor(RandomManager.instance.getRandomInt((3000 + smc.vmdata.mission.lv * 100) / 3 * 2, 3000 + smc.vmdata.mission.lv * 100));
|
||||
let parent = this.node.getChildByName("Node").getChildByName("items")
|
||||
item1.load(1001,gold,parent)
|
||||
for (let i = 0; i < conut; i++) {
|
||||
let item=ecs.getEntity<Item>(Item)
|
||||
let reward:any = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], 1);
|
||||
let im =Items[reward[0]]
|
||||
item.load(im.uuid,im.r_num,parent)
|
||||
}
|
||||
this.if_show=true
|
||||
}
|
||||
end_mission(){
|
||||
this.node.getChildByName("Node").active=false
|
||||
this.if_show=false
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user