diff --git a/exp_scenario/module/gui/calculator.lua b/exp_scenario/module/gui/calculator.lua index 68a11d06..a1bfcab2 100644 --- a/exp_scenario/module/gui/calculator.lua +++ b/exp_scenario/module/gui/calculator.lua @@ -67,10 +67,38 @@ end Elements.calculator_info_label = Gui.define("calculator/info_label") :draw{ type = "label", - caption = "[virtual-signal=signal-info]", - tooltip = {"exp-gui_calculator.info_tooltip"}, - style = "heading_2_label", + caption = {"exp-gui_calculator.info_caption"}, + name = "calculator_info_label", } + :style{ + single_line = false + } + +--- Container Info +Elements.container_info = Gui.define("calculator/container_info") + :draw{function(def, parent) + local screen_frame = Gui.elements.screen_frame(player, nil, true) + local header = Gui.elements.header(screen_frame, { caption = { "exp-gui_calculator.info_tooltip" } }) + Elements.calculator_info_label(screen_frame) + return Gui.elements.screen_frame.get_root_element(screen_frame) + end} + +--- Info button +--- @overload fun(parent: LuaGuiElement, screen: LuaGuiElement): LuaGuiElement +Elements.calculator_info_button = Gui.define("calculator/info_button") + :draw{ + type = "sprite-button", + sprite = "virtual-signal/signal-info", + style = "tool_button", + tooltip = {"exp-gui_calculator.info_tooltip"}, + name = "calculator_info_button", + } + :element_data( + Gui.from_argument(1) + ) + :on_click(function(def, player, element) + return Elements.calculator_info_frame + end) --[[@as any]] --- Input textfield Elements.calculator_input_textfield = Gui.define("calculator/input_textfield") @@ -95,11 +123,9 @@ Elements.container = Gui.define("calculator/container") :draw(function(def, parent) local screen_frame = Gui.elements.screen_frame(parent, nil, true) local header = Gui.elements.header(screen_frame, { caption = { "exp-gui_calculator.tooltip" } }) - Elements.calculator_info_label(header) - + Elements.calculator_info_button(header) Elements.calculator_input_textfield(screen_frame) Elements.calculator_result_label(screen_frame) - return Gui.elements.screen_frame.get_root_element(screen_frame) end) @@ -111,7 +137,8 @@ Gui.toolbar.create_button{ visible = function(player, element) return Roles.player_has_permission(player, "exp-gui_calculator") end -}:on_click(function(def, player, element, event) +} +:on_click(function(def, player, element, event) Elements.container(player.gui.screen) end) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index f79aa711..9b576a3e 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -271,7 +271,8 @@ inserted=Inserted __1__ __2__ into __3__ [exp-gui_calculator] tooltip=Calculator -info_tooltip=Supported Operators: + - * / % () ^ ** !\nPrefix: K M G T P\nBase: 0x 0b 0o\nFunction: ABS, CEIL, EXP, FLOOR, LN, LOG, ROUND, SQRT, TRUNC +info_tooltip=Calculator Info +info_caption=Supported Operators: + - * / % () ^ ** !\nPrefix: K M G T P\nBase: 0x 0b 0o\nFunction: ABS, CEIL, EXP, FLOOR, LN, LOG, ROUND, SQRT, TRUNC error=[ERROR] input_too_long=Input too long factorial_neg=Factorial of a negative number __1__ diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index b6144742..8c78f53f 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -273,7 +273,8 @@ inserted=自動填入 __1__ __2__ 到 __3__ [exp-gui_calculator] tooltip=計算機 -info_tooltip=支援的運算符: + - * / % () ^ ** !\n詞頭: K M G T P\n進制: 0x 0b 0o\n函數: ABS, CEIL, EXP, FLOOR, LN, LOG, ROUND, SQRT, TRUNC +info_tooltip=計算機資訊 +info_caption=支援的運算符: + - * / % () ^ ** !\n詞頭: K M G T P\n進制: 0x 0b 0o\n函數: ABS, CEIL, EXP, FLOOR, LN, LOG, ROUND, SQRT, TRUNC error=[錯誤] input_too_long=輸入太長 factorial_neg=負數的階乘 __1__ diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index b6144742..8c78f53f 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -273,7 +273,8 @@ inserted=自動填入 __1__ __2__ 到 __3__ [exp-gui_calculator] tooltip=計算機 -info_tooltip=支援的運算符: + - * / % () ^ ** !\n詞頭: K M G T P\n進制: 0x 0b 0o\n函數: ABS, CEIL, EXP, FLOOR, LN, LOG, ROUND, SQRT, TRUNC +info_tooltip=計算機資訊 +info_caption=支援的運算符: + - * / % () ^ ** !\n詞頭: K M G T P\n進制: 0x 0b 0o\n函數: ABS, CEIL, EXP, FLOOR, LN, LOG, ROUND, SQRT, TRUNC error=[錯誤] input_too_long=輸入太長 factorial_neg=負數的階乘 __1__