difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
"use strict";
cc._RF.push(module, 'cd98dYaRCNFELc5JdeLIbzW', 'game_views');
// Scripts/game_views.js
 
"use strict";
 
var StoryController = require("story_controller");
 
var GuideController = require("guide_controller");
 
window.WaitingStaus = {
  "CONNECT": 1,
  "LOADING": 2
};
cc.Class({
  "extends": cc.Component,
  properties: {// scene_tag: { default: null, type: cc.Node },
    // battle_tag: { default: null, type: cc.Node },
    // effect_tag: { default: null, type: cc.Node },
    // ui_tag: { default: null, type: cc.Node },
    // win_tag: { default: null, type: cc.Node },
    // top_tag: { default: null, type: cc.Node },
    // dialogue_tag: { default: null, type: cc.Node },
    // msg_tag: { default: null, type: cc.Node },
    // reconnect_tag: { default: null, type: cc.Node },
    // loading_tag: { default: null, type: cc.Node },
    // left_fill_bg: { default: null, type: cc.Node },
    // right_gill_bg: { default: null, type: cc.Node },
    // _waiting_status: null,
  },
  onLoad: function onLoad() {
    this.scene_tag = this.node.getChildByName("scene_tag");
    this.battle_tag = this.node.getChildByName("battle_tag");
    this.effect_tag = this.node.getChildByName("effect_tag");
    this.ui_tag = this.node.getChildByName("ui_tag");
    this.win_tag = this.node.getChildByName("win_tag");
    this.top_tag = this.node.getChildByName("top_tag");
    this.dialogue_tag = this.node.getChildByName("dialogue_tag");
    this.msg_tag = this.node.getChildByName("msg_tag");
    this.reconnect_tag = this.node.getChildByName("reconnect_tag");
    this.loading_tag = this.node.getChildByName("loading_tag");
    this.fille_nd = this.node.getChildByName("fille_node");
    this.left_fill_bg = this.fille_nd.getChildByName("left_bg");
    this.right_gill_bg = this.fille_nd.getChildByName("right_bg");
    var fille_bg_width = (cc.winSize.width - 720) * 0.5 + 50;
    this.left_fill_bg.width = fille_bg_width;
    this.right_gill_bg.width = fille_bg_width;
    this.touch_cp = this.msg_tag.addComponent(cc.BlockInputEvents);
    this.touch_cp.enabled = false;
  },
  start: function start() {// this.initWaitingView();
  },
  initMsgView: function initMsgView() {
    var effect_path = "spine/" + "E51110" + "/" + "action" + ".atlas";
    LoaderManager.getInstance().loadRes(effect_path, function (effect_sd) {
      this.touch_effect_nd = new cc.Node();
      this.loading_tag.addChild(this.touch_effect_nd);
      this.touch_efftct_sk = this.touch_effect_nd.addComponent(sp.Skeleton);
      this.touch_efftct_sk.skeletonData = effect_sd;
    }.bind(this));
    this.loading_tag.on(cc.Node.EventType.TOUCH_END, function (event) {
      // 判断是否在新手引导和剧情中
      if (GuideController.getInstance().isInGuide() || StoryController.getInstance().isInStory()) return;
 
      if (this.touch_efftct_sk && this.touch_effect_nd) {
        var pos = event.touch.getLocation();
        var tar_pos = this.loading_tag.convertToNodeSpaceAR(pos);
        this.touch_effect_nd.position = tar_pos;
        this.touch_efftct_sk.setAnimation(0, "action", false);
      }
    }, this);
    if (this.loading_tag._touchListener) this.loading_tag._touchListener.setSwallowTouches(false);
  },
  initWaitingView: function initWaitingView() {
    var mask_nd = this.mask_nd = new cc.Node();
    mask_nd.setContentSize(this.loading_tag.getContentSize());
 
    if (window.isMobile && window.FIT_HEIDGHT) {
      mask_nd.scale = FIT_SCALE;
    }
 
    this.loading_tag.addChild(mask_nd);
    this.touch_block = mask_nd.addComponent(cc.BlockInputEvents);
    var graphics_cp = this.waitint_mask = mask_nd.addComponent(cc.Graphics);
    graphics_cp.clear();
    graphics_cp.fillColor = cc.color(0, 0, 0, 168);
    graphics_cp.rect(-0.5 * mask_nd.width, -0.5 * (mask_nd.height * FIT_SCALE), mask_nd.width, mask_nd.height * FIT_SCALE);
    graphics_cp.fill();
    var skeleton_nd = this.skeleton_nd = new cc.Node();
    this.mask_nd.addChild(skeleton_nd);
    var waiting_sk = this.waiting_sk = skeleton_nd.addComponent(sp.Skeleton);
    LoaderManager.getInstance().loadRes("spine/E51006/action" + ".atlas", function (waiting_sd) {
      this.waiting_sk.skeletonData = waiting_sd;
    }.bind(this));
    mask_nd.active = false;
    this.touch_block.enabled = false;
    skeleton_nd.active = false;
  },
  // 更新等待界面状态
  updateWaitingStatus: function updateWaitingStatus(status) {
    if (this._waiting_status === status) return;
 
    if (status && this.waiting_sk.skeletonData) {
      this.mask_nd.active = true;
      this.skeleton_nd.active = true;
      this.touch_block.enabled = true;
 
      if (status == WaitingStaus.CONNECT) {
        this.waiting_sk.setAnimation(0, "action", true);
      } else if (status == WaitingStaus.LOADING) {
        this.waiting_sk.setAnimation(0, "action1", true);
        this.cancle_timer = gcore.Timer.set(function () {
          if (this._waiting_status == WaitingStaus.LOADING) {
            this.updateWaitingStatus(false);
          }
        }.bind(this), 6000, 1);
      }
    } else {
      this.mask_nd.active = false;
      this.skeleton_nd.active = false;
 
      if (this.cancle_timer) {
        gcore.Timer.del(this.cancle_timer);
        this.cancle_timer = null;
      }
    }
 
    this._waiting_status = status;
  },
  showFrame: function showFrame() {
    this.fille_nd.active = true;
  },
  forBidTouch: function forBidTouch() {
    this.touch_cp.enabled = true;
  },
  cancelTouch: function cancelTouch() {
    this.touch_cp.enabled = false;
  }
});
 
cc._RF.pop();