| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import { Data } from "../../../mk/data/Data";
- import GuideWeak from "../../module/guideWeak/GuideWeak";
- /**
- * 弱引导数据
- * - 主界面-弱引导
- 1. 弱引导启动:用户在主界面超过10秒未操作【配置】。
- 2. 弱引导效果:自动弹出以下界面中的一种:气泡红包界面、福袋界面、互推界面……【配置】
- 3. 配置需支持配置界面ID和对应的弹出概率。
- - 关卡界面-弱引导
- 1. 弱引导启动:用户在关卡界面超过10秒未操作【配置】。
- 2. 弱引导效果:自动弹出以下界面中的一种:气泡红包界面、福袋界面、互推界面……【配置】
- 3. 配置需支持配置界面ID和对应的弹出概率。
- * @author 薛鸿潇
- */
- export default class GuideWeakData {
- /**
- * 数据初始化
- */
- public init() {
- // this.data_config = data_config;
- if (gData.gameData.configs.ServerConfig.triggerTime)
- this.data_config.triggerTime = gData.gameData.configs.ServerConfig.triggerTime;
- if (gData.gameData.configs.ServerConfig.panelWeight) {
- }
- }
- /**
- * 星云数据配置
- * - 面板权重
- * - 触发时间
- */
- public data_config = {
- panelWeight: {
- "1": 10,
- "2": 10,
- "4": 10,
- "5": 10,
- "6": 10,
- "7": 10
- },
- triggerTime: 5
- }
- /** 功能是否启动 */
- public enable: boolean = false;
- /** 引导正在运行 */
- /** 样式类 */
- public guideStyle: GuideWeak = null;
- /**
- * 玩家静默时间
- * - 即:未进行任何操作的时间
- */
- public silent_time: number = 0;
- /** 当前打开的界面id */
- public cur_guide_id: number = 0;
- /** 当前打开的界面名字 */
- public cur_guide_panel: string = null;
- public initGuideId() {
- // gData.guideWeakData.cur_guide_id = 1 + 1;
- const panelWeight = this.data_config.panelWeight;
- let p_count = 0;
- let total_weight = 0;
- for (const key in panelWeight) {
- total_weight += panelWeight[key];
- p_count++;
- }
- /** 累计零时权重 */
- let temp_weight_sum = 0;
- // 根据奖池权重随机物品
- let random = mk.math.random(1, total_weight);
- for (const key in panelWeight) {
- temp_weight_sum += panelWeight[key];
- if (random < temp_weight_sum) {
- // 中奖了
- gData.guideWeakData.cur_guide_id = parseInt(key);
- break;
- }
- }
- }
- public openPanelByBtn() {
- const panel_id = gData.guideWeakData.cur_guide_id
- gData.gameData.funBtns['btn' + panel_id].emit('click')
- }
- public panel_name_config = {
- moreGame: 1,
- turnable: 2,
- none: 3,
- pigBank: 4,
- blessingBag: 5,
- sign: 6,
- redBagCash: 7,
- }
- }
|