Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-template-curse
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
劳工
game-template-curse
Commits
1f711c06
Commit
1f711c06
authored
Oct 22, 2018
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整目录
parent
629230a5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1 addition
and
399 deletions
+1
-399
BuriedPoint.ts
src/game/model/BuriedPoint.ts
+0
-0
BuriedPointService.ts
src/game/services/BuriedPointService.ts
+1
-1
GameInfo.ts
src/model/GameInfo.ts
+0
-42
LanguagePack.ts
src/model/LanguagePack.ts
+0
-46
data-center.ts
src/model/data-center.ts
+0
-11
BadgeService.ts
src/services/BadgeService.ts
+0
-53
BuriedPointService.ts
src/services/BuriedPointService.ts
+0
-85
DefenseService.ts
src/services/DefenseService.ts
+0
-59
MainService.ts
src/services/MainService.ts
+0
-28
StorageService.ts
src/services/StorageService.ts
+0
-74
No files found.
src/game/
net
/BuriedPoint.ts
→
src/game/
model
/BuriedPoint.ts
View file @
1f711c06
File moved
src/game/services/BuriedPointService.ts
View file @
1f711c06
...
...
@@ -7,7 +7,7 @@
import
Service
from
"../../core/Service"
;
import
GameConfig
from
"../model/GameConfig"
;
import
{
JSONP
}
from
"@alienlib/tools/Ajax"
;
import
BuriedPoint
from
"../
net
/BuriedPoint"
;
import
BuriedPoint
from
"../
model
/BuriedPoint"
;
import
{
gameInfo
}
from
"../model/data-center"
;
import
webService
from
"../../core/WebService"
;
...
...
src/model/GameInfo.ts
deleted
100644 → 0
View file @
629230a5
/**
* Created by rockyl on 2018/8/21.
*/
export
default
class
GameInfo
{
data
:
any
;
creditUnit
;
update
(
data
){
this
.
data
=
data
;
this
.
data
.
oldMaxScore
=
this
.
data
?
this
.
maxScore
:
0
;
}
get
statusCode
(){
return
this
.
data
.
status
.
code
;
}
get
maxScore
(){
return
this
.
data
.
maxScore
||
0
;
}
get
percentage
(){
return
this
.
data
.
percentage
;
}
get
credits
(){
return
this
.
data
.
credits
;
}
get
status
(){
return
this
.
data
.
status
;
}
get
gameId
(){
return
this
.
data
.
gameId
;
}
get
consumerId
(){
return
this
.
data
.
consumerId
;
}
}
src/model/LanguagePack.ts
deleted
100644 → 0
View file @
629230a5
export
class
LanguagePack
{
need_login
:
string
;
net_error
:
string
;
current_score
:
string
;
max_score
:
string
;
score_unit
:
string
;
free
:
string
;
my_credit
:
string
;
no_more_credits
:
string
;
revive_cost
:
string
;
revive_failed
:
string
;
rank_first
:
string
;
rank_second
:
string
;
rank_third
:
string
;
rank_num
:
string
;
rank_out
:
string
;
me
:
string
;
rank_max_score
:
string
;
rank_reward_content
:
string
;
no_more_items
:
string
;
need_install_app
:
string
;
share_result
:
any
;
}
export
class
LanguageIds
{
need_login
:
string
=
'need_login'
;
net_error
:
string
=
'net_error'
;
current_score
:
string
=
'current_score'
;
max_score
:
string
=
'max_score'
;
score_unit
:
string
=
'score_unit'
;
free
:
string
=
'free'
;
my_credit
:
string
=
'my_credit'
;
no_more_credits
:
string
=
'no_more_credits'
;
revive_cost
:
string
=
'revive_cost'
;
revive_failed
:
string
=
'revive_failed'
;
rank_first
:
string
=
'rank_first'
;
rank_second
:
string
=
'rank_second'
;
rank_third
:
string
=
'rank_third'
;
rank_num
:
string
=
'rank_num'
;
rank_out
:
string
=
'rank_out'
;
me
:
string
=
'me'
;
rank_max_score
:
string
=
'rank_max_score'
;
rank_reward_content
:
string
=
'rank_reward_content'
;
no_more_items
:
string
=
'no_more_items'
;
need_install_app
:
string
=
'need_install_app'
;
share_result
:
string
=
'share_result'
;
}
\ No newline at end of file
src/model/data-center.ts
deleted
100644 → 0
View file @
629230a5
/**
* Created by rockyl on 2018/9/12.
*
* 数据中心
*/
import
GameInfo
from
"./GameInfo"
;
export
const
gameInfo
:
GameInfo
=
new
GameInfo
();
export
const
authData
:
any
=
{};
export
const
pluginInfos
=
{};
src/services/BadgeService.ts
deleted
100644 → 0
View file @
629230a5
/**
* Created by rockyl on 2018/8/23.
*
* 任务服务
*/
import
Service
from
"./Service"
;
import
{
BADGE_CHANGED
}
from
"../model/events"
;
class
BadgeService
extends
Service
{
items
:
any
;
async
start
():
Promise
<
void
>
{
await
super
.
start
();
this
.
items
=
{};
}
private
getItem
(
name
){
let
item
=
this
.
items
[
name
];
if
(
!
item
){
item
=
this
.
items
[
name
]
=
{
number
:
0
,
};
}
return
item
;
}
private
updateItem
(
name
,
item
,
number
){
item
.
number
=
number
;
this
.
dispatchEventWith
(
BADGE_CHANGED
,
false
,
{
name
,
number
})
}
update
(
name
,
number
){
const
item
=
this
.
getItem
(
name
);
this
.
updateItem
(
name
,
item
,
number
);
}
change
(
name
,
number
){
const
item
=
this
.
getItem
(
name
);
this
.
updateItem
(
name
,
item
,
item
.
number
+
number
);
}
getNumber
(
name
){
const
item
=
this
.
getItem
(
name
);
return
item
.
number
;
}
}
const
badgeService
:
BadgeService
=
new
BadgeService
();
export
default
badgeService
;
src/services/BuriedPointService.ts
deleted
100644 → 0
View file @
629230a5
/**
* Created by rockyl on 2018/9/29.
*
* 埋点服务
*/
import
Service
from
"./Service"
;
import
GameConfig
from
"../model/GameConfig"
;
import
{
JSONP
}
from
"@alienlib/tools/Ajax"
;
import
webService
from
"../net/WebService"
;
import
BuriedPoint
from
"../net/BuriedPoint"
;
import
{
gameInfo
}
from
"../model/data-center"
;
class
BuriedPointService
extends
Service
{
private
_buriedPoints
:
any
=
{};
env
:
any
;
async
start
():
Promise
<
void
>
{
await
super
.
start
();
this
.
initEnv
();
}
initEnv
(){
this
.
env
=
{
app_id
:
GameConfig
.
appConfig
.
appId
,
oaid
:
GameConfig
.
gameConfig
.
oaId
,
}
}
addBuriedPoints
(
buriedPoints
)
{
for
(
let
name
in
buriedPoints
)
{
this
.
_buriedPoints
[
name
]
=
buriedPoints
[
name
];
}
}
addBuriedPointConfig
(
name
,
config
)
{
const
{
dpm
,
dcm
}
=
config
;
this
.
_buriedPoints
[
name
]
=
new
BuriedPoint
(
dpm
,
dcm
,
this
.
env
);
}
addBuriedPointConfigs
(
configs
)
{
for
(
let
name
in
configs
)
{
this
.
addBuriedPointConfig
(
name
,
configs
[
name
]);
}
}
logExposure
(
name
)
{
return
this
.
log
(
name
,
'exposure'
);
}
logClick
(
name
)
{
return
this
.
log
(
name
,
'click'
);
}
log
(
name
,
type
)
{
let
logPoint
=
this
.
_buriedPoints
[
name
];
let
{
consumerId
}
=
gameInfo
;
let
{
appId
}
=
GameConfig
.
appConfig
;
let
{
dpm
,
dcm
}
=
logPoint
;
if
(
type
==
'exposure'
)
{
return
JSONP
(
'//embedlog.duiba.com.cn/exposure/standard'
,
{
dpm
,
dcm
,
consumerId
,
appId
,
},
'get'
).
catch
(
e
=>
{
//console.log(e);
});
}
else
{
return
webService
.
callApi
(
'/log/click'
,
{
dpm
,
dcm
,
consumerId
,
appId
},
'get'
).
catch
(
e
=>
{
//console.log(e);
});
}
}
}
const
buriedPointService
:
BuriedPointService
=
new
BuriedPointService
();
export
default
buriedPointService
;
src/services/DefenseService.ts
deleted
100644 → 0
View file @
629230a5
/**
* Created by rockyl on 2018/8/23.
*/
import
Service
from
"./Service"
;
import
GameConfig
from
"../model/GameConfig"
;
import
*
as
api
from
"../net/proxy"
;
class
DefenseService
extends
Service
{
collection
:
any
[]
=
[];
strategyCollection
:
any
[]
=
[];
pashCount
;
setView
(
view
){
this
.
registerEvent
(
view
,
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
onTouch
.
bind
(
this
,
'md'
),
this
);
}
reset
()
{
this
.
collection
.
splice
(
0
);
this
.
strategyCollection
.
splice
(
0
);
this
.
pashCount
=
0
;
}
private
onTouch
(
type
,
e
:
egret
.
TouchEvent
){
const
data
=
{
a
:
type
,
t
:
Date
.
now
(),
x
:
e
.
stageX
,
y
:
e
.
stageY
};
/*let str = JSON.stringify(data);
str = md5(str);
let result = '';
for(let i = 0, li = str.length; i < li; i++){
result += Math.random() < 0.3 ? str.charAt(i) : '';
}*/
this
.
strategyCollection
.
push
(
data
)
}
scoreChanged
(
score
){
const
{
interfaceLimit
,
scoreUnit
}
=
GameConfig
.
defenseConfig
;
const
nextDatapashScore
=
score
-
this
.
pashCount
*
scoreUnit
;
if
(
scoreUnit
==
0
||
nextDatapashScore
<
scoreUnit
||
this
.
pashCount
>
interfaceLimit
)
{
return
;
}
this
.
collection
.
push
(
this
.
strategyCollection
.
concat
());
api
.
datapash
(
this
.
strategyCollection
);
this
.
strategyCollection
.
splice
(
0
);
this
.
pashCount
++
;
}
close
(){
this
.
collection
.
push
(
this
.
strategyCollection
.
concat
());
return
{
strategyCollection
:
this
.
strategyCollection
,
collection
:
this
.
collection
,
}
}
}
const
defenseService
:
DefenseService
=
new
DefenseService
();
export
default
defenseService
;
\ No newline at end of file
src/services/MainService.ts
deleted
100644 → 0
View file @
629230a5
/**
* Created by admin on 2017/6/26.
*
* 主服务
*/
import
GameConfig
from
"../model/GameConfig"
;
import
Service
from
"./Service"
;
import
*
as
api
from
'../net/proxy'
class
MainService
extends
Service
{
async
start
()
{
GameConfig
.
parseConfig
();
await
super
.
start
();
await
Promise
.
all
([
api
.
getInfo
(),
//api.getCredits(),
//api.getPrizeInfo(drawPluginId),
//api.plugDrawInfo(drawPluginId),
])
}
}
const
mainService
:
MainService
=
new
MainService
();
export
default
mainService
src/services/StorageService.ts
deleted
100644 → 0
View file @
629230a5
/**
* Created by admin on 2017/6/16.
*
* 存储数据服务
*/
import
Service
from
"./Service"
;
import
{
LocalStorage
}
from
"@alienlib/support"
;
import
{
SETTING_CHANGED
}
from
"../model/events"
;
class
StorageService
extends
Service
{
protected
store
:
any
;
protected
_initialized
;
start
():
Promise
<
any
>
{
this
.
load
();
this
.
store
.
launch_count
=
this
.
store
.
launch_count
?
this
.
store
.
launch_count
+
1
:
1
;
this
.
save
();
return
super
.
start
();
}
private
load
(){
this
.
store
=
LocalStorage
.
getItemObj
(
'store'
,
{});
}
save
(){
LocalStorage
.
setItemObj
(
'store'
,
this
.
store
);
}
clean
(
keeps
=
null
){
if
(
keeps
){
for
(
let
k
in
this
.
store
){
if
(
keeps
.
indexOf
(
k
)
<
0
&&
this
.
store
.
hasOwnProperty
(
k
)){
delete
this
.
store
[
k
];
}
}
}
else
{
this
.
store
=
{};
}
this
.
save
();
this
.
_initialized
=
false
;
}
get
launchCount
(){
return
this
.
store
.
launch_count
;
}
getSettingItem
(
field
){
return
this
.
store
.
setting
?
(
this
.
store
.
setting
[
field
]
===
undefined
?
true
:
this
.
store
.
setting
[
field
])
:
true
;
}
setSettingItem
(
field
,
value
,
dispatch
=
true
){
let
setting
=
this
.
store
.
setting
;
if
(
!
setting
){
setting
=
this
.
store
.
setting
=
{};
}
setting
[
field
]
=
value
;
this
.
save
();
if
(
dispatch
){
this
.
dispatchEventWith
(
SETTING_CHANGED
,
false
,
{
field
,
value
});
}
}
switchSettingItem
(
field
,
dispatch
=
true
){
this
.
setSettingItem
(
field
,
!
this
.
getSettingItem
(
field
),
dispatch
);
}
}
const
storageService
:
StorageService
=
new
StorageService
();
export
default
storageService
;
\ No newline at end of file
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