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
"use strict";
cc._RF.push(module, '99ffdFAolFPBJURf0PC+9vw', 'vedio_look_window');
// Scripts/mod/vedio/view/vedio_look_window.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//     这里是描述这个窗体的作用的
// <br/>Create: 2019-06-04 11:49:06
// --------------------------------------------------------------------
var VedioMainItem = require("vedio_item_panel");
 
var PathTool = require("pathtool");
 
var VedioController = require("vedio_controller");
 
var VedioConst = require("vedio_const");
 
var Vedio_lookWindow = cc.Class({
  "extends": BaseView,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("vedio", "vedio_look_panel");
    this.viewTag = SCENE_TAG.dialogue; //该窗体所属ui层级,全屏ui需要在ui层,非全屏ui在dialogue层,这个要注意
 
    this.win_type = WinType.Mini; //是否是全屏窗体  WinType.Full, WinType.Big, WinType.Mini, WinType.Tips
 
    this.ctrl = VedioController.getInstance();
    this._model = this.ctrl.getModel();
  },
  // 初始化一些配置数据,可以用于声明一些变量之类的
  initConfig: function initConfig() {},
  // 预制体加载完成之后的回调,可以在这里捕获相关节点或者组件
  openCallBack: function openCallBack() {
    var self = this;
    self.background = self.root_wnd.getChildByName("background");
    self.main_container = self.root_wnd.getChildByName("main_container");
    self.main_panel = self.main_container.getChildByName("main_panel");
    self.title_lb = self.main_panel.getChildByName("win_title").getComponent(cc.Label);
    self.title_lb.string = Utils.TI18N("录像详情");
    self.cell = new VedioMainItem();
    self.cell.addCallBack(function (world_pos) {
      self.onShowSharePanel(world_pos);
    });
    self.cell.addPlayCallBack(function () {
      self.onClickBtnClose();
    });
    self.cell.setPosition(0, 0);
    self.cell.setParent(self.main_panel);
    self.cell.show(true);
  },
  // 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
  registerEvent: function registerEvent() {
    this.background.on("touchend", function () {
      this.ctrl.openVedioLookPanel(false);
      Utils.playButtonSound(2);
    }, this);
  },
  // 预制体加载完成之后,添加到对应主节点之后的回调,也就是一个窗体的正式入口,可以设置一些数据了
  openRootWnd: function openRootWnd(data) {
    this.setData(data);
  },
  setData: function setData(data) {
    this.data = data;
    this.cell.setData(data);
  },
  onShowSharePanel: function onShowSharePanel(world_pos) {
    if (!world_pos) return;
    if (!this.data) return;
    this.ctrl.openVedioSharePanel(true, this.data.id, world_pos, function (share_btn_type) {
      this.updateData(share_btn_type);
    }.bind(this), this.data.a_srv_id, this.data.combat_type);
  },
  onClickBtnClose: function onClickBtnClose() {
    this.ctrl.openVedioLookPanel(false);
  },
  updateData: function updateData(share_btn_type) {
    if (!this.data) return;
 
    if (share_btn_type == VedioConst.Share_Btn_Type.eGuildBtn) {
      this.data.share = this.data.share + 1;
    } else {
      // -- share_btn_type == VedioConst.Share_Btn_Type.eWorldBtn
      // -- 默认世界分享
      this.data.share = this.data.share + 1;
    }
 
    this.cell.setData(this.data);
  },
  // 关闭窗体回调,需要在这里调用该窗体所属controller的close方法没用于置空该窗体实例对象
  closeCallBack: function closeCallBack() {
    if (this.cell) {
      this.cell.deleteMe();
      this.cell = null;
    }
 
    this.ctrl.openVedioLookPanel(false);
  }
});
 
cc._RF.pop();