|
@@ -2,18 +2,16 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-03-21 11:57:43
|
|
* @Date: 2025-03-21 11:57:43
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-04-18 17:07:22
|
|
|
|
|
|
|
+ * @LastEditTime: 2025-04-18 18:04:32
|
|
|
* @Description: 惊喜翻倍弹窗
|
|
* @Description: 惊喜翻倍弹窗
|
|
|
*/
|
|
*/
|
|
|
-import { _decorator, instantiate, Label, Node, Prefab, UITransform, ProgressBar } from 'cc';
|
|
|
|
|
|
|
+import { _decorator, instantiate, Label, Node, Prefab, UITransform } from 'cc';
|
|
|
import { oops } from 'db://oops-framework/core/Oops';
|
|
import { oops } from 'db://oops-framework/core/Oops';
|
|
|
-import { CCVMParentComp } from 'db://oops-framework/module/common/CCVMParentComp';
|
|
|
|
|
|
|
+import VMParent from 'db://oops-framework/libs/model-view/VMParent';
|
|
|
import { AD_TYPE } from '../common/config/GameDefine';
|
|
import { AD_TYPE } from '../common/config/GameDefine';
|
|
|
import { UIID } from '../common/config/GameUIConfig';
|
|
import { UIID } from '../common/config/GameUIConfig';
|
|
|
import { ADHandler } from '../common/manager/ADHandler';
|
|
import { ADHandler } from '../common/manager/ADHandler';
|
|
|
import { smc } from '../common/SingletonModuleComp';
|
|
import { smc } from '../common/SingletonModuleComp';
|
|
|
-import { ecs } from 'db://oops-framework/libs/ecs/ECS';
|
|
|
|
|
-import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
|
|
|
|
|
import { BricsItem } from './BricsItem';
|
|
import { BricsItem } from './BricsItem';
|
|
|
|
|
|
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
@@ -30,21 +28,9 @@ interface LevelInfo {
|
|
|
|
|
|
|
|
/** 显示对象控制 */
|
|
/** 显示对象控制 */
|
|
|
@ccclass('DoubleRewardsView')
|
|
@ccclass('DoubleRewardsView')
|
|
|
-export class DoubleRewardsView extends GameComponent {
|
|
|
|
|
|
|
+export class DoubleRewardsView extends VMParent {
|
|
|
@property([Label])
|
|
@property([Label])
|
|
|
lab_list: Label[] = [];
|
|
lab_list: Label[] = [];
|
|
|
- @property(Label)
|
|
|
|
|
- private lab_time: Label = null!; //提示文字 倒数
|
|
|
|
|
-
|
|
|
|
|
- //第一个面板
|
|
|
|
|
- @property(Node)
|
|
|
|
|
- private tipsNode: Node = null!; //提示Node
|
|
|
|
|
- @property(ProgressBar)
|
|
|
|
|
- private tipsBar1: ProgressBar = null!; //进度条
|
|
|
|
|
- @property(Label)
|
|
|
|
|
- private lab_title1: Label = null!; //提示文字
|
|
|
|
|
- @property(Label)
|
|
|
|
|
- private lab_tips: Label = null!; //提示文字 已赚,还差
|
|
|
|
|
@property(Node)
|
|
@property(Node)
|
|
|
private redBagNode: Node = null!; //红包Node
|
|
private redBagNode: Node = null!; //红包Node
|
|
|
@property(Node)
|
|
@property(Node)
|
|
@@ -56,14 +42,9 @@ export class DoubleRewardsView extends GameComponent {
|
|
|
@property(Node)
|
|
@property(Node)
|
|
|
private tipsLabelNode: Node = null!; //提示文字Node
|
|
private tipsLabelNode: Node = null!; //提示文字Node
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @property(Label)
|
|
|
|
|
- private lab_title2: Label = null!; //提示文字
|
|
|
|
|
- @property(ProgressBar)
|
|
|
|
|
- private tipsBar2: ProgressBar = null!; //进度条
|
|
|
|
|
@property(Node)
|
|
@property(Node)
|
|
|
private levelListNode: Node = null!; //等级Node
|
|
private levelListNode: Node = null!; //等级Node
|
|
|
|
|
+
|
|
|
@property(Prefab)
|
|
@property(Prefab)
|
|
|
private levelItemPrefab: Prefab = null!; //等级Item预制体
|
|
private levelItemPrefab: Prefab = null!; //等级Item预制体
|
|
|
|
|
|
|
@@ -143,22 +124,6 @@ export class DoubleRewardsView extends GameComponent {
|
|
|
this.data.handlingCharge = info.handingChargeProgress.handingCharge;
|
|
this.data.handlingCharge = info.handingChargeProgress.handingCharge;
|
|
|
this.data.curGoldNum = info.handingChargeProgress.hasNum;
|
|
this.data.curGoldNum = info.handingChargeProgress.hasNum;
|
|
|
this.data.gapGoldNum = info.handingChargeProgress.gapNum;
|
|
this.data.gapGoldNum = info.handingChargeProgress.gapNum;
|
|
|
- let str = this.lab_title1.string;
|
|
|
|
|
- str = str.replace("{{0}}", this.data.curGoldNum + "");
|
|
|
|
|
- str = str.replace("{{1}}", this.data.totalGoldNum + "");
|
|
|
|
|
- this.lab_title1.string = str;
|
|
|
|
|
- //已赚 还差
|
|
|
|
|
- let str2 = this.lab_tips.string;
|
|
|
|
|
- str2 = str2.replace("{{0}}", this.data.curGoldNum + "");
|
|
|
|
|
- str2 = str2.replace("{{1}}", this.data.gapGoldNum + "");
|
|
|
|
|
- this.lab_tips.string = str2;
|
|
|
|
|
- //进度条计算
|
|
|
|
|
- let progress = this.data.curGoldNum / this.data.handlingCharge;
|
|
|
|
|
- if (progress > 1) {
|
|
|
|
|
- progress = 1;
|
|
|
|
|
- }
|
|
|
|
|
- this.tipsBar1.progress = progress;
|
|
|
|
|
-
|
|
|
|
|
const showNode = this.node.getChildByPath("bottonNode/tips_node1");
|
|
const showNode = this.node.getChildByPath("bottonNode/tips_node1");
|
|
|
if (showNode) {
|
|
if (showNode) {
|
|
|
showNode.active = true;
|
|
showNode.active = true;
|
|
@@ -191,12 +156,10 @@ export class DoubleRewardsView extends GameComponent {
|
|
|
if (showNode) {
|
|
if (showNode) {
|
|
|
showNode.active = false;
|
|
showNode.active = false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
if (info.levelProgress) {
|
|
if (info.levelProgress) {
|
|
|
//设置进度条
|
|
//设置进度条
|
|
|
//克隆,然后添加
|
|
//克隆,然后添加
|
|
|
-
|
|
|
|
|
const showNode = this.node.getChildByPath("bottonNode/tips_node2");
|
|
const showNode = this.node.getChildByPath("bottonNode/tips_node2");
|
|
|
if (showNode) {
|
|
if (showNode) {
|
|
|
showNode.active = true;
|
|
showNode.active = true;
|
|
@@ -208,6 +171,7 @@ export class DoubleRewardsView extends GameComponent {
|
|
|
levelInfoList.forEach((item, index) => {
|
|
levelInfoList.forEach((item, index) => {
|
|
|
const levelItem = instantiate(this.levelItemPrefab);
|
|
const levelItem = instantiate(this.levelItemPrefab);
|
|
|
this.levelListNode.addChild(levelItem);
|
|
this.levelListNode.addChild(levelItem);
|
|
|
|
|
+ this.levelListNode.addChild(levelItem);
|
|
|
if (item.position) {
|
|
if (item.position) {
|
|
|
levelItem.setPosition(item.position, 0);
|
|
levelItem.setPosition(item.position, 0);
|
|
|
//设置数据
|
|
//设置数据
|
|
@@ -218,6 +182,16 @@ export class DoubleRewardsView extends GameComponent {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ //计算进度//如果当前关提现了
|
|
|
|
|
+ //const 最大关
|
|
|
|
|
+ const maxLevel = levelInfoList[levelInfoList.length - 1].level;
|
|
|
|
|
+ //const 当前关
|
|
|
|
|
+ const currentLevel = smc.account.AccountModel.curLevel;
|
|
|
|
|
+ this.data.curGoldNum = currentLevel;
|
|
|
|
|
+ this.data.handlingCharge = maxLevel;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
} else {
|
|
} else {
|
|
|
//隐藏节点
|
|
//隐藏节点
|
|
|
const showNode = this.node.getChildByPath("bottonNode/tips_node2");
|
|
const showNode = this.node.getChildByPath("bottonNode/tips_node2");
|
|
@@ -236,6 +210,7 @@ export class DoubleRewardsView extends GameComponent {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
//计算位置
|
|
//计算位置
|
|
|
calculatePositions(levelInfoList: LevelInfo[], totalLength: number = 516): LevelInfo[] {
|
|
calculatePositions(levelInfoList: LevelInfo[], totalLength: number = 516): LevelInfo[] {
|
|
|
if (levelInfoList.length === 0) return [];
|
|
if (levelInfoList.length === 0) return [];
|
|
@@ -297,8 +272,4 @@ export class DoubleRewardsView extends GameComponent {
|
|
|
return item;
|
|
return item;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- reset(): void {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|