Explorar el Código

优化积分显示

LTCatt hace 6 años
padre
commit
2b1783efe6

+ 2 - 2
data/ltw/functions/init.mcfunction

@@ -14,8 +14,8 @@ gamerule doImmediateRespawn true
 # 记分板
 scoreboard objectives remove mem
 scoreboard objectives add mem dummy "全局变量"
-scoreboard objectives remove gameparty_score
-scoreboard objectives add gameparty_score dummy "积分"
+scoreboard objectives remove total_score
+scoreboard objectives add total_score dummy "得分"
 
 # 时钟
 schedule function ltw:clock/tick4 4t replace

+ 5 - 4
data/ltw/functions/state/0/start_gameparty.mcfunction

@@ -7,10 +7,11 @@ execute store result score $count mem if entity @a[tag=hub_gameparty]
 execute if score $count mem matches ..2 run tellraw @a [{"text": "需要至少 3 人以开始小游戏模式, 当前仅有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
 execute if score $count mem matches 9.. run tellraw @a [{"text": "小游戏模式最多支持 8 人, 当前已有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
 
-# 重置积分
-scoreboard players reset gameparty_score
-
 # 开始小游戏
 execute if score $count mem matches 3..8 run tag @a remove watcher
 execute if score $count mem matches 3..8 run tag @a[tag=!hub_gameparty] add watcher
-execute if score $count mem matches 3..8 run function ltw:state/3/state_enter
+execute if score $count mem matches 3..8 run function ltw:state/3/state_enter
+
+# 重置积分
+scoreboard players reset total_score
+scoreboard players set @a[tag=!watcher] total_score 0

+ 3 - 0
data/ltw/functions/state/0/state_enter.mcfunction

@@ -2,5 +2,8 @@
 scoreboard players set $state mem 0
 execute as @a run function ltw:state/0/player_enter
 
+# HUD
+scoreboard objectives setdisplay sidebar
+
 # 关闭伤害
 gamerule fallDamage false

+ 3 - 0
data/ltw/functions/state/3/state_enter.mcfunction

@@ -2,6 +2,9 @@
 scoreboard players set $state mem 3
 execute as @a run function ltw:state/3/player_enter
 
+# HUD
+scoreboard objectives setdisplay sidebar total_score
+
 # 初始化倒计时
 scoreboard players set $countdown mem 3
 

+ 3 - 0
data/ltw/functions/state/4/state_enter.mcfunction

@@ -2,5 +2,8 @@
 scoreboard players set $state mem 4
 execute as @a run function ltw:state/4/player_enter
 
+# HUD
+scoreboard objectives setdisplay sidebar
+
 # 初始化倒计时
 scoreboard players set $countdown mem 10

+ 3 - 0
data/ltw/functions/state/5/state_enter.mcfunction

@@ -1,3 +1,6 @@
 # 要求系统进入状态 5(小游戏进行中)
 scoreboard players set $state mem 5
 execute as @a run function ltw:state/5/player_enter
+
+# HUD
+scoreboard objectives setdisplay sidebar

+ 3 - 0
data/ltw/functions/state/6/state_enter.mcfunction

@@ -2,5 +2,8 @@
 scoreboard players set $state mem 6
 execute as @a run function ltw:state/6/player_enter
 
+# HUD
+scoreboard objectives setdisplay sidebar total_score
+
 # 初始化倒计时
 scoreboard players set $countdown mem 5

+ 3 - 0
data/ltw/functions/state/7/state_enter.mcfunction

@@ -2,4 +2,7 @@
 scoreboard players set $state mem 7
 execute as @a run function ltw:state/7/player_enter
 
+# HUD
+scoreboard objectives setdisplay sidebar total_score
+
 schedule function ltw:state/0/state_enter 5t replace

+ 4 - 4
data/mini/functions/main/show_result.mcfunction

@@ -3,7 +3,7 @@
 tellraw @s [{"text":"\n>> 小游戏结束 >>\n\n","color":"gold","bold":true},{"text": "第一名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank1]","color":"white","bold": false},{"text": "\n第二名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank2]","color":"white","bold": false},{"text": "\n第三名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank3]","color":"white","bold": false},"\n"]
 
 # 记分
-scoreboard players add @s[tag=mini_rank1] gameparty_score 3
-scoreboard players add @s[tag=mini_rank2] gameparty_score 2
-scoreboard players add @s[tag=mini_rank3] gameparty_score 1
-scoreboard players add @s[tag=mini_rank4] gameparty_score 0
+scoreboard players add @s[tag=mini_rank1] total_score 3
+scoreboard players add @s[tag=mini_rank2] total_score 2
+scoreboard players add @s[tag=mini_rank3] total_score 1
+scoreboard players add @s[tag=mini_rank4] total_score 0