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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
"use strict";
cc._RF.push(module, '97af1We3T1H0bE3BdiOkKUX', 'login_window');
// Scripts/mod/login/view/login_window.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
//      用户输入框
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var EnterPanel = require("enter_panel");
 
var UserPanel = require("user_panel");
 
var LoaderManager = require("loadermanager");
 
var LoginWindow = cc.Class({
  "extends": BaseView,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("login", "login_window");
    this.viewTag = SCENE_TAG.dialogue;
    this.panel_list = [];
    this.win_type = WinType.Full;
    this.mask_max_height = 260;
    this.mask_min_height = 160;
    this.is_move = false;
    this.is_touch = false;
    this.change_progress = false;
  },
  openCallBack: function openCallBack() {
    this.background = this.root_wnd.getChildByName("background");
    this.background_component = this.background.getComponent(cc.Sprite); // this.background.scale = 1.25;
    // 版本信息
 
    this.label_component = this.seekChild("label_version", cc.Label); // this.root_wnd.getChildByName("label_version").getComponent(cc.Label);
    // 版号信息,原始csb里面没有这个,后面如果需要重新导入的时候,要手动添加,但是不建议手动创建
    // this.label_notice = this.root_wnd.getChildByName("label_notice");
    // this.label_notice.getComponent(cc.Label).string = Utils.TI18N("新广出审【2017】 368号\nISBN 968 - 5 - 458 - 03215 - 2\n文网游备字 【2017】-RPG 0918号\n出版单位:上海科学技术文献出版社有限公司");
 
    this.progress_bar_nd = this.seekChild("total_progress_bar");
    this.progress_bar = this.progress_bar_nd.getComponent(cc.ProgressBar);
    this.sco_progress_bar = this.seekChild("sco_progress_bar", cc.ProgressBar);
    this.container = this.root_wnd.getChildByName("container"); // this.spine            = this.seekChild("spine", sp.Skeleton);
 
    this.mask_bg_nd = this.seekChild("mask_bg");
    this.mask_bg_1_nd = this.seekChild("mask_bg_1");
    this.progress_con_nd = this.seekChild("progress_con");
    this.progress_des_lb = this.seekChild("progress_des", cc.Label);
    this.progress_num_lb = this.seekChild("progress_num", cc.Label);
    this.protress_des_lb = this.seekChild("protress_des", cc.Label); // var testBtn = this.root_wnd.getChildByName("actionfund_1002")
    // testBtn.on(cc.Node.EventType.TOUCH_END, this.onClickRootWnd, this);
 
    this.effect_nd = this.seekChild("effect_node");
    this.sp_node = this.seekChild("sp_node");
    this.target_node = this.seekChild("targe_node");
    this.touch_nd = this.seekChild("touch");
    this.touch_nd.on(cc.Node.EventType.TOUCH_END, function () {
      if (this.is_move == false) this.moveEffectNd();
    }, this);
    this.background.scale *= FIT_SCALE;
  },
  registerEvent: function registerEvent() {},
  openRootWnd: function openRootWnd() {
    //加载背景资源
    // this.addTicket(function() {
    //     if (!this.background_component.spriteFrame) {
    //         this.loadRes("ui_res/login2/loading_bg_1.jpg", (function (res) {
    //             this.background_component.spriteFrame = res;
    //         }).bind(this))
    //     }
    // }.bind(this), 0.1)
    // 加载背景动画,
    // this.addTicket(function() {
    //     this.loadRes("spine/E51008/action.atlas", (function (res) {
    //         this.spine.skeletonData = res;
    //         this.spine.setAnimation(0, "action", true);
    //     }).bind(this))
    // }.bind(this), 0.3)
    //这里需要判断一下平台或者包
    if (USE_SDK) {
      // Android原生SDK
      // 初始化SDK并进行登录
      SDK.initSDK();
      this.changeSubPanel(2);
    } else {
      // 切换面板类型
      if (this.open_params) {
        this.changeSubPanel(this.open_params.index);
      }
    } //加载完成才隐藏初始界面和进度条
 
 
    var splash = document.getElementById('splash');
 
    if (splash) {
      splash.style.display = 'none';
    }
  },
  // 切换面板类型
  changeSubPanel: function changeSubPanel(index) {
    if (this.cur_panel) {
      this.cur_panel.hide();
      this.cur_panel = null;
    }
 
    index = index ? index : 1;
    var panel = this.panel_list[index];
 
    if (panel == null) {
      if (index == 1) {
        panel = new UserPanel();
      } else if (index == 2) {
        panel = this.enter_panel = new EnterPanel();
      }
 
      this.panel_list[index] = panel;
      panel.setParent(this.container);
    }
 
    if (panel) {
      panel.show();
      this.cur_panel = panel;
    }
  },
  closeCallBack: function closeCallBack() {
    for (var key in this.panel_list) {
      if (this.panel_list.hasOwnProperty(key)) {
        var element = this.panel_list[key];
        element.deleteMe();
      }
    }
 
    this.cur_panel = null;
 
    if (this.sp_node) {
      this.sp_node.destroy();
      this.sp_node = null;
    }
 
    if (this.randow_timer) gcore.Timer.del(this.randow_timer);
  },
  showLoading: function showLoading() {
    this.enter_panel.setVisible(false);
    this.progress_con_nd.active = true;
    this.mask_bg_nd.active = true;
    this.mask_bg_1_nd.active = false;
    this.mask_bg_nd.height = this.mask_max_height; // this.spine.clearTracks();
 
    this.randowTitle(); //第一次登陆领紫武
 
    this.showFirstRoleEffect();
  },
  updateLoading: function updateLoading(progress) {
    this.progress_bar.progress = progress;
 
    if (progress > 0.52 && !this.change_progress) {
      this.progress_des_lb.string = Utils.TI18N("加载资源文件");
      this.change_progress = true;
    }
 
    if (progress > 0) {
      if (USE_SDK == true && PLATFORM_TYPR == "SH_SDK" && !IS_LOADING) {
        SDK.dataPlacement(90000);
      }
 
      IS_LOADING = true;
    } else {
      IS_LOADING = false;
    }
 
    if (progress > 0.7) {
      this.is_touch = true;
    }
 
    if (progress >= 1) {
      if (this.is_move == false) this.moveEffectNd();
    }
  },
  updateSeconLoading: function updateSeconLoading(progress) {
    this.sco_progress_bar.progress = progress;
    var value = Math.ceil(progress * 100);
    if (value > 100) value = 100;
    this.progress_num_lb.string = "[" + value + "%" + "]";
  },
  onClickRootWnd: function onClickRootWnd() {
    SDK.sdkLogin();
    SDK.pay();
  },
  getTestAccount: function getTestAccount() {
    if (this.enter_panel) return this.enter_panel.getTestAccount();
  },
  // 随机提示
  randowTitle: function randowTitle() {
    this.randow_timer = gcore.Timer.set(function () {
      var loginInfo = require("login_controller").getInstance().getCurRoleInfo();
 
      var login_des = [];
      var lev = 0;
      if (loginInfo && loginInfo.lev) lev = loginInfo.lev;
 
      for (var des_i = 1; des_i < 14; des_i++) {
        if (Lang["LOADING_DESC_" + des_i]) {
          if (LoadingDes[des_i]) {
            if (lev < LoadingDes[des_i]) {
              continue;
            }
          }
 
          login_des.push(Lang["LOADING_DESC_" + des_i]);
        }
      }
 
      var index = Math.ceil(Math.random() * 10) % login_des.length + 1;
 
      if (login_des[index]) {
        this.protress_des_lb.string = login_des[index];
      }
    }.bind(this), 2000, -1);
  },
  //展示第一次角色领取紫装特效
  showFirstRoleEffect: function showFirstRoleEffect() {
    var LoginController = require("login_controller");
 
    var status = LoginController.getInstance().getModel().getFirstRoleData();
    cc.log(status);
    if (!status) return;
    if (!this.effect_nd) return;
    this.effect_sk = this.effect_nd.addComponent(sp.Skeleton);
    var res = "spine/E99998/action.atlas";
    this.loadRes(res, function (res_object) {
      this.effect_sk.skeletonData = res_object;
      this.effect_sk.setAnimation(1, PlayerAction.action, true);
    }.bind(this));
    this.get_sp = this.sp_node.addComponent(cc.Sprite);
    this.target_sp = this.target_node.addComponent(cc.Sprite);
    this.loadRes(PathTool.getUIIconPath("login2", "login2_1018"), function (sp) {
      this.get_sp.spriteFrame = sp;
    }.bind(this));
    this.loadRes(PathTool.getUIIconPath("login2", "login2_1019"), function (sp) {
      this.target_sp.spriteFrame = sp;
    }.bind(this));
  },
  moveEffectNd: function moveEffectNd() {
    if (!this.is_touch) return;
    this.is_move = true;
    this.sp_node.active = false;
    this.target_node.active = false;
    var move_to = cc.moveTo(0.7, cc.v2(this.effect_nd.x, this.effect_nd.y + 500));
    var callback = cc.callFunc(function () {
      this.effect_nd.active = false;
    }.bind(this));
    this.effect_nd.runAction(cc.sequence(move_to, callback));
  }
});
 
cc._RF.pop();