Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new-kickball
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
new-kickball
Commits
6d039ae8
Commit
6d039ae8
authored
May 29, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
15529af9
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
769 additions
and
39 deletions
+769
-39
launch.json
.vscode/launch.json
+15
-0
main.scene
assets/scenes/main.scene
+52
-9
MainController.ts
assets/scripts/MainController.ts
+63
-6
CustomTextRenderer.ts
assets/scripts/game/CustomTextRenderer.ts
+20
-0
CustomTextRenderer.ts.meta
assets/scripts/game/CustomTextRenderer.ts.meta
+1
-0
navigator.meta
assets/scripts/navigator.meta
+1
-0
Navigator.ts
assets/scripts/navigator/Navigator.ts
+156
-0
Navigator.ts.meta
assets/scripts/navigator/Navigator.ts.meta
+1
-0
SingleSceneNavigator.ts
assets/scripts/navigator/SingleSceneNavigator.ts
+63
-0
SingleSceneNavigator.ts.meta
assets/scripts/navigator/SingleSceneNavigator.ts.meta
+1
-0
StackNavigator.ts
assets/scripts/navigator/StackNavigator.ts
+101
-0
StackNavigator.ts.meta
assets/scripts/navigator/StackNavigator.ts.meta
+1
-0
VirtualNavigator.ts
assets/scripts/navigator/VirtualNavigator.ts
+122
-0
VirtualNavigator.ts.meta
assets/scripts/navigator/VirtualNavigator.ts.meta
+1
-0
scenes.meta
assets/scripts/scenes.meta
+1
-0
ScenePlay.ts
assets/scripts/scenes/ScenePlay.ts
+56
-0
ScenePlay.ts.meta
assets/scripts/scenes/ScenePlay.ts.meta
+1
-0
SceneStart.ts
assets/scripts/scenes/SceneStart.ts
+57
-0
SceneStart.ts.meta
assets/scripts/scenes/SceneStart.ts.meta
+1
-0
index.ts
assets/scripts/scenes/index.ts
+6
-0
index.ts.meta
assets/scripts/scenes/index.ts.meta
+1
-0
index.html
index.html
+31
-20
readme.md
readme.md
+1
-0
MustCompile.ts
src/generated/MustCompile.ts
+16
-4
No files found.
.vscode/launch.json
0 → 100644
View file @
6d039ae8
{
//
使用
IntelliSense
了解相关属性。
//
悬停以查看现有属性的描述。
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"type"
:
"chrome"
,
"request"
:
"launch"
,
"name"
:
"Launch Chrome against localhost"
,
"url"
:
"http://localhost:58664"
,
"webRoot"
:
"${workspaceFolder}"
}
]
}
\ No newline at end of file
assets/scenes/main.scene
View file @
6d039ae8
...
...
@@ -24,8 +24,10 @@
"script": "./scripts/MainController",
"properties": {
"Popup": "entity|3f66eb80-5d67-4b76-a0c1-f385e0a6e947",
"Toast": "entity|0dd3ddfd-5da9-4b66-be26-0e4dea8331fd",
"opActivityId": "dynamic|CFG|opActivityId"
"Toast": "entity|1d7c03a2-f89a-47ca-9681-7dd17352a14f",
"opActivityId": "dynamic|CFG|hdToolId",
"actId": "dynamic|CFG|actId",
"hdToolId": "dynamic|CFG|hdToolId"
}
},
{
...
...
@@ -33,19 +35,19 @@
"properties": {
"method": "GET",
"name": "ajaxElement",
"uri": "/hdtool/ajaxElement",
"uri": "/hdtool/
recon/
ajaxElement",
"onError": [
{
"entity": "entity|20181212032053",
"component":
null
,
"method":
null
"component":
2
,
"method":
"onGotAjaxElementError"
}
],
"onResponse": [
{
"entity": "entity|20181212032053",
"component":
null
,
"method":
null
"component":
2
,
"method":
"onGotAjaxElement"
}
]
}
...
...
@@ -62,6 +64,10 @@
{
"script": "components/other/FullStageSize",
"properties": {}
},
{
"script": "./scripts/navigator/SingleSceneNavigator",
"properties": {}
}
],
"uuid": "74d86361-3aa2-4ce6-ba1f-796598147075",
...
...
@@ -111,10 +117,47 @@
"components": [
{
"script": "components/base/Transform",
"properties": {}
"properties": {
"height": 40
}
},
{
"script": "components/renderer/RectRenderer",
"properties": {
"fillColor": "rgba(0, 0, 0, 0.7)",
"cornerRadius": 10
}
},
{
"script": "./scripts/common/Toast",
"properties": {
"Label": "entity|44aec2c1-1670-4347-a0a3-9c3aa4ac0e2a"
}
}
],
"uuid": "1d7c03a2-f89a-47ca-9681-7dd17352a14f",
"children": [
{
"name": "Label",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/game/CustomTextRenderer",
"properties": {
"fillColor": "rgba(255, 255, 255, 1)",
"text": "...",
"textStyle": {
"fontSize": 30
}
}
}
],
"uuid": "44aec2c1-1670-4347-a0a3-9c3aa4ac0e2a"
}
],
"uuid": "0dd3ddfd-5da9-4b66-be26-0e4dea8331fd",
"disabled": true
}
]
...
...
assets/scripts/MainController.ts
View file @
6d039ae8
...
...
@@ -7,7 +7,8 @@ import Popup from "./popup/Popup";
export
default
class
MainController
extends
ScillaComponent
{
Popup
:
Entity
;
//PopupContainer 弹窗容器
Toast
:
Entity
;
//toast 实体
opActivityId
:
dynamic
;
hdToolId
:
dynamic
;
actId
:
dynamic
;
private
_toast
:
Toast
;
private
_popup
:
Popup
;
...
...
@@ -22,15 +23,71 @@ export default class MainController extends ScillaComponent {
initEnv
();
this
.
broadcast
(
'callApi'
,
1
,
'ajaxElement'
,
{
opActivityId
:
this
.
opActivityId
})
this
.
broadcast
(
'callApi'
,
1
,
'ajaxElement'
,
{
duibaId
:
this
.
hdToolId
,
activityId
:
this
.
actId
})
}
onUpdate
(
t
)
{
super
.
onUpdate
(
t
);
onGotAjaxElement
()
{
console
.
log
(
'onGotAjaxElement'
)
this
.
broadcast
(
'initGameStage'
);
this
.
showToast
(
'onGotAjaxElement'
);
}
onGotAjaxElementError
(
e
)
{
console
.
log
(
e
);
// if (typeof e === 'string') {
// switch (e) {
// case '0100016': //活动未开始
// case '0100014': //活动已结束
// case '0100017': //活动已关闭
// this.showErrorToast(e);
// break;
// default:
// this.showNetError();
// }
// } else {
// this.showNetError();
// }
}
onGotActivityBaseInfo
()
{
this
.
broadcast
(
'initGameStage'
);
showErrorToast
(
e
)
{
// switch (e) {
// case '0100016': //活动未开始
// this.showToast('活动未开始,暂时无法参与');
// break;
// case '0100014': //活动已结束
// case '0100017': //活动已关闭
// this.showToast('活动已结束,无法参与');
// break;
// }
}
showToast
(
content
,
duration
?)
{
this
.
_toast
.
show
({
content
,
duration
,
})
}
showDialog
(
name
,
data
?,
callback
?)
{
this
.
_popup
.
showDialog
(
name
,
data
,
callback
);
}
showNetError
(
action
?)
{
// this.showDialog('Alert', { title: '网络异常', content: '请检查网络后重试!', button: '重新加载', showCloseButton: false }, () => {
// if (typeof action === 'function') {
// action();
// } else {
// action = action || 'refresh';
// switch (action) {
// case 'back':
// history.back();
// break;
// case 'refresh':
// location.reload();
// break;
// }
// }
// })
}
}
assets/scripts/game/CustomTextRenderer.ts
0 → 100644
View file @
6d039ae8
/**
* Created by rockyl on 2019-05-23.
*
* 自定义文本渲染器
*/
import
TextRenderer
from
"components/renderer/TextRenderer"
;
export
default
class
CustomTextRenderer
extends
TextRenderer
{
fillColorKey
:
string
;
onAwake
()
{
super
.
onAwake
();
const
config
=
window
[
'configJson'
];
if
(
this
.
fillColorKey
){
this
.
fillColor
=
config
[
this
.
fillColorKey
];
}
}
}
assets/scripts/game/CustomTextRenderer.ts.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"74c1fe4d-621a-4908-aaf7-0934901d3c1e","subMetas":{},"type":"script"}
assets/scripts/navigator.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"c0c3cf56-be33-4264-8613-5f2e8f8ebb33","subMetas":{},"isGroup":true}
assets/scripts/navigator/Navigator.ts
0 → 100644
View file @
6d039ae8
/**
* Created by rocky.l on 2017/1/19.
*
* 场景导航器
*/
import
{
EventEmitter
}
from
'scilla'
import
{
alien
}
from
"./StackNavigator"
;
import
NavigatorAction
=
alien
.
NavigatorAction
;
import
INavigatorDelegate
=
alien
.
INavigatorDelegate
;
import
StackNavigator
=
alien
.
StackNavigator
;
export
interface
INavigatorViewBase
{
onAddView
():
boolean
;
onWillMount
(
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
;
onWillUnMount
(
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
;
onWillEnter
(
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
;
onDidEnter
(
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
void
;
onWillLeave
(
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
;
onDidLeave
(
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
void
;
}
const
showLog
=
false
;
export
class
Navigator
extends
EventEmitter
implements
INavigatorDelegate
{
static
VIEW_WILL_ENTER
:
string
=
'VIEW_WILL_ENTER'
;
static
VIEW_DID_ENTER
:
string
=
'VIEW_DID_ENTER'
;
static
VIEW_WILL_LEAVE
:
string
=
'VIEW_WILL_LEAVE'
;
static
VIEW_DID_LEAVE
:
string
=
'VIEW_DID_LEAVE'
;
stack
:
StackNavigator
;
protected
_classDic
:
any
;
protected
_instanceDic
:
any
;
protected
_currentName
:
string
;
protected
_currentView
:
INavigatorViewBase
;
constructor
()
{
super
();
this
.
_classDic
=
{};
this
.
_instanceDic
=
{};
this
.
stack
=
new
StackNavigator
(
this
);
}
register
(
name
:
string
,
clazz
:
any
):
void
{
this
.
_classDic
[
name
]
=
clazz
;
}
push
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
stack
.
push
(
name
,
parameters
);
}
pop
(
parameters
:
any
=
null
)
{
this
.
stack
.
pop
(
parameters
);
}
popToBottom
(
parameters
:
any
=
null
)
{
this
.
stack
.
popTo
(
0
,
null
,
parameters
);
}
popAll
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
stack
.
popAll
(
name
,
parameters
);
}
replace
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
stack
.
replace
(
name
,
parameters
);
}
jump
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
stack
.
jump
(
name
,
parameters
);
}
get
currentView
():
INavigatorViewBase
{
return
this
.
_currentView
;
}
get
currentName
():
string
{
return
this
.
_currentName
;
}
protected
newView
(
name
:
string
):
INavigatorViewBase
{
return
new
this
.
_classDic
[
name
]();
}
protected
getViewInstanceByName
(
name
:
string
):
INavigatorViewBase
{
let
view
:
INavigatorViewBase
=
this
.
_instanceDic
[
name
];
if
(
!
view
)
{
view
=
this
.
_instanceDic
[
name
]
=
this
.
newView
(
name
);
}
return
view
;
}
protected
addView
(
view
:
INavigatorViewBase
,
addToBottom
)
{
}
/**
* 栈入实现
* @param name
* @param last
* @param action
* @param parameters
* @returns {Promise<void>}
*/
async
onEnter
(
name
:
string
,
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
)
{
let
view
:
INavigatorViewBase
=
this
.
getViewInstanceByName
(
name
);
this
.
_currentView
=
view
;
this
.
_currentName
=
name
;
await
view
.
onWillMount
(
last
,
action
,
parameters
);
let
addToBottom
=
view
.
onAddView
();
this
.
addView
(
view
,
addToBottom
);
if
(
showLog
)
console
.
log
(
name
+
' will enter.'
);
this
.
emit
(
Navigator
.
VIEW_WILL_ENTER
,
{
name
,
last
,
action
,
parameters
});
await
view
.
onWillEnter
(
last
,
action
,
parameters
);
if
(
showLog
)
console
.
log
(
name
+
' did enter.'
);
this
.
emit
(
Navigator
.
VIEW_DID_ENTER
,
{
name
,
last
,
action
,
parameters
});
view
.
onDidEnter
(
last
,
action
,
parameters
);
}
/**
* 栈出实现
* @param name
* @param next
* @param action
* @param parameters
* @returns {Promise<void>}
*/
async
onLeave
(
name
:
string
,
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
)
{
let
view
:
INavigatorViewBase
=
this
.
getViewInstanceByName
(
name
);
await
view
.
onWillUnMount
(
name
,
action
,
parameters
);
if
(
showLog
)
console
.
log
(
name
+
' will leave.'
);
this
.
emit
(
Navigator
.
VIEW_WILL_LEAVE
,
{
name
,
next
,
action
,
parameters
});
await
view
.
onWillLeave
(
next
,
action
,
parameters
);
if
(
showLog
)
console
.
log
(
name
+
' did leave.'
);
this
.
emit
(
Navigator
.
VIEW_DID_LEAVE
,
{
name
,
next
,
action
,
parameters
});
view
.
onDidLeave
(
next
,
action
,
parameters
);
}
/**
* 当收到错误实现
* @param error
*/
onError
(
error
:
Error
)
{
}
}
assets/scripts/navigator/Navigator.ts.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"636ee90d-508d-4b65-9605-f7352d0b2466","subMetas":{},"type":"script"}
assets/scripts/navigator/SingleSceneNavigator.ts
0 → 100644
View file @
6d039ae8
/**
* Created by rockyl on 2019-04-09.
*
* 单场景导航器
*/
import
{
VirtualNavigator
}
from
"./VirtualNavigator"
;
import
{
SceneStart
,
ScenePlay
}
from
"../scenes"
;
import
ScillaComponent
from
"components/base/ScillaComponent"
;
export
default
class
SingleSceneNavigator
extends
ScillaComponent
{
_navigator
:
VirtualNavigator
;
onCreate
()
{
super
.
onCreate
();
this
.
_navigator
=
new
VirtualNavigator
(
this
.
entity
);
this
.
_navigator
.
register
(
'start'
,
'SceneStart'
,
SceneStart
);
this
.
_navigator
.
register
(
'play'
,
'ScenePlay'
,
ScenePlay
);
}
onAwake
()
{
super
.
onAwake
();
this
.
push
(
'start'
);
}
onUpdate
(
t
)
{
super
.
onUpdate
(
t
);
}
onSleep
()
{
super
.
onSleep
();
}
onDestroy
()
{
super
.
onDestroy
();
}
push
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
_navigator
.
stack
.
push
(
name
,
parameters
);
}
pop
(
parameters
:
any
=
null
)
{
this
.
_navigator
.
stack
.
pop
(
parameters
);
}
popToBottom
(
parameters
:
any
=
null
)
{
this
.
_navigator
.
stack
.
popTo
(
0
,
null
,
parameters
);
}
popAll
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
_navigator
.
stack
.
popAll
(
name
,
parameters
);
}
replace
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
_navigator
.
stack
.
replace
(
name
,
parameters
);
}
jump
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
_navigator
.
stack
.
jump
(
name
,
parameters
);
}
}
assets/scripts/navigator/SingleSceneNavigator.ts.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"4b5a29f1-88af-47d5-8949-cfc2c1f8f861","subMetas":{},"type":"script"}
assets/scripts/navigator/StackNavigator.ts
0 → 100644
View file @
6d039ae8
/**
* Created by rocky.l on 2017/1/17.
*
* 堆栈导航器
*/
export
module
alien
{
export
enum
NavigatorAction
{
Push
,
Pop
,
Replace
,
Jump
}
export
interface
INavigatorDelegate
{
onEnter
(
name
:
string
,
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
);
onLeave
(
name
:
string
,
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
);
onError
(
error
:
Error
);
}
export
class
StackNavigator
{
private
_stack
:
string
[];
private
_delegate
:
INavigatorDelegate
;
constructor
(
delegate
:
INavigatorDelegate
)
{
this
.
_stack
=
[];
this
.
_delegate
=
delegate
;
}
private
catchPromise
(
p
:
Promise
<
any
>
)
{
if
(
p
)
{
p
.
catch
((
e
=>
{
this
.
_delegate
.
onError
(
e
);
}))
}
}
push
(
name
:
string
,
parameters
:
any
=
null
)
{
let
last
:
string
=
this
.
getTopSceneName
();
if
(
last
)
{
if
(
last
==
name
)
{
return
;
}
this
.
catchPromise
(
this
.
_delegate
.
onLeave
(
last
,
name
,
NavigatorAction
.
Push
,
parameters
));
}
this
.
_stack
.
push
(
name
);
this
.
catchPromise
(
this
.
_delegate
.
onEnter
(
name
,
last
,
NavigatorAction
.
Push
,
parameters
));
}
popTo
(
index
,
name
?:
string
,
parameters
:
any
=
null
)
{
if
(
this
.
_stack
.
length
>
0
&&
this
.
_stack
.
length
<
(
index
+
1
))
{
return
;
}
let
last
:
string
=
this
.
getTopSceneName
();
this
.
_stack
.
splice
(
Math
.
max
(
index
+
1
,
0
));
let
next
:
string
=
this
.
_stack
[
index
];
if
(
!
next
)
{
this
.
_stack
.
push
(
next
=
name
);
}
if
(
last
)
{
this
.
catchPromise
(
this
.
_delegate
.
onLeave
(
last
,
next
,
NavigatorAction
.
Pop
,
parameters
));
}
this
.
catchPromise
(
this
.
_delegate
.
onEnter
(
next
,
last
,
NavigatorAction
.
Pop
,
parameters
));
}
pop
(
parameters
:
any
=
null
)
{
this
.
popTo
(
this
.
_stack
.
length
-
2
,
null
,
parameters
);
}
popAll
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
popTo
(
-
1
,
name
,
parameters
);
}
replace
(
name
:
string
,
parameters
:
any
=
null
)
{
let
last
:
string
=
this
.
_stack
.
pop
();
this
.
_stack
.
push
(
name
);
this
.
catchPromise
(
this
.
_delegate
.
onLeave
(
last
,
name
,
NavigatorAction
.
Replace
,
parameters
));
this
.
catchPromise
(
this
.
_delegate
.
onEnter
(
name
,
last
,
NavigatorAction
.
Replace
,
parameters
));
}
jump
(
name
:
string
,
parameters
:
any
=
null
){
if
(
this
.
_stack
.
length
<
2
){
this
.
push
(
name
,
parameters
);
return
;
}
let
last
:
string
=
this
.
_stack
.
pop
();
this
.
_stack
.
splice
(
1
);
let
next
:
string
=
name
;
this
.
_stack
.
push
(
next
);
this
.
_delegate
.
onLeave
(
last
,
next
,
NavigatorAction
.
Pop
,
parameters
);
this
.
_delegate
.
onEnter
(
next
,
last
,
NavigatorAction
.
Pop
,
parameters
);
}
private
getTopSceneName
():
string
{
return
this
.
_stack
.
length
>
0
?
this
.
_stack
[
this
.
_stack
.
length
-
1
]
:
null
;
}
private
getBottomSceneName
():
string
{
return
this
.
_stack
.
length
>
0
?
this
.
_stack
[
0
]
:
null
;
}
}
}
assets/scripts/navigator/StackNavigator.ts.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"c787ec07-0e47-4ac2-8f55-d4195acbcddc","subMetas":{},"type":"script"}
assets/scripts/navigator/VirtualNavigator.ts
0 → 100644
View file @
6d039ae8
/**
* Created by rocky.l on 2017/1/19.
*
* 场景导航器
*/
import
{
Entity
,
EventEmitter
}
from
'scilla'
import
{
alien
}
from
"./StackNavigator"
;
import
NavigatorAction
=
alien
.
NavigatorAction
;
import
INavigatorDelegate
=
alien
.
INavigatorDelegate
;
import
StackNavigator
=
alien
.
StackNavigator
;
const
showLog
=
false
;
export
const
VIEW_WILL_ENTER
:
string
=
'VIEW_WILL_ENTER'
;
export
const
VIEW_DID_ENTER
:
string
=
'VIEW_DID_ENTER'
;
export
const
VIEW_WILL_LEAVE
:
string
=
'VIEW_WILL_LEAVE'
;
export
const
VIEW_DID_LEAVE
:
string
=
'VIEW_DID_LEAVE'
;
export
interface
INavigatorViewBase
{
onWillMount
(
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
;
onWillUnMount
(
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
;
onWillEnter
(
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
;
onDidEnter
(
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
void
;
onWillLeave
(
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
;
onDidLeave
(
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
):
void
;
}
export
class
VirtualNavigator
extends
EventEmitter
implements
INavigatorDelegate
{
stack
:
StackNavigator
;
protected
_currentName
:
string
;
protected
_currentView
:
INavigatorViewBase
;
protected
_classDic
:
any
;
protected
_container
:
Entity
;
constructor
(
container
)
{
super
();
this
.
_container
=
container
;
this
.
_classDic
=
{};
this
.
stack
=
new
StackNavigator
(
this
);
}
register
(
alias
:
string
,
childName
:
string
,
componentDef
):
void
{
this
.
_classDic
[
alias
]
=
{
childName
,
componentDef
,
};
}
get
currentView
():
INavigatorViewBase
{
return
this
.
_currentView
;
}
get
currentName
():
string
{
return
this
.
_currentName
;
}
protected
getViewInstanceByName
(
name
:
string
):
INavigatorViewBase
{
let
{
childName
,
componentDef
,}
=
this
.
_classDic
[
name
];
let
scene
:
Entity
=
this
.
_container
.
getChildrenByName
(
childName
)[
0
];
let
component
:
any
=
scene
.
getComponent
(
componentDef
);
return
component
;
}
/**
* 栈入实现
* @param name
* @param last
* @param action
* @param parameters
* @returns {Promise<void>}
*/
async
onEnter
(
name
:
string
,
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
)
{
let
view
:
INavigatorViewBase
=
this
.
getViewInstanceByName
(
name
);
this
.
_currentView
=
view
;
this
.
_currentName
=
name
;
await
view
.
onWillMount
(
last
,
action
,
parameters
);
if
(
showLog
)
console
.
log
(
name
+
' will enter.'
);
this
.
emit
(
VIEW_WILL_ENTER
,
{
name
,
last
,
action
,
parameters
});
await
view
.
onWillEnter
(
last
,
action
,
parameters
);
if
(
showLog
)
console
.
log
(
name
+
' did enter.'
);
this
.
emit
(
VIEW_DID_ENTER
,
{
name
,
last
,
action
,
parameters
});
view
.
onDidEnter
(
last
,
action
,
parameters
);
}
/**
* 栈出实现
* @param name
* @param next
* @param action
* @param parameters
* @returns {Promise<void>}
*/
async
onLeave
(
name
:
string
,
next
:
string
,
action
:
NavigatorAction
,
parameters
:
any
)
{
let
view
:
INavigatorViewBase
=
this
.
getViewInstanceByName
(
name
);
await
view
.
onWillUnMount
(
name
,
action
,
parameters
);
if
(
showLog
)
console
.
log
(
name
+
' will leave.'
);
this
.
emit
(
VIEW_WILL_LEAVE
,
{
name
,
next
,
action
,
parameters
});
await
view
.
onWillLeave
(
next
,
action
,
parameters
);
if
(
showLog
)
console
.
log
(
name
+
' did leave.'
);
this
.
emit
(
VIEW_DID_LEAVE
,
{
name
,
next
,
action
,
parameters
});
view
.
onDidLeave
(
next
,
action
,
parameters
);
}
/**
* 当收到错误实现
* @param error
*/
onError
(
error
:
Error
)
{
}
}
assets/scripts/navigator/VirtualNavigator.ts.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"cca81914-b73a-42e1-8c20-273329a24220","subMetas":{},"type":"script"}
assets/scripts/scenes.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"45d473b1-a874-47aa-8c1a-9323b6720a82","subMetas":{},"isGroup":true}
assets/scripts/scenes/ScenePlay.ts
0 → 100644
View file @
6d039ae8
/**
* Created by rockyl on 2019-04-09.
*/
import
{
Component
,
Entity
}
from
"scilla"
;
import
{
Transform
}
from
'scilla-components/src'
;
import
{
alien
}
from
"../navigator/StackNavigator"
;
import
{
INavigatorViewBase
}
from
"../navigator/VirtualNavigator"
;
export
default
class
ScenePlay
extends
Component
implements
INavigatorViewBase
{
startbtn
:
Entity
;
rankbtn
:
Entity
;
rulebtn
:
Entity
;
onAwake
()
{
super
.
onAwake
();
}
onClick_startbtn
()
{
console
.
log
(
'onClick_startbtn'
);
// globalEvent.emit('popup', { name: 'RulePanel', params: {} }, this.onAlertClose);
}
onAlertClose
()
{
console
.
log
(
'onAlertClose'
);
};
onClick_rankbtn
()
{
alert
(
'onClick_rankbtn'
)
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter
(
last
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
void
{
(
this
.
entity
.
getComponent
(
Transform
)
as
Transform
).
alpha
=
1
;
}
onDidLeave
(
next
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
void
{
(
this
.
entity
.
getComponent
(
Transform
)
as
Transform
).
alpha
=
0
;
}
async
onWillEnter
(
last
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
)
{
}
async
onWillLeave
(
next
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
)
{
}
onWillMount
(
last
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
{
return
undefined
;
}
onWillUnMount
(
next
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
{
return
undefined
;
}
}
assets/scripts/scenes/ScenePlay.ts.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"4c940094-0966-44b4-9875-0c7deb522cb5","subMetas":{},"type":"script"}
assets/scripts/scenes/SceneStart.ts
0 → 100644
View file @
6d039ae8
/**
* Created by rockyl on 2019-04-09.
*/
import
{
Component
,
Entity
}
from
"scilla"
;
import
{
alien
}
from
"../navigator/StackNavigator"
;
import
{
INavigatorViewBase
}
from
"../navigator/VirtualNavigator"
;
import
{
Transform
}
from
'scilla-components/src'
;
import
globalEvent
from
"globalEvent"
;
export
default
class
SceneStart
extends
Component
implements
INavigatorViewBase
{
startbtn
:
Entity
;
rankbtn
:
Entity
;
rulebtn
:
Entity
;
onAwake
()
{
super
.
onAwake
();
}
onClick_startbtn
()
{
console
.
log
(
'onClick_startbtn'
);
// globalEvent.emit('popup', { name: 'RulePanel', params: {} }, this.onAlertClose);
}
onAlertClose
()
{
console
.
log
(
'onAlertClose'
);
};
onClick_rankbtn
()
{
alert
(
'onClick_rankbtn'
)
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter
(
last
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
void
{
(
this
.
entity
.
getComponent
(
Transform
)
as
Transform
).
alpha
=
1
;
}
onDidLeave
(
next
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
void
{
(
this
.
entity
.
getComponent
(
Transform
)
as
Transform
).
alpha
=
0
;
}
async
onWillEnter
(
last
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
)
{
}
async
onWillLeave
(
next
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
)
{
}
onWillMount
(
last
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
{
return
undefined
;
}
onWillUnMount
(
next
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
Promise
<
any
>
{
return
undefined
;
}
}
assets/scripts/scenes/SceneStart.ts.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"9b17ef27-60b5-46b4-b9d2-735a2861e5f6","subMetas":{},"type":"script"}
assets/scripts/scenes/index.ts
0 → 100644
View file @
6d039ae8
/**
* Created by rockyl on 2019-04-09.
*/
export
{
default
as
SceneStart
}
from
"./SceneStart"
;
export
{
default
as
ScenePlay
}
from
"./ScenePlay"
;
assets/scripts/scenes/index.ts.meta
0 → 100644
View file @
6d039ae8
{"ver":"1.0.1","uuid":"f5c11db4-1b48-4d86-8433-e4afda5d9a8d","subMetas":{},"type":"script"}
index.html
View file @
6d039ae8
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
new-kickball
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
<meta
name=
"full-screen"
content=
"true"
/>
<meta
name=
"screen-orientation"
content=
"portrait"
/>
<meta
name=
"x5-fullscreen"
content=
"true"
/>
<meta
name=
"360-fullscreen"
content=
"true"
/>
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
<meta
name=
"full-screen"
content=
"true"
/>
<meta
name=
"screen-orientation"
content=
"portrait"
/>
<meta
name=
"x5-fullscreen"
content=
"true"
/>
<meta
name=
"360-fullscreen"
content=
"true"
/>
<style>
html
,
body
{
html
,
body
{
padding
:
0
;
margin
:
0
;
border
:
0
;
...
...
@@ -21,18 +23,27 @@
}
</style>
</head>
<body>
<div
id=
"gameContainer"
style=
"width: 100%;height: 100%;overflow: hidden;"
></div>
<script
src=
"debug/bundle.js"
></script>
<script>
setTimeout
(
function
(){
var
options
=
window
[
'inputOptions'
]
||
{};
window
[
'new-kickball'
].
startup
(
document
.
getElementById
(
'gameContainer'
),
options
);
},
100
);
</script>
<script>
document
.
write
(
'<script src="http://'
+
(
location
.
host
||
'localhost'
).
split
(
':'
)[
0
]
+
':35729/livereload.js?snipver=1"></'
+
'script>'
)
</script>
<div
id=
"gameContainer"
style=
"width: 100%;height: 100%;overflow: hidden;"
></div>
<script
src=
"debug/bundle.js"
></script>
<script>
var
CFG
=
{
"actId"
:
"3335069"
,
"oaId"
:
"3335069"
,
"unitName"
:
"积分"
,
"btnUnitName"
:
"积分"
,
"doJoin"
:
"/hdtool/doJoin?dpm=1.3.1.0&activityId=3335069"
,
"quireOrder"
:
"/hdtool/getOrderStatus"
,
"styleConfig"
:
"/hdtool/getHdtoolConfig"
,
"getElement"
:
"/hdtool/ajaxElement"
,
"getPrizeDetail"
:
"/hdtool/prizeDetail"
,
"ajaxThroughInfo"
:
"/hdtool/ajaxThroughInfo"
,
"throughSubmit"
:
"/hdtool/throughSubmit"
,
"gameGetOrder"
:
"/hdtool/getOrderInfo"
,
"gameSubmit"
:
"/hdtool/gameSubmit"
,
"doSubmit"
:
"/hdtool/submit"
,
"adslotId"
:
""
,
"consumerId"
:
"1"
,
"isNotLoginUser"
:
false
,
"uid"
:
"1"
,
"hdType"
:
"duiba"
,
"hdToolId"
:
"42363"
,
"appType"
:
"credits"
,
"subType"
:
"custom"
,
"directSendCoupon"
:
"false"
,
"ajaxAction"
:
""
,
"recommendQueue"
:
"/recommend/getRecommend"
,
"recommendSkin"
:
"/recommend/getRecommendSkin"
,
"isShowDetail"
:
true
,
"preview"
:
false
,
"from"
:
""
,
"login"
:
"//activity.m.duiba.com.cn/hdtool/login?dpm=1.3.3.0"
,
"flowRedirectUrl"
:
""
,
"flowRedirectTuiaUrl"
:
""
,
"isOpenRecommend"
:
false
,
"getCreditsLink"
:
"http://baidu.com?uid=1&dbnewopen"
,
"appId"
:
"1"
,
"recordUrl"
:
"//activity.m.duiba.com.cn/crecord/record?dbnewopen&dpm=1.3.2.0"
,
"shareDesc"
:
"分享分享文案文案"
,
"entranceDesc"
:
"测试领奖,也可到我的奖品领奖,24小时内有效哦"
,
"isSHowMeat"
:
true
,
"needCouponModal"
:
true
,
"needRecommendModal"
:
true
,
"asyncFiles"
:
[],
"shareAndroidLinkActivity"
:
"http://www.duiba.com.cn"
,
"shareIosLinkActivity"
:
"http://www.iqiyi.com"
,
"appName"
:
"custom"
,
"needShare"
:
true
,
"shareTitle"
:
""
,
"shareSubTitle"
:
""
,
"sharePicUrl"
:
""
,
"shareLink"
:
""
,
"shareAndroidDeeplink"
:
""
,
"shareIOSDeeplink"
:
""
};
function
requirelogin
()
{
console
.
log
(
'requirelogin'
);
}
setTimeout
(
function
()
{
var
options
=
window
[
'inputOptions'
]
||
{};
window
[
'new-kickball'
].
startup
(
document
.
getElementById
(
'gameContainer'
),
options
);
},
100
);
</script>
<script>
document
.
write
(
'<script src="http://'
+
(
location
.
host
||
'localhost'
).
split
(
':'
)[
0
]
+
':35729/livereload.js?snipver=1"></'
+
'script>'
)
</script>
</body>
</html>
</html>
\ No newline at end of file
readme.md
View file @
6d039ae8
...
...
@@ -25,6 +25,7 @@
# 流程
-
main controller
-
webservice,SampleApi,SamplePollingApi
-
toast
# 日报
-
5.28 跑新的demo,运行成功
...
...
src/generated/MustCompile.ts
View file @
6d039ae8
...
...
@@ -17,8 +17,20 @@ registerDef('components/other/FullStageSize', component2);
import
component3
from
'components/renderer/TextureRenderer'
;
registerDef
(
'components/renderer/TextureRenderer'
,
component3
);
import
component4
from
'
../../assets/scripts/MainControll
er'
;
registerDef
(
'
./scripts/MainControll
er'
,
component4
);
import
component4
from
'
components/renderer/RectRender
er'
;
registerDef
(
'
components/renderer/RectRender
er'
,
component4
);
import
component5
from
'../../assets/scripts/api/SampleApi'
;
registerDef
(
'./scripts/api/SampleApi'
,
component5
);
import
component5
from
'../../assets/scripts/MainController'
;
registerDef
(
'./scripts/MainController'
,
component5
);
import
component6
from
'../../assets/scripts/api/SampleApi'
;
registerDef
(
'./scripts/api/SampleApi'
,
component6
);
import
component7
from
'../../assets/scripts/navigator/SingleSceneNavigator'
;
registerDef
(
'./scripts/navigator/SingleSceneNavigator'
,
component7
);
import
component8
from
'../../assets/scripts/common/Toast'
;
registerDef
(
'./scripts/common/Toast'
,
component8
);
import
component9
from
'../../assets/scripts/game/CustomTextRenderer'
;
registerDef
(
'./scripts/game/CustomTextRenderer'
,
component9
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment