Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
car
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
car
Commits
23b36405
Commit
23b36405
authored
May 29, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
6f65aa47
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
11 deletions
+73
-11
HomeScene.ts
assets/Scripts/Scenes/HomeScene.ts
+4
-0
gameStore.ts
assets/Scripts/store/gameStore.ts
+69
-11
No files found.
assets/Scripts/Scenes/HomeScene.ts
View file @
23b36405
...
@@ -18,6 +18,7 @@ import { _asyncThrottle } from "../Utils/Utils";
...
@@ -18,6 +18,7 @@ import { _asyncThrottle } from "../Utils/Utils";
import
{
MainGame
}
from
"./MainGame/MainGame"
;
import
{
MainGame
}
from
"./MainGame/MainGame"
;
import
{
sendWebNet
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
import
{
sendWebNet
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
import
{
BoxPanel
}
from
"db://assets/Scripts/Panels/BoxPanel"
;
import
{
BoxPanel
}
from
"db://assets/Scripts/Panels/BoxPanel"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -105,6 +106,9 @@ export class HomeScene extends Scene {
...
@@ -105,6 +106,9 @@ export class HomeScene extends Scene {
clickStart
=
_asyncThrottle
(
async
()
=>
{
clickStart
=
_asyncThrottle
(
async
()
=>
{
await
loadWasmModuleBullet
();
await
loadWasmModuleBullet
();
const
suc
=
await
gameStore
.
start
();
if
(
!
suc
)
return
changeScene
(
MainGame
);
changeScene
(
MainGame
);
});
});
...
...
assets/Scripts/store/gameStore.ts
View file @
23b36405
import
mobx
from
"mobx"
;
import
mobx
from
"mobx"
;
import
store
from
"db://assets/Scripts/store/store"
;
import
{
creditsCost
,
sendWebNet
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
const
{
makeAutoObservable
}
=
mobx
;
const
{
makeAutoObservable
}
=
mobx
;
export
interface
IStartInfo
{
export
interface
IStartInfo
{
barrierFlag
:
boolean
,
// 本局游戏难度是否上升
startId
:
string
,
firstGameFlag
:
boolean
,
// 本局是否第一局,为true则有一,二,无尽模式三个阶段的区别
accumulateLuckNum
:
number
,
// 当局累计获得福袋数量
initScore
:
number
,
// 当局初始分数值
limitLuckNum
:
number
,
// 当日上限可获得福袋数
downArea
:
string
[],
// 掉落分布,集合,比如每日上限6个,这里配置返回1、2、3
currentAcquireNum
:
number
,
// 当局剩余可获得福袋数,不包含accumulateLuckNum,当局累计获得福袋数量
currentStage
:
1
|
2
|
3
,
// 当前应该进入的阶段(1-一阶段 2-二阶段 3-无尽模式)
startId
:
number
,
// 游戏记录ID
slideScore
:
number
,
// 校验滑块的分数值
eachUseLimitTimes
:
number
//每局可使用道具限制数量
}
}
class
GameStore
{
class
GameStore
{
startInfo
:
IStartInfo
=
{
startId
:
""
,
}
async
start
()
{
const
{
freeTimes
,
gameCreditsEach
}
=
store
.
homeInfo
;
const
params
:
{
ticketNum
?:
string
}
=
{};
if
(
freeTimes
<=
0
)
{
const
{
success
,
ticket
}
=
await
creditsCost
(
"toPlaywayId"
,
"toPlaywayName"
,
"wany"
,
gameCreditsEach
);
if
(
!
success
)
return
false
;
params
.
ticketNum
=
ticket
;
}
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
start
,
params
);
if
(
!
success
)
return
false
;
this
.
startInfo
=
data
;
return
success
;
}
async
unlockPark
()
{
const
{
startId
}
=
this
.
startInfo
;
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
unlockPark
,
{
startId
,
level
:
1
,
});
if
(
!
success
)
return
false
;
this
.
startInfo
=
data
;
}
async
middleSubmit
()
{
const
{
startId
}
=
this
.
startInfo
;
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
middleSubmit
,
{
startId
,
level
:
1
,
});
if
(
!
success
)
return
false
;
this
.
startInfo
=
data
;
}
async
submit
()
{
const
{
startId
}
=
this
.
startInfo
;
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
middleSubmit
,
{
startId
,
level
:
1
,
});
if
(
!
success
)
return
false
;
this
.
startInfo
=
data
;
}
}
}
...
...
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