mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 18:37:44 +02:00
Update rich text for last version
This commit is contained in:
parent
6ea5ed0b97
commit
547b10d097
@ -4,7 +4,7 @@ fonts {
|
|||||||
font: "/example/assets/fonts/game.font"
|
font: "/example/assets/fonts/game.font"
|
||||||
}
|
}
|
||||||
textures {
|
textures {
|
||||||
name: "kenney"
|
name: "items"
|
||||||
texture: "/example/assets/images/kenney.atlas"
|
texture: "/example/assets/images/kenney.atlas"
|
||||||
}
|
}
|
||||||
background_color {
|
background_color {
|
||||||
@ -33,8 +33,8 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
size {
|
size {
|
||||||
x: 300.0
|
x: 400.0
|
||||||
y: 200.0
|
y: 100.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
size {
|
size {
|
||||||
x: 200.0
|
x: 400.0
|
||||||
y: 100.0
|
y: 100.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
@ -103,7 +103,7 @@ nodes {
|
|||||||
}
|
}
|
||||||
type: TYPE_TEXT
|
type: TYPE_TEXT
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
text: "Text"
|
text: "Rich text"
|
||||||
font: "game"
|
font: "game"
|
||||||
id: "text_prefab"
|
id: "text_prefab"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
@ -116,9 +116,9 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
shadow {
|
shadow {
|
||||||
x: 1.0
|
x: 0.0
|
||||||
y: 1.0
|
y: 0.0
|
||||||
z: 1.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
adjust_mode: ADJUST_MODE_FIT
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
@ -127,7 +127,7 @@ nodes {
|
|||||||
layer: ""
|
layer: ""
|
||||||
inherit_alpha: true
|
inherit_alpha: true
|
||||||
alpha: 1.0
|
alpha: 1.0
|
||||||
outline_alpha: 1.0
|
outline_alpha: 0.0
|
||||||
shadow_alpha: 0.0
|
shadow_alpha: 0.0
|
||||||
template_node_child: false
|
template_node_child: false
|
||||||
text_leading: 1.0
|
text_leading: 1.0
|
||||||
@ -138,7 +138,7 @@ nodes {
|
|||||||
}
|
}
|
||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 77.0
|
x: 110.0
|
||||||
y: 0.0
|
y: 0.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
@ -156,8 +156,8 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
size {
|
size {
|
||||||
x: 36.0
|
x: 21.0
|
||||||
y: 36.0
|
y: 20.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ nodes {
|
|||||||
}
|
}
|
||||||
type: TYPE_BOX
|
type: TYPE_BOX
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
texture: "kenney/slider_move"
|
texture: "items/checkmark"
|
||||||
id: "icon_prefab"
|
id: "icon_prefab"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
yanchor: YANCHOR_NONE
|
yanchor: YANCHOR_NONE
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
local component = require("druid.component")
|
local component = require("druid.component")
|
||||||
local rich_text = require("druid.custom.rich_text.rich_text.richtext")
|
local rich_text = require("druid.custom.rich_text.rich_text.richtext")
|
||||||
|
|
||||||
|
---@class druid.rich_text
|
||||||
local RichText = component.create("rich_text")
|
local RichText = component.create("rich_text")
|
||||||
|
|
||||||
local SCHEME = {
|
local SCHEME = {
|
||||||
@ -10,19 +11,6 @@ local SCHEME = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local ALIGN_MAP = {
|
|
||||||
[gui.PIVOT_CENTER] = { rich_text.ALIGN_CENTER, rich_text.VALIGN_MIDDLE },
|
|
||||||
[gui.PIVOT_N] = { rich_text.ALIGN_CENTER, rich_text.VALIGN_TOP },
|
|
||||||
[gui.PIVOT_S] = { rich_text.ALIGN_CENTER, rich_text.VALIGN_BOTTOM },
|
|
||||||
[gui.PIVOT_NE] = { rich_text.ALIGN_RIGHT, rich_text.VALIGN_TOP },
|
|
||||||
[gui.PIVOT_E] = { rich_text.ALIGN_RIGHT, rich_text.VALIGN_MIDDLE },
|
|
||||||
[gui.PIVOT_SE] = { rich_text.ALIGN_RIGHT, rich_text.VALIGN_BOTTOM },
|
|
||||||
[gui.PIVOT_SW] = { rich_text.ALIGN_LEFT, rich_text.VALIGN_BOTTOM },
|
|
||||||
[gui.PIVOT_W] = { rich_text.ALIGN_LEFT, rich_text.VALIGN_MIDDLE },
|
|
||||||
[gui.PIVOT_NW] = { rich_text.ALIGN_LEFT, rich_text.VALIGN_TOP },
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function RichText:init(template, nodes)
|
function RichText:init(template, nodes)
|
||||||
self:set_template(template)
|
self:set_template(template)
|
||||||
self:set_nodes(nodes)
|
self:set_nodes(nodes)
|
||||||
@ -36,106 +24,66 @@ function RichText:init(template, nodes)
|
|||||||
gui.set_enabled(self.text_prefab, false)
|
gui.set_enabled(self.text_prefab, false)
|
||||||
gui.set_enabled(self.icon_prefab, false)
|
gui.set_enabled(self.icon_prefab, false)
|
||||||
|
|
||||||
self._text_font = gui.get_font(self.text_prefab)
|
|
||||||
self._settings = self:_get_settings()
|
self._settings = self:_get_settings()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---@return rich_text.word[], rich_text.lines_metrics
|
||||||
function RichText:set_text(text)
|
function RichText:set_text(text)
|
||||||
self:_clean_words()
|
self:clean()
|
||||||
local is_already_adjusted = self._settings.adjust_scale ~= 1
|
|
||||||
|
|
||||||
-- Make text singleline if prefab without line break
|
local words, settings, line_metrics = rich_text.create(text, self._settings)
|
||||||
local is_multiline = gui.get_line_break(self.text_prefab)
|
line_metrics = rich_text.adjust_to_area(words, settings, line_metrics)
|
||||||
if not is_multiline then
|
|
||||||
text = string.format("<nobr>%s</nobr>", text)
|
|
||||||
end
|
|
||||||
|
|
||||||
local words, metrics = rich_text.create(text, self._text_font, self._settings)
|
|
||||||
|
|
||||||
self._words = words
|
self._words = words
|
||||||
self._metrics = metrics
|
self._line_metrics = line_metrics
|
||||||
|
|
||||||
for _, word in ipairs(words) do
|
return words, line_metrics
|
||||||
print(word.text)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not is_multiline then
|
|
||||||
local scale_koef = self.root_size.x / self._metrics.width
|
|
||||||
self._settings.adjust_scale = math.min(scale_koef, 1)
|
|
||||||
else
|
|
||||||
local scale_koef = math.sqrt(self.root_size.y / self._metrics.height)
|
|
||||||
if self._metrics.width * scale_koef > self.root_size.x then
|
|
||||||
scale_koef = math.sqrt(self.root_size.x / self._metrics.width)
|
|
||||||
end
|
|
||||||
self._settings.adjust_scale = math.min(scale_koef, 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not is_already_adjusted and self._settings.adjust_scale < 1 then
|
|
||||||
print("Again set text with adjusted scale", self._settings.adjust_scale)
|
|
||||||
self:set_text(text)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Align vertically, different behaviour from rich text
|
|
||||||
self:_align_vertically()
|
|
||||||
|
|
||||||
pprint(self._metrics)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function RichText:on_remove()
|
function RichText:on_remove()
|
||||||
self:_clean_words()
|
self:clean()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function RichText:tagged(tag)
|
||||||
|
if not self._words then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
return rich_text.tagged(self._words, tag)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---@return druid.rich_text_word[]
|
||||||
|
function RichText:get_words()
|
||||||
|
return self._words
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function RichText:_get_settings()
|
function RichText:_get_settings()
|
||||||
local anchor = gui.get_pivot(self.root)
|
|
||||||
local align = ALIGN_MAP[anchor][1]
|
|
||||||
local valign = ALIGN_MAP[anchor][2]
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
width = self.root_size.x,
|
width = self.root_size.x,
|
||||||
parent = self.root,
|
parent = self.root,
|
||||||
color = gui.get_color(self.text_prefab),
|
text_prefab = self.text_prefab,
|
||||||
|
node_prefab = self.icon_prefab,
|
||||||
shadow = gui.get_shadow(self.text_prefab),
|
shadow = gui.get_shadow(self.text_prefab),
|
||||||
outline = gui.get_outline(self.text_prefab),
|
outline = gui.get_outline(self.text_prefab),
|
||||||
text_scale = gui.get_scale(self.text_prefab),
|
size = gui.get_scale(self.text_prefab).x,
|
||||||
default_texture = gui.get_texture(self.icon_prefab),
|
image_scale = gui.get_scale(self.icon_prefab),
|
||||||
default_anim = gui.get_flipbook(self.icon_prefab),
|
default_animation = gui.get_flipbook(self.icon_prefab),
|
||||||
combine_words = true,
|
|
||||||
adjust_scale = 1,
|
|
||||||
align = align,
|
|
||||||
valign = valign,
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function RichText:_clean_words()
|
function RichText:clean()
|
||||||
if not self._words then
|
if not self._words then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
rich_text.remove(self._words)
|
rich_text.remove(self._words)
|
||||||
self._words = nil
|
self._words = nil
|
||||||
self._metrics = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function RichText:_align_vertically()
|
|
||||||
local text_height = self._metrics.height
|
|
||||||
local offset = 0
|
|
||||||
if self._settings.valign == rich_text.VALIGN_MIDDLE then
|
|
||||||
offset = text_height * 0.5
|
|
||||||
end
|
|
||||||
if self._settings.valign == rich_text.VALIGN_BOTTOM then
|
|
||||||
offset = text_height
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, word in ipairs(self._words) do
|
|
||||||
word.position.y = word.position.y + offset
|
|
||||||
gui.set_position(word.node, word.position)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,30 +36,7 @@ function M.add(name, color)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
M.COLORS = {
|
M.COLORS = {}
|
||||||
aqua = M.parse_hex("#00ffffff"),
|
|
||||||
black = M.parse_hex("#000000ff"),
|
|
||||||
blue = M.parse_hex("#0000ffff"),
|
|
||||||
brown = M.parse_hex("#a52a2aff"),
|
|
||||||
cyan = M.parse_hex("#00ffffff"),
|
|
||||||
darkblue = M.parse_hex("#0000a0ff"),
|
|
||||||
fuchsia = M.parse_hex("#ff00ffff"),
|
|
||||||
green = M.parse_hex("#008000ff"),
|
|
||||||
grey = M.parse_hex("#808080ff"),
|
|
||||||
lightblue = M.parse_hex("#add8e6ff"),
|
|
||||||
lime = M.parse_hex("#00ff00ff"),
|
|
||||||
magenta = M.parse_hex("#ff00ffff"),
|
|
||||||
maroon = M.parse_hex("#800000ff"),
|
|
||||||
navy = M.parse_hex("#000080ff"),
|
|
||||||
olive = M.parse_hex("#808000ff"),
|
|
||||||
orange = M.parse_hex("#ffa500ff"),
|
|
||||||
purple = M.parse_hex("#800080ff"),
|
|
||||||
red = M.parse_hex("#ff0000ff"),
|
|
||||||
silver = M.parse_hex("#c0c0c0ff"),
|
|
||||||
teal = M.parse_hex("#008080ff"),
|
|
||||||
white = M.parse_hex("#ffffffff"),
|
|
||||||
yellow = M.parse_hex("#ffff00ff"),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function M.parse(c)
|
function M.parse(c)
|
||||||
|
@ -22,10 +22,11 @@ local function add_word(text, settings, words)
|
|||||||
-- handle HTML entities
|
-- handle HTML entities
|
||||||
text = text:gsub("<", "<"):gsub(">", ">"):gsub(" ", " ")
|
text = text:gsub("<", "<"):gsub(">", ">"):gsub(" ", " ")
|
||||||
|
|
||||||
local data = { text = text }
|
local data = { text = text, source_text = text }
|
||||||
for k,v in pairs(settings) do
|
for k,v in pairs(settings) do
|
||||||
data[k] = v
|
data[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
words[#words + 1] = data
|
words[#words + 1] = data
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ local function split_line(line, settings, words)
|
|||||||
assert(line)
|
assert(line)
|
||||||
assert(settings)
|
assert(settings)
|
||||||
assert(words)
|
assert(words)
|
||||||
|
|
||||||
local ws_start, trimmed_text, ws_end = line:match("^(%s*)(.-)(%s*)$")
|
local ws_start, trimmed_text, ws_end = line:match("^(%s*)(.-)(%s*)$")
|
||||||
if trimmed_text == "" then
|
if trimmed_text == "" then
|
||||||
add_word(ws_start .. ws_end, settings, words)
|
add_word(ws_start .. ws_end, settings, words)
|
||||||
@ -45,8 +47,10 @@ local function split_line(line, settings, words)
|
|||||||
end
|
end
|
||||||
local first = words[wi + 1]
|
local first = words[wi + 1]
|
||||||
first.text = ws_start .. first.text
|
first.text = ws_start .. first.text
|
||||||
|
first.source_text = first.text
|
||||||
local last = words[#words]
|
local last = words[#words]
|
||||||
last.text = utf8.sub(last.text, 1, utf8.len(last.text) - 1) .. ws_end
|
last.text = utf8.sub(last.text, 1, utf8.len(last.text) - 1) .. ws_end
|
||||||
|
last.source_text = last.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -113,6 +117,7 @@ function M.parse(text, default_settings)
|
|||||||
text = text:gsub("&zwsp;", "<zwsp>\226\128\139</zwsp>")
|
text = text:gsub("&zwsp;", "<zwsp>\226\128\139</zwsp>")
|
||||||
local all_words = {}
|
local all_words = {}
|
||||||
local open_tags = {}
|
local open_tags = {}
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
-- merge list of word settings from defaults and all open tags
|
-- merge list of word settings from defaults and all open tags
|
||||||
local word_settings = { tags = {} }
|
local word_settings = { tags = {} }
|
||||||
@ -149,19 +154,10 @@ function M.parse(text, default_settings)
|
|||||||
merge_tags(empty_tag_settings, word_settings)
|
merge_tags(empty_tag_settings, word_settings)
|
||||||
add_word("", empty_tag_settings, all_words)
|
add_word("", empty_tag_settings, all_words)
|
||||||
elseif not is_endtag then
|
elseif not is_endtag then
|
||||||
if name == "repeat" then
|
|
||||||
local text_to_repeat = after_tag:match("(.-)</repeat>")
|
|
||||||
local repetitions = tonumber(params)
|
|
||||||
if repetitions > 1 then
|
|
||||||
after_tag = text_to_repeat:rep(repetitions - 1) .. after_tag
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- open tag - parse and add it
|
-- open tag - parse and add it
|
||||||
local tag_settings = parse_tag(name, params)
|
local tag_settings = parse_tag(name, params)
|
||||||
open_tags[#open_tags + 1] = tag_settings
|
open_tags[#open_tags + 1] = tag_settings
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if name ~= "repeat" then
|
|
||||||
-- end tag - remove it from the list of open tags
|
-- end tag - remove it from the list of open tags
|
||||||
local found = false
|
local found = false
|
||||||
for i=#open_tags,1,-1 do
|
for i=#open_tags,1,-1 do
|
||||||
@ -173,30 +169,18 @@ function M.parse(text, default_settings)
|
|||||||
end
|
end
|
||||||
if not found then print(("Found end tag '%s' without matching start tag"):format(name)) end
|
if not found then print(("Found end tag '%s' without matching start tag"):format(name)) end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if name == "p" then
|
|
||||||
local last_word = all_words[#all_words]
|
|
||||||
if last_word then
|
|
||||||
if not is_endtag then
|
|
||||||
last_word.linebreak = true
|
|
||||||
end
|
|
||||||
if is_endtag or is_empty then
|
|
||||||
last_word.paragraph_end = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- parse text after the tag on the next iteration
|
-- parse text after the tag on the next iteration
|
||||||
text = after_tag
|
text = after_tag
|
||||||
end
|
end
|
||||||
|
|
||||||
return all_words
|
return all_words
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get the length of a text, excluding any tags (except image and spine tags)
|
--- Get the length of a text, excluding any tags (except image and spine tags)
|
||||||
function M.length(text)
|
function M.length(text)
|
||||||
return utf8.len(text:gsub("<img.-/>", " "):gsub("<spine.-/>", " "):gsub("<.->", ""))
|
return utf8.len(text:gsub("<img.-/>", " "):gsub("<.->", ""))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,20 @@ function M.register(tag, fn)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Split string at first occurrence of token
|
||||||
|
-- If the token doesn't exist the whole string is returned
|
||||||
|
-- @param s The string to split
|
||||||
|
-- @param token The token to split string on
|
||||||
|
-- @return before The string before the token or the whole string if token doesn't exist
|
||||||
|
-- @return after The string after the token or nul
|
||||||
|
local function split(s, token)
|
||||||
|
if not s then return nil, nil end
|
||||||
|
local before, after = s:match("(.-)" .. token .. "(.*)")
|
||||||
|
before = before or s
|
||||||
|
return before, after
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
M.register("color", function(params, settings)
|
M.register("color", function(params, settings)
|
||||||
settings.color = color.parse(params)
|
settings.color = color.parse(params)
|
||||||
end)
|
end)
|
||||||
@ -48,17 +62,7 @@ end)
|
|||||||
|
|
||||||
|
|
||||||
M.register("size", function(params, settings)
|
M.register("size", function(params, settings)
|
||||||
settings.size = tonumber(params)
|
settings.relative_scale = tonumber(params)
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
M.register("b", function(params, settings)
|
|
||||||
settings.bold = true
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
M.register("i", function(params, settings)
|
|
||||||
settings.italic = true
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +72,7 @@ end)
|
|||||||
|
|
||||||
|
|
||||||
M.register("br", function(params, settings)
|
M.register("br", function(params, settings)
|
||||||
settings.linebreak = true
|
settings.br = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
@ -77,20 +81,6 @@ M.register("nobr", function(params, settings)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
-- Split string at first occurrence of token
|
|
||||||
-- If the token doesn't exist the whole string is returned
|
|
||||||
-- @param s The string to split
|
|
||||||
-- @param token The token to split string on
|
|
||||||
-- @return before The string before the token or the whole string if token doesn't exist
|
|
||||||
-- @return after The string after the token or nul
|
|
||||||
local function split(s, token)
|
|
||||||
if not s then return nil, nil end
|
|
||||||
local before, after = s:match("(.-)" .. token .. "(.*)")
|
|
||||||
before = before or s
|
|
||||||
return before, after
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
M.register("img", function(params, settings)
|
M.register("img", function(params, settings)
|
||||||
local texture_and_anim, params = split(params, ",")
|
local texture_and_anim, params = split(params, ",")
|
||||||
local width, height
|
local width, height
|
||||||
@ -105,6 +95,11 @@ M.register("img", function(params, settings)
|
|||||||
width = width and tonumber(width)
|
width = width and tonumber(width)
|
||||||
height = height and tonumber(height)
|
height = height and tonumber(height)
|
||||||
|
|
||||||
|
---@class rich_text.word.image
|
||||||
|
---@field texture string
|
||||||
|
---@field anim string
|
||||||
|
---@field width number
|
||||||
|
---@field height number
|
||||||
settings.image = {
|
settings.image = {
|
||||||
texture = texture,
|
texture = texture,
|
||||||
anim = anim,
|
anim = anim,
|
||||||
@ -114,18 +109,4 @@ M.register("img", function(params, settings)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
M.register("spine", function(params, settings)
|
|
||||||
local scene, anim = params:match("(.-):(.*)")
|
|
||||||
settings.spine = {
|
|
||||||
scene = scene,
|
|
||||||
anim = anim
|
|
||||||
}
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
M.register("p", function(params, settings)
|
|
||||||
settings.paragraph = tonumber(params) or true
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -70,6 +70,64 @@ nodes {
|
|||||||
enabled: true
|
enabled: true
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 300.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 400.0
|
||||||
|
y: 150.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.101960786
|
||||||
|
y: 0.3019608
|
||||||
|
z: 0.3019608
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
texture: ""
|
||||||
|
id: "case1"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "root"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
slice9 {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 0.0
|
||||||
|
}
|
||||||
|
clipping_mode: CLIPPING_MODE_NONE
|
||||||
|
clipping_visible: true
|
||||||
|
clipping_inverted: false
|
||||||
|
alpha: 1.0
|
||||||
|
template_node_child: false
|
||||||
|
size_mode: SIZE_MODE_MANUAL
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
@ -84,8 +142,8 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
scale {
|
scale {
|
||||||
x: 1.3
|
x: 1.0
|
||||||
y: 1.3
|
y: 1.0
|
||||||
z: 1.0
|
z: 1.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -102,8 +160,8 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
type: TYPE_TEMPLATE
|
type: TYPE_TEMPLATE
|
||||||
id: "rich_text"
|
id: "rich_text_1"
|
||||||
parent: "root"
|
parent: "case1"
|
||||||
layer: ""
|
layer: ""
|
||||||
inherit_alpha: true
|
inherit_alpha: true
|
||||||
alpha: 1.0
|
alpha: 1.0
|
||||||
@ -126,32 +184,32 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
scale {
|
scale {
|
||||||
x: 1.2
|
x: 1.0
|
||||||
y: 1.2
|
y: 1.0
|
||||||
z: 1.0
|
z: 1.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
size {
|
size {
|
||||||
x: 300.0
|
x: 400.0
|
||||||
y: 200.0
|
y: 150.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
color {
|
color {
|
||||||
x: 0.4
|
x: 1.0
|
||||||
y: 0.6
|
y: 1.0
|
||||||
z: 0.6
|
z: 1.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
type: TYPE_BOX
|
type: TYPE_BOX
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
texture: ""
|
texture: ""
|
||||||
id: "rich_text/root"
|
id: "rich_text_1/root"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
yanchor: YANCHOR_NONE
|
yanchor: YANCHOR_NONE
|
||||||
pivot: PIVOT_N
|
pivot: PIVOT_CENTER
|
||||||
adjust_mode: ADJUST_MODE_FIT
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
parent: "rich_text"
|
parent: "rich_text_1"
|
||||||
layer: ""
|
layer: ""
|
||||||
inherit_alpha: true
|
inherit_alpha: true
|
||||||
slice9 {
|
slice9 {
|
||||||
@ -164,15 +222,12 @@ nodes {
|
|||||||
clipping_visible: true
|
clipping_visible: true
|
||||||
clipping_inverted: false
|
clipping_inverted: false
|
||||||
alpha: 1.0
|
alpha: 1.0
|
||||||
overridden_fields: 3
|
overridden_fields: 4
|
||||||
overridden_fields: 5
|
|
||||||
overridden_fields: 14
|
|
||||||
overridden_fields: 46
|
|
||||||
template_node_child: true
|
template_node_child: true
|
||||||
size_mode: SIZE_MODE_MANUAL
|
size_mode: SIZE_MODE_MANUAL
|
||||||
custom_type: 0
|
custom_type: 0
|
||||||
enabled: true
|
enabled: true
|
||||||
visible: true
|
visible: false
|
||||||
}
|
}
|
||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
@ -188,14 +243,14 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
scale {
|
scale {
|
||||||
x: 0.8
|
x: 1.0
|
||||||
y: 0.8
|
y: 1.0
|
||||||
z: 1.0
|
z: 1.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
size {
|
size {
|
||||||
x: 200.0
|
x: 400.0
|
||||||
y: 100.0
|
y: 150.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -207,9 +262,9 @@ nodes {
|
|||||||
}
|
}
|
||||||
type: TYPE_TEXT
|
type: TYPE_TEXT
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
text: "Text"
|
text: "Rich text"
|
||||||
font: "game"
|
font: "game"
|
||||||
id: "rich_text/text_prefab"
|
id: "rich_text_1/text_prefab"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
yanchor: YANCHOR_NONE
|
yanchor: YANCHOR_NONE
|
||||||
pivot: PIVOT_CENTER
|
pivot: PIVOT_CENTER
|
||||||
@ -220,21 +275,22 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
shadow {
|
shadow {
|
||||||
x: 1.0
|
x: 0.0
|
||||||
y: 1.0
|
y: 0.0
|
||||||
z: 1.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
adjust_mode: ADJUST_MODE_FIT
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
line_break: true
|
line_break: true
|
||||||
parent: "rich_text/root"
|
parent: "rich_text_1/root"
|
||||||
layer: ""
|
layer: ""
|
||||||
inherit_alpha: true
|
inherit_alpha: true
|
||||||
alpha: 1.0
|
alpha: 1.0
|
||||||
outline_alpha: 1.0
|
outline_alpha: 0.75
|
||||||
shadow_alpha: 0.0
|
shadow_alpha: 0.0
|
||||||
overridden_fields: 3
|
overridden_fields: 4
|
||||||
overridden_fields: 18
|
overridden_fields: 18
|
||||||
|
overridden_fields: 31
|
||||||
template_node_child: true
|
template_node_child: true
|
||||||
text_leading: 1.0
|
text_leading: 1.0
|
||||||
text_tracking: 0.0
|
text_tracking: 0.0
|
||||||
@ -244,7 +300,7 @@ nodes {
|
|||||||
}
|
}
|
||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 77.0
|
x: 110.0
|
||||||
y: 0.0
|
y: 0.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
@ -262,8 +318,8 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
size {
|
size {
|
||||||
x: 36.0
|
x: 21.0
|
||||||
y: 36.0
|
y: 20.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -275,13 +331,13 @@ nodes {
|
|||||||
}
|
}
|
||||||
type: TYPE_BOX
|
type: TYPE_BOX
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
texture: "kenney/slider_move"
|
texture: "items/checkmark"
|
||||||
id: "rich_text/icon_prefab"
|
id: "rich_text_1/icon_prefab"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
yanchor: YANCHOR_NONE
|
yanchor: YANCHOR_NONE
|
||||||
pivot: PIVOT_CENTER
|
pivot: PIVOT_CENTER
|
||||||
adjust_mode: ADJUST_MODE_FIT
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
parent: "rich_text/root"
|
parent: "rich_text_1/root"
|
||||||
layer: ""
|
layer: ""
|
||||||
inherit_alpha: true
|
inherit_alpha: true
|
||||||
slice9 {
|
slice9 {
|
||||||
@ -300,6 +356,64 @@ nodes {
|
|||||||
enabled: true
|
enabled: true
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 180.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 400.0
|
||||||
|
y: 50.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.101960786
|
||||||
|
y: 0.3019608
|
||||||
|
z: 0.3019608
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
texture: ""
|
||||||
|
id: "case2"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "root"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
slice9 {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 0.0
|
||||||
|
}
|
||||||
|
clipping_mode: CLIPPING_MODE_NONE
|
||||||
|
clipping_visible: true
|
||||||
|
clipping_inverted: false
|
||||||
|
alpha: 1.0
|
||||||
|
template_node_child: false
|
||||||
|
size_mode: SIZE_MODE_MANUAL
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
@ -320,8 +434,50 @@ nodes {
|
|||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
size {
|
size {
|
||||||
x: 150.0
|
x: 200.0
|
||||||
y: 4.0
|
y: 100.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEMPLATE
|
||||||
|
id: "rich_text_2"
|
||||||
|
parent: "case2"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
alpha: 1.0
|
||||||
|
template: "/druid/custom/rich_text/rich_text.gui"
|
||||||
|
template_node_child: false
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 400.0
|
||||||
|
y: 50.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -334,7 +490,197 @@ nodes {
|
|||||||
type: TYPE_BOX
|
type: TYPE_BOX
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
texture: ""
|
texture: ""
|
||||||
id: "middle_line"
|
id: "rich_text_2/root"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "rich_text_2"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
slice9 {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 0.0
|
||||||
|
}
|
||||||
|
clipping_mode: CLIPPING_MODE_NONE
|
||||||
|
clipping_visible: true
|
||||||
|
clipping_inverted: false
|
||||||
|
alpha: 1.0
|
||||||
|
overridden_fields: 4
|
||||||
|
template_node_child: true
|
||||||
|
size_mode: SIZE_MODE_MANUAL
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 0.75
|
||||||
|
y: 0.75
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 550.0
|
||||||
|
y: 50.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 1.0
|
||||||
|
y: 0.9019608
|
||||||
|
z: 0.6
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
text: "Rich text"
|
||||||
|
font: "game"
|
||||||
|
id: "rich_text_2/text_prefab"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
outline {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
shadow {
|
||||||
|
x: 0.5019608
|
||||||
|
y: 0.7019608
|
||||||
|
z: 0.7019608
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
line_break: true
|
||||||
|
parent: "rich_text_2/root"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
alpha: 1.0
|
||||||
|
outline_alpha: 0.0
|
||||||
|
shadow_alpha: 0.0
|
||||||
|
overridden_fields: 3
|
||||||
|
overridden_fields: 4
|
||||||
|
overridden_fields: 5
|
||||||
|
overridden_fields: 16
|
||||||
|
overridden_fields: 18
|
||||||
|
overridden_fields: 32
|
||||||
|
template_node_child: true
|
||||||
|
text_leading: 1.0
|
||||||
|
text_tracking: 0.0
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 110.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 0.75
|
||||||
|
y: 0.75
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 21.0
|
||||||
|
y: 20.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
texture: "items/checkmark"
|
||||||
|
id: "rich_text_2/icon_prefab"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "rich_text_2/root"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
slice9 {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 0.0
|
||||||
|
}
|
||||||
|
clipping_mode: CLIPPING_MODE_NONE
|
||||||
|
clipping_visible: true
|
||||||
|
clipping_inverted: false
|
||||||
|
alpha: 1.0
|
||||||
|
overridden_fields: 3
|
||||||
|
template_node_child: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 110.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 400.0
|
||||||
|
y: 50.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.101960786
|
||||||
|
y: 0.3019608
|
||||||
|
z: 0.3019608
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
texture: ""
|
||||||
|
id: "case3"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
yanchor: YANCHOR_NONE
|
yanchor: YANCHOR_NONE
|
||||||
pivot: PIVOT_CENTER
|
pivot: PIVOT_CENTER
|
||||||
@ -351,13 +697,369 @@ nodes {
|
|||||||
clipping_mode: CLIPPING_MODE_NONE
|
clipping_mode: CLIPPING_MODE_NONE
|
||||||
clipping_visible: true
|
clipping_visible: true
|
||||||
clipping_inverted: false
|
clipping_inverted: false
|
||||||
alpha: 0.56
|
alpha: 1.0
|
||||||
template_node_child: false
|
template_node_child: false
|
||||||
size_mode: SIZE_MODE_MANUAL
|
size_mode: SIZE_MODE_MANUAL
|
||||||
custom_type: 0
|
custom_type: 0
|
||||||
enabled: true
|
enabled: true
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEMPLATE
|
||||||
|
id: "rich_text_3"
|
||||||
|
parent: "case3"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
alpha: 1.0
|
||||||
|
template: "/druid/custom/rich_text/rich_text.gui"
|
||||||
|
template_node_child: false
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 400.0
|
||||||
|
y: 50.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
texture: ""
|
||||||
|
id: "rich_text_3/root"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "rich_text_3"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
slice9 {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 0.0
|
||||||
|
}
|
||||||
|
clipping_mode: CLIPPING_MODE_NONE
|
||||||
|
clipping_visible: true
|
||||||
|
clipping_inverted: false
|
||||||
|
alpha: 1.0
|
||||||
|
overridden_fields: 4
|
||||||
|
template_node_child: true
|
||||||
|
size_mode: SIZE_MODE_MANUAL
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 0.75
|
||||||
|
y: 0.75
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 550.0
|
||||||
|
y: 50.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 1.0
|
||||||
|
y: 0.9019608
|
||||||
|
z: 0.6
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
text: "Rich text"
|
||||||
|
font: "game"
|
||||||
|
id: "rich_text_3/text_prefab"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
outline {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
shadow {
|
||||||
|
x: 0.5019608
|
||||||
|
y: 0.7019608
|
||||||
|
z: 0.7019608
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
line_break: true
|
||||||
|
parent: "rich_text_3/root"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
alpha: 1.0
|
||||||
|
outline_alpha: 0.0
|
||||||
|
shadow_alpha: 0.0
|
||||||
|
overridden_fields: 3
|
||||||
|
overridden_fields: 4
|
||||||
|
overridden_fields: 5
|
||||||
|
overridden_fields: 16
|
||||||
|
overridden_fields: 18
|
||||||
|
overridden_fields: 32
|
||||||
|
template_node_child: true
|
||||||
|
text_leading: 1.0
|
||||||
|
text_tracking: 0.0
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 110.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 0.75
|
||||||
|
y: 0.75
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 21.0
|
||||||
|
y: 20.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
texture: "items/checkmark"
|
||||||
|
id: "rich_text_3/icon_prefab"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "rich_text_3/root"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
slice9 {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 0.0
|
||||||
|
}
|
||||||
|
clipping_mode: CLIPPING_MODE_NONE
|
||||||
|
clipping_visible: true
|
||||||
|
clipping_inverted: false
|
||||||
|
alpha: 1.0
|
||||||
|
overridden_fields: 3
|
||||||
|
template_node_child: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 40.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 400.0
|
||||||
|
y: 50.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.101960786
|
||||||
|
y: 0.3019608
|
||||||
|
z: 0.3019608
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
texture: ""
|
||||||
|
id: "case4"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "root"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
slice9 {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 0.0
|
||||||
|
}
|
||||||
|
clipping_mode: CLIPPING_MODE_NONE
|
||||||
|
clipping_visible: true
|
||||||
|
clipping_inverted: false
|
||||||
|
alpha: 1.0
|
||||||
|
template_node_child: false
|
||||||
|
size_mode: SIZE_MODE_MANUAL
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 0.75
|
||||||
|
y: 0.75
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 550.0
|
||||||
|
y: 50.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 1.0
|
||||||
|
y: 0.9019608
|
||||||
|
z: 0.6
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
text: "Energy is full to restore"
|
||||||
|
font: "game"
|
||||||
|
id: "usual_text"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
outline {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
shadow {
|
||||||
|
x: 0.5019608
|
||||||
|
y: 0.7019608
|
||||||
|
z: 0.7019608
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
line_break: true
|
||||||
|
parent: "case4"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
alpha: 1.0
|
||||||
|
outline_alpha: 0.0
|
||||||
|
shadow_alpha: 0.0
|
||||||
|
template_node_child: false
|
||||||
|
text_leading: 1.0
|
||||||
|
text_tracking: 0.0
|
||||||
|
custom_type: 0
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
layers {
|
layers {
|
||||||
name: "image"
|
name: "image"
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,16 @@ local RichText = require("druid.custom.rich_text.rich_text")
|
|||||||
function init(self)
|
function init(self)
|
||||||
self.druid = druid.new(self)
|
self.druid = druid.new(self)
|
||||||
|
|
||||||
self.rich_text = self.druid:new(RichText, "rich_text")
|
self.rich_text = self.druid:new(RichText, "rich_text_1")
|
||||||
|
self.rich_text:set_text("Lorem long text with differrent placeholder <img=checkmark,32/>here to check")
|
||||||
-- self.rich_text:set_text("Lorem long text with differrent placeholder or just text without any sense here to check multiline without long words")
|
-- self.rich_text:set_text("Lorem long text with differrent placeholder or just text without any sense here to check multiline without long words")
|
||||||
-- self.rich_text:set_text("Lorem long text with differrent placeholder or just text without any sense here to check multiline without long wordswordwordwrodwrodwrodswrodword he")
|
--self.rich_text:set_text("Some text with image <img=logo,32/> in the middle")
|
||||||
self.rich_text:set_text("Some text with image <img=logo,32/> in the middle")
|
--self.rich_text:set_text("Some text with image <img=slider_move,32/> in the middle")
|
||||||
self.rich_text:set_text("Some text with image <img=slider_move,32/> in the middle")
|
self.rich_text_2 = self.druid:new(RichText, "rich_text_2")
|
||||||
|
self.rich_text_2:set_text("<color=#C2CACC>Energy</color> is full to restore")
|
||||||
|
|
||||||
|
self.rich_text_3 = self.druid:new(RichText, "rich_text_3")
|
||||||
|
self.rich_text_3:set_text("Energy is full to restore")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user