Implement 40250 classic client port
This commit is contained in:
@@ -16,6 +16,8 @@ var _pat := "ETC/ymir work/ui/pattern/"
|
||||
var _tex_cache := {}
|
||||
var _hp_fill: NinePatchRect
|
||||
var _mp_fill: NinePatchRect
|
||||
var _stamina_fill: ColorRect
|
||||
var _stamina_label: Label
|
||||
var _exp_fill: ColorRect
|
||||
var _lvl_label: Label
|
||||
var _hp_label: Label
|
||||
@@ -186,6 +188,20 @@ func _build_status() -> void:
|
||||
slot.add_child(_hp_label)
|
||||
else:
|
||||
_mp_fill = fill
|
||||
# 体力条(40250 POINT_STAMINA,冲刺/骑乘时由 ServerCommand 驱动)。
|
||||
var stamina_slot := ColorRect.new()
|
||||
stamina_slot.color = Color(0, 0, 0, 0.55)
|
||||
stamina_slot.custom_minimum_size = Vector2(_hp_w, 10)
|
||||
stamina_slot.size = Vector2(_hp_w, 10)
|
||||
_stamina_fill = ColorRect.new()
|
||||
_stamina_fill.color = Color(0.25, 0.85, 0.35)
|
||||
_stamina_fill.size = Vector2(0, 10)
|
||||
stamina_slot.add_child(_stamina_fill)
|
||||
_stamina_label = Label.new()
|
||||
_stamina_label.add_theme_font_size_override("font_size", 9)
|
||||
_stamina_label.position = Vector2(6, -1)
|
||||
stamina_slot.add_child(_stamina_label)
|
||||
box.add_child(stamina_slot)
|
||||
# 能量条(原客户端 POINT_ENERGY,0..100)。资源缺失时仍用纯色条保持可读。
|
||||
var energy_slot := ColorRect.new()
|
||||
energy_slot.color = Color(0, 0, 0, 0.55)
|
||||
@@ -241,6 +257,14 @@ func set_energy(value: int, max_value: int = 100) -> void:
|
||||
if _energy_label:
|
||||
_energy_label.text = "%d / %d" % [v, cap]
|
||||
|
||||
func set_stamina(value: int, max_value: int) -> void:
|
||||
var cap := maxi(1, max_value)
|
||||
var v := clampi(value, 0, cap)
|
||||
if _stamina_fill:
|
||||
_stamina_fill.size.x = _hp_w * float(v) / float(cap)
|
||||
if _stamina_label:
|
||||
_stamina_label.text = "%d / %d" % [v, cap]
|
||||
|
||||
# P4:状态图标条。affects = [{type, point_idx, value, flag, duration}, ...]
|
||||
func set_affects(affects: Array) -> void:
|
||||
if _affect_row == null:
|
||||
|
||||
Reference in New Issue
Block a user