Fixed file-choosing methods not removing file extensions, fixed typo in Puddle envirnment registration

This commit is contained in:
Maruno17
2022-11-23 22:43:11 +00:00
parent bd04112122
commit 91efb4684b
6 changed files with 64 additions and 26 deletions

View File

@@ -49,7 +49,7 @@ def pbSelectAnim(canvas, animwin)
if Input.trigger?(Input::USE) && animfiles.length > 0
filename = cmdwin.commands[cmdwin.index]
bitmap = AnimatedBitmap.new("Graphics/Animations/" + filename, ctlwin.value(0)).deanimate
canvas.animation.graphic = File.basename(filename, ".png")
canvas.animation.graphic = File.basename(filename, ".*")
canvas.animation.hue = ctlwin.value(0)
canvas.animbitmap = bitmap
animwin.animbitmap = bitmap
@@ -544,11 +544,7 @@ def pbSelectSE(canvas, audio)
pbSEStop
end
if maxsizewindow.changed?(5) # OK
filename = File.basename(filename, ".wav")
# filename = File.basename(filename,".mp3")
filename = File.basename(filename, ".ogg")
filename = File.basename(filename, ".wma")
audio.name = filename
audio.name = File.basename(filename, ".*")
audio.volume = maxsizewindow.value(1)
audio.pitch = maxsizewindow.value(2)
ret = true
@@ -583,6 +579,9 @@ def pbSelectBG(canvas, timing)
# animfiles.concat(Dir.glob("*.jpeg"))
# animfiles.concat(Dir.glob("*.bmp"))
}
animfiles.map! { |f| File.basename(f, ".*") }
animfiles.uniq!
animfiles.sort! { |a, b| a.downcase <=> b.downcase }
cmdwin = pbListWindow(animfiles, 320)
cmdwin.height = 480
cmdwin.opacity = 200

View File

@@ -359,7 +359,7 @@ end
module BGMProperty
def self.set(settingname, oldsetting)
chosenmap = pbListScreen(settingname, MusicFileLister.new(true, oldsetting))
return (chosenmap && chosenmap != "") ? chosenmap : oldsetting
return (chosenmap && chosenmap != "") ? File.basename(chosenmap, ".*") : oldsetting
end
def self.format(value)
@@ -372,7 +372,7 @@ end
module MEProperty
def self.set(settingname, oldsetting)
chosenmap = pbListScreen(settingname, MusicFileLister.new(false, oldsetting))
return (chosenmap && chosenmap != "") ? chosenmap : oldsetting
return (chosenmap && chosenmap != "") ? File.basename(chosenmap, ".*") : oldsetting
end
def self.format(value)
@@ -385,7 +385,7 @@ end
module WindowskinProperty
def self.set(settingname, oldsetting)
chosenmap = pbListScreen(settingname, GraphicsLister.new("Graphics/Windowskins/", oldsetting))
return (chosenmap && chosenmap != "") ? chosenmap : oldsetting
return (chosenmap && chosenmap != "") ? File.basename(chosenmap, ".*") : oldsetting
end
def self.format(value)
@@ -653,7 +653,7 @@ end
module CharacterProperty
def self.set(settingname, oldsetting)
chosenmap = pbListScreen(settingname, GraphicsLister.new("Graphics/Characters/", oldsetting))
return (chosenmap && chosenmap != "") ? chosenmap : oldsetting
return (chosenmap && chosenmap != "") ? File.basename(chosenmap, ".*") : oldsetting
end
def self.format(value)

View File

@@ -148,15 +148,10 @@ class GraphicsLister
@commands.clear
Dir.chdir(@folder) {
Dir.glob("*.png") { |f| @commands.push(f) }
Dir.glob("*.PNG") { |f| @commands.push(f) }
Dir.glob("*.gif") { |f| @commands.push(f) }
Dir.glob("*.GIF") { |f| @commands.push(f) }
# Dir.glob("*.jpg") { |f| @commands.push(f) }
# Dir.glob("*.JPG") { |f| @commands.push(f) }
# Dir.glob("*.jpeg") { |f| @commands.push(f) }
# Dir.glob("*.JPEG") { |f| @commands.push(f) }
# Dir.glob("*.bmp") { |f| @commands.push(f) }
# Dir.glob("*.BMP") { |f| @commands.push(f) }
}
@commands.sort!
@commands.length.times do |i|