feat: complete mobile UI implementation
This commit is contained in:
+17
-1
@@ -5,6 +5,7 @@ var client: Node
|
||||
var _root: Panel
|
||||
var _name: Label
|
||||
var _bar: ProgressBar
|
||||
var _mobile_mode := false
|
||||
|
||||
func setup(m2client: Node, parent: Node) -> void:
|
||||
client = m2client
|
||||
@@ -18,13 +19,28 @@ func refresh() -> void:
|
||||
return
|
||||
var lover: Dictionary = client.get_lover()
|
||||
var valid := bool(lover.get("valid", false))
|
||||
_root.visible = valid
|
||||
_root.visible = valid and not _mobile_mode
|
||||
if not valid:
|
||||
return
|
||||
_name.text = "♥ " + String(lover.get("name", ""))
|
||||
_bar.value = clampi(int(lover.get("love_point", 0)), 0, 100)
|
||||
_bar.tooltip_text = "爱意值:%d%%" % int(_bar.value)
|
||||
|
||||
func get_mobile_window() -> Control:
|
||||
return _root
|
||||
|
||||
func set_mobile_mode(enabled: bool) -> void:
|
||||
_mobile_mode = enabled
|
||||
if enabled and _root:
|
||||
_root.visible = false
|
||||
|
||||
func toggle() -> void:
|
||||
if _root:
|
||||
var valid := false
|
||||
if client and client.has_method("get_lover"):
|
||||
valid = bool(client.get_lover().get("valid", false))
|
||||
_root.visible = valid and not _root.visible
|
||||
|
||||
func _build(parent: Node) -> void:
|
||||
_root = Panel.new()
|
||||
_root.name = "LoveStatus"
|
||||
|
||||
Reference in New Issue
Block a user