Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crazyflirt
Project
Overview
Details
Activity
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
Shawn Wang
crazyflirt
Commits
c7c4ac86
Commit
c7c4ac86
authored
May 05, 2018
by
Shawn Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add platform
parent
6983c1f2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
3 deletions
+72
-3
.gitignore
.gitignore
+5
-2
SceneManager.ts
fe/src/SceneManager.ts
+1
-1
platform.js
fe_wxgame/platform.js
+66
-0
No files found.
.gitignore
View file @
c7c4ac86
node_modules/
node_modules/
.wing/
.wing/
fe_wxgame/
\ No newline at end of file
fe_wxgame/*
!fe_wxgame/platform.js
\ No newline at end of file
fe/src/SceneManager.ts
View file @
c7c4ac86
...
@@ -15,7 +15,7 @@ class SceneManager extends egret.DisplayObjectContainer {
...
@@ -15,7 +15,7 @@ class SceneManager extends egret.DisplayObjectContainer {
this
.
roomScene
=
new
RoomScene
();
this
.
roomScene
=
new
RoomScene
();
this
.
gameScene
=
new
GameScene
();
this
.
gameScene
=
new
GameScene
();
// 默认添加开始场景
// 默认添加开始场景
this
.
addChild
(
this
.
room
Scene
);
this
.
addChild
(
this
.
game
Scene
);
}
}
// 实例化单例获取方法
// 实例化单例获取方法
public
static
getInstance
():
SceneManager
{
public
static
getInstance
():
SceneManager
{
...
...
fe_wxgame/platform.js
0 → 100644
View file @
c7c4ac86
/**
* 请在白鹭引擎的Main.ts中调用 platform.login() 方法调用至此处。
*/
class
WxgamePlatform
{
name
=
'wxgame'
login
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
login
({
success
:
(
res
)
=>
{
resolve
(
res
)
}
})
})
}
getUserInfo
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getUserInfo
({
withCredentials
:
true
,
success
:
function
(
res
)
{
var
userInfo
=
res
.
userInfo
var
nickName
=
userInfo
.
nickName
var
avatarUrl
=
userInfo
.
avatarUrl
var
gender
=
userInfo
.
gender
//性别 0:未知、1:男、2:女
var
province
=
userInfo
.
province
var
city
=
userInfo
.
city
var
country
=
userInfo
.
country
resolve
(
userInfo
);
}
})
})
}
connectSocket
(
options
){
wx
.
connectSocket
(
options
)
}
onSocketOpen
(
callback
){
wx
.
onSocketOpen
(
callback
)
}
onSocketClose
(
callback
){
wx
.
onSocketClose
(
callback
)
}
onSocketMessage
(
callback
){
wx
.
onSocketMessage
(
callback
)
}
onSocketError
(
callback
){
wx
.
onSocketError
(
callback
)
}
sendSocketMessage
(
options
){
wx
.
sendSocketMessage
(
options
)
}
request
(
options
){
wx
.
request
(
options
)
}
}
window
.
platform
=
new
WxgamePlatform
();
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