Domanda forse banalissima, ma ci provo ugualmente.
Non ho capito esattamente come si fa a far sì che una finestra contenente diversi elementi da selezionare (per esempio un inventario o un menu con varie opzioni) scrolli verso il basso se il numero degli elementi è superiore a quello visualizzabile.
Mi trovo con questa finestra qui, in un sistema di quest:
class Window_Listequete < Window_Selectable
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize
super(0, 120, 320, 360) #super(0, 120, 320, 360)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 0
self.opacity = 0
self.contents.font.name = $fontface
self.contents.font.size = 20
self.active = false
self.index = -1
@column_max = 1
refresh
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh(etat_quete = 1)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@tab_quete = []
# Parcourir la liste des quete en cours
$game_party.tab_quete.each_key { |id_quete_party|
# Si la quete est en cours
if $game_party.tab_quete[id_quete_party][0] == etat_quete
#@tab_quete.push(id_quete_party)
@tab_quete.insert(0,id_quete_party)
end
}
@item_max = @tab_quete.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 20 -3)
self.contents.font.name = $fontface
self.contents.font.size = 18
self.contents.font.color = Color.new(0,0,0,255)
for i in 0...@tab_quete.size
id_quete_party = @tab_quete[i]
# Afficher le nom de la quete
self.contents.draw_text(30, (i * 20) - 4, 250, 20, $data_quete.tab_def_quete[id_quete_party]["nom"])
end
end
#--------------------------------------------------------------------------
# ● nb_quete
#--------------------------------------------------------------------------
def nb_quete()
return @tab_quete.size
end
#--------------------------------------------------------------------------
# ● id_quete
#--------------------------------------------------------------------------
def id_quete()
return @tab_quete[@index]
end
end
#--------------------------------------------------------------------------
# ● update_cursor_rect
# - Permet de modifier la position du rectangle de sélection à chaque cycle
#--------------------------------------------------------------------------
def update_cursor_rect
# Si l'index de focus est inferieur à 0
if @index < 0
# Alors effacer le rectangle de sélection
self.cursor_rect.empty
else
# Sinon afficher le rectangle à la position du focus
self.cursor_rect.set(20, -4 + (20 * @index), 280, 20)
end
end
end
Il problema è che superato un certo numero di oggetti elencati, essi continuano a essere elencati ma la finestra non "scrolla", è il cursore continua ad andare in basso senza fermarsi...
So che è un problema stupidissimo, ma non ne vengo a capo.
Question
Zosimos
Domanda forse banalissima, ma ci provo ugualmente.
Non ho capito esattamente come si fa a far sì che una finestra contenente diversi elementi da selezionare (per esempio un inventario o un menu con varie opzioni) scrolli verso il basso se il numero degli elementi è superiore a quello visualizzabile.
Mi trovo con questa finestra qui, in un sistema di quest:
class Window_Listequete < Window_Selectable #-------------------------------------------------------------------------- # ● initialize #-------------------------------------------------------------------------- def initialize super(0, 120, 320, 360) #super(0, 120, 320, 360) self.contents = Bitmap.new(width - 32, height - 32) self.back_opacity = 0 self.opacity = 0 self.contents.font.name = $fontface self.contents.font.size = 20 self.active = false self.index = -1 @column_max = 1 refresh end #-------------------------------------------------------------------------- # ● refresh #-------------------------------------------------------------------------- def refresh(etat_quete = 1) if self.contents != nil self.contents.dispose self.contents = nil end @tab_quete = [] # Parcourir la liste des quete en cours $game_party.tab_quete.each_key { |id_quete_party| # Si la quete est en cours if $game_party.tab_quete[id_quete_party][0] == etat_quete #@tab_quete.push(id_quete_party) @tab_quete.insert(0,id_quete_party) end } @item_max = @tab_quete.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 20 -3) self.contents.font.name = $fontface self.contents.font.size = 18 self.contents.font.color = Color.new(0,0,0,255) for i in 0...@tab_quete.size id_quete_party = @tab_quete[i] # Afficher le nom de la quete self.contents.draw_text(30, (i * 20) - 4, 250, 20, $data_quete.tab_def_quete[id_quete_party]["nom"]) end end #-------------------------------------------------------------------------- # ● nb_quete #-------------------------------------------------------------------------- def nb_quete() return @tab_quete.size end #-------------------------------------------------------------------------- # ● id_quete #-------------------------------------------------------------------------- def id_quete() return @tab_quete[@index] end end #-------------------------------------------------------------------------- # ● update_cursor_rect # - Permet de modifier la position du rectangle de sélection à chaque cycle #-------------------------------------------------------------------------- def update_cursor_rect # Si l'index de focus est inferieur à 0 if @index < 0 # Alors effacer le rectangle de sélection self.cursor_rect.empty else # Sinon afficher le rectangle à la position du focus self.cursor_rect.set(20, -4 + (20 * @index), 280, 20) end end endIl problema è che superato un certo numero di oggetti elencati, essi continuano a essere elencati ma la finestra non "scrolla", è il cursore continua ad andare in basso senza fermarsi...
So che è un problema stupidissimo, ma non ne vengo a capo.
Edited by ZosimosGioco in Sviluppo:
http://www.studibizantini.it/docs/Logo.png
Blog: Ode to my Forthcoming Winter
Riferimento
Contest:
http://rpg2s.net/gif/SCContest2Oct.gifx2 http://rpg2s.net/gif/SCContest1Oct.gifx1
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now