Sujet n°11125
Posté par Maxime le 11 Mar - 15:37 (2012)
Titre : Modifier la couleur du pokédex à partir des options
Bonjour,
je demande si il serait possible de modifier la couleur du début du pokédex BW ( pkdex_rouge), en bleu (pkdex_bleu) ou en rose (pkdex_rose) de la même manière que l'on modifie les bouton rouge, vert et bleu () à partir des options.
Je vous donne le script "Pokemon_Pokedex" :

Spoiler

#==============================================================================
# ■ Pokemon_Pokedex
# Pokemon Script Project - Krosk & Shaolan
# Image de Slashet Homerio, Modifier par Slash et Homerio
# 16/02/08
#-----------------------------------------------------------------------------
# Scène modifiable
#-----------------------------------------------------------------------------
# Pokédex
#-----------------------------------------------------------------------------


module POKEMON_S
class Pokemon_Pokedex #(Numérique)
def initialize(index = 0, list=nil, tr = false)
@index = index
@list = list
@tronquage = false
end
#-------------Ajouté par Homerio-------------
def main
@background = Sprite.new
@background.bitmap = RPG::Cache.picture("pkdex_rouge.png")
@background.x = 13
@background.y = 13
Graphics.transition(5) # Vitesse de l'apparition de l'image
Graphics.freeze
Graphics.transition(30) # Durée d'affichage de l'image
Graphics.freeze
#------------------Jusqu'à là----------------------------
# Fenêtre principale
# Fond
@background = Sprite.new
@background.bitmap = RPG::Cache.picture("Menu_Pokedex2.png")
@background.x = 13
@background.y = 13

# Liste
if @list == nil
@list = []
if POKEMON_S._DEXREG
for id in 1..$data_pokedex.length-1
@list[Pokemon_Info.id_bis(id)] = 0
end

else
# National
for id in 1..$data_pokedex.length-1
if $data_pokedex[id][1]
@list.push(id)
end
end
end
end
if @tronquage
id = @list[@index]
else
id = @index + 1
end
ida = sprintf("%03d", id)
@pkm_img = Sprite.new
@pkm_img.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
@pkm_img.y = 227
@pkm_img.x = 13
@pkm_img.z = 10000
show = $data_pokedex[id][0]
if show
@pkm_img.opacity = 255
else
@pkm_img.opacity = 0
end
@pokemon_list = POKEMON_S::Pokemon_List.new(@list, @index, @tronquage)
@pokemon_list.active = true

# Vu/Capture
@pokemon_amount = Window_Base.new(0, -5, 640, 480)
@pokemon_amount.contents = Bitmap.new(640, 480)
@pokemon_amount.contents.font.name = $fontface
@pokemon_amount.contents.font.size = $fontsize
@pokemon_amount.z = 2
#print $fontsizebig
@pokemon_amount.contents.font.italic = false
@pokemon_amount.opacity = 0
#viewed = @list.length.to_s
captured = 0
viewed = 0
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][0]
viewed += 1
end
end
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][1]
captured += 1
end
end
viewed = sprintf("% 3s", viewed)
captured = sprintf("% 3s", captured.to_s)
if POKEMON_S._DEXREG
dex = "Pokédex Régional"
else
dex = "Pokédex National"
end
@pokemon_amount.contents.font.color = Color.new(132, 132, 132)
@pokemon_amount.contents.draw_text(11, 1, 150, 28, dex )
@pokemon_amount.contents.draw_text(12, 0, 150, 28, dex )
@pokemon_amount.contents.draw_text(12, 1, 150, 28, dex )
@pokemon_amount.contents.font.color = Color.new(222, 222, 222)
@pokemon_amount.contents.draw_text(11, 0, 150, 28, dex )
@pokemon_amount.contents.font.color = Color.new(140, 140, 140)
@pokemon_amount.contents.draw_text(11, 26, 150, 28, "Aperçus : " + viewed)
@pokemon_amount.contents.draw_text(12, 25, 150, 28, "Aperçus : " + viewed)
@pokemon_amount.contents.draw_text(12, 26, 150, 28, "Aperçus : " + viewed)
@pokemon_amount.contents.draw_text(90, 26, 150, 28, "Capturés : " + captured, 2)
@pokemon_amount.contents.draw_text(91, 25, 150, 28, "Capturés : " + captured, 2)
@pokemon_amount.contents.draw_text(91, 26, 150, 28, "Capturés : " + captured, 2)
@pokemon_amount.contents.font.color = Color.new(49, 49, 49)
@pokemon_amount.contents.draw_text(11, 25, 150, 28, "Aperçus : " + viewed)
@pokemon_amount.contents.draw_text(90, 25, 150, 28, "Capturés : " + captured, 2)

@pokemon_list.update
@pokemon_list.refresh
# Fin Fenêtre principale

# Fenêtre détail
# Sprite
@pokemon_sprite = Sprite.new
@pokemon_sprite.x = 400
@pokemon_sprite.y = 75
@pokemon_sprite.z = 10
@pokemon_sprite.visible = false

# Identité
@data_window = Window_Base.new(39 - 16, 75 - 16 , 220 + 32, 170 + 32)
@data_window.contents = Bitmap.new(220 , 170)
color = Color.new(60,60,60)
@data_window.contents.font.name = $fontface
@data_window.contents.font.size = $fontsize
@data_window.contents.font.color = color
@data_window.opacity = 0
@data_window.z = 10
@data_window.visible = false

# Descr
@text_window = Window_Base.new(60 - 16, 264 - 16, 550 + 32, 160 + 32)
@text_window.contents = Bitmap.new(550 , 160)
@text_window.contents.font.name = $fontface
@text_window.contents.font.size = $fontsize
@text_window.contents.font.color = color
@text_window.opacity = 0
@text_window.z = 10
@text_window.visible = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@pkm_img.dispose
@pokemon_list.dispose
@pokemon_amount.dispose
@background.dispose
@data_window.dispose
@pokemon_sprite.dispose
@text_window.dispose
################################################################################
@pokemon_list.dispose_image
Graphics.transition
Graphics.freeze
end

def update
@pokemon_list.update
@index = @pokemon_list.index
@pkm_img.dispose
if @tronquage
id = @list[@index]
else
id = @index + 1
end
ida = sprintf("%03d", id)
@pkm_img = Sprite.new
@pkm_img.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
@pkm_img.y = 227
@pkm_img.x = 13
@pkm_img.z = 10000
show = $data_pokedex[id][0]
if show
@pkm_img.opacity = 255
else
@pkm_img.opacity = 0
end

if Input.trigger?(Input::B) and @pokemon_sprite.visible == false
$game_system.se_play($data_system.cancel_se)
$scene = POKEMON_S::Pokemon_Menu.new(0)
return
end

if Input.trigger?(Input::C) and ((@tronquage == false and @list.include?(@index + 1)) or (@tronquage == true))
$scene = POKEMON_S::Pokemon_Pokedex_Detail.new(@index, @list, @tronquage)
return
end

if Input.trigger?(Input::B) and @pokemon_sprite.visible == true
$game_system.se_play($data_system.cursor_se)
Graphics.freeze
@background.bitmap = RPG::Cache.picture("Menu_Pokedex2.png")
@pokemon_sprite.visible = false
@data_window.visible = false
@text_window.visible = false
@pokemon_amount.visible = true
@pokemon_list.visible = true
@pokemon_list.active = true
Graphics.transition
return
end
#=begin
if Input.trigger?(Input::Y) or Input.trigger?(Input::CTRL)
$game_system.se_play($data_system.cancel_se)
if @tronquage
@tronquage = false
@pokemon_list.dispose_image
@pokemon_list.dispose
@pokemon_list = POKEMON_S::Pokemon_List.new(@list, @list[@index]-1, @tronquage)
@pokemon_list.active = true
@pokemon_list.update
@pokemon_list.refresh
else
@tronquage = true
a = @list.index(@index+1)
if a == nil
a = 0
end
@pokemon_list.dispose_image
@pokemon_list.dispose
@pokemon_list = POKEMON_S::Pokemon_List.new(@list, a, @tronquage)
@pokemon_list.active = true
@pokemon_list.update
@pokemon_list.refresh
end
end
#=end
if Input.trigger?(Input::Z)
$scene= POKEMON_S::Pokemon_Pokedex_Recherche.new(@index, @list, @tronquage)
end

end


def data_refresh
@index = @pokemon_list.index
@pokemon = $data_pokemon[@index+1]

ida = sprintf("%03d", @index+1)
@pokemon_sprite.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)

name = "N." + ida + " " + @pokemon[0]
show = $data_pokedex[@index+1][1]

if show # Descr accessible
species = @pokemon[9][1]
height_data = @pokemon[9][2]
weight = @pokemon[9][3]
else
species = "???"
height_data = "???"
weight = "???"
end

@data_window.contents.clear
@data_window.contents.draw_text(0, 0, 260, 39, name)
@data_window.contents.draw_text(0, 44, 220, 39, species)
@data_window.contents.draw_text(0, 88, 220, 30, "Taille: "+ height_data)
@data_window.contents.draw_text(0, 132, 220, 30, "Poids: "+ weight)

@text_window.contents.clear
if show
text = @pokemon[9][0]
string = string_builder(text, 51)
string1 = string[0]
string2 = string[1]
string3 = string[2]
string4 = string[3]
@text_window.contents.draw_text(0, 0, 550, 40, string1)
@text_window.contents.draw_text(0, 40, 550, 40, string2)
@text_window.contents.draw_text(0, 80, 550, 40, string3)
@text_window.contents.draw_text(0, 120, 550, 40, string4)
end
end

def string_builder(text, limit)
length = text.length
full1 = false
full2 = false
full3 = false
full4 = false
string1 = ""
string2 = ""
string3 = ""
string4 = ""
word = ""
for i in 0..length
letter = text[i..i]
if letter != " " and i != length
word += letter.to_s
else
word = word + " "
if (string1 + word).length < limit and not(full1)
string1 += word
word = ""
else
full1 = true
end

if (string2 + word).length < limit and not(full2)
string2 += word
word = ""
else
full2 = true
end

if (string3 + word).length < limit and not(full3)
string3 += word
word = ""
else
full3 = true
end

if (string4 + word).length < limit and not(full4)
string4 += word
word = ""
else
full4 = true
end
end
end
return [string1, string2, string3, string4]
end
end



class Pokemon_List < Window_Selectable

def dispose_image
@image_pokemon.dispose
end

def initialize(id_list = [], menu_index = 0, tronquage = false)
#print id_list
# show montre les pokémons intermédiaires
# id_list liste des pokémons vu/attrapés
@hauteur = 24
super(1, 211 , 560+32, 200, @hauteur)#(640 - 320, (480-418-32)/2, 560+32, 387+32, 43)
@index = menu_index
@id_list = id_list
@last = id_list[-1]
self.oy = (-1 * ((self.height - 32)/2)) + ((@hauteur) * menu_index) + @hauteur/2
self.opacity = 0
if tronquage == false
value = @last
else
value = id_list.length
end
@tronquage = tronquage
#print "tronquage : #@tronquage"
if value == nil
value = 1
@last = 1
end
@item_max = value
self.contents = Bitmap.new(width - 32, value * @hauteur)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@image_pokemon = POKEMON_S::Image_Pokemon.new(id_list, @index, @tronquage)
end

def refresh
self.contents.clear
normal_color = Color.new(60,60,60)
self.contents.font.color = normal_color
if @tronquage
#print "tronquage oui " + @id_list.to_s
calcul = 0
@id_list.each do |i|
#print i
ida = sprintf("%03d", i)
if $data_pokedex[i][0]
bitmap = RPG::Cache.picture("Pokedex_vu.png")
self.contents.blt(92, 1 + @hauteur * calcul, bitmap, Rect.new(0, 0, 151, 24))
id = i
idx = (id - 1 )% 10
idy = (id - 1 ) / 10
xrect = idx * 32
yrect = idy * 32
bitmap = RPG::Cache.battler("Icon/000.png",0)
self.contents.blt(93, -8 + @hauteur * calcul, bitmap, Rect.new(xrect, yrect, 32, 32))
else
bitmap = RPG::Cache.picture("Pokedex_nc.png")
self.contents.blt(92, 1 + @hauteur * calcul, bitmap, Rect.new(0, 0, 151, 24))
end

string = name = $data_pokemon[i][0]#$pokemon_info.name(i)
self.contents.font.color = Color.new(132, 132, 132)
self.contents.draw_text(149, 1 + @hauteur * calcul, 300, @hauteur, ida + " " + string)
self.contents.draw_text(150, @hauteur * calcul, 300, @hauteur, ida + " " + string)
self.contents.draw_text(150, 1 + @hauteur * calcul, 300, @hauteur, ida + " " + string)
self.contents.font.color = Color.new(222, 222, 222)
self.contents.draw_text(149, @hauteur * calcul, 300, @hauteur, ida + " " + string)
if $data_pokedex[i][1]
bitmap = RPG::Cache.picture("Pokedexball.png")
self.contents.blt(133, 5 + @hauteur * calcul, bitmap, Rect.new(0, 0, 24, 24))
#type1 = $pokemon_info.type1(i)
#type2 = $pokemon_info.type2(i)
#src_rect = Rect.new(0, 0, 96, 42)
#bitmap = RPG::Cache.picture("T" + type1.to_s + ".png")
#self.contents.blt(336, 43 * (i-1), bitmap, src_rect, 255)
#bitmap = RPG::Cache.picture("T" + type2.to_s + ".png")
#self.contents.blt(432, 43 * (i-1), bitmap, src_rect, 255)
end
calcul += 1
end
else
for i in 1..@last
#self.contents.font.size = (i <= 96 and i >= 8) ? i : 38
ida = sprintf("%03d", i)

if $data_pokedex[i][0]
bitmap = RPG::Cache.picture("Pokedex_vu.png")
self.contents.blt(92, 1 + @hauteur * (i-1), bitmap, Rect.new(0, 0, 151, 24))
id = i
idx = (id - 1 )% 10
idy = (id - 1 ) / 10
xrect = idx * 32
yrect = idy * 32
bitmap = RPG::Cache.battler("Icon/000.png",0)
self.contents.blt(93, -8 + @hauteur * (i-1), bitmap, Rect.new(xrect, yrect, 32, 32))
else
bitmap = RPG::Cache.picture("Pokedex_nc.png")
self.contents.blt(92, 1 + @hauteur * (i-1), bitmap, Rect.new(0, 0, 151, 24))
end


if @id_list.include?(i)
string = name = $data_pokemon[i][0]#$pokemon_info.name(i)
else
string = "?????"
end
self.contents.font.color = Color.new(132, 132, 132)
self.contents.draw_text(149, 1 + @hauteur * (i-1), 300, @hauteur, ida + " " + string)
self.contents.draw_text(150, @hauteur * (i-1), 300, @hauteur, ida + " " + string)
self.contents.draw_text(150, 1 + @hauteur * (i-1), 300, @hauteur, ida + " " + string)
self.contents.font.color = Color.new(222, 222, 222)
self.contents.draw_text(149, @hauteur * (i-1), 300, @hauteur, ida + " " + string)
if $data_pokedex[i][1]
bitmap = RPG::Cache.picture("Pokedexball.png")
self.contents.blt(133, 5 + @hauteur * (i-1), bitmap, Rect.new(0, 0, 24, 24))
end
end
end
end

def update
# super
#@image_pokemon.update
if @image_pokemon.flag_move_up or @image_pokemon.flag_move_down
if @image_pokemon.flag_move_up
self.oy += @hauteur/10
return
end
if @image_pokemon.flag_move_down
self.oy -= @hauteur/10
return
end
else
if self.oy != (-1 * ((self.height - 32)/2)) + ((@hauteur) * @index) + @hauteur/2
self.oy = (-1 * ((self.height - 32)/2)) + ((@hauteur) * @index) + @hauteur/2
end
end
# カーソルの移動が可能な状態の場合
if self.active and @item_max > 0 and @index >= 0
# 方向ボタンの下が押された場合
if Input.repeat?(Input::DOWN)
# 列数が 1 かつ 方向ボタンの下の押下状態がリピートでない場合か、
# またはカーソル位置が(項目数 - 列数)より前の場合
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
# カーソルを下に移動
$game_system.se_play($data_system.cursor_se)
if (@index == @id_list[@id_list.size - 1] - 1 and @tronquage == false) or (@index == (@id_list.size - 1) and @tronquage == true)
@index = 0
self.oy = (-1 * ((self.height-32)/2)) + ((@hauteur) * @index) + @hauteur/2
else
@index += 1
#self.oy += @hauteur
end
#@image_pokemon.move_up(@index)
end
#refresh
end
# 方向ボタンの上が押された場合
if Input.repeat?(Input::UP)
# 列数が 1 かつ 方向ボタンの上の押下状態がリピートでない場合か、
# またはカーソル位置が列数より後ろの場合
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
# カーソルを上に移動
$game_system.se_play($data_system.cursor_se)
if @index == 0
if @tronquage
@index = @id_list.size - 1
else
@index = @id_list[@id_list.size - 1] - 1
end

self.oy = (-1 * ((self.height-32)/2)) + ((@hauteur) * @index) + @hauteur/2
else
@index -= 1
#self.oy -= @hauteur
end
#@image_pokemon.move_down(@index)
#@image_pokemon.refresh(@index)
end
end
# R ボタンが押された場合
if Input.repeat?(Input::R)
# 表示されている最後尾の行が、データ上の最後の行よりも前の場合
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# カーソルを 1 ページ後ろに移動
$game_system.se_play($data_system.cursor_se)
#if @index == @id_list[@id_list.size - 1] - 1
# @index = 0
# self.oy = (-1 * ((self.height-32)/2)) + ((@hauteur) * @index) + @hauteur/2
#end
if (@index + 8) >= @id_list[@id_list.size - 1] - 1
@index = @id_list[@id_list.size - 1] - 1
self.oy = (-1 * ((self.height-32)/2)) + ((@hauteur) * @index) + @hauteur/2
else
@index += 8
self.oy += @hauteur*8
end
#@image_pokemon.refresh(@index)
else
@index = self.row_max - 1
self.oy = (-1 * ((self.height-32)/2)) + ((@hauteur) * @index) + @hauteur/2
#@image_pokemon.refresh(@index)
end
end
# L ボタンが押された場合
if Input.repeat?(Input::L)
# 表示されている先頭の行が 0 より後ろの場合
if self.top_row > 0
$game_system.se_play($data_system.cursor_se)
#if @index == @id_list[@id_list.size - 1] - 1
# @index = 0
# self.oy = (-1 * ((self.height-32)/2)) + ((@hauteur) * @index) + @hauteur/2
#end
if (@index - 8) < 0
@index = 0
self.oy = (-1 * ((self.height-32)/2)) + ((@hauteur) * @index) + @hauteur/2
else
@index -= 8
self.oy -= @hauteur*8
end
#@image_pokemon.refresh(@index)
else
@index = 0
self.oy = (-1 * ((self.height-32)/2)) + ((@hauteur) * @index) + @hauteur/2
#@image_pokemon.refresh(@index)
end
#refresh
end
end
# ヘルプテキストを更新 (update_help は継承先で定義される)
if self.active and @help_window != nil
update_help
end






# カーソルの矩形を更新
#update_cursor_rect
end


end
class Pokemon_Pokedex_Detail
def initialize(index, list, tronquage)
$forme = false
#print list
@index = index
@list = list
@tronquage = tronquage
end

def main
@arriere_plan = Sprite.new
@arriere_plan.x = @arriere_plan.y = 13
@index_commande = 0
refresh_page
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
#self.dispose
@arriere_plan.dispose
Graphics.freeze
end

def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
Graphics.freeze
self.dispose
Graphics.transition
Graphics.freeze
$scene = POKEMON_S::Pokemon_Pokedex.new(@index, @list, @tronquage)
return
end
if Input.trigger?(Input::C)
if @index_commande == 2
if @tronquage
index = @list[@index]
else
index = @index + 1
end
filename = "Audio/SE/Cries/" + sprintf("%03d", index) + "Cry.wav"
if FileTest.exist?(filename)
Audio.se_play(filename)
end
end
if @index_commande == 3
@img_pok.dispose
@texte.dispose
if @tronquage
index = @list[@index]
else
index = @index + 1
end
if $forme
$forme = false
else
$forme = true
end
$game_system.se_play($data_system.cursor_se)
refresh_tail
end
end
if Input.trigger?(Input::DOWN)
$forme = false
if @tronquage
if @list[@index +1] != nil
@index +=1
else
return
end
else
calcul = @list.index(@index + 1)+1
if @list[calcul] != nil
#print "calcul : " + (@list.index(@index + 1) + 1).to_s
#print "acien index #@index"
@index = @list[@list.index(@index + 1)+1] - 1
#print "nouveau index #@index"
else
return
end
end
$game_system.se_play($data_system.cursor_se)
Graphics.freeze
self.dispose
Graphics.transition
Graphics.freeze
#@arriere_plan = Sprite.new
@index_commande = 0
refresh_page
Graphics.transition
end

if Input.trigger?(Input::UP)
$forme = false
if @tronquage
if @index > 0
@index -=1
else
return
end
else
calcul = @list.index(@index + 1)-1
if (@index+1)>@list[0]
@index = @list[calcul] - 1
else
return
end
end
$game_system.se_play($data_system.cursor_se)
Graphics.freeze
self.dispose
Graphics.transition
Graphics.freeze
#@arriere_plan = Sprite.new
~@index_commande = 0
refresh_page
Graphics.transition
end
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
if @index_commande > 0
Graphics.freeze
self.dispose
Graphics.transition
@index_commande -= 1
Graphics.freeze
case @index_commande
when 0
refresh_page
when 1
refresh_zone
when 2
refresh_cri
when 3
refresh_tail
end
end
end

if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
if @index_commande < 3
if @tronquage
ida = @list[@index]
else
ida = @index + 1
end
if @index_commande == 2 and $data_pokedex[ida][1] == false
return
end
Graphics.freeze
self.dispose
Graphics.transition
@index_commande += 1
Graphics.freeze
case @index_commande
when 0
refresh_page
when 1
refresh_zone
when 2
refresh_cri
when 3
refresh_tail
end
end
end

end

def data_refresh
if @tronquage
index = @list[@index]
else
index = @index + 1
end
@pokemon = $data_pokemon[index]

ida = sprintf("%03d", index)
@pokemon_sprite = Sprite.new
@pokemon_sprite.x = 15
@pokemon_sprite.y = 37
@pokemon_sprite.z = 10
@pokemon_sprite.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
txt = @pokemon[0]
name = ida + " " + txt
show = $data_pokedex[index][1]

if show # Descr accessible
species = @pokemon[9][1].capitalize
height_data = @pokemon[9][2]
weight = @pokemon[9][3]
#print weight.slice!(" kg")

else
species = "???"
height_data = "???"
weight = "???"
end

if @data_window != nil and @data_window.disposed? == false
@data_window.contents.clear
end
@data_window = Window_Base.new(99, 19, 340 + 30, 170 + 62)
@data_window.contents = Bitmap.new(250 , 200)
color = Color.new(60,60,60)
@data_window.opacity = 0
@data_window.contents.font.name = $fontface
@data_window.contents.font.size = $fontsize
@data_window.contents.font.color = Color.new(165,165,173,255)
@data_window.contents.draw_text(37, 0, 260, 45, name)
@data_window.contents.draw_text(37, 1, 260, 45, name)
@data_window.contents.draw_text(36, 1, 260, 45, name)
@data_window.contents.draw_text(-23, 16, 220, 45, "Pokémon " + species,1)
@data_window.contents.draw_text(-23, 17, 220, 45, "Pokémon " + species,1)
@data_window.contents.draw_text(-24, 17, 220, 45, "Pokémon " + species,1)
@data_window.contents.draw_text(48, 63, 92, 45, height_data,2)
@data_window.contents.draw_text(48, 64, 92, 45, height_data,2)
@data_window.contents.draw_text(47, 64, 92, 45, height_data,2)
@data_window.contents.draw_text(48, 79, 92, 45, weight,2)
@data_window.contents.draw_text(48, 80, 92, 45, weight,2)
@data_window.contents.draw_text(47, 80, 92, 45, weight,2)
@data_window.contents.font.color = Color.new(90,90,82,255)
@data_window.contents.draw_text(36, 0, 260, 45, name)
@data_window.contents.draw_text(-24, 16, 220, 45, "Pokémon " + species,1)
@data_window.contents.draw_text(47, 63, 92, 45, height_data,2)
@data_window.contents.draw_text(47, 79, 92, 45, weight,2)

if show
bitmap = RPG::Cache.battler("Pas.png",0)
idx = (@index )% 20
idy = (@index ) / 20
xrect = idx * 16
yrect = idy * 16
@data_window.contents.blt(10 , 59, bitmap, Rect.new(xrect, yrect, 16, 16),255)
bitmap = RPG::Cache.picture("dexball.png")
@data_window.contents.blt(1, 11, bitmap, Rect.new(0, 0, 32, 32),255)
type1 = @pokemon[6][0]
type2 = @pokemon[6][1]
bitmap = RPG::Cache.picture("TD" + type1.to_s + ".png")
@data_window.contents.blt(43 , 55, bitmap, Rect.new(0, 0, 48, 16),255)
if type2 != nil
bitmap = RPG::Cache.picture("TD" + type2.to_s + ".png")
@data_window.contents.blt(93 , 55, bitmap, Rect.new(0, 0, 48, 16),255)
end
end

if @text_window != nil and @text_window.disposed? == false
@text_window.contents.clear
end
@text_window = Window_Base.new(0, 4, 640, 480)
@text_window.contents = Bitmap.new(640 , 480)
@text_window.contents.font.name = $fontface
@text_window.contents.font.size = $fontsize
@text_window.opacity = 0
@text_window.z = 10

if show
text = @pokemon[9][0]
string = string_builder(text, 47)
string1 = string[0]
string2 = string[1]
string3 = string[2]
string4 = string[3]
@text_window.contents.font.color = Color.new(165,165,173,255)
@text_window.contents.draw_text(3, 134, 454, 16, string1)
@text_window.contents.draw_text(3, 135, 454, 16, string1)
@text_window.contents.draw_text(2, 135, 454, 16, string1)
@text_window.contents.draw_text(3, 148, 454, 16, string2)
@text_window.contents.draw_text(3, 149, 454, 16, string2)
@text_window.contents.draw_text(2, 149, 454, 16, string2)
@text_window.contents.draw_text(3, 162, 454, 16, string3)
@text_window.contents.draw_text(3, 163, 454, 16, string3)
@text_window.contents.draw_text(2, 163, 454, 16, string3)
@text_window.contents.draw_text(3, 176, 454, 16, string4)
@text_window.contents.draw_text(3, 177, 454, 16, string4)
@text_window.contents.draw_text(2, 177, 454, 16, string4)
@text_window.contents.font.color = Color.new(255,255,255,255)
@text_window.contents.draw_text(2, 134, 454, 16, string1)
@text_window.contents.draw_text(2, 148, 454, 16, string2)
@text_window.contents.draw_text(2, 162, 454, 16, string3)
@text_window.contents.draw_text(2, 176, 454, 16, string4)
end
end

def string_builder(text, limit)
length = text.length
full1 = false
full2 = false
full3 = false
full4 = false
string1 = ""
string2 = ""
string3 = ""
string4 = ""
word = ""
for i in 0..length
letter = text[i..i]
if letter != " " and i != length
word += letter.to_s
else
word = word + " "
if (string1 + word).length < limit and not(full1)
string1 += word
word = ""
else
full1 = true
end

if (string2 + word).length < limit and not(full2)
string2 += word
word = ""
else
full2 = true
end

if (string3 + word).length < limit and not(full3)
string3 += word
word = ""
else
full3 = true
end

if (string4 + word).length < limit and not(full4)
string4 += word
word = ""
else
full4 = true
end
end
end
return [string1, string2, string3, string4]
end

def refresh_page
@arriere_plan.bitmap = Bitmap.new("Graphics/Pictures/Pokedex_page.png")
data_refresh
Graphics.transition
if @tronquage
index = @list[@index]
else
index = @index + 1
end
filename = "Audio/SE/Cries/" + sprintf("%03d", index) + "Cry.wav"
if FileTest.exist?(filename)
Audio.se_play(filename)
end
end

def dispose
case @index_commande
when 0
@data_window.dispose
@text_window.dispose
@pokemon_sprite.dispose
when 1
@window_zone.dispose
when 2
@texte.dispose
@img_pok.dispose
when 3
@img_pok.dispose
@img_dre.dispose
@texte.dispose
end
@arriere_plan.bitmap.dispose
#@commande.bitmap = RPG::Cache.clear
#@commande.dispose
end

def refresh_zone
@arriere_plan.bitmap = Bitmap.new("Graphics/Pictures/Pokedex_map.png")
@window_zone = Window_Base.new(-34, 249, 320 + 32, 100 + 32)
@window_zone.contents = Bitmap.new(320, 100)
@window_zone.opacity = 0
@window_zone.contents.font.name = $fontface
@window_zone.contents.font.size = $fontsize
@window_zone.contents.font.color = Color.new(255, 255, 255)
@window_zone.contents.draw_text(@window_zone.contents.rect, "Non Programmé", 1)
Graphics.transition
end

def refresh_cri
@arriere_plan.bitmap = Bitmap.new("Graphics/Pictures/Pokedex_cri.png")
@texte = Window_Base.new(58 -16, 2 - 16, 169 +32, 80 + 32)
@texte.contents = Bitmap.new(169, 80)
@texte.opacity = 0
@texte.contents.font.name = $fontface
@texte.contents.font.size = $fontsize

if @tronquage
at = $data_pokemon[@list[@index]][0]
ida = @list[@index]
else
at = $data_pokemon[@index+1][0]
ida = @index + 1
end
ida = sprintf("%03d", ida)
@texte.contents.font.color = Color.new(165,165,173)
@texte.contents.draw_text(1, 40, 169, 80/2, at.to_s,1)
@texte.contents.draw_text(1, 41, 169, 80/2, at.to_s,1)
@texte.contents.draw_text(0, 41, 169, 80/2, at.to_s,1)
@texte.contents.font.color = Color.new(255, 255, 255)
@texte.contents.draw_text(0, 40, 169, 80/2, at.to_s,1)
@img_pok = Sprite.new
@img_pok.x = 93
@img_pok.y = 93
@img_pok.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
Graphics.transition
end

def refresh_tail
@arriere_plan.bitmap = Bitmap.new("Graphics/Pictures/Pokedex_tail.png")
@texte = Window_Base.new(-138 -16, 210 - 16, 560 + 32, 84 + 32)
@texte.contents = Bitmap.new(560, 84)
@texte.opacity = 0
@texte.contents.font.name = $fontface
@texte.contents.font.size = $fontsize
if $forme
txt = "Vue de Dos"
else
txt = "Vue de Face"
end
@texte.contents.font.color = Color.new (165,165,173)
@texte.contents.draw_text(1, 0, 560, 84, txt, 1)
@texte.contents.draw_text(1, 1, 560, 84, txt, 1)
@texte.contents.draw_text(0, 1, 560, 84, txt, 1)
@texte.contents.font.color = Color.new (255,255,255)
@texte.contents.draw_text(0, 0, 560, 84, txt, 1)
if @tronquage
ida = @list[@index]
else
ida = @index + 1
end
#print $data_pokemon[ida][9][2].to_f
if $data_pokemon[ida][9][2].to_f > 1.40
zoom_pok = 1.00
zoom_dre = 1.40 / $data_pokemon[ida][9][2].to_f
else
zoom_pok = $data_pokemon[ida][9][2].to_f/1.40
zoom_dre = 1.00
end
@img_pok = Sprite.new
#@img_pok.ox = 160/2
#@img_pok.oy = 160
ida = sprintf("%03d", ida)
if $forme
@img_pok.bitmap = RPG::Cache.battler("Back_Male/" + ida.to_s + ".png",0)
else
@img_pok.bitmap = RPG::Cache.battler("Front_Male/" + ida.to_s + ".png",0)
end
@img_pok.x = 92
@img_pok.y = 286
@img_dre = Sprite.new
@img_dre.ox = 160/2
@img_dre.oy = 160
@img_dre.bitmap = RPG::Cache.picture("img_dresseur")
@img_dre.x = 330 + 160/2
@img_dre.y = 95 + 160
#print zoom_pok
@img_pok.zoom_x = @img_pok.zoom_y = 1
@img_dre.zoom_x = @img_dre.zoom_y = zoom_dre
Graphics.transition
end
end

class Image_Pokemon

attr_reader :flag_move_up
attr_reader :flag_move_down

def initialize (list, index = 0, tronquage = false)
@viewport = Viewport.new(205, 127, 130, 226)
@viewport.z = 5000
@id_list = list
@pokeball = Sprite.new
@pokeball.bitmap = RPG::Cache.picture("pokeball_menu.png")
@pokeball.ox = 240
@pokeball.oy = 240
@pokeball.y = 240
@pokeball.visible = false
@tronquage = tronquage
#refresh(index)
end

def refresh(index)
if @image3 != nil and @image3.disposed? == false
@image3.dispose
end
if @image2 != nil and @image2.disposed? == false
@image2.dispose
end
if @image4 != nil and @image4.disposed? == false
@image4.dispose
end
@image3 = Sprite.new(@viewport)

if @tronquage
if @id_list[index] != nil
ida = sprintf("%03d", @id_list[index])
@image3.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image3.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image3.ox = @image3.bitmap.width/2
@image3.oy = @image3.bitmap.height/2
@image3.x = @viewport.rect.width/2
@image3.y = @viewport.rect.height/2
@image3.zoom_x = 0.82
@image3.zoom_y = 0.82
#print "id list index - 1 : " + (index - 1).to_s
if (index - 1) >= 0
@image2 = Sprite.new(@viewport)
if @id_list[index - 1] != nil
ida = sprintf("%03d", @id_list[index - 1])
@image2.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image2.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image2.ox = @image2.bitmap.width/2
@image2.oy = @image2.bitmap.height/2
@image2.x = @viewport.rect.width/2
@image2.y = 8 #@viewport.rect.height/10
@image2.zoom_x = 0.82
@image2.zoom_y = 0.62
end
if @id_list[index+1] != nil
@image4 = Sprite.new(@viewport)
if @id_list.include?(@id_list[index+1])
ida = sprintf("%03d", @id_list[index+1])
@image4.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image4.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image4.ox = @image4.bitmap.width/2
@image4.oy = @image4.bitmap.height/2
@image4.x = @viewport.rect.width/2
@image4.y = @viewport.rect.height - 8
@image4.zoom_x = 0.82
@image4.zoom_y = 0.62
end
@pokeball.angle = (index % 8.00) * -22.5
else
if @id_list.include?(index+1)
ida = sprintf("%03d", index+1)
@image3.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image3.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image3.ox = @image3.bitmap.width/2
@image3.oy = @image3.bitmap.height/2
@image3.x = @viewport.rect.width/2
@image3.y = @viewport.rect.height/2
@image3.zoom_x = 0.82
@image3.zoom_y = 0.82
if (index-1) >= 0
@image2 = Sprite.new(@viewport)
if @id_list.include?(index)
ida = sprintf("%03d", index)
@image2.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image2.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image2.ox = @image2.bitmap.width/2
@image2.oy = @image2.bitmap.height/2
@image2.x = @viewport.rect.width/2
@image2.y = 8 #@viewport.rect.height/10
@image2.zoom_x = 0.82
@image2.zoom_y = 0.62
end
if (index+1) < @id_list[@id_list.size - 1]
@image4 = Sprite.new(@viewport)
if @id_list.include?(index+2)
ida = sprintf("%03d", index+2)
@image4.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image4.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image4.ox = @image4.bitmap.width/2
@image4.oy = @image4.bitmap.height/2
@image4.x = @viewport.rect.width/2
@image4.y = @viewport.rect.height - 8
@image4.zoom_x = 0.82
@image4.zoom_y = 0.62
end
@pokeball.angle = (index % 8.00) * -22.5
end
end

def dispose
=begin
@image3.dispose

if @image2 != nil and @image2.disposed? == false
@image2.dispose
end
if @image4 != nil and @image4.disposed? == false
@image4.dispose
end
=end
@viewport.dispose
@pokeball.dispose
end

def update
if @image2 != nil and @image2.disposed? == false
@image2.update
end
@image3.update
if @image4 != nil and @image4.disposed? == false
@image4.update
end
if @flag_move_up
update_move_up
end
if @flag_move_down
update_move_down
end
end

def move_up(index = @id_list[@id_list.size - 1])
@index = index
@flag_move_up = true
if @tronquage
#print " animation tronquage move_up"
if @id_list[index+1] != nil
@image1 = Sprite.new(@viewport)
if @id_list[index+1] != nil
ida = sprintf("%03d", @id_list[index+1])
@image1.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image1.bitmap = RPG::Cache.picture("inconnu")
end
@image1.ox = @image1.bitmap.width/2
@image1.oy = @image1.bitmap.height/2
@image1.x = @viewport.rect.width/2
@image1.y = (@viewport.rect.height - 8) + (@viewport.rect.height/2.00) - 8.00
@image1.zoom_x = 0.82
@image1.zoom_y = 0.62
end
else
if (index+1) < @id_list[@id_list.size - 1]
@image1 = Sprite.new(@viewport)
if @id_list.include?(index+2)
ida = sprintf("%03d", index+2)
@image1.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image1.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image1.ox = @image1.bitmap.width/2
@image1.oy = @image1.bitmap.height/2
@image1.x = @viewport.rect.width/2
@image1.y = (@viewport.rect.height - 8) + (@viewport.rect.height/2.00) - 8.00
@image1.zoom_x = 0.82
@image1.zoom_y = 0.62
end
end
end

def move_down(index = @id_list[@id_list.size - 1])
@flag_move_down = true
@index = index

if @tronquage
#print " animation tronquage move_up"
if (index-1) > 0
@image1 = Sprite.new(@viewport)
if @id_list[index-1] != nil
ida = sprintf("%03d", @id_list[index-1])
@image1.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image1.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image1.ox = @image1.bitmap.width/2
@image1.oy = @image1.bitmap.height/2
@image1.x = @viewport.rect.width/2
@image1.y = - ((@viewport.rect.height/2.00) - 8.00)
@image1.zoom_x = 0.82
@image1.zoom_y = 0.62
end
else
if (index) > 0
@image1 = Sprite.new(@viewport)
if @id_list.include?(index)
ida = sprintf("%03d", index)
@image1.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
else
@image1.bitmap = RPG::Cache.battler("Front_Male/000.png", 0)
end
@image1.ox = @image1.bitmap.width/2
@image1.oy = @image1.bitmap.height/2
@image1.x = @viewport.rect.width/2
@image1.y = - ((@viewport.rect.height/2.00) - 8.00)
@image1.zoom_x = 0.82
@image1.zoom_y = 0.62
end
end

end

def update_move_up
if @image3.y != 13
#print "image 3 " + @image3.y.to_s + " zoom_y : " + @image3.zoom_y.to_s
@image3.y -= ((@viewport.rect.height/2)- 8) /10
@image3.zoom_y -= 0.02

if @image2 != nil and @image2.disposed? == false
#print "image 2"
@image2.y -= ((@viewport.rect.height/2)- 8) /10
#@image2.zoom_y -= 2
end
if @image4 != nil and @image4.disposed? == false
#print "image 4"
@image4.y -= ((@viewport.rect.height/2)- 8) /10
@image4.zoom_y += 0.02
end
if @image1 != nil and @image1.disposed? == false
#print "image 1"
@image1.y -= ((@viewport.rect.height/2)- 8) /10
#@image2.zoom_y -= 2
end
@pokeball.angle += -2.25
else
#print "fin move"
@flag_move_up = false
@image3.dispose
if @image2 != nil and @image2.disposed? == false
@image2.dispose
end
if @image4 != nil and @image4.disposed? == false
@image4.dispose
end
if @image1 != nil and @image1.disposed? == false
@image1.dispose
end
refresh(@index)
end
end

def update_move_down
#print @image3.y
if @image3.y != 213
#print "image 3 " + @image3.y.to_s + " zoom_y : " + @image3.zoom_y.to_s
@image3.y += ((@viewport.rect.height/2)- 8) /10
@image3.zoom_y -= 0.02
if @image2 != nil and @image2.disposed? == false
#print "image 2"
@image2.y += ((@viewport.rect.height/2)- 8) /10
@image2.zoom_y += 0.02
end
if @image4 != nil and @image4.disposed? == false
#print "image 4"
@image4.y += ((@viewport.rect.height/2)- 8) /10
#@image4.zoom_y -= 0.02
end
if @image1 != nil and @image1.disposed? == false
#print "image 1"
@image1.y += ((@viewport.rect.height/2)- 8) /10
#@image2.zoom_y -= 2
end
@pokeball.angle -= -2.25
else
#print "fin move"
@flag_move_down = false
@image3.dispose
if @image2 != nil and @image2.disposed? == false
@image2.dispose
end
if @image4 != nil and @image4.disposed? == false
@image4.dispose
end
if @image1 != nil and @image1.disposed? == false
@image1.dispose
end
refresh(@index)
end
end

end

class Pokemon_Pokedex_Recherche
def initialize(index=0, list=[], tronquage=false)
@index = index
@list = list
@tronquage = tronquage
end

def main
@arrire_plan = Sprite.new
@arrire_plan.bitmap = RPG::Cache.picture("Menu_recherche")
@window_choix = POKEMON_S::Window_Choix.new
@window_choix.active = true
#@window_type_rech = Window_Command.New
#@window_donnee_rech = Window_Command.New
@window_aide = Window_Aide.new
@window_choix.aide_window = @window_aide
@window_type_rech = Window_Type_Rech.new
@window_type_rech.aide_window = @window_aide
#Graphics.transition
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@arrire_plan.bitmap = RPG::Cache.clear
@window_choix.dispose
@window_type_rech.dispose
@window_aide.dispose
Graphics.transition
Graphics.freeze
end

def update
@window_choix.update
@window_type_rech.update
if @window_choix.quitte
$scene = POKEMON_S::Pokemon_Pokedex.new(@index, @list, @tronquage)
end
if @window_choix.active == false and @window_choix.go
@window_type_rech.active = true
@window_type_rech.min_index = @window_type_rech.index = 3 * @window_choix.index
@window_type_rech.update_cursor
@window_type_rech.update_aide
@window_choix.go = false
end
if @window_type_rech.active == false and @window_choix.active == false
@window_choix.active = true
end

end


end

#===============================================================================
# ■ Window_Choix
#-------------------------------------------------------------------------------
#
#===============================================================================
class Window_Choix < Window_Base

attr_reader :aide_window
attr_reader :quitte
attr_reader :index
attr_accessor :go

def initialize(index = 0)
super(-16 +8, -16, 351 + 32, 45 + 32)
self.windowskin = RPG::Cache.clear
self.contents = Bitmap.new(351, 45)
self.contents.font.name = $fontface
self.contents.font.size = 30
self.contents.font.color = Color.new(32, 32, 32)
self.contents.draw_text(0+2, 3+1, 96, 39, "RECH.", 1)
self.contents.draw_text(129+2 , 3+1, 96, 39, "TRI", 1)
self.contents.draw_text(258+2, 3+1, 96, 39, "RETOUR", 1)

self.contents.font.color = Color.new(255, 255, 255)
self.contents.draw_text(0, 3, 96, 39, "RECH.", 1)
self.contents.draw_text(129 , 3, 96, 39, "TRI", 1)
self.contents.draw_text(258, 3, 96, 39, "RETOUR", 1)
@index = index
@cursor = Sprite.new
@cursor.bitmap = RPG::Cache.picture("recherce_curseur.png")
@cursor.opacity = 0
@cursor.x = 8 + (129 * @index)
@cursor.y = 3
@quitte = false
@viewport = Viewport.new(5, 48, 369, 0)
@sprite = Sprite.new(@viewport)
@sprite.bitmap = Bitmap.new("Graphics/Pictures/disable.png")
@go = false
end

def update
super
if self.active
@cursor.opacity = 255
if Input.trigger?(Input::RIGHT)
if @index < 2
$game_system.se_play($data_system.cursor_se)
@index += 1
update_cursor
update_aide
end
end
if Input.trigger?(Input::LEFT)
if @index > 0
$game_system.se_play($data_system.cursor_se)
@index -= 1
update_cursor
update_aide
end
end
if Input.trigger?(Input::B)
@quitte = true
end
if Input.trigger?(Input::C)
case @index
when 0
self.active = false
@go = true
when 1
self.active = false
@go = true
when 2
@quitte = true
end
end
else
#if @cursor.opacity != 0
# @cursor.opacity = 0
#end
end
end

def aide_window=(aide_window)
@aide_window = aide_window
if self.active and @aide_window != nil
update_aide
end
end


def update_cursor
if self.active
@cursor.x = 8 + (129 * @index)
end
end

def update_aide
case @index
when 0
@sprite.bitmap.dispose
@viewport = Viewport.new(5, 48, 369, 0)
@sprite = Sprite.new(@viewport)
@sprite.bitmap = Bitmap.new("Graphics/Pictures/disable.png")
text = ["Recherche de certaines pokémons", "selon certaines critères"]
#@window_type_rech.index = 0
when 1
@sprite.bitmap.dispose
@viewport = Viewport.new(5, 48, 369, 143)
@sprite = Sprite.new(@viewport)
@sprite.bitmap = Bitmap.new("Graphics/Pictures/disable.png")
text = ["Changer le classement du POKEDEX"]
#@window_type_rech.index = 3
when 2
@sprite.bitmap.dispose
@viewport = Viewport.new(5, 48, 369, 237)
@sprite = Sprite.new(@viewport)
@sprite.bitmap = Bitmap.new("Graphics/Pictures/disable.png")
text = ["Revenir au POKEDEX"]
end
@aide_window.update_text(text)
end

alias new_dispose dispose
def dispose
@cursor.bitmap = RPG::Cache.clear
@sprite.dispose
@viewport.dispose
new_dispose
end
end

#==============================================================================
# ■ Window_Type_Rech
#------------------------------------------------------------------------------
#
#==============================================================================

class Window_Type_Rech < Window_Base

attr_reader :aide_window
attr_accessor :index
attr_accessor:min_index
def initialize
super(5 - 16, 48 -16, 360 + 32, 237 + 32)
self.windowskin = RPG::Cache.clear
@critere = [0, 0, [0,0], 0]
self.contents = Bitmap.new(360, 237)
#draw_text
self.contents.font.name = $fontface
self.contents.font.size = 30
self.contents.font.color = Color.new(32, 32, 32)
self.contents.draw_text(3+2, 3+1, 96, 39, "NOM.", 1)
self.contents.draw_text(3+2, 51+1, 96, 39, "COUL.", 1)
self.contents.draw_text(3+2, 99+1, 96, 39, "TYPE", 1)
self.contents.draw_text(3+2, 147+1, 96, 39, "ORDRE", 1)
self.contents.draw_text(0+2, 192+1, 102, 45, "OK", 1)

self.contents.font.color = Color.new(255, 255, 255)
self.contents.draw_text(3, 3, 96, 39, "NOM.", 1)
self.contents.draw_text(3, 51, 96, 39, "COUL.", 1)
self.contents.draw_text(3, 99, 96, 39, "TYPE", 1)
self.contents.draw_text(3, 147, 96, 39, "ORDRE", 1)
self.contents.draw_text(0, 192, 102, 45, "OK", 1)

self.contents.font.color = Color.new(72, 72, 72)
self.contents.font.size = 45
self.contents.draw_text(114, 3-2, 249, 45, "INDIFFERENT")
self.contents.draw_text(114, 51-2, 249, 45, "INDIFFERENT")
self.contents.draw_text(114, 99-2, 115, 39, "AUCUN")
self.contents.draw_text(243, 99-2, 115, 39, "AUCUN")
self.contents.draw_text(114, 147-2, 249, 45, "MODE NUMERIQUE")
#self.contents.fill_rect(114, 52, 244, 37, Color.new(248, 248, 248))
#self.contents.draw_text(114, 51-2, 249, 45, "ROUGE")

self.active = false
@index = 0
@cursor = Sprite.new
@cursor.x = 8
@cursor.y = 51 + (48 * @index)
@cursor2 = Sprite.new
@cursor2.x = 8
@cursor2.y = 51 + (48 * @index)
@min_index = 0
@index_bis = 0
end

def update
super
if @window_donnee != nil
@window_donnee.update
if Input.trigger?(Input::B)
@window_donnee.dispose
@window_donnee = nil
end
if Input.trigger?(Input::C)
if @index == 2
@critere[2][@index_bis] = @window_donnee.index
else
@critere[@index] = @window_donnee.index
end
draw_text
@window_donnee.dispose
@window_donnee = nil
#print @critere
end

return
end
if self.active
@cursor.opacity = 255
if Input.trigger?(Input::RIGHT)
if @index == 2 and @index_bis < 1
$game_system.se_play($data_system.cursor_se)
@index_bis += 1
update_cursor
update_aide
end
end
if Input.trigger?(Input::LEFT)
if @index == 2 and @index_bis > 0
$game_system.se_play($data_system.cursor_se)
@index_bis -= 1
update_cursor
update_aide
end
end
if Input.trigger?(Input::DOWN)
if @index < 4
$game_system.se_play($data_system.cursor_se)
@index += 1
update_cursor
update_aide
end
end
if Input.trigger?(Input::UP)
if @index > @min_index
$game_system.se_play($data_system.cursor_se)
@index -= 1
update_cursor
update_aide
end
end

if Input.trigger?(Input::B)
@cursor2.bitmap = RPG::Cache.clear
@cursor.bitmap = RPG::Cache.clear
self.active = false
end
if Input.trigger?(Input::C)
if @index < 4
@window_donnee = Window_Donnee_Rech.new(@index)
end
if @index == 4
lance_rech
end
end
else
if @cursor.opacity != 0
@cursor.opacity = 0
end
end
end

def aide_window=(aide_window)
@aide_window = aide_window
if self.active and @aide_window != nil
update_aide
end
end


def update_cursor
#print "upadate cursor type rech"
if self.active
if @index < 4
if @index == 2
@cursor2.bitmap = RPG::Cache.clear
@cursor2.bitmap = RPG::Cache.picture("e.png")
@cursor2.zoom_x = 0.49#0.4859
@cursor2.y = 51 + (48 * @index) -3
@cursor2.x = 116 + 128*@index_bis

else
@cursor2.bitmap = RPG::Cache.clear
@cursor2.bitmap = RPG::Cache.picture("e.png")
@cursor2.zoom_x = 1.00
@cursor2.y = 51 + (48 * @index) - 3
@cursor2.x = 116

end

@cursor.bitmap = RPG::Cache.clear
@cursor.bitmap = RPG::Cache.picture("c.png")
@cursor.y = 51 + (48 * @index)
@cursor.x = 8
else
@cursor2.bitmap = RPG::Cache.clear
@cursor.bitmap = RPG::Cache.clear
@cursor.bitmap = RPG::Cache.picture("d.png")
@cursor.y = 240
@cursor.x = 5
end
end
end

def update_aide
case @index
when 0
text = ["Recherche par la première lettre du nom : ", "POKEMON vus uniquement."]
when 1
text = ["Recherche par la couleur", "POKEMON vus uniquement."]
when 2
text = ["Recherche par le type ", "POKEMON pris uniquement."]
when 3
text = ["Choisis le modede classement du POKEDEX."]
when 4
text = ["Exécuter Recherche/Changement."]
end
#print text
@aide_window.update_text(text)
end

def draw_text
#if self.contents.disposed? == false
# self.contents.dispose
#end
self.contents.dispose
self.contents = Bitmap.new(360, 237)
self.contents.font.name = $fontface
self.contents.font.size = 30
self.contents.font.color = Color.new(32, 32, 32)
self.contents.draw_text(3+2, 3+1, 96, 39, "NOM.", 1)
self.contents.draw_text(3+2, 51+1, 96, 39, "COUL.", 1)
self.contents.draw_text(3+2, 99+1, 96, 39, "TYPE", 1)
self.contents.draw_text(3+2, 147+1, 96, 39, "ORDRE", 1)
self.contents.draw_text(0+2, 192+1, 102, 45, "OK", 1)

self.contents.font.color = Color.new(255, 255, 255)
self.contents.draw_text(3, 3, 96, 39, "NOM.", 1)
self.contents.draw_text(3, 51, 96, 39, "COUL.", 1)
self.contents.draw_text(3, 99, 96, 39, "TYPE", 1)
self.contents.draw_text(3, 147, 96, 39, "ORDRE", 1)
self.contents.draw_text(0, 192, 102, 45, "OK", 1)

self.contents.font.color = Color.new(72, 72, 72)
self.contents.font.size = 45
self.contents.draw_text(114, 3-2, 249, 45, @window_donnee.amt[0][@critere[0]])
self.contents.draw_text(114, 51-2, 249, 45, @window_donnee.amt[1][@critere[1]])
self.contents.draw_text(114, 99-2, 115, 39, @window_donnee.amt[2][@critere[2][0]])
self.contents.draw_text(243, 99-2, 115, 39, @window_donnee.amt[2][@critere[2][1]])
self.contents.draw_text(114, 147-2, 249, 45, @window_donnee.amt[3][@critere[3]])
end

alias new_dispose dispose
def dispose
@cursor.bitmap = RPG::Cache.clear
@cursor2.bitmap = RPG::Cache.clear
new_dispose
end

def lance_rech
@aide_window.update_text(["Recherche en cours...", "Veuillez patientez."])
if @min_index == 0
@list = []
if @critere[2][0] != 0 or @critere[2][1] != 0
if @critere[2][0] != 0 and @critere[2][1] != 0
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][1] and (($data_pokemon[i][6][0] == @critere[2][0] or $data_pokemon[i][6][0] == @critere[2][1]) and ($data_pokemon[i][6][1] != nil and ($data_pokemon[i][6][1] == @critere[2][0] or $data_pokemon[i][6][1] == @critere[2][1])))
@list.push($data_pokemon[i])
end
end
else
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][1] and (($data_pokemon[i][6][0] == @critere[2][0] or $data_pokemon[i][6][0] == @critere[2][1]) or ($data_pokemon[i][6][1] != nil and ($data_pokemon[i][6][1] == @critere[2][0] or $data_pokemon[i][6][1] == @critere[2][1])))
@list.push($data_pokemon[i])
end
end
end
else
if @critere[3] >= 2 and @critere[3] <= 5
#print "critere tri"
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][1]
@list.push($data_pokemon[i])
end
end
else
#print "pokemon tout"
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][0]
@list.push($data_pokemon[i])
end
end
end
end
if @critere[0] != 0
@amt = ["INDIFFERENT", "ABC", "DEF", "GHI", "JKL", "MNO", "PQR", "STU", "VWX", "YZ"]
@i = @list.size - 1
@list_temp = []
@list.each do |i|
#print i[2]
@lettres = @amt[@critere[0]].scan(/./)
@nom = i[0].scan(/./)
if @nom[0] == @lettres[0] or @nom[0] == @lettres[1] or @nom[0] == @lettres[2]
#print "retirer" + @nom.to_s
@list_temp.push(i)
end
end
@list = @list_temp.dup
@list_temp.clear
#print @lettres
#print @nom
end
else
@list = []
if @critere[3] >= 2 and @critere[3] <= 5
#print "critere tri"
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][1]
@list.push($data_pokemon[i])
end
end
else
#print "pokemon tout"
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][0]
@list.push($data_pokemon[i])
end
end
end
#print "pokemon tri"
end
@list_temp = @list.dup
#print "@critere[3] : " + @list.to_s
case @critere[3]
when 0
@list.clear
#print "@list_temp : " + @list_temp.to_s
@list_temp.each do |i|
@list.push($data_pokemon.index(i))
end
when 1
@list_temp = @list_temp.sort do |a, b|
a[0] <= b[0]
end
@list.clear
#print "essai : " + $data_pokemon[3][1].to_s
@list_temp.each do |i|
@list.push($data_pokemon.index(i))
end
when 2
@list_temp = @list_temp.sort do |b, a|
#print "tri : " + a[9][3].gsub(" kg"){""}.to_f.to_s
a[9][3].gsub(" kg"){""}.to_f <= b[9][3].gsub(" kg"){""}.to_f
end
@list.clear
#print "essai : " + $data_pokemon[3][1].to_s
@list_temp.each do |i|
@list.push($data_pokemon.index(i))
end
when 3
@list_temp = @list_temp.sort do |a, b|
a[9][3].gsub(" kg"){""}.to_f <= b[9][3].gsub(" kg"){""}.to_f
end
@list.clear
#print "essai : " + $data_pokemon[3][1].to_s
@list_temp.each do |i|
@list.push($data_pokemon.index(i))
end
when 4
@list_temp = @list_temp.sort do |b, a|
a[9][2].gsub(" kg"){""}.to_f <= b[9][2].gsub(" kg"){""}.to_f
end
@list.clear
#print "essai : " + $data_pokemon[3][1].to_s
@list_temp.each do |i|
@list.push($data_pokemon.index(i))
end
when 5
@list_temp = @list_temp.sort do |a, b|
a[9][2].gsub(" kg"){""}.to_f <= b[9][2].gsub(" kg"){""}.to_f
end
@list.clear
#print "essai : " + $data_pokemon[3][1].to_s
@list_temp.each do |i|
@list.push($data_pokemon.index(i))
end
end
if @min_index == 0
if @list.size == 0
@aide_window.update_text(["Aucun POKEMON correspondant trouvé"])
#print "nb pokemon restant" + @list.size.to_s
#print @list
else
@aide_window.update_text(["Recherche terminée."])
#print "nb pokemon restant" + @list.size.to_s
#print @list
Graphics.freeze
Graphics.transition
$scene = POKEMON_S::Pokemon_Pokedex.new(0, @list, true)
end
else
#print "nb pokemon restant" + @list.size.to_s
#print @list
$scene = POKEMON_S::Pokemon_Pokedex.new(0, @list, true)
end
end
end

#==============================================================================
# ■ Window_Donnee_Rech
#------------------------------------------------------------------------------
#
#==============================================================================

class Window_Donnee_Rech < Window_Command
attr_reader :amt
def initialize(type)
@amt=[]
@amt[0] = ["INDIFFERENT", "ABC", "DEF", "GHI", "JKL", "MNO", "PQR", "STU", "VWX", "YZ"]
@amt[1] = ["INDIFFERENT", "ROUGE", "BLEU", "JAUNE", "VERT", "NOIR", "MARRON", "VIOLET", "GRIS", "BLANC", "ROSE"]
@amt[2] = ["AUCUN", "NORMAL", "FEU", "EAU", "ELECTR", "PLANTE", "GLACE", "COMBAT", "POISON", "SOL","VOL", "PSY", "INSECT", "ROCHE", "SPECTR", "DRAGON" ,"ACIER", "TENEBR"]
@amt[3] = ["MODE NUMERIQUE", "MODE A à Z", "MODE + - LOURD", "MODE + - LEGER", "MODE + - GRAND", "MODE + - PETIT"]
super(270, @amt[type], 40, 1, 42)
self.x = 370
self.height = 337
end

end

#==============================================================================
# ■ Window_Aide
#------------------------------------------------------------------------------
#
#==============================================================================

class Window_Aide < Window_Base
def initialize
super(24 - 16, 348 - 16, 592 + 32, 120 + 32)
self.windowskin = RPG::Cache.clear
self.contents = Bitmap.new(592, 120)
@text = ["", ""]
end

def update_text(text=["", ""])
if text == ["", ""] and text != @text
self.contents.clear
@text = text
return
end
if text != @text
@text = text
self.contents.clear
self.contents.font.name = $fontface
self.contents.font.color = Color.new(72, 72, 72)
self.contents.font.size = 45
self.contents.draw_text(0, 0, 592, 60, @text[0])
if @text[1] != nil
self.contents.draw_text(0, 60, 592, 60, @text[1])
end

end
end

end

end



Voilà merci d'avance.

Posté par Nuri Yuri le 11 Mar - 16:37 (2012)
Pose la même condition que pour le bouton -_-
Je me demande comment tu vas faire plus tard pour réussir les TP sans avoir eu un cours là dessus, si t'es même pas capable de suivre un parcours expérimental simple et d'en tirer des conclusions...