Skip to content

Commit 59965b0

Browse files
committed
feature: screenbutton isActive and cleaned up editor field overwriting
1 parent 035893f commit 59965b0

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/engine/SceneManagement/SceneBuilder.jl

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,22 +246,18 @@ module SceneBuilderModule
246246
constructor = Base.invokelatest(getfield, module_name, Symbol(script.name))
247247
newScript = Base.invokelatest(constructor)
248248
scriptFields = get(script, "fields", Dict())
249-
249+
@debug("getting fields for: $(script)")
250250
for (key, value) in scriptFields
251251
ftype = nothing
252252
try
253253
ftype = fieldtype(typeof(newScript), Symbol(key))
254-
if ftype == Float64
255-
value = Float64(value)
256-
elseif ftype == Int32
257-
value = Int32(value)
258-
elseif ftype == Int64
259-
value = Int64(value)
260-
elseif ftype == EditorExport
254+
@debug("type: $(ftype)")
255+
if ftype <: EditorExport
256+
@debug "Overwriting $(key) to $(value) using scene file"
261257
Base.invokelatest(setfield!, newScript, key, EditorExport(value))
262-
@info "Overwriting $(key) to $(value) using scene file"
263258
continue
264259
elseif value === nothing
260+
@debug "Value is nothing"
265261
continue
266262
end
267263
catch e

src/engine/UI/ScreenButton.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module ScreenButtonModule
1616
buttonUpSpritePath::String
1717
buttonUpTexture
1818
fontPath::Union{String, Ptr{Nothing}}
19+
isActive::Bool
1920
isHovered::Bool
2021
isInitialized::Bool
2122
mouseOverSprite
@@ -48,6 +49,7 @@ module ScreenButtonModule
4849
this.isInitialized = false
4950
this.persistentBetweenScenes = false
5051
this.isHovered = false
52+
this.isActive = true
5153

5254
return this
5355
end
@@ -58,6 +60,10 @@ module ScreenButtonModule
5860
UI.initialize(this)
5961
end
6062

63+
if !this.isActive
64+
return
65+
end
66+
6167
if !this.mouseOverSprite && this.currentTexture == this.buttonDownTexture
6268
#TODO: this.currentTexture = this.buttonUpTexture
6369
end

0 commit comments

Comments
 (0)