From b107c4901a15e22dddc8ded1c985bb9ad6d44eed Mon Sep 17 00:00:00 2001 From: mennomax Date: Thu, 20 May 2021 23:34:41 +0200 Subject: [PATCH] fixed badge cache, added missing file --- Button.gd | 4 +- LICENSE | 2 +- Node.tscn | 85 ++++++++++++++++++++++++++++----- addons/gift/util/image_cache.gd | 2 - project.godot | 10 ++++ 5 files changed, 87 insertions(+), 16 deletions(-) mode change 100644 => 100755 LICENSE diff --git a/Button.gd b/Button.gd index b2aba84..11f7090 100644 --- a/Button.gd +++ b/Button.gd @@ -1,5 +1,5 @@ extends Button func _pressed(): - $"../Gift".chat($"../LineEdit".text) - $"../LineEdit".text = "" \ No newline at end of file + $"../../../Gift".chat($"../LineEdit".text) + $"../LineEdit".text = "" diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 index 409cf39..fcdc939 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Max Kross +Copyright (c) 2019-2021 Max Kross Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Node.tscn b/Node.tscn index 7de9d04..f7cf884 100644 --- a/Node.tscn +++ b/Node.tscn @@ -1,27 +1,90 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Gift.gd" type="Script" id=1] [ext_resource path="res://addons/gift/icon.png" type="Texture" id=2] [ext_resource path="res://Button.gd" type="Script" id=3] +[ext_resource path="res://ChatContainer.gd" type="Script" id=5] +[ext_resource path="res://Node.gd" type="Script" id=6] [node name="Node" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 6 ) +__meta__ = { +"_edit_use_anchors_": false +} [node name="Gift" type="Node" parent="."] script = ExtResource( 1 ) __meta__ = { "_editor_icon": ExtResource( 2 ) } +get_images = true -[node name="LineEdit" type="LineEdit" parent="."] -margin_left = 403.0 -margin_top = 278.0 -margin_right = 531.0 -margin_bottom = 302.0 +[node name="ChatContainer" type="VBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 5 ) +__meta__ = { +"_edit_use_anchors_": false +} -[node name="Button" type="Button" parent="."] -margin_left = 539.0 -margin_top = 278.0 -margin_right = 586.0 -margin_bottom = 302.0 +[node name="Chat" type="Panel" parent="ChatContainer"] +show_behind_parent = true +margin_right = 400.0 +margin_bottom = 572.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ScrollContainer" type="ScrollContainer" parent="ChatContainer/Chat"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 10.0 +margin_top = 10.0 +margin_right = -10.0 +margin_bottom = -10.0 +follow_focus = true +scroll_horizontal_enabled = false +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ChatMessagesContainer" type="VBoxContainer" parent="ChatContainer/Chat/ScrollContainer"] +margin_right = 380.0 +margin_bottom = 552.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/separation = 6 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="ChatContainer"] +margin_top = 576.0 +margin_right = 400.0 +margin_bottom = 600.0 + +[node name="LineEdit" type="LineEdit" parent="ChatContainer/HBoxContainer"] +margin_right = 296.0 +margin_bottom = 24.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +caret_blink = true +caret_blink_speed = 0.5 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button" type="Button" parent="ChatContainer/HBoxContainer"] +margin_left = 300.0 +margin_right = 400.0 +margin_bottom = 24.0 +rect_min_size = Vector2( 100, 0 ) text = "Send" script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/addons/gift/util/image_cache.gd b/addons/gift/util/image_cache.gd index 2c165e5..0260fad 100644 --- a/addons/gift/util/image_cache.gd +++ b/addons/gift/util/image_cache.gd @@ -112,8 +112,6 @@ func get_badge(badge_name : String, channel_id : String = "_global", scale : Str return get_badge(badge_name, "_global", scale) texture.take_over_path(filename) caches[RequestType.BADGE][channel_id][cachename] = texture - elif channel_id != "_global": - return get_badge(badge_name, "_global", scale) return caches[RequestType.BADGE][channel_id][cachename] func get_emote(emote_id : String, scale = "1.0") -> ImageTexture: diff --git a/project.godot b/project.godot index cd5a892..ac641e2 100644 --- a/project.godot +++ b/project.godot @@ -24,6 +24,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/gift/gift_node.gd" }, { +"base": "Resource", +"class": "ImageCache", +"language": "GDScript", +"path": "res://addons/gift/util/image_cache.gd" +}, { "base": "Reference", "class": "SenderData", "language": "GDScript", @@ -33,6 +38,7 @@ _global_script_class_icons={ "CommandData": "", "CommandInfo": "", "Gift": "", +"ImageCache": "", "SenderData": "" } @@ -47,6 +53,10 @@ config/icon="res://icon.png" gdscript/warnings/unused_argument=false gdscript/warnings/return_value_discarded=false +[display] + +window/size/width=400 + [editor_plugins] enabled=PoolStringArray( "gift" )