Hats menu navigation improvements

This commit is contained in:
chardub
2025-03-10 12:59:14 -04:00
parent 3d6e76a41e
commit 36851c7bb7
11 changed files with 432 additions and 18 deletions

View File

@@ -25,6 +25,11 @@ class OutfitsMartAdapter < PokemonMartAdapter
return outfit_id == @worn_clothes
end
def player_changed_clothes?()
return false
#implement in inheriting classes
end
def toggleText()
return ""
end

View File

@@ -77,6 +77,10 @@ class ClothesMartAdapter < OutfitsMartAdapter
return $Trainer.clothes
end
def player_changed_clothes?()
$Trainer.clothes != @worn_clothes
end
def putOnOutfit(item)
putOnClothes(item.id) if item
@worn_clothes = item.id if item

View File

@@ -68,6 +68,32 @@ class ClothesShopPresenter < PokemonMartScreen
return true
end
def confirmPutClothes(item)
putOnClothes(item)
end
def quitMenuPrompt(item)
boolean_changes_detected = @adapter.player_changed_clothes?
return true if !boolean_changes_detected
pbPlayCancelSE
cmd_confirm = "Set outfit"
cmd_discard = "Discard changes"
cmd_cancel = "Cancel"
options = [cmd_confirm,cmd_discard,cmd_cancel]
choice = pbMessage("You have unsaved changes!",options,2)
case options[choice]
when cmd_confirm
confirmPutClothes(item)
pbPlayDecisionSE
return true
when cmd_discard
pbPlayCloseMenuSE
return true
else
return false
end
end
def pbBuyScreen
@scene.pbStartBuyScene(@stock, @adapter)
@scene.select_specific_item(@adapter.worn_clothes) if !@adapter.isShop?
@@ -77,11 +103,9 @@ class ClothesShopPresenter < PokemonMartScreen
#break if !item
if !item
break if @adapter.isShop?
if pbConfirm(_INTL("Discard the changes to your outfit?"))
break
else
item = @scene.pbChooseBuyItem
end
quit_menu_choice = quitMenuPrompt(item)
break if quit_menu_choice
item = @scene.pbChooseBuyItem
end
@@ -96,7 +120,7 @@ class ClothesShopPresenter < PokemonMartScreen
return
else
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
putOnClothes(item)
confirmPutClothes(item)
return
end
next

View File

@@ -77,7 +77,6 @@ class ClothesShopPresenter < PokemonMartScreen
playOutfitChangeAnimation()
pbMessage(_INTL("You put on the hat(s)!\\wtnp[30]"))
@scene.pbEndBuyScene
end
def dyeOptions(secondary_hat=false,item)
@@ -115,6 +114,12 @@ class ClothesShopPresenter < PokemonMartScreen
return ret
end
def confirmPutClothes(item)
putOnHats()
$Trainer.hat_color = @adapter.get_dye_color($Trainer.hat)
$Trainer.hat2_color = @adapter.get_dye_color($Trainer.hat2)
end
def playerHatActionsMenu(item)
cmd_confirm = "Confirm"
cmd_remove = "Remove hat"
@@ -128,10 +133,8 @@ class ClothesShopPresenter < PokemonMartScreen
removeHat(item)
return true
elsif options[choice] == cmd_confirm
putOnHats()
$Trainer.hat_color = @adapter.get_dye_color($Trainer.hat)
$Trainer.hat2_color = @adapter.get_dye_color($Trainer.hat2)
confirmPutClothes(nil)
@scene.pbEndBuyScene
return false
elsif options[choice] == cmd_dye
#removeDye(item) selectHatColor

View File

@@ -31,6 +31,10 @@ class HairMartAdapter < OutfitsMartAdapter
@version = newVersion
end
def player_changed_clothes?()
$Trainer.hairstyle != @worn_hair
end
#player can't "own" hairstyles
# if you want to go back one you had before, you have to pay again
def itemOwned(item)

View File

@@ -9,12 +9,22 @@ class HatsMartAdapter < OutfitsMartAdapter
super(stock,isShop,isSecondaryHat)
@worn_clothes = $Trainer.hat
@worn_clothes2 = $Trainer.hat2
@second_hat_visible = true
end
#Used in shops only
def toggleSecondHat()
@second_hat_visible = !@second_hat_visible
$Trainer.hat2 = @second_hat_visible ? @worn_clothes2 : nil
end
def toggleEvent(item)
return if isShop?
$Trainer.set_hat(nil,@is_secondary_hat)
@worn_clothes = nil
if isShop?
toggleSecondHat
else
$Trainer.set_hat(nil,@is_secondary_hat)
@worn_clothes = nil
end
end
def set_secondary_hat(value)
@@ -33,7 +43,8 @@ class HatsMartAdapter < OutfitsMartAdapter
end
def switchVersion(item,delta=1)
return if isShop?
pbSEPlay("GUI storage put down", 80, 100)
return toggleSecondHat if isShop?
@is_secondary_hat = !@is_secondary_hat
end
@@ -58,6 +69,7 @@ class HatsMartAdapter < OutfitsMartAdapter
previewWindow.set_hat(hat1.id,false) if hat1
previewWindow.set_hat(hat2.id,true) if hat2
previewWindow.set_hat(nil,true) if !@second_hat_visible #for toggling in shops
hat1_color=0
hat2_color=0
@@ -139,6 +151,12 @@ class HatsMartAdapter < OutfitsMartAdapter
return $Trainer.hat(@is_secondary_hat)
end
def player_changed_clothes?()
echoln("Trainer hat: #{$Trainer.hat}, Worn hat: #{@worn_clothes}")
echoln("Trainer hat2: #{$Trainer.hat2}, Worn hat2: #{@worn_clothes2}")
$Trainer.hat != @worn_clothes || $Trainer.hat2 != @worn_clothes2
end
def putOnOutfit(item)
return unless item.is_a?(Outfit)
putOnHat(item.id,false,@is_secondary_hat)