woso_javan 2 months ago
parent
commit
01ac9d161e

+ 15 - 7
assets/module_storm_sunder/Script/Component/ButtonComponent.ts

@@ -16,7 +16,7 @@ export class ButtonComponent extends Component {
     @property(Button) btSpeed: Button = null!;
     @property(Button) btExp: Button = null!;
 
-    protected start(): void {
+    protected onEnable(): void {
         this.addUIEvent();
         this.updateBtView(BonusType.ATTACK);
         this.updateBtView(BonusType.SPEED);
@@ -37,10 +37,13 @@ export class ButtonComponent extends Component {
 
         // 检查金额是否足够
         if (!AttributeBonusMgr.inst.checkMoneyEnough(bonus.upgradeCost)) {
-            console.log("金额不足");
-            //DOTO 看广告
-            this.updateBtStatus(type);
-            return;
+            if (!GlobalConfig.isDebug) {
+                AdvertMgr.instance.showReawardVideo(() => {
+                    this.upLevelBonus(type);
+                })
+            } else {
+                this.upLevelBonus(type);
+            }
         }
 
         // 扣除金额
@@ -48,6 +51,13 @@ export class ButtonComponent extends Component {
             return;
         }
 
+        this.upLevelBonus(type);
+        // console.log(`当前属性最终加成:${AttributeBonusMgr.inst.getBonus(type)}`);
+    }
+
+    private upLevelBonus(type: BonusType): void {
+        const { userModel } = AttributeBonusMgr.inst;
+        const bonus = userModel.bonusData[type];
         // 升级逻辑
         bonus.level++;
         // 更新升级消耗
@@ -57,8 +67,6 @@ export class ButtonComponent extends Component {
         // 更新按钮状态
         this.updateBtView(type);
         this.onUpdateBtnsStatus();
-
-        console.log(`当前属性最终加成:${AttributeBonusMgr.inst.getBonus(type)}`)
     }
 
     private onUpdateBtnsStatus(): void {

+ 2 - 2
assets/module_storm_sunder/Script/Manager/Effect2DUIMgr.ts

@@ -39,7 +39,7 @@ export class Effect2DUIMgr {
                     bloodComp.updateHP(hpPercent);
                 }
 
-                const height = existing.getComponent(UITransform).height * 20;
+                const height = existing.getComponent(UITransform).height * 15;
 
                 console.log('height:', height);
                 this.setPlayerInfoPosition(existing, target, bloodUI, height);
@@ -65,7 +65,7 @@ export class Effect2DUIMgr {
                 bloodComp.updateHP(hpPercent);
             }
 
-            const height = bloodNode.getComponent(UITransform).height * 20;
+            const height = bloodNode.getComponent(UITransform).height * 15;
             this.setPlayerInfoPosition(bloodNode, target, bloodUI, height);
             this.bloodMap.set(target, bloodNode);
         } catch (error) {

+ 1 - 1
assets/module_storm_sunder/Script/Model/UserModel.ts

@@ -6,7 +6,7 @@ import { AttributeBonusMgr, BonusType } from "../Manager/AttributeBonusMgr";
  * @param expPower 经验加成
 */
 export class UserModel {
-    money: number = 999999;
+    money: number = 1000;
     nickName: string = 'player'; //昵称
     // userTornadoLevel: number = 1; //玩家风暴等级