mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
double hats menu UI stuff
This commit is contained in:
@@ -16,18 +16,6 @@ class PokemonHatPresenter
|
||||
@original_pokemon_bitmap = nil
|
||||
end
|
||||
|
||||
# def getPicturePath()
|
||||
# if @pokemon.isTripleFusion?
|
||||
# picturePath = GameData::Species::getSpecialSpriteName(@pokemon.species_data.id_number)
|
||||
# elsif @pokemon.isFusion?
|
||||
# picturePath = get_fusion_sprite_path(@pokemon.species_data.head_pokemon.id_number, @pokemon.species_data.body_pokemon.id_number)
|
||||
# else
|
||||
# picturePath = get_unfused_sprite_path(@pokemon.species_data.id_number)
|
||||
# end
|
||||
# echoln picturePath
|
||||
# return picturePath
|
||||
# end
|
||||
|
||||
def pbStartScreen
|
||||
@view.init_window(self)
|
||||
cancel if !select_hat()
|
||||
@@ -101,14 +89,6 @@ class PokemonHatPresenter
|
||||
echoln @pokemon.species_data
|
||||
@original_pokemon_bitmap = spriteLoader.load_base_sprite(@pokemon.id_number)
|
||||
end
|
||||
|
||||
# picturePath = getPicturePath()
|
||||
# if picturePath
|
||||
# @original_pokemon_bitmap = AnimatedBitmap.new(picturePath)
|
||||
# else
|
||||
# @original_pokemon_bitmap = GameData::Species.setAutogenSprite(@pokemon)
|
||||
# #autogen
|
||||
# end
|
||||
@original_pokemon_bitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
|
||||
end
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
|
||||
if choice == 0
|
||||
putOnClothes(item)
|
||||
$Trainer.clothes_color = @adapter.get_dye_color(item)
|
||||
$Trainer.clothes_color = @adapter.get_dye_color(item.id)
|
||||
return false
|
||||
elsif options[choice] == "Remove dye"
|
||||
if pbConfirm(_INTL("Are you sure you want to remove the dye from the {1}?", item.name))
|
||||
@@ -50,7 +50,15 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
item = nil
|
||||
loop do
|
||||
item = @scene.pbChooseBuyItem
|
||||
break if !item
|
||||
#break if !item
|
||||
if !item
|
||||
if pbConfirm(_INTL("Discard the changes to your outfit?"))
|
||||
break
|
||||
else
|
||||
item = @scene.pbChooseBuyItem
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if !@adapter.isShop?
|
||||
if @adapter.is_a?(ClothesMartAdapter)
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
class ClothesShopPresenter < PokemonMartScreen
|
||||
|
||||
def removeHat(item)
|
||||
if item.id == @adapter.worn_clothes
|
||||
$Trainer.set_hat(nil,false)
|
||||
@adapter.worn_clothes = nil
|
||||
elsif item.id == @adapter.worn_clothes2
|
||||
$Trainer.set_hat(nil,true)
|
||||
@adapter.worn_clothes2 = nil
|
||||
end
|
||||
pbSEPlay("GUI storage put down")
|
||||
@adapter.toggleEvent(item)
|
||||
@scene.select_specific_item(nil,true)
|
||||
end
|
||||
|
||||
def wearAsHat1(item)
|
||||
@adapter.set_secondary_hat(false)
|
||||
putOnClothes(item)
|
||||
$Trainer.set_hat_color(@adapter.get_dye_color(item),false)
|
||||
$Trainer.set_hat_color(@adapter.get_dye_color(item.id),false)
|
||||
end
|
||||
def wearAsHat2(item)
|
||||
@adapter.set_secondary_hat(true)
|
||||
putOnClothes(item)
|
||||
$Trainer.set_hat_color(@adapter.get_dye_color(item),true)
|
||||
$Trainer.set_hat_color(@adapter.get_dye_color(item.id),true)
|
||||
end
|
||||
|
||||
def removeDye(item)
|
||||
@@ -28,31 +24,26 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
end
|
||||
|
||||
def swapHats()
|
||||
hat1 = $Trainer.hat
|
||||
hat2 = $Trainer.hat2
|
||||
hat1_color = $Trainer.hat_color
|
||||
hat2_color = $Trainer.hat2_color
|
||||
$Trainer.hat, $Trainer.hat2 = $Trainer.hat2, $Trainer.hat
|
||||
#$Trainer.hat_color,$Trainer.hat2_color=$Trainer.hat2_color,$Trainer.hat_color
|
||||
|
||||
$Trainer.hat = hat2
|
||||
$Trainer.hat2 = hat1
|
||||
$Trainer.hat_color = hat1_color
|
||||
$Trainer.hat2_color = hat2_color
|
||||
pbSEPlay("GUI naming tab swap start")
|
||||
|
||||
|
||||
new_selected_hat = @adapter.is_secondary_hat ? $Trainer.hat2 : $Trainer.hat
|
||||
@scene.select_specific_item(new_selected_hat)
|
||||
@scene.select_specific_item(new_selected_hat,true)
|
||||
@scene.updatePreviewWindow
|
||||
end
|
||||
|
||||
|
||||
def build_options_menu(cmd_confirm,cmd_remove,cmd_remove_dye,cmd_swap,cmd_cancel)
|
||||
def build_options_menu(item,cmd_confirm,cmd_remove,cmd_dye,cmd_swap,cmd_cancel)
|
||||
options = []
|
||||
options << cmd_confirm
|
||||
options << cmd_remove
|
||||
|
||||
options << cmd_swap
|
||||
remove_dye_option_available = $Trainer.hat_color(@adapter.is_secondary_hat) != 0
|
||||
options << cmd_remove_dye if remove_dye_option_available
|
||||
dye_option_available = true#$Trainer.dyed_hats.include?(item.id) && $Trainer.dyed_hats[item.id] != 0
|
||||
options << cmd_dye if dye_option_available
|
||||
options << cmd_cancel
|
||||
end
|
||||
|
||||
@@ -74,25 +65,60 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
|
||||
|
||||
def putOnHats()
|
||||
@adapter.worn_clothes = $Trainer.hat
|
||||
@adapter.worn_clothes2 = $Trainer.hat2
|
||||
|
||||
putOnHat($Trainer.hat,true,false)
|
||||
putOnHat($Trainer.hat2,true,true)
|
||||
@worn_clothes = $Trainer.hat
|
||||
@worn_clothes2 = $Trainer.hat2
|
||||
|
||||
playOutfitChangeAnimation()
|
||||
pbMessage(_INTL("You put on the hat(s)!\\wtnp[30]"))
|
||||
@scene.pbEndBuyScene
|
||||
end
|
||||
|
||||
def dyeOptions(secondary_hat=false,item)
|
||||
original_color = secondary_hat ? $Trainer.hat2_color : $Trainer.hat_color
|
||||
options = ["Shift up", "Shift down", "Reset", "Confirm", "Never Mind"]
|
||||
previous_input = 0
|
||||
while (true)
|
||||
choice = pbShowCommands(nil, options, options.length, previous_input,200)
|
||||
previous_input = choice
|
||||
case choice
|
||||
when 0 #NEXT
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
shiftHatColor(10,secondary_hat)
|
||||
ret = true
|
||||
when 1 #PREVIOUS
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
shiftHatColor(-10,secondary_hat)
|
||||
ret = true
|
||||
when 2 #Reset
|
||||
pbSEPlay("GUI storage put down", 80, 100)
|
||||
$Trainer.hat_color = 0 if !secondary_hat
|
||||
$Trainer.hat2_color = 0 if secondary_hat
|
||||
ret = false
|
||||
when 3 #Confirm
|
||||
break
|
||||
else
|
||||
$Trainer.hat_color = original_color if !secondary_hat
|
||||
$Trainer.hat2_color = original_color if secondary_hat
|
||||
ret = false
|
||||
break
|
||||
end
|
||||
@scene.updatePreviewWindow
|
||||
@scene.displayLayerIcons(item)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def playerHatActionsMenu(item)
|
||||
cmd_confirm = "Confirm"
|
||||
|
||||
cmd_remove = "Remove hat"
|
||||
cmd_cancel = "Cancel"
|
||||
cmd_remove_dye = "Remove dye"
|
||||
cmd_swap = "Swap hats positions"
|
||||
|
||||
options = build_options_menu(cmd_confirm,cmd_remove,cmd_remove_dye,cmd_swap,cmd_cancel)
|
||||
cmd_dye = "Dye Kit"
|
||||
cmd_swap = "Swap hat positions"
|
||||
|
||||
options = build_options_menu(item,cmd_confirm,cmd_remove,cmd_dye,cmd_swap,cmd_cancel)
|
||||
choice = pbMessage("What would you like to do?", options, -1,nil,0)
|
||||
if options[choice] == cmd_remove
|
||||
removeHat(item)
|
||||
@@ -103,12 +129,17 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
$Trainer.hat2_color = @adapter.get_dye_color($Trainer.hat2)
|
||||
|
||||
return false
|
||||
elsif options[choice] == cmd_remove_dye
|
||||
removeDye(item)
|
||||
elsif options[choice] == cmd_dye
|
||||
#removeDye(item) selectHatColor
|
||||
dyeOptions(@adapter.is_secondary_hat,item)
|
||||
return true
|
||||
elsif options[choice] == cmd_swap
|
||||
swapHats()
|
||||
return true
|
||||
elsif options[choice] == "dye"
|
||||
selectHatColor
|
||||
end
|
||||
@scene.updatePreviewWindow
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,8 +23,13 @@ class ClothesShopView < PokemonMart_Scene
|
||||
|
||||
end
|
||||
|
||||
def select_specific_item(scroll_to_item_id)
|
||||
def select_specific_item(scroll_to_item_id,go_to_end_of_list_if_nil=false)
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
if !scroll_to_item_id && go_to_end_of_list_if_nil
|
||||
itemwindow.index=@adapter.items.length-1
|
||||
itemwindow.refresh
|
||||
end
|
||||
|
||||
i=0
|
||||
for item in @adapter.items
|
||||
next if !item.is_a?(Outfit)
|
||||
@@ -104,6 +109,11 @@ class ClothesShopView < PokemonMart_Scene
|
||||
@sprites["itemtextwindow"].text = description
|
||||
end
|
||||
|
||||
def updatePreviewWindow
|
||||
itemwindow= @sprites["itemwindow"]
|
||||
@adapter.updateTrainerPreview(itemwindow.item, @sprites["trainerPreview"])
|
||||
end
|
||||
|
||||
def pbChooseBuyItem
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
refreshStock(@adapter) if !itemwindow
|
||||
@@ -137,8 +147,8 @@ class ClothesShopView < PokemonMart_Scene
|
||||
return nil
|
||||
elsif Input.trigger?(Input::USE)
|
||||
if itemwindow.item.is_a?(Symbol)
|
||||
@adapter.doSpecialItemAction(itemwindow.item)
|
||||
updateTrainerPreview()
|
||||
ret = onSpecialActionTrigger(itemwindow)
|
||||
return ret if ret
|
||||
elsif itemwindow.index < @stock.length
|
||||
pbRefresh
|
||||
return @stock[itemwindow.index]
|
||||
@@ -150,6 +160,23 @@ class ClothesShopView < PokemonMart_Scene
|
||||
}
|
||||
end
|
||||
|
||||
def onSpecialActionTrigger(itemwindow)
|
||||
@adapter.doSpecialItemAction(itemwindow.item)
|
||||
updateTrainerPreview()
|
||||
return nil
|
||||
end
|
||||
def onItemClick(itemwindow)
|
||||
if itemwindow.item.is_a?(Symbol)
|
||||
@adapter.doSpecialItemAction(itemwindow.item)
|
||||
updateTrainerPreview()
|
||||
elsif itemwindow.index < @stock.length
|
||||
pbRefresh
|
||||
return @stock[itemwindow.index]
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def switchItemVersion(itemwindow)
|
||||
@adapter.switchVersion(itemwindow.item, 1)
|
||||
updateTrainerPreview()
|
||||
|
||||
@@ -28,13 +28,16 @@ class HatShopView < ClothesShopView
|
||||
def switchItemVersion(itemwindow)
|
||||
@adapter.switchVersion(itemwindow.item, 1)
|
||||
new_selected_hat = @adapter.is_secondary_hat ? $Trainer.hat2 : $Trainer.hat
|
||||
|
||||
|
||||
echoln "scroll to #{new_selected_hat} (#{@adapter.is_secondary_hat}"
|
||||
select_specific_item(new_selected_hat)
|
||||
select_specific_item(new_selected_hat,true)
|
||||
updateTrainerPreview()
|
||||
end
|
||||
|
||||
def onSpecialActionTrigger(itemwindow)
|
||||
#@adapter.doSpecialItemAction(itemwindow.item)
|
||||
#updateTrainerPreview()
|
||||
return @stock[itemwindow.index]
|
||||
end
|
||||
|
||||
def displayLayerIcons(selected_item=nil)
|
||||
if !selected_item.is_a?(Hat)
|
||||
if @adapter.is_secondary_hat
|
||||
@@ -48,8 +51,8 @@ class HatShopView < ClothesShopView
|
||||
hat2Filename = getOverworldHatFilename($Trainer.hat2)
|
||||
|
||||
|
||||
hat_color_shift = $Trainer.dyed_hats[@adapter.worn_clothes]
|
||||
hat2_color_shift = $Trainer.dyed_hats[@adapter.worn_clothes2]
|
||||
hat_color_shift = $Trainer.dyed_hats[$Trainer.hat]
|
||||
hat2_color_shift = $Trainer.dyed_hats[$Trainer.hat2]
|
||||
|
||||
hatBitmapWrapper = AnimatedBitmap.new(hat1Filename, hat_color_shift) if pbResolveBitmap(hat1Filename)
|
||||
hat2BitmapWrapper = AnimatedBitmap.new(hat2Filename, hat2_color_shift) if pbResolveBitmap(hat2Filename)
|
||||
@@ -58,7 +61,7 @@ class HatShopView < ClothesShopView
|
||||
@sprites["wornHat_layer2"].bitmap = hat2BitmapWrapper.bitmap if hat2BitmapWrapper
|
||||
|
||||
frame_width=80
|
||||
frame_height=40
|
||||
frame_height=80
|
||||
|
||||
@sprites["wornHat_layer1"].src_rect.set(0, 0, frame_width, frame_height) if hatBitmapWrapper
|
||||
@sprites["wornHat_layer2"].src_rect.set(0, 0, frame_width, frame_height) if hat2BitmapWrapper
|
||||
|
||||
@@ -12,25 +12,8 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def toggleEvent(item)
|
||||
if !@isShop
|
||||
$Trainer.set_hat(nil,@is_secondary_hat)
|
||||
@worn_clothes = nil
|
||||
|
||||
hat1_name = get_hat_by_id($Trainer.hat) ? get_hat_by_id($Trainer.hat).name : "(Empty)"
|
||||
hat2_name = get_hat_by_id($Trainer.hat2) ? get_hat_by_id($Trainer.hat2).name : "(Empty)"
|
||||
|
||||
cmd_remove_hat1 = "Remove #{hat1_name}"
|
||||
cmd_remove_hat2 = "Remove #{hat2_name}"
|
||||
options = [cmd_remove_hat1,cmd_remove_hat2, "Cancel"]
|
||||
choice = optionsMenu(options)
|
||||
if options[choice] == cmd_remove_hat1
|
||||
$Trainer.set_hat(nil,false)
|
||||
@worn_clothes = nil
|
||||
elsif options[choice] == cmd_remove_hat2
|
||||
$Trainer.set_hat(nil,true)
|
||||
@worn_clothes = nil
|
||||
end
|
||||
end
|
||||
$Trainer.set_hat(nil,@is_secondary_hat)
|
||||
@worn_clothes = nil
|
||||
end
|
||||
|
||||
def set_secondary_hat(value)
|
||||
@@ -68,9 +51,24 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
|
||||
def updateTrainerPreview(item, previewWindow)
|
||||
if item.is_a?(Outfit)
|
||||
previewWindow.set_hat(item.id,@is_secondary_hat)
|
||||
$Trainer.set_hat(item.id,@is_secondary_hat)# unless $Trainer.hat==nil
|
||||
set_dye_color(item,previewWindow)
|
||||
hat1 = @is_secondary_hat ? get_hat_by_id($Trainer.hat) : item
|
||||
hat2 = @is_secondary_hat ? item : get_hat_by_id($Trainer.hat2)
|
||||
|
||||
previewWindow.set_hat(hat1.id,false) if hat1
|
||||
previewWindow.set_hat(hat2.id,true) if hat2
|
||||
|
||||
hat1_color=0
|
||||
hat2_color=0
|
||||
hat1_color = $Trainer.dyed_hats[hat1.id] if hat1 && $Trainer.dyed_hats.include?(hat1.id)
|
||||
hat2_color = $Trainer.dyed_hats[hat2.id] if hat2 && $Trainer.dyed_hats.include?(hat2.id)
|
||||
previewWindow.hat_color = hat1_color
|
||||
previewWindow.hat2_color = hat2_color
|
||||
|
||||
$Trainer.hat = hat1&.id
|
||||
$Trainer.hat2 = hat2&.id
|
||||
$Trainer.hat_color = hat1_color
|
||||
$Trainer.hat2_color = hat2_color
|
||||
|
||||
else
|
||||
$Trainer.set_hat(nil,@is_secondary_hat)
|
||||
previewWindow.set_hat(nil,@is_secondary_hat)
|
||||
@@ -81,33 +79,50 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
previewWindow.updatePreview()
|
||||
end
|
||||
|
||||
def get_dye_color(item)
|
||||
def get_dye_color(item_id)
|
||||
return if !item_id
|
||||
return 0 if isShop?
|
||||
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
|
||||
if $Trainer.dyed_hats.include?(item.id)
|
||||
return $Trainer.dyed_hats[item.id]
|
||||
if $Trainer.dyed_hats.include?(item_id)
|
||||
return $Trainer.dyed_hats[item_id]
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
def set_dye_color(item,previewWindow)
|
||||
|
||||
|
||||
def set_dye_color(item,previewWindow,is_secondary_hat=false)
|
||||
return if !item
|
||||
if !isShop?
|
||||
$Trainer.dyed_hats= {} if !$Trainer.dyed_hats
|
||||
if $Trainer.dyed_hats.include?(item.id)
|
||||
dye_color = $Trainer.dyed_hats[item.id]
|
||||
$Trainer.set_hat_color(dye_color,@is_secondary_hat)
|
||||
previewWindow.hat_color = dye_color
|
||||
else
|
||||
$Trainer.set_hat_color(0,@is_secondary_hat)
|
||||
previewWindow.hat_color=0
|
||||
end
|
||||
#echoln $Trainer.dyed_hats
|
||||
|
||||
else
|
||||
$Trainer.set_hat_color(0,@is_secondary_hat)
|
||||
$Trainer.set_hat_color(0,is_secondary_hat)
|
||||
previewWindow.hat_color=0
|
||||
end
|
||||
end
|
||||
|
||||
# def set_dye_color(item,previewWindow,is_secondary_hat=false)
|
||||
# return if !item
|
||||
# if !isShop?
|
||||
# $Trainer.dyed_hats= {} if !$Trainer.dyed_hats
|
||||
#
|
||||
# echoln item.id
|
||||
# echoln $Trainer.dyed_hats.include?(item.id)
|
||||
# echoln $Trainer.dyed_hats[item.id]
|
||||
#
|
||||
# if $Trainer.dyed_hats.include?(item.id)
|
||||
# dye_color = $Trainer.dyed_hats[item.id]
|
||||
# $Trainer.set_hat_color(dye_color,is_secondary_hat)
|
||||
# previewWindow.hat_color = dye_color
|
||||
# else
|
||||
# $Trainer.set_hat_color(0,is_secondary_hat)
|
||||
# previewWindow.hat_color=0
|
||||
# end
|
||||
# #echoln $Trainer.dyed_hats
|
||||
# else
|
||||
# $Trainer.set_hat_color(0,is_secondary_hat)
|
||||
# previewWindow.hat_color=0
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
def addItem(item)
|
||||
@@ -129,8 +144,11 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def reset_player_clothes()
|
||||
$Trainer.set_hat(@worn_clothes,@is_secondary_hat)
|
||||
$Trainer.set_hat_color($Trainer.dyed_hats[@worn_clothes],@is_secondary_hat) if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
|
||||
$Trainer.set_hat(@worn_clothes,false)
|
||||
$Trainer.set_hat(@worn_clothes2,true)
|
||||
|
||||
$Trainer.set_hat_color($Trainer.dyed_hats[@worn_clothes],false) if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
|
||||
$Trainer.set_hat_color($Trainer.dyed_hats[@worn_clothes2],true) if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes2]
|
||||
end
|
||||
|
||||
def get_unlocked_items_list()
|
||||
@@ -162,7 +180,6 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def getSpecialItemDescription(specialType)
|
||||
echoln $Trainer.hair
|
||||
hair_situation = !$Trainer.hair || getSimplifiedHairIdFromFullID($Trainer.hair) == HAIR_BALD ? "bald head" : "fabulous hair"
|
||||
return "Go without a hat and show off your #{hair_situation}!"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user