-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsg.gd
37 lines (24 loc) · 844 Bytes
/
msg.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
extends HBoxContainer
@export var avatar_size := 24
var _user: BiliveInfo.User
func set_user(user: BiliveInfo.User):
_user = user
if not _user.name.is_empty():
set_user_name(_user.name)
if _user.avatar != null:
set_avatar(_user.avatar)
func set_avatar(img: Image):
if img != null:
img.resize(avatar_size, avatar_size, Image.INTERPOLATE_BILINEAR)
$Avatar.texture = ImageTexture.create_from_image(img)
func set_user_name(uname: String):
$Name.text = uname
func set_info(info: String):
$Info.text = ": " + info
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$Avatar.custom_minimum_size = Vector2i(avatar_size, avatar_size)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass