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, 'b87eeQcmM5AvYJNW92A50p4', 'ladder_rank_window');
// Scripts/mod/ladder/view/ladder_rank_window.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//     这里是描述这个窗体的作用的
// <br/>Create: 2019-07-24 16:55:57
// --------------------------------------------------------------------
var PlayerHead = require("playerhead");
 
var CommonScrollview = require('common_scrollview');
 
var LadderController = require("ladder_controller");
 
var PathTool = require("pathtool");
 
var Ladder_rankWindow = cc.Class({
  "extends": BaseView,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("ladder", "ladder_rank_window");
    this.viewTag = SCENE_TAG.dialogue; //该窗体所属ui层级,全屏ui需要在ui层,非全屏ui在dialogue层,这个要注意
 
    this.win_type = WinType.Big; //是否是全屏窗体  WinType.Full, WinType.Big, WinType.Mini, WinType.Tips
  },
  // 初始化一些配置数据,可以用于声明一些变量之类的
  initConfig: function initConfig() {
    this.ctrl = LadderController.getInstance();
    this.model = this.ctrl.getModel();
  },
  // 预制体加载完成之后的回调,可以在这里捕获相关节点或者组件
  openCallBack: function openCallBack() {
    this.background = this.seekChild("background");
    this.background.scale = FIT_SCALE;
    this.main_panel = this.seekChild("main_container");
    this.close_btn = this.seekChild("close_btn");
    var title_con = this.seekChild("title_con");
    var title_lb = this.seekChild(title_con, "title_label", cc.Label);
    title_lb.string = Utils.TI18N("排行榜");
    this.no_log_image_nd = this.seekChild(this.main_panel, "no_log_image");
    this.no_log_image_nd.active = false;
    this.rank_panel = this.seekChild("rank_panel");
    this.my_rank = this.seekChild(this.main_panel, "my_rank");
    var title = this.seekChild(this.my_rank, "title", cc.Label);
    title.string = Utils.TI18N("我的排名");
    this.no_rank_label_nd = this.seekChild(this.my_rank, "no_rank_label");
    this.no_rank_label_nd.active = false;
    this.my_rank_id_nd = this.seekChild(this.my_rank, "rank_id");
    this.my_name_lb = this.seekChild(this.my_rank, "my_name_label", cc.Label);
    this.my_attk_lb = this.seekChild(this.my_rank, "my_attk_label", cc.Label);
    this.my_guild_lb = this.seekChild(this.my_rank, "my_guild_label", cc.Label);
    this.best_rank_lb = this.seekChild(this.my_rank, "best_rank_label", cc.Label);
    this.my_head = new PlayerHead();
    this.my_head.setScale(0.8);
    this.my_head.setPosition(150, 66);
    this.my_head.setParent(this.my_rank);
    this.my_head.show();
    var bgSize = this.rank_panel.getContentSize();
    var tab_size = cc.size(bgSize.width, bgSize.height - 4);
    var setting = {
      item_class: LadderRankItem,
      // 单元类
      start_x: 5,
      // 第一个单元的X起点
      space_x: 0,
      // x方向的间隔
      start_y: 0,
      // 第一个单元的Y起点
      space_y: 0,
      // y方向的间隔
      item_width: 612,
      // 单元的尺寸width
      item_height: 112,
      // 单元的尺寸height
      row: 0,
      // 行数,作用于水平滚动类型
      col: 1,
      // 列数,作用于垂直滚动类型
      need_dynamic: true
    };
    this.order_scrollview = new CommonScrollView();
    this.order_scrollview.createScroll(this.rank_panel, cc.v2(0, 0), ScrollViewDir.vertical, ScrollViewStartPos.top, tab_size, setting, cc.v2(0.5, 0.5));
  },
  // 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
  registerEvent: function registerEvent() {
    Utils.onTouchEnd(this.close_btn, function () {
      this.ctrl.openLadderRankWindow(false);
    }.bind(this), 2);
    Utils.onTouchEnd(this.background, function () {
      this.ctrl.openLadderRankWindow(false);
    }.bind(this), 2);
  },
  // 预制体加载完成之后,添加到对应主节点之后的回调,也就是一个窗体的正式入口,可以设置一些数据了
  openRootWnd: function openRootWnd(params) {},
  // 关闭窗体回调,需要在这里调用该窗体所属controller的close方法没用于置空该窗体实例对象
  closeCallBack: function closeCallBack() {}
});
 
cc._RF.pop();