Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
ZheShangBank_TaoQuan_20240612
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
ZheShangBank_TaoQuan_20240612
Commits
b455e75d
Commit
b455e75d
authored
Jun 20, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理一下代码
parent
3ef0cea9
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
639 additions
and
621 deletions
+639
-621
HomeScene.ts
assets/Scripts/Scenes/HomeScene.ts
+7
-7
RankScene.ts
assets/Scripts/Scenes/RankScene/RankScene.ts
+90
-74
TaskCenter.ts
assets/Scripts/TaskCenter.ts
+18
-16
HomeScene.scene
assets/resources/HomeScene/HomeScene.scene
+524
-524
No files found.
assets/Scripts/Scenes/HomeScene.ts
View file @
b455e75d
...
...
@@ -114,8 +114,10 @@ export class HomeScene extends Scene {
Tween
.
stopAllByTarget
(
this
.
startBtn
);
}
if
(
rank
===
0
||
rank
===
-
1
||
rank
>
999
)
{
this
.
currentRankLabel
.
string
=
'999+'
;
if
(
rank
===
0
||
rank
===
-
1
)
{
this
.
currentRankLabel
.
string
=
'-'
;
}
else
if
(
rank
>
1000
)
{
this
.
currentRankLabel
.
string
=
'1000+'
;
}
else
{
this
.
currentRankLabel
.
string
=
`
${
rank
}
`
;
}
...
...
@@ -165,7 +167,7 @@ export class HomeScene extends Scene {
/** 奖励排行 */
clickRank
=
async
()
=>
{
await
changeScene
(
RankScene
)
await
changeScene
(
RankScene
)
;
}
/** 任务 */
...
...
@@ -201,16 +203,14 @@ export class HomeScene extends Scene {
/** 规则 */
clickRule
=
async
()
=>
{
showPanel
(
RulePanel
)
showPanel
(
RulePanel
)
;
}
/** 返回 */
clickShare
=
async
()
=>
{
if
(
!
this
.
checkActStatus
())
return
false
;
}
update
(
deltaTime
:
number
)
{
}
}
assets/Scripts/Scenes/RankScene/RankScene.ts
View file @
b455e75d
import
{
_decorator
,
Label
,
Node
,
view
,
Widget
,
UITransform
,
Prefab
,
instantiate
,
assetManager
,
ImageAsset
,
SpriteFrame
,
Texture2D
,
Sprite
,
UIOpacity
}
from
"cc"
;
import
{
_decorator
,
Label
,
Node
,
view
,
Widget
,
UITransform
,
Prefab
,
instantiate
,
assetManager
,
ImageAsset
,
SpriteFrame
,
Texture2D
,
Sprite
,
UIOpacity
}
from
"cc"
;
import
Scene
from
"db://assets/Module/Scene"
;
import
{
changeScene
}
from
"db://assets/Module/UIFast"
;
import
{
HomeScene
}
from
"db://assets/Scripts/Scenes/HomeScene"
;
import
{
ScrollList
,
SCROLL_VERTICAL
}
from
"db://assets/Scripts/ScrollList/ScrollList"
;
import
{
strFormat
}
from
"db://assets/Scripts/Utils/Utils"
;
import
{
sendWebNet
,
WebNetName
}
from
"db://assets/Scripts/Utils/WebNet/WebNet"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
@
ccclass
(
"RankScene"
)
export
class
RankScene
extends
Scene
{
static
skin
:
string
=
"RankScene"
;
static
group
:
string
[]
=
[
"RankScene"
];
static
skin
:
string
=
"RankScene"
;
static
group
:
string
[]
=
[
"RankScene"
];
@
property
({
type
:
ScrollList
,
tooltip
:
"竖行滚动容器"
})
private
vScroll
:
ScrollList
;
@
property
({
type
:
ScrollList
,
tooltip
:
"竖行滚动容器"
})
private
vScroll
:
ScrollList
;
/** 排行榜类别 */
private
_type
:
string
=
"2"
;
/** 排行榜类别 */
private
_type
:
string
=
"2"
;
get
type
()
{
return
this
.
_type
;
}
get
type
()
{
return
this
.
_type
;
}
set
type
(
type
:
string
)
{
this
.
_type
=
type
;
}
set
type
(
type
:
string
)
{
this
.
_type
=
type
;
}
/** 我的排名 */
@
property
(
Node
)
myRnak
:
Node
=
null
;
/** 我的排名 */
@
property
(
Node
)
myRnak
:
Node
=
null
;
/** 奖品展览区域 */
@
property
(
Node
)
prizeBox
:
Node
=
null
;
/** 奖品展览区域 */
@
property
(
Node
)
prizeBox
:
Node
=
null
;
/** 奖品对象 */
@
property
(
Prefab
)
prizeItem
:
Prefab
=
null
;
/** 奖品对象 */
@
property
(
Prefab
)
prizeItem
:
Prefab
=
null
;
onLoad
()
{
}
onLoad
()
{
}
start
()
{
console
.
log
(
"%c RankScene"
,
"font-size: 20px"
);
this
.
getRankInfo
();
}
start
()
{
console
.
log
(
"%c RankScene"
,
"font-size: 20px"
);
this
.
getRankInfo
();
}
/** 排名处理 */
rankIndexFormat
(
rank
)
{
if
(
rank
==
0
||
!!!
rank
)
{
return
"999+"
;
/** 排名处理 */
rankIndexFormat
(
rank
)
{
if
(
rank
>
1000
)
{
return
"1000+"
;
}
if
(
rank
==
-
1
||
rank
==
0
||
!!!
rank
)
{
return
"-"
;
}
return
rank
;
}
if
(
rank
==
-
1
)
{
return
"999+"
/** 获取排行榜首页信息 */
async
getRankInfo
()
{
const
res
=
await
sendWebNet
(
WebNetName
.
rank
,
{
type
:
this
.
type
});
const
{
success
,
data
}
=
res
;
const
{
myRank
,
myRankScore
,
myNickName
,
rankInfo
=
[],
prizeInfo
=
[]}
=
data
||
{};
if
(
success
)
{
/** 我的排名 - 更新 */
this
.
myRnak
.
getChildByName
(
"MyRankIndex"
).
getComponent
(
Label
).
string
=
`
${
this
.
rankIndexFormat
(
myRank
)}
`
;
this
.
myRnak
.
getChildByName
(
"MyCredits"
).
getComponent
(
Label
).
string
=
`
${
myRankScore
>
99999
?
"99999+"
:
myRankScore
}
`
;
this
.
myRnak
.
getChildByName
(
"MyName"
).
getComponent
(
Label
).
string
=
`
${
strFormat
(
myNickName
||
""
,
12
)}
(我)`
;
/** 排行榜渲染 */
this
.
rankRender
(
rankInfo
);
/** 奖品区域渲染 */
this
.
prizeRender
(
prizeInfo
);
}
}
return
rank
;
}
/** 获取排行榜首页信息 */
async
getRankInfo
()
{
const
res
=
await
sendWebNet
(
WebNetName
.
rank
,
{
type
:
this
.
type
});
const
{
success
,
data
}
=
res
;
const
{
myRank
,
myRankScore
,
myNickName
,
rankInfo
=
[],
prizeInfo
=
[]
}
=
data
||
{};
if
(
success
)
{
/** 我的排名 - 更新 */
this
.
myRnak
.
getChildByName
(
"MyRankIndex"
).
getComponent
(
Label
).
string
=
`
${
this
.
rankIndexFormat
(
myRank
)}
`
;
this
.
myRnak
.
getChildByName
(
"MyCredits"
).
getComponent
(
Label
).
string
=
`
${
myRankScore
>
99999
?
"99999+"
:
myRankScore
}
`
;
this
.
myRnak
.
getChildByName
(
"MyName"
).
getComponent
(
Label
).
string
=
`
${
strFormat
(
myNickName
||
""
,
12
)}
(我)`
;
/** 排行榜渲染 */
this
.
rankRender
(
rankInfo
);
/** 奖品区域渲染 */
this
.
prizeRender
(
prizeInfo
);
/** 排行榜渲染 */
rankRender
(
rankInfo
=
[])
{
this
.
vScroll
.
setDataList
(
rankInfo
,
SCROLL_VERTICAL
,
[
0
,
0
,
0
]);
this
.
vScroll
.
scrollToTop
(
0
);
}
}
/** 排行榜渲染 */
rankRender
(
rankInfo
=
[])
{
this
.
vScroll
.
setDataList
(
rankInfo
,
SCROLL_VERTICAL
,
[
0
,
0
,
0
]);
this
.
vScroll
.
scrollToTop
(
0
);
}
/** 奖品栏渲染 */
async
prizeRender
(
prizeInfo
=
[])
{
this
.
prizeBox
.
destroyAllChildren
();
for
(
let
i
=
0
;
i
<
prizeInfo
.
length
;
i
++
)
{
const
node
=
instantiate
(
this
.
prizeItem
);
node
.
getChildByName
(
"PrizeName"
).
getComponent
(
Label
).
string
=
strFormat
(
prizeInfo
[
i
]?.
prizeName
,
12
);
node
.
getChildByName
(
"RankIndex"
).
getComponent
(
Label
).
string
=
`第
${
prizeInfo
[
i
]?.
prizeRank
}
名
`
node.getChildByName("PrizeImg").getComponent(Sprite).spriteFrame = prizeInfo[i]?.prizeImg;
this.prizeBox.addChild(node);
/** 奖品栏渲染 */
async
prizeRender
(
prizeInfo
=
[])
{
this
.
prizeBox
.
destroyAllChildren
();
for
(
let
i
=
0
;
i
<
prizeInfo
.
length
;
i
++
)
{
const
node
=
instantiate
(
this
.
prizeItem
);
node
.
getChildByName
(
"PrizeName"
).
getComponent
(
Label
).
string
=
strFormat
(
prizeInfo
[
i
]?.
prizeName
,
12
);
node
.
getChildByName
(
"RankIndex"
).
getComponent
(
Label
).
string
=
`第
${
prizeInfo
[
i
]?.
prizeRank
}
名
`
node.getChildByName("PrizeImg").getComponent(Sprite).spriteFrame = prizeInfo[i]?.prizeImg;
this.prizeBox.addChild(node);
}
}
}
/** 回到首页 */
async handleClickBack() {
await changeScene(HomeScene);
}
/** 回到首页 */
async handleClickBack() {
await changeScene(HomeScene);
}
}
assets/Scripts/TaskCenter.ts
View file @
b455e75d
...
...
@@ -40,13 +40,13 @@ export default class TaskCenter {
const
jumpUrl
=
url
?.
split
(
"$$$"
)?.[
1
];
/** 邀请任务 */
if
(
code
?.
startsWith
(
"it"
))
{
if
(
code
?.
startsWith
(
"it
_
"
))
{
beforeDoComplete
(
item
,
()
=>
{
ShareCenter
.
ins
.
doShare
(
SHARE_TYPE
.
INVITE
);
});
}
/** 浏览任务 */
else
if
(
code
?.
startsWith
(
"bt"
))
{
else
if
(
code
?.
startsWith
(
"bt
_
"
))
{
if
(
code
==
"bt_real"
)
{
// 真浏览-浏览长图任务
showPanel
(
BrowseImgPanel
,
{
...
...
@@ -79,25 +79,27 @@ export default class TaskCenter {
WebNetName
.
finishBrowseTask
,
{
taskCode
:
code
,
taskId
:
id
}
);
appJump
(
jumpUrl
);
location
.
href
=
jumpUrl
;
// appJump(jumpUrl);
});
}
}
/** 行方任务 */
else
if
(
code
?.
startsWith
(
"
tt
"
))
{
else
if
(
code
?.
startsWith
(
"
bank_
"
))
{
beforeDoComplete
(
item
,
async
()
=>
{
if
(
!
item
?.
extra
||
item
?.
extra
==
0
)
{
// 未领取任务 调领取行方任务接口
await
sendWebNetWithToken
(
WebNetName
.
claimThirdTask
,
{
taskCode
:
code
,
taskId
:
id
}
);
}
const
type
=
code
.
split
(
"_"
)[
1
];
if
(
type
==
"t"
)
{
// 行方交易任务
appJump
(
jumpUrl
)
}
else
if
(
type
==
"s"
)
{
// 行方签约任务
appJump
(
jumpUrl
)
}
// if (!item?.extra || item?.extra == 0) { // 未领取任务 调领取行方任务接口
// await sendWebNetWithToken(
// WebNetName.claimThirdTask,
// {taskCode: code, taskId: id}
// );
// }
// const type = code.split("_")[1];
// if (type == "t") { // 行方交易任务
// appJump(jumpUrl)
// } else if (type == "s") { // 行方签约任务
// appJump(ju mpUrl)
// }
location
.
href
=
jumpUrl
;
})
}
/** 会员等级达标任务 */
...
...
assets/resources/HomeScene/HomeScene.scene
View file @
b455e75d
This diff is collapsed.
Click to expand it.
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