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
|
include PropertyMixin
|
||||||
attr_reader :name
|
attr_reader :name
|
||||||
attr_reader :optstart
|
attr_reader :optstart
|
||||||
attr_reader :optend
|
attr_reader :optend
|
||||||
|
|
||||||
def initialize(name, optstart, optend, getProc, setProc)
|
def initialize(name, optstart, optend, getProc, setProc, description="")
|
||||||
|
super(description)
|
||||||
@name = name
|
@name = name
|
||||||
@optstart = optstart
|
@optstart = optstart
|
||||||
@optend = optend
|
@optend = optend
|
||||||
@@ -212,6 +213,7 @@ class Window_PokemonOption < Window_DrawableCommand
|
|||||||
@mustUpdateDescription = false
|
@mustUpdateDescription = false
|
||||||
@selected_position = 0
|
@selected_position = 0
|
||||||
@allow_arrows_jump = false
|
@allow_arrows_jump = false
|
||||||
|
@is_first_update = true
|
||||||
for i in 0...@options.length
|
for i in 0...@options.length
|
||||||
@optvalues[i] = 0
|
@optvalues[i] = 0
|
||||||
end
|
end
|
||||||
@@ -319,23 +321,43 @@ class Window_PokemonOption < Window_DrawableCommand
|
|||||||
oldindex = self.index
|
oldindex = self.index
|
||||||
@mustUpdateOptions = false
|
@mustUpdateOptions = false
|
||||||
super
|
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 self.active && self.index < @options.length
|
||||||
if Input.repeat?(Input::LEFT)
|
if Input.repeat?(Input::LEFT)
|
||||||
self[self.index] = @options[self.index].prev(self[self.index])
|
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]
|
@selected_position = self[self.index]
|
||||||
@mustUpdateOptions = true
|
@mustUpdateOptions = true
|
||||||
@mustUpdateDescription = 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
|
||||||
end
|
end
|
||||||
refresh if dorefresh
|
refresh if (self.index != oldindex)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user