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
"use strict";
cc._RF.push(module, '24dcaikkoBNkq4PBIbHMXFT', 'guild_operation_post_window');
// Scripts/mod/guild/view/guild_operation_post_window.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
//      任命或者免职以及踢人面板
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var GuildController = require("guild_controller");
 
var GuildConst = require("guild_const");
 
var GuildOperationPostWindow = cc.Class({
  "extends": BaseView,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("guild", "guild_operation_post_window");
    this.win_type = WinType.Mini;
    this.viewTag = SCENE_TAG.dialogue;
    this.ctrl = GuildController.getInstance();
  },
  openCallBack: function openCallBack() {
    this.background = this.seekChild("background");
    this.background.scale = FIT_SCALE;
    this.notcie = this.seekChild("notice", cc.Label);
    this.close_btn = this.seekChild("close_btn");
    this.setmember_btn = this.seekChild("setmember_btn");
    this.setmember_btn_label = this.seekChild(this.setmember_btn, "label", cc.Label);
    this.kickout_btn = this.seekChild("kickout_btn");
    this.setleader_btn = this.seekChild("setleader_btn");
    this.center_y = this.setmember_btn.y;
  },
  registerEvent: function registerEvent() {
    this.background.on(cc.Node.EventType.TOUCH_END, function () {
      this.ctrl.openGuildOperationPostWindow(false);
    }, this);
    this.close_btn.on(cc.Node.EventType.TOUCH_END, function () {
      this.ctrl.openGuildOperationPostWindow(false);
    }, this);
    this.setleader_btn.on(cc.Node.EventType.TOUCH_END, function () {
      if (this.data != null) this.ctrl.requestOperationPost(this.data.rid, this.data.srv_id, GuildConst.post_type.leader);
    }, this);
    this.setmember_btn.on(cc.Node.EventType.TOUCH_END, function (event) {
      var btn = event.currentTarget;
      if (btn.index != null && this.data != null) this.ctrl.requestOperationPost(this.data.rid, this.data.srv_id, btn.index);
    }, this);
    this.kickout_btn.on(cc.Node.EventType.TOUCH_END, function () {
      if (this.data != null) this.ctrl.requestKickoutMember(this.data.rid, this.data.srv_id, this.data.name);
    }, this);
  },
  // 列表中 对应的1:转让会长 2:任命副会长 3:罢免副会长 4:踢出公会
  openRootWnd: function openRootWnd(data) {
    if (data == null) return;
    this.data = data;
    this.notcie.string = cc.js.formatStr("你要对【%s】玩家执行的操作是", data.name);
 
    if (data.role_post == GuildConst.post_type.leader) {
      if (data.post == GuildConst.post_type.assistant) {
        this.setmember_btn_label.string = Utils.TI18N("罢免副会长");
        this.setmember_btn.index = GuildConst.post_type.member;
      } else {
        this.setmember_btn.index = GuildConst.post_type.assistant;
        this.setmember_btn_label.string = Utils.TI18N("任命副会长");
      }
    } else if (data.role_post == GuildConst.post_type.assistant) {
      if (data.post == GuildConst.post_type.member) {
        this.kickout_btn.y = this.center_y;
        this.setleader_btn.active = false;
        this.setmember_btn.active = false;
      } else {
        this.kickout_btn.active = false;
        this.setleader_btn.active = false;
        this.setmember_btn.active = false;
      }
    }
  },
  closeCallBack: function closeCallBack() {
    this.ctrl.openGuildOperationPostWindow(false);
  }
});
module.exports = GuildOperationPostWindow;
 
cc._RF.pop();