Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TNGD_CaveCruiser
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
TNGD_CaveCruiser
Commits
8ebceaed
Commit
8ebceaed
authored
Sep 02, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传
parent
f8fd2e42
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
5 deletions
+27
-5
custom.ts
@types/custom.ts
+1
-0
store.ts
assets/Scripts/store/store.ts
+17
-0
Start.ts
assets/Start/Start.ts
+5
-4
index.ejs
preview-template/index.ejs
+4
-1
No files found.
@types/custom.ts
0 → 100644
View file @
8ebceaed
declare
const
window
:
any
;
assets/Scripts/store/store.ts
View file @
8ebceaed
...
@@ -12,6 +12,23 @@ export interface IHomeInfo {
...
@@ -12,6 +12,23 @@ export interface IHomeInfo {
class
Store
{
class
Store
{
miniAppQuery
:
any
=
{};
async
getMiniQuery
()
{
return
new
Promise
<
void
>
((
resolve
)
=>
{
window
[
"my"
].
onMessage
=
(
e
:
any
=
{})
=>
{
const
{
query
,
type
}
=
e
;
if
(
type
==
"getMiniAppQuery"
)
{
this
.
miniAppQuery
=
query
;
resolve
();
}
}
window
[
"my"
].
postMessage
({
type
:
"getMiniAppQuery"
});
});
}
frontVariable
:
{
[
key
in
string
]:
any
}
=
{}
frontVariable
:
{
[
key
in
string
]:
any
}
=
{}
async
updateFrontVariable
()
{
async
updateFrontVariable
()
{
...
...
assets/Start/Start.ts
View file @
8ebceaed
...
@@ -5,11 +5,10 @@ import { changeScene, showToast } from "db://assets/Module/UIFast";
...
@@ -5,11 +5,10 @@ import { changeScene, showToast } from "db://assets/Module/UIFast";
import
{
HomeScene
}
from
"db://assets/Scripts/Scenes/HomeScene"
;
import
{
HomeScene
}
from
"db://assets/Scripts/Scenes/HomeScene"
;
import
{
sendWebNet
,
WebNetName
}
from
"../Scripts/Utils/WebNet/WebNet"
;
import
{
sendWebNet
,
WebNetName
}
from
"../Scripts/Utils/WebNet/WebNet"
;
import
{
getUrlParams
}
from
"../Scripts/Utils/WebNet/web/webTools"
;
import
{
getUrlParams
}
from
"../Scripts/Utils/WebNet/web/webTools"
;
import
store
from
"../Scripts/store/store"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
declare
const
window
:
any
;
const
_FPS
=
61
;
const
_FPS
=
61
;
@
ccclass
(
'Start'
)
@
ccclass
(
'Start'
)
...
@@ -45,13 +44,13 @@ export class Start extends Component {
...
@@ -45,13 +44,13 @@ export class Start extends Component {
async
getAuthCode
()
{
async
getAuthCode
()
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
window
.
my
.
onMessage
=
(
e
:
any
=
{})
=>
{
window
[
"my"
]
.
onMessage
=
(
e
:
any
=
{})
=>
{
const
{
authCode
,
type
}
=
e
;
const
{
authCode
,
type
}
=
e
;
if
(
type
==
"getAuthCode"
)
{
if
(
type
==
"getAuthCode"
)
{
resolve
(
authCode
);
resolve
(
authCode
);
}
}
}
}
window
.
my
.
postMessage
({
type
:
"getAuthCode"
});
window
[
"my"
]
.
postMessage
({
type
:
"getAuthCode"
});
});
});
}
}
...
@@ -75,6 +74,8 @@ export class Start extends Component {
...
@@ -75,6 +74,8 @@ export class Start extends Component {
}
}
}
else
{
}
else
{
await
store
.
getMiniQuery
();
const
authCode
=
await
this
.
getAuthCode
();
const
authCode
=
await
this
.
getAuthCode
();
if
(
!
authCode
)
{
if
(
!
authCode
)
{
...
...
preview-template/index.ejs
View file @
8ebceaed
...
@@ -48,8 +48,11 @@
...
@@ -48,8 +48,11 @@
window
.
my
=
{
window
.
my
=
{
postMessage
(
e
){
postMessage
(
e
){
if
(
e
.
type
===
"getAuthCode"
)
{
const
eventType
=
e
.
detail
.
type
;
if
(
eventType
===
"getAuthCode"
)
{
this
.
onMessage
({
type
:
e
.
type
,
authCode
:
"authCode"
});
this
.
onMessage
({
type
:
e
.
type
,
authCode
:
"authCode"
});
}
else
if
(
eventType
===
"getMiniAppQuery"
){
this
.
onMessage
({
type
:
eventType
,
query
:
{}});
}
}
},
},
onMessage
:
()
=>
0
,
onMessage
:
()
=>
0
,
...
...
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