Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
super-miner
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
劳工
super-miner
Commits
81f61b87
Commit
81f61b87
authored
May 29, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
昵称截断
parent
9f365599
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
90 additions
and
94 deletions
+90
-94
PKMatching.ts
assets/scripts/dialogs/PKMatching.ts
+3
-2
PKResultAnimSide.ts
assets/scripts/game/PKResultAnimSide.ts
+2
-2
PKResultSide.ts
assets/scripts/game/PKResultSide.ts
+3
-5
utils.ts
assets/scripts/game/utils.ts
+7
-0
Navigator.ts
assets/scripts/navigator/Navigator.ts
+1
-5
StackNavigator.ts
assets/scripts/navigator/StackNavigator.ts
+70
-72
VirtualNavigator.ts
assets/scripts/navigator/VirtualNavigator.ts
+1
-5
index.html
index.html
+1
-1
activityBaseInfo.json
mock/aaw/miningMachine/activityBaseInfo.json
+1
-1
pkFriends.json
mock/aaw/miningMachine/pkFriends.json
+1
-1
No files found.
assets/scripts/dialogs/PKMatching.ts
View file @
81f61b87
...
...
@@ -7,6 +7,7 @@
import
DialogContent
from
"../popup/DialogContent"
;
import
{
dynamic
,
Entity
,
resource
}
from
"scilla"
;
import
TextRenderer
from
"components/renderer/TextRenderer"
;
import
{
stringFixed
}
from
"../game/utils"
;
export
default
class
PKMatching
extends
DialogContent
{
Title
:
Entity
;
...
...
@@ -36,8 +37,8 @@ export default class PKMatching extends DialogContent {
const
{
channel
}
=
data
;
this
.
_titleRenderer
.
text
=
'正在匹配对手…'
;
this
.
_selfNameRenderer
.
text
=
this
.
userNickname
;
this
.
_otherNameRenderer
.
text
=
this
.
otherName
;
this
.
_selfNameRenderer
.
text
=
stringFixed
(
this
.
userNickname
)
;
this
.
_otherNameRenderer
.
text
=
stringFixed
(
this
.
otherName
)
;
this
.
AvatarOther
.
enabled
=
false
;
this
.
AvatarWaiting
.
enabled
=
true
;
...
...
assets/scripts/game/PKResultAnimSide.ts
View file @
81f61b87
...
...
@@ -10,7 +10,7 @@ import Transform from "components/base/Transform";
import
TextRenderer
from
"components/renderer/TextRenderer"
;
import
TimesCard
from
"./TimesCard"
;
import
RunNumber
from
"../common/RunNumber"
;
import
{
renderRunCredits
}
from
"./utils"
;
import
{
renderRunCredits
,
stringFixed
}
from
"./utils"
;
export
default
class
PKResultAnimSide
extends
ScillaComponent
{
LabelName
:
Entity
;
...
...
@@ -46,7 +46,7 @@ export default class PKResultAnimSide extends ScillaComponent {
const
{
nickname
,
receiveCredits
,
finalCredits
,
multipleCard
}
=
data
;
const
showTimesCard
=
multipleCard
>
0
;
this
.
_labelName
.
text
=
nickname
;
this
.
_labelName
.
text
=
stringFixed
(
nickname
)
;
this
.
_labelCredits
.
text
=
''
;
this
.
TimesCard
.
enabled
=
false
;
...
...
assets/scripts/game/PKResultSide.ts
View file @
81f61b87
...
...
@@ -4,14 +4,12 @@
* pk结果一侧
*/
import
{
Entity
,
resource
}
from
"scilla"
;
import
ScillaComponent
from
"components/base/ScillaComponent"
;
import
{
createTween
,
ease
,
engine
,
Entity
,
Tween
}
from
"scilla"
;
import
{
createTween
,
ease
,
engine
,
Entity
,
resource
}
from
"scilla"
;
import
Transform
from
"components/base/Transform"
;
import
TextRenderer
from
"components/renderer/TextRenderer"
;
import
RunNumber
from
"../common/RunNumber"
;
import
{
renderRunCredits
}
from
"./utils"
;
import
{
renderRunCredits
,
stringFixed
}
from
"./utils"
;
import
Zoom
from
"components/animation/Zoom"
;
import
TextureRenderer
from
"components/renderer/TextureRenderer"
;
...
...
@@ -63,7 +61,7 @@ export default class PKResultSide extends ScillaComponent {
async
play
(
data
)
{
const
{
nickname
,
finalCredits
,
otherFinalCredits
,
resultState
}
=
data
;
this
.
_labelName
.
text
=
nickname
;
this
.
_labelName
.
text
=
stringFixed
(
nickname
)
;
this
.
_labelCredits
.
text
=
renderRunCredits
(
finalCredits
);
const
win
=
resultState
===
this
.
side
;
...
...
assets/scripts/game/utils.ts
View file @
81f61b87
...
...
@@ -26,3 +26,10 @@ export function isWeiXin() {
const
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
includes
(
'micromessenger'
);
}
export
function
stringFixed
(
str
,
limit
=
6
,
mask
=
'…'
){
if
(
str
.
length
>
limit
){
return
str
.
substr
(
0
,
limit
)
+
mask
;
}
return
str
;
}
assets/scripts/navigator/Navigator.ts
View file @
81f61b87
...
...
@@ -5,11 +5,7 @@
*/
import
{
EventEmitter
}
from
'scilla'
import
{
alien
}
from
"./StackNavigator"
;
import
NavigatorAction
=
alien
.
NavigatorAction
;
import
INavigatorDelegate
=
alien
.
INavigatorDelegate
;
import
StackNavigator
=
alien
.
StackNavigator
;
import
{
INavigatorDelegate
,
NavigatorAction
,
StackNavigator
}
from
"./StackNavigator"
;
export
interface
INavigatorViewBase
{
onAddView
():
boolean
;
...
...
assets/scripts/navigator/StackNavigator.ts
View file @
81f61b87
...
...
@@ -4,98 +4,96 @@
* 堆栈导航器
*/
export
module
alien
{
export
enum
NavigatorAction
{
Push
,
Pop
,
Replace
,
Jump
}
export
enum
NavigatorAction
{
Push
,
Pop
,
Replace
,
Jump
}
export
interface
INavigatorDelegate
{
onEnter
(
name
:
string
,
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
);
export
interface
INavigatorDelegate
{
onEnter
(
name
:
string
,
last
:
string
,
action
:
NavigatorAction
,
parameters
:
any
);
onLeave
(
name
:
string
,
next
:
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
;
onError
(
error
:
Error
);
}
constructor
(
delegate
:
INavigatorDelegate
)
{
this
.
_stack
=
[];
this
.
_delegate
=
delegate
;
}
export
class
StackNavigator
{
private
_stack
:
string
[];
private
_delegate
:
INavigatorDelegate
;
private
catchPromise
(
p
:
Promise
<
any
>
)
{
if
(
p
)
{
p
.
catch
((
e
=>
{
this
.
_delegate
.
onError
(
e
);
}))
}
}
constructor
(
delegate
:
INavigatorDelegate
)
{
this
.
_stack
=
[];
this
.
_delegate
=
delegate
;
}
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
));
private
catchPromise
(
p
:
Promise
<
any
>
)
{
if
(
p
)
{
p
.
catch
((
e
=>
{
this
.
_delegate
.
onError
(
e
);
}))
}
}
popTo
(
index
,
name
?:
string
,
parameters
:
any
=
null
)
{
if
(
this
.
_stack
.
length
>
0
&&
this
.
_stack
.
length
<
(
index
+
1
))
{
push
(
name
:
string
,
parameters
:
any
=
null
)
{
let
last
:
string
=
this
.
getTopSceneName
();
if
(
last
)
{
if
(
last
==
name
)
{
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
));
this
.
catchPromise
(
this
.
_delegate
.
onLeave
(
last
,
name
,
NavigatorAction
.
Push
,
parameters
));
}
this
.
_stack
.
push
(
name
);
this
.
catchPromise
(
this
.
_delegate
.
onEnter
(
name
,
last
,
NavigatorAction
.
Push
,
parameters
));
}
pop
(
parameters
:
any
=
null
)
{
this
.
popTo
(
this
.
_stack
.
length
-
2
,
null
,
parameters
);
popTo
(
index
,
name
?:
string
,
parameters
:
any
=
null
)
{
if
(
this
.
_stack
.
length
>
0
&&
this
.
_stack
.
length
<
(
index
+
1
))
{
return
;
}
popAll
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
popTo
(
-
1
,
name
,
parameters
);
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
));
}
replace
(
name
:
string
,
parameters
:
any
=
null
)
{
let
last
:
string
=
this
.
_stack
.
pop
(
);
this
.
_stack
.
push
(
name
);
pop
(
parameters
:
any
=
null
)
{
this
.
popTo
(
this
.
_stack
.
length
-
2
,
null
,
parameters
);
}
this
.
catchPromise
(
this
.
_delegate
.
onLeave
(
last
,
name
,
NavigatorAction
.
Replace
,
parameters
));
this
.
catchPromise
(
this
.
_delegate
.
onEnter
(
name
,
last
,
NavigatorAction
.
Replace
,
parameters
)
);
}
popAll
(
name
:
string
,
parameters
:
any
=
null
)
{
this
.
popTo
(
-
1
,
name
,
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
);
}
replace
(
name
:
string
,
parameters
:
any
=
null
)
{
let
last
:
string
=
this
.
_stack
.
pop
();
this
.
_stack
.
push
(
name
);
private
getTopSceneName
():
string
{
return
this
.
_stack
.
length
>
0
?
this
.
_stack
[
this
.
_stack
.
length
-
1
]
:
null
;
}
this
.
catchPromise
(
this
.
_delegate
.
onLeave
(
last
,
name
,
NavigatorAction
.
Replace
,
parameters
));
this
.
catchPromise
(
this
.
_delegate
.
onEnter
(
name
,
last
,
NavigatorAction
.
Replace
,
parameters
))
;
}
private
getBottomSceneName
():
string
{
return
this
.
_stack
.
length
>
0
?
this
.
_stack
[
0
]
:
null
;
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/VirtualNavigator.ts
View file @
81f61b87
...
...
@@ -5,11 +5,7 @@
*/
import
{
Entity
,
EventEmitter
}
from
'scilla'
import
{
alien
}
from
"./StackNavigator"
;
import
NavigatorAction
=
alien
.
NavigatorAction
;
import
INavigatorDelegate
=
alien
.
INavigatorDelegate
;
import
StackNavigator
=
alien
.
StackNavigator
;
import
{
INavigatorDelegate
,
NavigatorAction
,
StackNavigator
}
from
"./StackNavigator"
;
const
showLog
=
false
;
...
...
index.html
View file @
81f61b87
...
...
@@ -64,7 +64,7 @@
logined
:
true
,
//是否登录 true是为登录
earnCreditsUrl
:
'http://www.baidu.com'
,
//加积分接口
unitName
:
'贝壳'
,
//积分单位
userNickname
:
'超级登山包'
,
//用户昵称
userNickname
:
'超级登山包
超级登山包超级登山包
'
,
//用户昵称
showCredits
:
1
,
//是否展示积分 1:展示 2:不展示
activityCode
:
''
,
//活动代码
configJson
:
'{"background":"//yun.duiba.com.cn/h5/miningMachine/home-bg.jpg","pk_button_normal":"//yun.duiba.com.cn/h5/miningMachine/pk-btn.png","pk_button_disabled":"//yun.duiba.com.cn/h5/miningMachine/pk-filter-btn.png","dig_button_normal":"//yun.duiba.com.cn/h5/miningMachine/mining-btn.png","dig_button_disabled":"//yun.dui88.com/h5/miningMachine/mining-filter-btn.png","dialog_background":"//yun.duiba.com.cn/h5/miningMachine/modal-bg.png","dialog_button":"//yun.duiba.com.cn/h5/miningMachine/modal-btn.png","pk_button_label_normal":"#FFF591","pk_button_label_disabled":"#666666","dig_button_label_normal":"#D12C00","dig_button_label_disabled":"#666666","dialog_text_color":"#AB5400","dialog_button_label":"#FFF591"}'
...
...
mock/aaw/miningMachine/activityBaseInfo.json
View file @
81f61b87
...
...
@@ -8,6 +8,6 @@
"heapCredits"
:
400
,
"miningExpend"
:
100
,
"pkExpend"
:
100
,
"machineNickname
1"
:
"机器人昵称
"
"machineNickname
"
:
"超级登山包超级登山包超级登山包
"
}
}
\ No newline at end of file
mock/aaw/miningMachine/pkFriends.json
View file @
81f61b87
...
...
@@ -10,7 +10,7 @@
"machineReceiveCredits"
:
50
,
"machineMultipleCard"
:
2
,
"machineFinalCredits"
:
100
,
"machineNickname"
:
"simba"
,
"machineNickname"
:
"simba
simbasimbasimbasimba
"
,
"machineAvatar"
:
"Avengers"
,
"operationType"
:
1
}
...
...
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