Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MingSnake_241120
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
MingSnake_241120
Commits
0958ae10
Commit
0958ae10
authored
Dec 24, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
7be4533e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
232 additions
and
191 deletions
+232
-191
MainGame.scene
assets/Bundles/MainGame/MainGame.scene
+18
-18
PropPage.scene
assets/Bundles/PropPage/PropPage.scene
+11
-9
prizeBg.prefab
assets/Bundles/PropPage/png/prizeBg.prefab
+2
-2
ExchangeSuccess.ts
assets/Scripts/Panels/ExchangeSuccess.ts
+17
-8
ProPop.ts
assets/Scripts/Panels/ProPop.ts
+45
-27
PropPage.ts
assets/Scripts/Scenes/PropPage.ts
+54
-123
WebNet.ts
assets/Scripts/Utils/WebNet/WebNet.ts
+3
-3
store.ts
assets/Scripts/store/store.ts
+14
-0
exchangeSp.do.json
preview-template/mock/exchange/exchangeSp.do.json
+11
-0
queryExchangeList.do.json
preview-template/mock/exchange/queryExchangeList.do.json
+55
-0
index.do.json
preview-template/mock/home/index.do.json
+2
-1
No files found.
assets/Bundles/MainGame/MainGame.scene
View file @
0958ae10
...
@@ -11998,7 +11998,7 @@
...
@@ -11998,7 +11998,7 @@
"y": 180,
"y": 180,
"z": 0
"z": 0
},
},
"_id": "e
4Xdc3OHFAuoxwSIh0Dpss
"
"_id": "e
cmmu1ll9Oko1T65DKrTlL
"
},
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
...
@@ -12020,7 +12020,7 @@
...
@@ -12020,7 +12020,7 @@
"x": 0,
"x": 0,
"y": 1
"y": 1
},
},
"_id": "
fcw3wYg5ZNxrczeBtP3t4j
"
"_id": "
31OnLiyShPeLFjNMoLl+C3
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -12056,7 +12056,7 @@
...
@@ -12056,7 +12056,7 @@
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_useGrayscale": false,
"_atlas": null,
"_atlas": null,
"_id": "
c1H1DjK3BHHKOlLLTBMT6l
"
"_id": "
4cD+qRCoFJw4m8r8FyfiwF
"
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
...
@@ -12104,7 +12104,7 @@
...
@@ -12104,7 +12104,7 @@
"y": 0,
"y": 0,
"z": 0
"z": 0
},
},
"_id": "
54ts/kNLFFq7cpRZZvFxy1
"
"_id": "
2e49+nXUdNyoGYe+1qUHRQ
"
},
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
...
@@ -12126,7 +12126,7 @@
...
@@ -12126,7 +12126,7 @@
"x": 0,
"x": 0,
"y": 1
"y": 1
},
},
"_id": "
ab9pIzkCRFda2KHJ1cAlMB
"
"_id": "
fdAvh4HH9Bwpydjhq4HJdF
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -12162,7 +12162,7 @@
...
@@ -12162,7 +12162,7 @@
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_useGrayscale": false,
"_atlas": null,
"_atlas": null,
"_id": "
2furQrwXtP0pNtUrmOnfPS
"
"_id": "
canRtXfVpNo7jQFCVIheWe
"
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
...
@@ -12210,7 +12210,7 @@
...
@@ -12210,7 +12210,7 @@
"y": 0,
"y": 0,
"z": 0
"z": 0
},
},
"_id": "
4fih1PDnxFG43iEneKJvEj
"
"_id": "
17mT565rVAeLxBsWVerWQz
"
},
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
...
@@ -12232,7 +12232,7 @@
...
@@ -12232,7 +12232,7 @@
"x": 0,
"x": 0,
"y": 1
"y": 1
},
},
"_id": "
59LUg752pAj4CrekPyr616
"
"_id": "
fclB6lvnxCN6e8oI6IATqM
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -12268,7 +12268,7 @@
...
@@ -12268,7 +12268,7 @@
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_useGrayscale": false,
"_atlas": null,
"_atlas": null,
"_id": "
7906yzUgBD0Iqf2kqpzdj
O"
"_id": "
c1H8tNkeFLwawoMmHjp2r
O"
},
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
...
@@ -12460,7 +12460,7 @@
...
@@ -12460,7 +12460,7 @@
"y": 180,
"y": 180,
"z": 0
"z": 0
},
},
"_id": "
c8cL3uT29GHqtcmERKNTy2
"
"_id": "
27cSNAEXNGLqbve1VR8qJL
"
},
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
...
@@ -12482,7 +12482,7 @@
...
@@ -12482,7 +12482,7 @@
"x": 0,
"x": 0,
"y": 1
"y": 1
},
},
"_id": "
7aHViiSrNPAL77pfbUI3TG
"
"_id": "
9c/e+r045NXJQnKyKOfeaJ
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -12518,7 +12518,7 @@
...
@@ -12518,7 +12518,7 @@
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_useGrayscale": false,
"_atlas": null,
"_atlas": null,
"_id": "8
feWN4fB5G5qqoefvs+TO7
"
"_id": "8
aUVvORcFDt6QW7V4wK1yu
"
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
...
@@ -12566,7 +12566,7 @@
...
@@ -12566,7 +12566,7 @@
"y": 0,
"y": 0,
"z": 0
"z": 0
},
},
"_id": "
ece+OTlGJJSIhZDHISwZww
"
"_id": "
98waMNxWFEU6ipo+3wtQby
"
},
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
...
@@ -12588,7 +12588,7 @@
...
@@ -12588,7 +12588,7 @@
"x": 0,
"x": 0,
"y": 1
"y": 1
},
},
"_id": "
8dDHMxyNxPUbpLw5NI7JyM
"
"_id": "
fdDLWuHkVBKY0vUZxY9qaw
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -12624,7 +12624,7 @@
...
@@ -12624,7 +12624,7 @@
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_useGrayscale": false,
"_atlas": null,
"_atlas": null,
"_id": "
9bHqHCAOBIUIClF+5gXS3h
"
"_id": "
e4xNUj9h1FsrT1n6tvg9iR
"
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
...
@@ -12672,7 +12672,7 @@
...
@@ -12672,7 +12672,7 @@
"y": 0,
"y": 0,
"z": 0
"z": 0
},
},
"_id": "
9bs0Y34a5HrJgmfi0Yw+Il
"
"_id": "
54OVPvDxtMRIRXk0x2Caes
"
},
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
...
@@ -12694,7 +12694,7 @@
...
@@ -12694,7 +12694,7 @@
"x": 0,
"x": 0,
"y": 1
"y": 1
},
},
"_id": "
67u8kYeQxEPZbkfwg+U2aA
"
"_id": "
48Yjbgd/BDkJHPpgmojs8c
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -12730,7 +12730,7 @@
...
@@ -12730,7 +12730,7 @@
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_useGrayscale": false,
"_atlas": null,
"_atlas": null,
"_id": "
5cDQFrGw5NQLFoEQ4R8QwJ
"
"_id": "
c8QuapttNCo5TK34oHrT+A
"
},
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
...
...
assets/Bundles/PropPage/PropPage.scene
View file @
0958ae10
...
@@ -193,7 +193,7 @@
...
@@ -193,7 +193,7 @@
"_priority": 1073741824,
"_priority": 1073741824,
"_fov": 45,
"_fov": 45,
"_fovAxis": 0,
"_fovAxis": 0,
"_orthoHeight":
739.6666666666667
,
"_orthoHeight":
554.9402173913044
,
"_near": 1,
"_near": 1,
"_far": 2000,
"_far": 2000,
"_color": {
"_color": {
...
@@ -907,7 +907,7 @@
...
@@ -907,7 +907,7 @@
"__prefab": null,
"__prefab": null,
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 132
0
,
"width": 132
4
,
"height": 0
"height": 0
},
},
"_anchorPoint": {
"_anchorPoint": {
...
@@ -961,8 +961,8 @@
...
@@ -961,8 +961,8 @@
"__prefab": null,
"__prefab": null,
"_alignFlags": 40,
"_alignFlags": 40,
"_target": null,
"_target": null,
"_left":
52
,
"_left":
0
,
"_right":
52
,
"_right":
0
,
"_top": 0,
"_top": 0,
"_bottom": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_horizontalCenter": 0,
...
@@ -991,7 +991,7 @@
...
@@ -991,7 +991,7 @@
"__prefab": null,
"__prefab": null,
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 1
4
24,
"width": 1
3
24,
"height": 630
"height": 630
},
},
"_anchorPoint": {
"_anchorPoint": {
...
@@ -1099,7 +1099,7 @@
...
@@ -1099,7 +1099,7 @@
"__prefab": null,
"__prefab": null,
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 1
4
24,
"width": 1
3
24,
"height": 630
"height": 630
},
},
"_anchorPoint": {
"_anchorPoint": {
...
@@ -1146,8 +1146,8 @@
...
@@ -1146,8 +1146,8 @@
"__prefab": null,
"__prefab": null,
"_alignFlags": 45,
"_alignFlags": 45,
"_target": null,
"_target": null,
"_left": 1
0
0,
"_left": 1
5
0,
"_right": 1
0
0,
"_right": 1
5
0,
"_top": 120,
"_top": 120,
"_bottom": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_horizontalCenter": 0,
...
@@ -1643,7 +1643,9 @@
...
@@ -1643,7 +1643,9 @@
"skin2": {
"skin2": {
"__uuid__": "08a7d346-f4a0-49b3-8be3-2564e4705eb3@f9941",
"__uuid__": "08a7d346-f4a0-49b3-8be3-2564e4705eb3@f9941",
"__expectedType__": "cc.SpriteFrame"
"__expectedType__": "cc.SpriteFrame"
}
},
"node1": null,
"node2": null
},
},
{
{
"__type__": "cc.PrefabInfo",
"__type__": "cc.PrefabInfo",
...
...
assets/Bundles/PropPage/png/prizeBg.prefab
View file @
0958ae10
...
@@ -45,8 +45,8 @@
...
@@ -45,8 +45,8 @@
},
},
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x":
-592
,
"x":
0
,
"y":
-20
0,
"y": 0,
"z": 0
"z": 0
},
},
"_lrot": {
"_lrot": {
...
...
assets/Scripts/Panels/ExchangeSuccess.ts
View file @
0958ae10
...
@@ -4,6 +4,7 @@ import {observer, render} from "../store/decorators";
...
@@ -4,6 +4,7 @@ import {observer, render} from "../store/decorators";
import
{
sendWebNetWithToken
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
import
{
sendWebNetWithToken
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
import
{
changeScene
,
showPanel
}
from
"db://assets/Module/UIFast"
;
import
{
changeScene
,
showPanel
}
from
"db://assets/Module/UIFast"
;
import
{
MyBagPanel
}
from
"db://assets/Scripts/Panels/MyBagPanel"
;
import
{
MyBagPanel
}
from
"db://assets/Scripts/Panels/MyBagPanel"
;
import
store
from
"../store/store"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -25,14 +26,22 @@ export default class ExchangeSuccess extends Panel {
...
@@ -25,14 +26,22 @@ export default class ExchangeSuccess extends Panel {
}
}
async
start
()
{
async
start
()
{
const
{
consumeSp
,
item
,
conditionsItem
}
=
this
.
data
const
{
id
,
this
.
prizeName
.
string
=
item
.
optionName
;
optionName
,
optionImg
,
this
.
prize
.
spriteFrame
=
item
.
optionImg
;
spDetail
,
prizeId
,
await
sendWebNetWithToken
(
WebNetName
.
propPag
)
userLimitCount
,
alreadyUserCount
,
consumeCreditsNum
}
=
this
.
data
;
this
.
prizeName
.
string
=
optionName
;
this
.
prize
.
spriteFrame
=
optionImg
;
store
.
getExchangeInfo
();
}
}
clickLook
=
async
()
=>
{
clickLook
=
async
()
=>
{
...
...
assets/Scripts/Panels/ProPop.ts
View file @
0958ae10
import
Panel
from
"../../Module/Panel"
;
import
Panel
from
"../../Module/Panel"
;
import
{
_decorator
,
Button
,
Node
,
Sprite
,
Label
}
from
"cc"
;
import
{
_decorator
,
Button
,
Node
,
Sprite
,
Label
}
from
"cc"
;
import
{
observer
}
from
"../store/decorators"
;
import
{
observer
}
from
"../store/decorators"
;
import
{
showPanel
,
showToast
}
from
"db://assets/Module/UIFast"
;
import
{
showPanel
,
showToast
}
from
"db://assets/Module/UIFast"
;
import
ExchangeSuccess
from
"db://assets/Scripts/Panels/ExchangeSuccess"
;
import
ExchangeSuccess
from
"db://assets/Scripts/Panels/ExchangeSuccess"
;
import
{
creditsCost
,
sendWebNetWithToken
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
import
{
creditsCost
,
sendWebNetWithToken
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
import
{
_asyncThrottle
}
from
"../Utils/Utils"
;
import
{
_asyncThrottle
}
from
"../Utils/Utils"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
@
observer
@
observer
@
ccclass
(
'ProPop'
)
@
ccclass
(
"ProPop"
)
export
default
class
ProPop
extends
Panel
{
export
default
class
ProPop
extends
Panel
{
static
bundle
=
"PropPop"
;
static
bundle
=
"PropPop"
;
...
@@ -22,37 +22,56 @@ export default class ProPop extends Panel {
...
@@ -22,37 +22,56 @@ export default class ProPop extends Panel {
@
property
(
Label
)
explanation
:
Label
=
null
;
@
property
(
Label
)
explanation
:
Label
=
null
;
@
property
(
Label
)
num
:
Label
=
null
;
@
property
(
Label
)
num
:
Label
=
null
;
exchangeInfo
=
{}
onLoad
()
{
onLoad
()
{
this
.
closeBtn
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickClose
)
this
.
closeBtn
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickClose
)
;
this
.
btn
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickExchange
)
this
.
btn
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickExchange
)
;
}
}
start
()
{
start
()
{
const
{
consumeSp
,
item
,
conditionsItem
}
=
this
.
data
const
{
id
,
optionName
,
optionImg
,
spDetail
,
prizeId
,
userLimitCount
,
alreadyUserCount
,
consumeCreditsNum
}
=
this
.
data
;
this
.
explanation
.
string
=
item
.
spDetail
;
this
.
explanation
.
string
=
spDetail
;
const
num
=
this
.
btn
.
getChildByName
(
"num"
)
const
num
=
this
.
btn
.
getChildByName
(
"num"
)
;
num
.
getComponent
(
Label
).
string
=
consume
Sp
.
quantity
;
num
.
getComponent
(
Label
).
string
=
consume
CreditsNum
;
this
.
prize
.
spriteFrame
=
item
.
optionImg
;
this
.
prize
.
spriteFrame
=
optionImg
;
this
.
prizeName
.
string
=
item
.
optionName
;
this
.
prizeName
.
string
=
optionName
;
}
}
clickClose
=
()
=>
{
clickClose
=
()
=>
{
this
.
hidePanel
();
this
.
hidePanel
();
}
}
;
clickExchange
=
_asyncThrottle
(
async
()
=>
{
clickExchange
=
_asyncThrottle
(
async
()
=>
{
const
{
consumeSp
,
item
,
conditionsItem
}
=
this
.
data
;
const
num
=
1
;
const
{
id
,
optionName
,
optionImg
,
spDetail
,
prizeId
,
userLimitCount
,
alreadyUserCount
,
consumeCreditsNum
}
=
this
.
data
;
const
{
const
{
success
:
costSuc
,
success
:
costSuc
,
ticket
ticket
}
=
await
creditsCost
(
"exchang
_1"
,
"doExchange"
,
`sp_deduct_desc`
,
consumeSp
.
quantity
);
}
=
await
creditsCost
(
"exchang
e"
,
"exchangeSp"
,
`sp_deduct_desc`
,
(
+
consumeCreditsNum
)
*
num
);
if
(
!
costSuc
)
{
if
(
!
costSuc
)
{
showToast
(
"网络异常,请稍后重试~"
);
showToast
(
"网络异常,请稍后重试~"
);
...
@@ -60,20 +79,19 @@ export default class ProPop extends Panel {
...
@@ -60,20 +79,19 @@ export default class ProPop extends Panel {
}
}
//兑换接口
//兑换接口
const
{
success
,
data
}
=
await
sendWebNetWithToken
(
WebNetName
.
propExchange
,
{
const
{
success
,
data
}
=
await
sendWebNetWithToken
(
WebNetName
.
propExchange
,
{
id
,
ticketNum
:
ticket
,
ticketNum
:
ticket
,
ruId
:
item
.
ruleId
,
num
:
num
,
gear
:
conditionsItem
.
gear
,
// ruId: item.ruleId
,
});
});
if
(
!
success
)
return
;
if
(
!
success
)
return
;
this
.
exchangeInfo
=
data
;
// if (conditionsItem.credits >= consumeSp.quantity) {
// if (conditionsItem.credits >= consumeSp.quantity) {
showPanel
(
ExchangeSuccess
,
{
consumeSp
,
item
,
conditionsItem
})
showPanel
(
ExchangeSuccess
,
this
.
data
);
this
.
hidePanel
();
this
.
hidePanel
();
// }
// }
})
})
;
}
}
assets/Scripts/Scenes/PropPage.ts
View file @
0958ae10
import
{
_decorator
,
Button
,
instantiate
,
js
,
Label
,
math
,
Node
,
Prefab
,
Sprite
}
from
"cc"
;
import
{
_decorator
,
Button
,
instantiate
,
Label
,
Node
,
Prefab
,
Sprite
}
from
"cc"
;
import
Scene
from
"db://assets/Module/Scene"
;
import
Scene
from
"db://assets/Module/Scene"
;
import
{
MainGame
}
from
"./MainGame/MainGame"
;
import
{
changeScene
,
showPanel
,
showToast
}
from
"db://assets/Module/UIFast"
;
import
{
changeScene
,
showPanel
,
showToast
}
from
"db://assets/Module/UIFast"
;
import
store
from
"../store/store"
;
import
store
from
"../store/store"
;
import
{
observer
,
render
}
from
"../store/decorators"
;
import
{
observer
,
render
}
from
"../store/decorators"
;
import
{
_asyncThrottle
}
from
"../Utils/Utils"
;
import
ProPop
from
"db://assets/Scripts/Panels/ProPop"
;
import
ProPop
from
"db://assets/Scripts/Panels/ProPop"
;
import
{
sendWebNet
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
import
{
HomeScene
}
from
"db://assets/Scripts/Scenes/HomeScene"
;
import
{
HomeScene
}
from
"db://assets/Scripts/Scenes/HomeScene"
;
import
{
PointDetailScene
}
from
"db://assets/Scripts/Scenes/PointDetailScene"
;
import
{
YXCollectionView
,
YXFlowLayout
}
from
"../../Component/YXList/lib"
;
import
{
PointDetailScene
}
from
"db://assets/Scripts/Scenes/PointDetailScene"
;
import
Panel
from
"db://assets/Module/Panel"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
@
observer
@
observer
@
ccclass
(
'PropPage'
)
@
ccclass
(
"PropPage"
)
export
class
PropPage
extends
Scene
{
export
class
PropPage
extends
Scene
{
static
bundle
:
string
=
"PropPage"
;
static
bundle
:
string
=
"PropPage"
;
static
skin
:
string
=
"PropPage"
;
static
skin
:
string
=
"PropPage"
;
// static group: string[] = ["HomeScene"];
@
property
(
Node
)
backBtn
:
Node
=
null
;
@
property
(
Node
)
backBtn
:
Node
=
null
;
@
property
(
Label
)
credits
:
Label
=
null
;
@
property
(
Label
)
credits
:
Label
=
null
;
...
@@ -29,145 +23,82 @@ export class PropPage extends Scene {
...
@@ -29,145 +23,82 @@ export class PropPage extends Scene {
@
property
(
Node
)
content
:
Node
=
null
;
@
property
(
Node
)
content
:
Node
=
null
;
@
property
(
Node
)
point
:
Node
=
null
;
@
property
(
Node
)
point
:
Node
=
null
;
/**
* 列表组件
*/
@
property
(
YXCollectionView
)
listComp
:
YXCollectionView
=
null
;
propPageInfo
:
any
=
{};
onLoad
()
{
onLoad
()
{
this
.
backBtn
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickToBack
,
this
)
this
.
backBtn
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickToBack
,
this
)
;
this
.
point
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickToChange
,
this
)
this
.
point
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickToChange
,
this
)
;
}
}
async
start
()
{
async
start
()
{
await
this
.
getPropPageInfo
()
await
store
.
getExchangeInfo
();
this
.
setCredits
()
this
.
updateInfo
();
this
.
setPrizeList
()
}
}
async
getPropPageInfo
()
{
@
render
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
propPag
);
render
()
{
if
(
!
success
)
{
const
{
remainCredits
}
=
store
.
exchangeInfo
;
return
;
this
.
credits
.
string
=
`
${
remainCredits
}
`
;
}
this
.
propPageInfo
=
data
// this.listComp.numberOfItems = () => data.conditions.length;
//
// this.listComp.onCellDisplay = this.onCellDisplay;
//
// let layout = new YXFlowLayout();
// layout.horizontalSpacing = 10;
// layout.verticalSpacing = 10;
// layout.itemSize = new math.Size(240, 400);
// this.listComp.layout = layout;
//
// this.listComp.reloadData();
}
// onCellDisplay = (cell: Node, indexPath) => {
// const data = this.propPageInfo.conditions[indexPath.item];
//
// const consumeSp = data.consumeSps[0];
// const item = data.options[0];
//
// cell.getChildByName("prizeName")
// .getComponent(Label).string = item.spName;
//
// cell.getChildByName("prize")
// .getComponent(Sprite).spriteFrame = item.optionImg;
//
// cell.getChildByName("explain")
// .getComponent(Label).string = item.spDetail;
//
// const btn = cell.getChildByName("btn");
//
// btn.getChildByName("num2")
// .getComponent(Label).string = consumeSp.quantity;
//
// btn.targetOff(Button.EventType.CLICK);
//
// btn.on(Button.EventType.CLICK, () => this.clickToConfirm(consumeSp, item, data));
// };
/** 积分数据*/
setCredits
()
{
if
(
this
.
propPageInfo
.
credits
>
999999
)
{
this
.
credits
.
string
=
"999999+"
}
else
{
this
.
credits
.
string
=
this
.
propPageInfo
.
credits
;
}
}
}
/** 道具卡*/
updateInfo
()
{
setPrizeList
()
{
const
{
exchangeShopList
}
=
store
.
exchangeInfo
;
const
conditions
=
this
.
propPageInfo
.
conditions
conditions
.
map
((
conditionsItem
,
conditionsIndex
)
=>
{
const
consumeSp
=
conditionsItem
.
consumeSps
[
0
]
const
item
=
conditionsItem
.
options
[
0
]
const
prize
=
instantiate
(
this
.
prizePrefab
)
this
.
content
.
addChild
(
prize
)
const
prizeName
=
prize
.
getChildByName
(
"prizeName"
)
prizeName
.
getComponent
(
Label
).
string
=
item
.
optionName
const
prizeimg
=
prize
.
getChildByName
(
"prize"
)
prizeimg
.
getComponent
(
Sprite
).
spriteFrame
=
item
.
optionImg
const
explain
=
prize
.
getChildByName
(
"explain"
)
exchangeShopList
.
forEach
((
item
,
index
)
=>
{
explain
.
getComponent
(
Label
).
string
=
item
.
spDetail
const
btn
=
prize
.
getChildByName
(
"btn"
)
const
{
const
num2
=
btn
.
getChildByName
(
"num2"
)
id
,
num2
.
getComponent
(
Label
).
string
=
consumeSp
.
quantity
;
optionName
,
optionImg
,
spDetail
,
prizeId
,
userLimitCount
,
alreadyUserCount
,
consumeCreditsNum
,
}
=
item
;
const
prize
=
instantiate
(
this
.
prizePrefab
);
this
.
content
.
addChild
(
prize
);
btn
.
on
(
Button
.
EventType
.
CLICK
,
()
=>
this
.
clickToConfirm
(
consumeSp
,
item
,
conditionsItem
))
prize
.
getChildByName
(
"prizeName"
)
.
getComponent
(
Label
).
string
=
optionName
;
})
prize
.
getChildByName
(
"prize"
)
.
getComponent
(
Sprite
).
spriteFrame
=
optionImg
;
//遍历conditions
prize
.
getChildByName
(
"explain"
)
//再遍历options
.
getComponent
(
Label
).
string
=
spDetail
;
//item 获取道具卡数量,展示道具数量
//将数组内的图片、名字、道具说明加入到道具卡内
//遍历option
const
btn
=
prize
.
getChildByName
(
"btn"
);
//将道具卡的预制体进行遍历
btn
.
getChildByName
(
"num2"
)
//预制体内的名字、解释、图片 进行更替
.
getComponent
(
Label
).
string
=
consumeCreditsNum
;
btn
.
on
(
Button
.
EventType
.
CLICK
,
()
=>
this
.
clickToConfirm
(
item
));
});
}
}
/** 点击积分按钮*/
/** 点击积分按钮*/
clickToChange
()
{
clickToChange
()
{
changeScene
(
PointDetailScene
,
{
ifFrom
:
PropPage
,
back
:
this
.
data
.
isFrom
})
changeScene
(
PointDetailScene
,
{
ifFrom
:
PropPage
,
back
:
this
.
data
.
isFrom
});
}
}
/** 点击返回按钮*/
/** 点击返回按钮*/
clickToBack
=
async
()
=>
{
clickToBack
=
async
()
=>
{
const
{
isFrom
,
isPop
}
=
this
.
data
const
{
isFrom
,
isPop
}
=
this
.
data
;
if
(
isPop
==
true
)
{
if
(
isPop
==
true
)
{
changeScene
(
HomeScene
)
changeScene
(
HomeScene
)
;
showPanel
(
isFrom
,
{
tab
:
"TOOL"
})
showPanel
(
isFrom
,
{
tab
:
"TOOL"
});
}
else
{
}
else
{
changeScene
(
isFrom
,)
changeScene
(
isFrom
);
}
}
}
};
clickToConfirm
=
async
(
item
)
=>
{
const
{
consumeCreditsNum
,
}
=
item
;
clickToConfirm
=
async
(
consumeSp
,
item
,
conditionsItem
)
=>
{
if
(
store
.
exchangeInfo
.
remainCredits
<
consumeCreditsNum
)
{
if
(
this
.
propPageInfo
.
credits
<
consumeSp
.
quantity
)
{
showToast
(
"积分数量不足"
);
showToast
(
"积分数量不足"
)
}
else
{
}
else
{
showPanel
(
ProPop
,
{
consumeSp
,
item
,
conditionsItem
});
showPanel
(
ProPop
,
item
);
console
.
log
(
consumeSp
,
item
)
}
}
}
}
;
}
}
\ No newline at end of file
assets/Scripts/Utils/WebNet/WebNet.ts
View file @
0958ae10
...
@@ -122,12 +122,12 @@ export enum WebNetName {
...
@@ -122,12 +122,12 @@ export enum WebNetName {
/**
/**
* 道具首页
* 道具首页
*/
*/
propPag
=
"exchang
_1/listExchangeLimi
t.do"
,
propPag
=
"exchang
e/queryExchangeLis
t.do"
,
/**
/**
* 道具_兑换
* 道具_兑换
*/
*/
propExchange
=
"exchang
_1/doExchange
.do"
,
propExchange
=
"exchang
e/exchangeSp
.do"
,
/**
/**
* 任务列表
* 任务列表
...
@@ -512,7 +512,7 @@ export const sendLogList = (type: LOG_TYPE | 'exposure' | 'click', areaList: (nu
...
@@ -512,7 +512,7 @@ export const sendLogList = (type: LOG_TYPE | 'exposure' | 'click', areaList: (nu
* @param credits
* @param credits
* @return {Promise<{ success: boolean, ticket?: any,pollingData }>}
* @return {Promise<{ success: boolean, ticket?: any,pollingData }>}
*/
*/
export
async
function
creditsCost
(
toPlaywayId
,
toActionId
,
desc
,
credits
=
""
)
{
export
async
function
creditsCost
(
toPlaywayId
,
toActionId
,
desc
,
credits
:
number
=
0
)
{
// 预扣积分
// 预扣积分
const
param
=
{
const
param
=
{
toPlaywayId
,
toPlaywayId
,
...
...
assets/Scripts/store/store.ts
View file @
0958ae10
...
@@ -192,6 +192,20 @@ class Store {
...
@@ -192,6 +192,20 @@ class Store {
return
success
;
return
success
;
}
}
exchangeInfo
=
{
remainCredits
:
0
,
exchangeShopList
:
[],
};
async
getExchangeInfo
()
{
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
propPag
);
if
(
!
success
)
{
return
;
}
this
.
exchangeInfo
=
data
;
}
}
}
...
...
preview-template/mock/exchange/exchangeSp.do.json
0 → 100644
View file @
0958ae10
{
"success"
:
true
,
"message"
:
"sint commodo"
,
"code"
:
"proident in deserunt"
,
"data"
:
{
"prizeType"
:
68915736.28756568
,
"prizeId"
:
"amet"
,
"optionImg"
:
"nisi aliquip ad pariatur"
,
"optionName"
:
"dolor sint"
}
}
\ No newline at end of file
preview-template/mock/exchange/queryExchangeList.do.json
0 → 100644
View file @
0958ae10
{
"success"
:
true
,
"message"
:
"eu in"
,
"code"
:
"enim"
,
"data"
:
{
"remainCredits"
:
123
,
"exchangeShopList"
:
[
{
"id"
:
"id1"
,
"optionName"
:
"optionName1"
,
"optionImg"
:
"optionImg1"
,
"prizeId"
:
"prizeId1"
,
"alreadyUserCount"
:
21
,
"userLimitCount"
:
121
,
"consumeCreditsNum"
:
123
},
{
"id"
:
"ipsum aliquip in"
,
"optionName"
:
"fugiat tempor enim dolor"
,
"optionImg"
:
"nisi tempor adipisicing velit"
,
"prizeId"
:
"dolor"
,
"alreadyUserCount"
:
90188736.47222015
,
"userLimitCount"
:
-79072168.36165074
,
"consumeCreditsNum"
:
31445676.271960154
},
{
"id"
:
"culpa sint ipsum"
,
"optionName"
:
"culpa deserunt velit sint ut"
,
"optionImg"
:
"nisi dolor est ut"
,
"prizeId"
:
"sit proident"
,
"alreadyUserCount"
:
3810352.981223941
,
"userLimitCount"
:
36226662.41323769
,
"consumeCreditsNum"
:
34958851.89662337
},
{
"id"
:
"elit aliquip dolor aute"
,
"optionName"
:
"officia laboris do elit dolor"
,
"optionImg"
:
"consectetur in dolore quis nulla"
,
"prizeId"
:
"mollit elit cillum sed laboris"
,
"alreadyUserCount"
:
11613513.750834286
,
"userLimitCount"
:
-70296789.59688011
,
"consumeCreditsNum"
:
-73457919.7008391
},
{
"id"
:
"laborum do irure"
,
"optionName"
:
"est deserunt sed ullamco sit"
,
"optionImg"
:
"non ex"
,
"prizeId"
:
"tempor eu cupidatat esse consectetur"
,
"alreadyUserCount"
:
-88183997.52915691
,
"userLimitCount"
:
79374337.42955035
,
"consumeCreditsNum"
:
13252937.275845021
}
]
}
}
preview-template/mock/home/index.do.json
View file @
0958ae10
...
@@ -48,7 +48,8 @@
...
@@ -48,7 +48,8 @@
}
}
],
],
"rankPopList"
:
[],
"rankPopList"
:
[],
"signPopFlag"
:
false
"signPopFlag"
:
false
,
"bagLightFlag"
:
true
},
},
"message"
:
null
,
"message"
:
null
,
"success"
:
true
,
"success"
:
true
,
...
...
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