gameLoading.js
4.73 KB
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
var Common = require('Common');
var Network = require('Network');
var TVFocus = require('TVFocus');
var CCTVFocus = require('CCTVFocus');
var FocusInfo = require('FocusInfo');
var TVCanvas = require('TVCanvas');
var TVScrollParameter = require('TVScrollParameter');
var ListView = require('ListView');
var BusinessParameter = require('BusinessParameter');
var ListCell = require('ListCell');
cc.Class({
extends: TVCanvas,
properties: {
},
onLoad: function () {
this._super();
this._oSceneContext._packageName = "";
this._oSceneContext._className = "";
this._oSceneContext._downloadUrl = "";
let aSceneContext = this._cApplication.getSceneContext();
let aSceneParameter = this._cApplication.getSceneParameter();
if (aSceneParameter.length) {
this._oSceneContext._packageName = aSceneParameter[aSceneParameter.length - 1].packageName;
this._oSceneContext._className = aSceneParameter[aSceneParameter.length - 1].className;
this._oSceneContext._downloadUrl = aSceneParameter[aSceneParameter.length - 1].downloadUrl;
} else if (aSceneParameter) {
this._oSceneContext._packageName = aSceneParameter.packageName;
this._oSceneContext._className = aSceneParameter.className;
this._oSceneContext._downloadUrl = aSceneParameter.downloadUrl;
}
cc.log("gameLoading包名:" + this._oSceneContext._downloadUrl);
if (this._oSceneContext._downloadUrl && this._oSceneContext._downloadUrl != "undefined") { //如果有下载地址就启动奥比游戏
jsb.reflection.callStaticMethod("com/topdraw/melody/TopdrawSDKWrapper", "startOBiGame", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", this._oSceneContext._downloadUrl, this._oSceneContext._packageName, this._oSceneContext._className, "updateProgress");
} else {
jsb.reflection.callStaticMethod("com/topdraw/melody/TopdrawSDKWrapper", "startGame", "(Ljava/lang/String;Ljava/lang/String;)V", this._oSceneContext._packageName, "updateProgress");
}
},
updateProgress: function (strProgress) {
this._cLog.screenI("gameLoading下载进度:" + strProgress);
cc.find("ProgressLabel", this.node).getComponent(cc.Label).string = strProgress + "%";
let progressBarWidth = cc.find("ProgressBar", this.node).width - 7;//
let nodeBar = cc.find("ProgressBar/bar", this.node);
nodeBar.width = strProgress / 100 * progressBarWidth;
// this._downloadUrl && this._downloadUrl != "undefined" &&
if (strProgress == "100") {
this._bIsFocusInit = true;
this.backAScene();
}
},
keyDownDirection: function (Direct) {
var fiFocusTarget = null;
var fiCurrentFocus = this._fiCurrentFocus;
var oScrollParameter = null;
let aCheckResult;
fiFocusTarget = this._cFocus.findTarget(fiCurrentFocus, this._aFocusTargets, this._iSceneStatus, Direct);
if (!fiFocusTarget) { return; }
// aCheckResult = this.checkFocusTarget(fiFocusTarget, oScrollParameter);
// fiFocusTarget = aCheckResult[0];
// oScrollParameter = aCheckResult[1];
this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Direct, null, oScrollParameter);
},
onKeyDown: function (event) {
this._super(event);
switch (event.keyCode) {
case cc.macro.KEY.up:
case Common.ANDROID_KEY.up:
this.keyDownDirection(Common.MOVE_DIRECTION_UP);
break;
case cc.macro.KEY.right:
case Common.ANDROID_KEY.right:
this.keyDownDirection(Common.MOVE_DIRECTION_RIGHT);
break;
case cc.macro.KEY.down:
case Common.ANDROID_KEY.down:
this.keyDownDirection(Common.MOVE_DIRECTION_DOWN);
break;
case cc.macro.KEY.left:
case Common.ANDROID_KEY.left:
this.keyDownDirection(Common.MOVE_DIRECTION_LEFT);
break;
case cc.macro.KEY.enter:
case cc.macro.KEY.space:
case Common.ANDROID_KEY.enter:
// this.doCurrentFocusTVLinkAction(Common.TV_LINK_ACTION_CLICK);
break;
case cc.macro.KEY.backspace:
case Common.ANDROID_KEY.back:
this._bIsFocusInit = true;
this.backAScene();
break;
}
},
// hideLoadingIcon: function () {
// cc.log("隐藏LoadingIcon...");
// cc.find("Loading/LoadingIcon", this.node).getComponent(cc.Animation).pause();
// cc.find("Loading/LoadingIcon", this.node).opacity = 0;
// this.cheduleOn
// },
});