ajout du plugin dialogical
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
@tool
|
||||
class_name DialogicRichTextTransitionEffect
|
||||
extends RichTextEffect
|
||||
|
||||
var visible_characters := -1
|
||||
|
||||
@export var bbcode := "animate_in"
|
||||
var cache := []
|
||||
|
||||
@export_range(0.0, 5.0, 0.01) var time := 0.2
|
||||
@export_group("Color", "color")
|
||||
@export var color_modulate: Gradient = null
|
||||
@export var color_replace: Gradient = null
|
||||
@export_group("Scale", "scale")
|
||||
@export var scale_enabled := false
|
||||
@export var scale_curve := Curve.new()
|
||||
@export var scale_pivot := Vector2()
|
||||
@export_group("Position", "position")
|
||||
@export var position_enabled := false
|
||||
@export var position_x_curve := Curve.new()
|
||||
@export var position_y_curve := Curve.new()
|
||||
|
||||
@export_group("Test", "test")
|
||||
@export_range(-0.1, 1.0, 0.1) var test_value := -0.1
|
||||
|
||||
var was_skipped := false
|
||||
var was_reset := false
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
was_reset = true
|
||||
was_skipped = false
|
||||
cache.clear()
|
||||
|
||||
|
||||
func skip() -> void:
|
||||
was_skipped = true
|
||||
|
||||
|
||||
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
|
||||
var char_age :float = 0.0
|
||||
if test_value >= 0:
|
||||
char_age = test_value
|
||||
|
||||
else:
|
||||
if visible_characters == 0:
|
||||
cache.clear()
|
||||
return false
|
||||
if was_reset:
|
||||
if visible_characters != -1:
|
||||
was_reset = false
|
||||
else:
|
||||
return false
|
||||
|
||||
if len(cache) < visible_characters or visible_characters == -1 or was_skipped:
|
||||
if char_fx.range.x >= len(cache):
|
||||
cache.append(char_fx.elapsed_time)
|
||||
|
||||
if was_skipped:
|
||||
for i in range(len(cache)):
|
||||
cache[i] = char_fx.elapsed_time-time
|
||||
|
||||
if len(cache) > char_fx.range.x:
|
||||
char_age = char_fx.elapsed_time - cache[char_fx.range.x]
|
||||
|
||||
var text_server := TextServerManager.get_primary_interface()
|
||||
var trans: float = clamp(char_age, 0.0, time)/time
|
||||
|
||||
if color_replace:
|
||||
var c := color_replace.sample(trans)
|
||||
c.a = 1
|
||||
char_fx.color = char_fx.color.lerp(c, color_replace.sample(trans).a)
|
||||
if color_modulate:
|
||||
char_fx.color *= color_modulate.sample(trans)
|
||||
if char_fx.font.is_valid():
|
||||
var glyph_size := text_server.font_get_glyph_size(char_fx.font, Vector2i(16,1), char_fx.glyph_index)
|
||||
if scale_enabled:
|
||||
char_fx.transform = char_fx.transform.translated_local(scale_pivot*glyph_size*Vector2(1, -1)*(1-scale_curve.sample(trans)))
|
||||
char_fx.transform = char_fx.transform.scaled_local(Vector2.ONE*scale_curve.sample(trans))
|
||||
|
||||
if position_enabled:
|
||||
char_fx.transform = char_fx.transform.translated_local(Vector2(position_x_curve.sample(trans), position_y_curve.sample(trans))*glyph_size)
|
||||
|
||||
return true
|
||||
@@ -0,0 +1 @@
|
||||
uid://wf7hpguw17ex
|
||||
@@ -0,0 +1,17 @@
|
||||
[gd_resource type="RichTextEffect" script_class="DialogicRichTextTransitionEffect" load_steps=3 format=3 uid="uid://qegqrr4g2riu"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://wf7hpguw17ex" path="res://addons/dialogic/Example Assets/bbcode_transitions/bbcode_transition_effect.gd" id="1_5w3vn"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_5w3vn"]
|
||||
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_5w3vn")
|
||||
bbcode = "fade_in"
|
||||
time = 0.2
|
||||
color_modulate = SubResource("Gradient_5w3vn")
|
||||
scale_enabled = false
|
||||
scale_pivot = Vector2(0, 0)
|
||||
position_enabled = false
|
||||
test_value = -0.1
|
||||
metadata/_custom_type_script = "uid://wf7hpguw17ex"
|
||||
@@ -0,0 +1,24 @@
|
||||
[gd_resource type="RichTextEffect" script_class="DialogicRichTextTransitionEffect" load_steps=4 format=3 uid="uid://hx8qyt5ry3h0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://wf7hpguw17ex" path="res://addons/dialogic/Example Assets/bbcode_transitions/bbcode_transition_effect.gd" id="1_rsak6"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_rsak6"]
|
||||
offsets = PackedFloat32Array(0, 0.6351706)
|
||||
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="Curve" id="Curve_oitc5"]
|
||||
_limits = [0.0, 2.0, 0.0, 1.0]
|
||||
_data = [Vector2(0, 2), 0.0, 0.0, 0, 0, Vector2(0.40294844, 1.0066038), -0.13865282, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_rsak6")
|
||||
bbcode = "fade_scale_in"
|
||||
time = 0.30000000000000004
|
||||
color_modulate = SubResource("Gradient_rsak6")
|
||||
scale_enabled = true
|
||||
scale_curve = SubResource("Curve_oitc5")
|
||||
scale_pivot = Vector2(0.5, 0.5)
|
||||
position_enabled = false
|
||||
test_value = -0.1
|
||||
metadata/_custom_type_script = "uid://wf7hpguw17ex"
|
||||
@@ -0,0 +1,35 @@
|
||||
[gd_resource type="RichTextEffect" script_class="DialogicRichTextTransitionEffect" load_steps=6 format=3 uid="uid://c8b884puc720d"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://wf7hpguw17ex" path="res://addons/dialogic/Example Assets/bbcode_transitions/bbcode_transition_effect.gd" id="1_n3lqs"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_n3lqs"]
|
||||
offsets = PackedFloat32Array(0, 0.45292622)
|
||||
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_lhhwu"]
|
||||
interpolation_mode = 1
|
||||
offsets = PackedFloat32Array(0, 0.6666667, 0.86513996)
|
||||
colors = PackedColorArray(0.5208, 0.76631993, 0.93, 0, 0.5242275, 0.76595265, 0.93170327, 1, 0.5208, 0.76631993, 0.93, 0)
|
||||
|
||||
[sub_resource type="Curve" id="Curve_lhhwu"]
|
||||
_data = [Vector2(0.002457004, 1), 0.0, -1.993977, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Curve" id="Curve_4i73d"]
|
||||
_limits = [0.0, 1.5, 0.0, 1.0]
|
||||
_data = [Vector2(0, 0.6627359), 0.0, 1.7969435, 0, 0, Vector2(0.4987715, 1.0308962), -1.6188686, -1.6188686, 0, 0, Vector2(0.66093373, 1), -0.34929827, 0.0, 0, 0]
|
||||
point_count = 3
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_n3lqs")
|
||||
bbcode = "fancy_in"
|
||||
time = 0.4
|
||||
color_modulate = SubResource("Gradient_n3lqs")
|
||||
color_replace = SubResource("Gradient_lhhwu")
|
||||
scale_enabled = true
|
||||
scale_curve = SubResource("Curve_4i73d")
|
||||
scale_pivot = Vector2(0.5, 0)
|
||||
position_enabled = true
|
||||
position_x_curve = SubResource("Curve_lhhwu")
|
||||
test_value = -0.1
|
||||
metadata/_custom_type_script = "uid://wf7hpguw17ex"
|
||||
@@ -0,0 +1,35 @@
|
||||
[gd_resource type="RichTextEffect" script_class="DialogicRichTextTransitionEffect" load_steps=6 format=3 uid="uid://dnxkgwncm1pt5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://wf7hpguw17ex" path="res://addons/dialogic/Example Assets/bbcode_transitions/bbcode_transition_effect.gd" id="1_ur6c5"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_ur6c5"]
|
||||
offsets = PackedFloat32Array(0, 0.5089058)
|
||||
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="Curve" id="Curve_5qe3f"]
|
||||
_limits = [-0.5, 0.51556605, 0.0, 1.0]
|
||||
_data = [Vector2(0, 0.0235914), 0.0, 0.0, 0, 0, Vector2(0.019656021, -0.2441923), 0.0, 0.0, 0, 0, Vector2(0.046683047, 0.17305207), 0.0, 0.0, 0, 0, Vector2(0.1081081, -0.23173726), 0.0, 0.0, 0, 0, Vector2(0.16216215, 0.12323183), 0.0, 0.0, 0, 0, Vector2(0.2997543, -0.16946197), 0.0, 0.0, 0, 0, Vector2(0.38329238, 0.042274), 0.0, 0.0, 0, 0, Vector2(0.46928746, -0.107186675), 0.0, 0.0, 0, 0, Vector2(0.5135135, 0.054729044), 0.0, 0.0, 0, 0, Vector2(0.66339064, -0.07604903), 0.0, 0.0, 0, 0, Vector2(0.86240786, 0.054729044), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 12
|
||||
|
||||
[sub_resource type="Curve" id="Curve_ur6c5"]
|
||||
_limits = [-0.5, 0.51556605, 0.0, 1.0]
|
||||
_data = [Vector2(0, 0.042274), 0.0, 0.0, 0, 0, Vector2(0.051597048, -0.13209677), 0.0, 0.0, 0, 0, Vector2(0.09336609, 0.21041724), 0.0, 0.0, 0, 0, Vector2(0.14742014, -0.25664735), 0.0, 0.0, 0, 0, Vector2(0.22850122, 0.098321736), 0.0, 0.0, 0, 0, Vector2(0.31203932, -0.107186675), 0.0, 0.0, 0, 0, Vector2(0.44717443, 0.054729044), 0.0, 0.0, 0, 0, Vector2(0.5995086, -0.08227658), 0.0, 0.0, 0, 0, Vector2(0.8132678, 0.042274), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 10
|
||||
|
||||
[sub_resource type="Curve" id="Curve_qelc7"]
|
||||
_data = [Vector2(0, 0.57688683), 0.0, 0.0, 0, 0, Vector2(0.14250615, 0.77311325), 0.0, 0.0, 0, 0, Vector2(0.2850123, 0.6443397), 0.0, 0.0, 0, 0, Vector2(0.41769046, 0.7976416), 0.0, 0.0, 0, 0, Vector2(0.5503686, 0.74245286), 0.0, 0.0, 0, 0, Vector2(0.6781328, 0.8712265), 0.0, 0.0, 0, 0, Vector2(0.79606885, 0.8528303), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 8
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ur6c5")
|
||||
bbcode = "shaky_in"
|
||||
time = 0.4
|
||||
color_modulate = SubResource("Gradient_ur6c5")
|
||||
scale_enabled = true
|
||||
scale_curve = SubResource("Curve_qelc7")
|
||||
scale_pivot = Vector2(0.5, 0.5)
|
||||
position_enabled = true
|
||||
position_x_curve = SubResource("Curve_5qe3f")
|
||||
position_y_curve = SubResource("Curve_ur6c5")
|
||||
test_value = -0.1
|
||||
metadata/_custom_type_script = "uid://wf7hpguw17ex"
|
||||
Reference in New Issue
Block a user