Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
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
崔立强
db-game-template
Commits
f2072756
Commit
f2072756
authored
Dec 11, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
189e5c8e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
165 additions
and
6 deletions
+165
-6
index.html
egret/index.html
+1
-1
MainBase.ts
egret/src/MainBase.ts
+32
-4
ShareDreamScene.ts
egret/src/ShareDreamScene.ts
+4
-1
Utils.ts
egret/src/Utils.ts
+128
-0
No files found.
egret/index.html
View file @
f2072756
...
...
@@ -48,7 +48,7 @@
window
[
'rule'
]
=
'1111<br>2222'
;
window
[
'projectID'
]
=
'p32804e45'
;
// window.firstScene='admin';
window
.
firstScene
=
'invite'
;
//
window.firstScene='invite';
window
[
'renderMode'
]
=
'webgl'
;
window
[
'development'
]
=
true
;
var
gameId
=
1
;
...
...
egret/src/MainBase.ts
View file @
f2072756
...
...
@@ -7,7 +7,7 @@ import SuccessPanel from "./panels/SuccessPanel";
import
AdminPanel
from
"./panels/AdminPanel"
;
import
CostPanel
from
"./panels/CostPanel"
;
import
ShareDreamScene
from
"./ShareDreamScene"
;
import
HisDreamScene
from
"./HisDreamScene"
;
import
HisDreamScene
,
{
HisDreamType
}
from
"./HisDreamScene"
;
import
MainScene
from
"./MainScene"
;
import
IntroScene
from
"./IntroScene"
;
import
DreamScene
from
"./DreamScene"
;
...
...
@@ -22,9 +22,34 @@ import ThemeAdapter from "../libs/new_wx/adapter/ThemeAdapter";
import
layers
from
"../libs/new_wx/views/layers"
;
import
getResPath
from
"../libs/new_tc/getResPath"
;
import
{
NetManager
}
from
"../libs/tw/manager/NetManager"
;
import
{
updateCredits
}
from
"./getcredits"
;
import
getcredits
,
{
updateCredits
}
from
"./getcredits"
;
import
AdminPanel2
from
"./panels/AdminPanel2"
;
import
Utils
from
"./Utils"
;
import
join_1_index
from
"./interfaces/join_1_index"
;
const
onTap_detail
=
(
id
)
=>
{
// console.log('点击查看详情');
NetManager
.
ins
.
yyh_credits
(()
=>
{
const
credits
=
getcredits
();
NetManager
.
ins
.
yyh_join1_dreamDetail
(()
=>
{
const
join_1_index
:
join_1_index
=
DataManager
.
ins
.
getData
(
'yyh_join1_index'
);
const
detail
=
DataManager
.
ins
.
getData
(
'yyh_join1_dreamDetail'
).
data
;
if
(
new
Date
().
getTime
()
>
join_1_index
.
data
.
assistDeadline
)
SceneCtrl
.
instance
.
change
(
'HisDreamScene'
,
HisDreamType
.
TIMES_OUT
);
else
if
(
detail
.
assist
)
{
//主力了
SceneCtrl
.
instance
.
change
(
'HisDreamScene'
,
HisDreamType
.
HELP_DONE
);
}
else
{
if
(
join_1_index
.
data
.
doAssistCount
>=
join_1_index
.
data
.
doAssistLimit
)
{
//次数限制
SceneCtrl
.
instance
.
change
(
'HisDreamScene'
,
HisDreamType
.
TIMES_LIMIT
);
}
else
if
(
credits
<=
0
)
{
SceneCtrl
.
instance
.
change
(
'HisDreamScene'
,
HisDreamType
.
MONEY_NOT_ENOUPH
);
}
else
{
SceneCtrl
.
instance
.
change
(
'HisDreamScene'
,
HisDreamType
.
ENOUPH_TIMES
);
}
}
},
false
,
id
);
});
}
export
default
class
MainBase
extends
eui
.
UILayer
{
constructor
()
{
...
...
@@ -157,7 +182,10 @@ export default class MainBase extends eui.UILayer {
SceneCtrl
.
instance
.
change
(
'AdminScene'
);
}
else
{
await
this
.
getIndex
();
SceneCtrl
.
instance
.
change
(
'MainScene'
);
if
(
Utils
.
getRequestByKey
(
'id'
))
{
onTap_detail
(
Utils
.
getRequestByKey
(
'id'
));
}
else
SceneCtrl
.
instance
.
change
(
'MainScene'
);
}
updateCredits
();
...
...
egret/src/ShareDreamScene.ts
View file @
f2072756
...
...
@@ -7,12 +7,14 @@ import iswx from "./iswx";
export
default
class
ShareDreamScene
extends
Scene
{
type
;
id
;
async
start
(
type
?)
{
this
.
showlog
();
let
{
id2
,
address
,
avatar
,
url
,
content
,
title
}
=
getRequest
();
this
[
'from'
].
text
=
`来自
${
getProvince
(
decodeURIComponent
(
address
))}
的梦想`
;
this
[
'idtxt'
].
text
=
`编号:
${
id2
}
`
;
this
.
id
=
id2
;
this
[
'title'
].
text
=
decodeURIComponent
(
title
);
this
.
type
=
type
;
...
...
@@ -42,7 +44,8 @@ export default class ShareDreamScene extends Scene {
let
state
=
false
;
console
.
log
(
'唤起app'
);
state
=
true
;
const
url
=
'esports://openapp?url=http://aghzact.zjkczn.com/h5/defaultActive.html?activeUrl='
+
encodeURIComponent
(
window
[
'activeUrl'
]);
const
url1
=
`
${
window
[
'activeUrl'
]}
?id=
${
this
.
id
}
`
;
const
url
=
'esports://openapp?url=http://aghzact.zjkczn.com/h5/defaultActive.html?activeUrl='
+
encodeURIComponent
(
url1
);
window
.
location
.
href
=
url
;
let
timer
=
setTimeout
(()
=>
{
...
...
egret/src/Utils.ts
0 → 100644
View file @
f2072756
export
default
class
Utils
{
constructor
()
{
}
/**
* 获取连接上的参数,以对象的形式返回
* @constructor
*/
public
static
getRequest
()
{
const
url
=
location
.
search
;
//获取url中"?"符后的字串
let
theRequest
=
{};
if
(
url
.
indexOf
(
"?"
)
!=
-
1
)
{
let
str
=
url
.
substr
(
1
);
let
strs
=
str
.
split
(
"&"
);
for
(
let
i
=
0
;
i
<
strs
.
length
;
i
++
)
{
theRequest
[
strs
[
i
].
split
(
"="
)[
0
]]
=
unescape
(
strs
[
i
].
split
(
"="
)[
1
]);
}
}
return
theRequest
;
}
/**
* 通过Key获取连接上的参数
* @param key
*/
public
static
getRequestByKey
(
key
:
string
)
{
return
this
.
getRequest
()[
key
];
}
/**
* 时间戳转几时几分几秒
* @param time 时间戳
*/
public
static
convertTime
(
time
:
number
)
{
let
hour
=
~~
(
time
/
3600000
);
// 小时
let
min
=
~~
((
time
-
hour
*
3600000
)
/
60000
);
// 分
let
sec
=
~~
((
time
-
hour
*
3600000
-
min
*
60000
)
/
1000
);
// 秒
return
{
hour
:
Utils
.
prefixInteger
(
hour
,
2
),
min
:
Utils
.
prefixInteger
(
min
,
2
),
sec
:
Utils
.
prefixInteger
(
sec
,
2
)
}
}
/**
* 数字补0
* @param num 数字
* @param length 位数
*/
public
static
prefixInteger
(
num
,
length
)
{
return
(
Array
(
length
).
join
(
'0'
)
+
num
).
slice
(
-
length
);
}
/**
* 对象/数组 深拷贝
* @param {Object} src - 来源对象
* @param {Object} dst - 目标对象
* @returns {Object} obj - 拷贝完成的对象
*/
public
static
deepClone
(
src
,
dst
=
undefined
)
{
if
(
src
){
return
src
;
}
let
_obj
=
dst
||
(
src
instanceof
Array
?
[]
:
{});
for
(
let
key
in
src
)
{
let
prop
=
src
[
key
];
if
(
prop
===
_obj
)
{
// 避免相互引用对象导致死循环,如src.a = dst的情况
continue
;
}
_obj
[
key
]
=
((
typeof
prop
===
'object'
)
?
this
.
deepClone
(
prop
)
:
_obj
[
key
]
=
prop
);
// if (typeof prop === 'object') { // 如果这是个对象则递归调用
// _obj[key] = _deepClone(prop);
// } else {
// _obj[key] = prop;
// }
}
return
_obj
;
};
/**
* 产生一个固定范围的随机数(左闭右开)
* @param start
* @param end
*/
public
static
Random
(
start
:
number
,
end
:
number
)
{
return
Math
.
random
()
*
(
end
-
start
)
+
start
;
}
/**
* 产生一个固定范围的随机整数(左闭右开)
* @param start
* @param end
*/
public
static
RandomInt
(
start
:
number
,
end
:
number
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
end
-
start
)
+
start
);
}
/**
* obj是否在array中
* @param obj
* @param array
*/
public
static
isInArray
(
obj
:
any
,
array
:
any
[])
{
for
(
let
i
in
array
)
{
if
(
obj
==
array
[
i
])
{
return
true
;
}
}
return
false
;
}
/**
* 简单的碰撞检测
* @param obj1
* @param obj2
*/
public
static
hitTest
(
obj1
:
any
,
obj2
:
any
):
boolean
{
let
rect1
:
egret
.
Rectangle
=
obj1
.
getBounds
();
let
rect2
:
egret
.
Rectangle
=
obj2
.
getBounds
();
rect1
.
x
=
obj1
.
x
;
rect1
.
y
=
obj1
.
y
;
rect2
.
x
=
obj2
.
x
;
rect2
.
y
=
obj2
.
y
;
return
rect1
.
intersects
(
rect2
);
}
}
\ 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