mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
add: initial options update and up/down update trigger
This commit is contained in:
@@ -129,13 +129,14 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class NumberOption
|
||||
class NumberOption < Option
|
||||
include PropertyMixin
|
||||
attr_reader :name
|
||||
attr_reader :optstart
|
||||
attr_reader :optend
|
||||
|
||||
def initialize(name, optstart, optend, getProc, setProc)
|
||||
def initialize(name, optstart, optend, getProc, setProc, description="")
|
||||
super(description)
|
||||
@name = name
|
||||
@optstart = optstart
|
||||
@optend = optend
|
||||
@@ -212,6 +213,7 @@ class Window_PokemonOption < Window_DrawableCommand
|
||||
@mustUpdateDescription = false
|
||||
@selected_position = 0
|
||||
@allow_arrows_jump = false
|
||||
@is_first_update = true
|
||||
for i in 0...@options.length
|
||||
@optvalues[i] = 0
|
||||
end
|
||||
@@ -319,23 +321,43 @@ class Window_PokemonOption < Window_DrawableCommand
|
||||
oldindex = self.index
|
||||
@mustUpdateOptions = false
|
||||
super
|
||||
dorefresh = (self.index != oldindex)
|
||||
|
||||
if @is_first_update
|
||||
# Needed for displaying the description of the initially selected option correctly
|
||||
@selected_position = self[self.index]
|
||||
@mustUpdateOptions = true
|
||||
@mustUpdateDescription = true
|
||||
@is_first_update = false
|
||||
refresh
|
||||
return
|
||||
end
|
||||
|
||||
if self.active && self.index < @options.length
|
||||
if Input.repeat?(Input::LEFT)
|
||||
self[self.index] = @options[self.index].prev(self[self.index])
|
||||
dorefresh =
|
||||
@selected_position = self[self.index]
|
||||
@mustUpdateOptions = true
|
||||
@mustUpdateDescription = true
|
||||
elsif Input.repeat?(Input::RIGHT)
|
||||
self[self.index] = @options[self.index].next(self[self.index])
|
||||
dorefresh = true
|
||||
@selected_position = self[self.index]
|
||||
@mustUpdateOptions = true
|
||||
@mustUpdateDescription = true
|
||||
refresh if self[self.index]
|
||||
return
|
||||
end
|
||||
if Input.repeat?(Input::RIGHT)
|
||||
self[self.index] = @options[self.index].next(self[self.index])
|
||||
@selected_position = self[self.index]
|
||||
@mustUpdateOptions = true
|
||||
@mustUpdateDescription = true
|
||||
refresh
|
||||
return
|
||||
end
|
||||
if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
|
||||
@selected_position = self[self.index]
|
||||
@mustUpdateOptions = true
|
||||
@mustUpdateDescription = true
|
||||
refresh
|
||||
return
|
||||
end
|
||||
end
|
||||
refresh if dorefresh
|
||||
refresh if (self.index != oldindex)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user