Skip to content

Commit

Permalink
add loading-bar for text box
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <uso.cosmo.ray@gmail.com>
  • Loading branch information
cosmo-ray committed May 5, 2024
1 parent a17be36 commit af3c69d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion actions.lua
Expand Up @@ -835,7 +835,6 @@ function printMessage(_main, _obj, msg)
return
end

print(#txt_tmp)
if #txt_tmp > 1000 then
local i = txt_tmp:find("\n-------------------------------\n", 1, true)
if i and i > 1 then
Expand All @@ -857,6 +856,10 @@ function printMessage(_main, _obj, msg)
else
main.box_t = TIME_RESET
end
if box_loading_bar then
ywCanvasRemoveObj(main_widget.upCanvas, box_loading_bar)
end
box_loading_bar = loading_bar.create(main.upCanvas, 0, 0)
end

local TMP_OBJ_SMALL_TALK = 0
Expand Down
11 changes: 9 additions & 2 deletions phq.lua
Expand Up @@ -19,6 +19,7 @@ tiled = Entity.wrapp(ygGet("tiled"))
local jrpg_fight = Entity.wrapp(ygGet("jrpg-fight"))
dialogue_box = Entity.wrapp(ygGet("DialogueBox"))
dialogue_mod = Entity.wrapp(ygGet("Dialogue"))
loading_bar = Entity.wrapp(ygGet("loading-bar"))
lpcs = Entity.wrapp(ygGet("lpcs"))
sprite_man = Entity.wrapp(ygGet("sprite-man"))
phq = Entity.wrapp(ygGet("phq"))
Expand All @@ -30,7 +31,7 @@ saved_scenes = nil
dialogues = Entity.new_array()
o_dialogues = nil
phq_pc = nil

box_loading_bar = nil
students = nil

-- make students an array containing all students npcs
Expand Down Expand Up @@ -194,6 +195,9 @@ end
local function reposScreenInfo(ent, x0, y0)
ywCanvasObjSetPos(ent.night_r, x0, y0)
dialogue_box.set_pos(ent.box, 40 + x0, 40 + y0)
if box_loading_bar then
ywCanvasObjSetPos(box_loading_bar, 40 + x0, 28 + y0)
end
for i = 0, yeLen(ent.rain_a) - 1 do
local r = ent.rain_a[i]
local x = yuiRand() % window_width
Expand Down Expand Up @@ -751,8 +755,11 @@ function phq_action(entity, eve)
dialogue_box.rm(entity.upCanvas, entity.box)
entity.box = nil
entity.box_t = 0
ywCanvasRemoveObj(main_widget.upCanvas, box_loading_bar)
box_loading_bar = nil
elseif isNewlyLoad == false then
entity.box_t = entity.box_t - ywidGetTurnTimer()
entity.box_t = entity.box_t - ywidGetTurnTimer()
loading_bar.setPercent(box_loading_bar, 100 - (100 * yeGetInt(entity.box_t) / 4000000))
end
end

Expand Down
1 change: 1 addition & 0 deletions start.json
Expand Up @@ -18,6 +18,7 @@
{ "path" : "YIRL_MODULES_PATH/hightscore/", "type" : "module" },
{ "path" : "YIRL_MODULES_PATH/c_app/", "type" : "module" },
{ "path" : "YIRL_MODULES_PATH/smart_cobject/", "type" : "module"},
{ "path" : "YIRL_MODULES_PATH/loading_bar/", "type" : "module"},

{ "file" : "modules/tetris", "type" : "module" },
{ "file" : "modules/croco-427/", "type" : "module" },
Expand Down

0 comments on commit af3c69d

Please sign in to comment.