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
"use strict";
cc._RF.push(module, 'cb70eu4b8ZLnrpvEbKR3MB+', 'task_main_window');
// Scripts/mod/task/view/task_main_window.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
//      日常主界面,包含了任务和成就
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var TaskController = require("task_controller");
 
var TaskEvent = require("task_event");
 
var TaskConst = require("task_const");
 
var TaskMainWindow = cc.Class({
  "extends": CommonWindowTab,
  ctor: function ctor() {
    this.ctrl = TaskController.getInstance();
    this.model = this.ctrl.getModel();
    this.win_type = WinType.Full;
    this.tab_info_list = [{
      label: Utils.TI18N("日常"),
      index: TaskConst.type.quest,
      status: true,
      notice: Utils.TI18N("日常任务11级开启")
    }, {
      label: Utils.TI18N("成就"),
      index: TaskConst.type.feat,
      status: true,
      notice: Utils.TI18N("日常任务15级开启")
    }];
    this.title_str = Utils.TI18N("日常");
    this.cur_index = 1;
    this.cur_panel = null;
    this.panel_list = [];
 
    var ActionController = require("action_controller");
 
    if (ActionController.getInstance().action_operate) {
      ActionController.getInstance().action_operate.setVisible(false);
    }
  },
  registerEvent: function registerEvent() {
    this.addGlobalEvent(TaskEvent.UpdateUIRedStatus, function (key, value) {
      this.updateUIRedStatus(key);
    }.bind(this));
  },
  selectedTabCallBack: function selectedTabCallBack(index) {
    if (index == TaskConst.type.quest) this.changeTitleName(Utils.TI18N("日常"));else if (index == TaskConst.type.feat) this.changeTitleName(Utils.TI18N("成就"));
    this.changePanel(index);
  },
  openRootWnd: function openRootWnd(index) {
    index = index || TaskConst.type.quest;
    this.setSelecteTab(index, true);
    this.updateUIRedStatus(TaskConst.update_type.feat);
    this.updateUIRedStatus(TaskConst.update_type.quest);
  },
  updateUIRedStatus: function updateUIRedStatus(type) {
    if (type == TaskConst.update_type.feat) {
      var feat_status = this.model.getRedStatus(TaskConst.update_type.feat);
      this.setTabTips(feat_status, TaskConst.type.feat);
    } else {
      var task_status = this.model.getRedStatus(TaskConst.update_type.quest);
      if (task_status == false) task_status = this.model.getRedStatus(TaskConst.update_type.activity);
      this.setTabTips(task_status, TaskConst.type.quest);
    }
  },
  changePanel: function changePanel(index) {
    if (this.cur_panel != null) {
      this.cur_panel.addToParent(false);
      this.cur_panel = null;
    }
 
    if (this.panel_list[index] == null) {
      if (index == TaskConst.type.quest) {
        var TaskPanel = require("task_panel");
 
        this.panel_list[index] = new TaskPanel();
      } else if (index == TaskConst.type.feat) {
        var FeatPanel = require("feat_panel");
 
        this.panel_list[index] = new FeatPanel();
      }
 
      this.panel_list[index].setParent(this.container);
      this.panel_list[index].show();
    }
 
    this.cur_panel = this.panel_list[index];
    if (this.cur_panel != null) this.cur_panel.addToParent(true);
  },
  closeCallBack: function closeCallBack() {
    for (var k in this.panel_list) {
      this.panel_list[k].deleteMe();
      this.panel_list[k] = null;
    }
 
    this.panel_list = null;
 
    var ActionController = require("action_controller");
 
    if (ActionController.getInstance().action_operate) {
      ActionController.getInstance().action_operate.setVisible(true);
    }
 
    this.ctrl.openTaskMainWindow(false);
  }
});
module.exports = TaskMainWindow;
 
cc._RF.pop();