mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Secondary Hat (WIP)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class TrainerClothesPreview
|
||||
attr_writer :pokeball, :clothes, :hat, :hair, :skin_tone, :hair_color, :hat_color, :clothes_color
|
||||
attr_writer :pokeball, :clothes, :hat, :hat2, :hair, :skin_tone, :hair_color, :hat_color, :clothes_color
|
||||
|
||||
def initialize(x = 0, y = 0, windowed = true, pokeball = nil)
|
||||
@playerBitmap = nil
|
||||
@@ -15,19 +15,22 @@ class TrainerClothesPreview
|
||||
def resetOutfits()
|
||||
@clothes = $Trainer.clothes
|
||||
@hat = $Trainer.hat
|
||||
@hat2 = $Trainer.hat2
|
||||
@hair = $Trainer.hair
|
||||
@skin_tone = $Trainer.skin_tone
|
||||
@hair_color = $Trainer.hair_color
|
||||
@hat_color = $Trainer.hat_color
|
||||
@hat2_color = $Trainer.hat2_color
|
||||
@clothes_color = $Trainer.clothes_color
|
||||
end
|
||||
|
||||
def show()
|
||||
@playerBitmap = generate_front_trainer_sprite_bitmap(false,
|
||||
@pokeball,
|
||||
@clothes, @hat, @hair,
|
||||
@clothes,
|
||||
@hat,@hat2, @hair,
|
||||
@skin_tone,
|
||||
@hair_color, @hat_color, @clothes_color)
|
||||
@hair_color, @hat_color, @clothes_color, @hat2_color)
|
||||
initialize_preview()
|
||||
end
|
||||
|
||||
|
||||
@@ -71,8 +71,38 @@ def hairShop(outfits_list = [],free=false, customMessage=nil)
|
||||
genericOutfitsShopMenu(stock, :HAIR, true,!free,customMessage)
|
||||
end
|
||||
|
||||
|
||||
|
||||
SWAP_HAT_POSITIONS_CAPTION = "Switch hats position"
|
||||
def set_hat_adapter_options(adapter)
|
||||
slot1_hat = $Trainer.hat ? "Swap #{get_hat_by_id($Trainer.hat).name}" : "(Empty slot)"
|
||||
slot2_hat = $Trainer.hat2 ? "Swap #{get_hat_by_id($Trainer.hat2).name}" : "(Empty slot)"
|
||||
options = [slot1_hat,slot2_hat]
|
||||
options << SWAP_HAT_POSITIONS_CAPTION if $Trainer.hat && $Trainer.hat2
|
||||
options << "Cancel"
|
||||
hat_options_choice = optionsMenu(options)
|
||||
if options[hat_options_choice] == SWAP_HAT_POSITIONS_CAPTION
|
||||
hat1 = $Trainer.hat
|
||||
hat2 = $Trainer.hat2
|
||||
$Trainer.hat = hat2
|
||||
$Trainer.hat2 = hat1
|
||||
pbSEPlay("GUI naming tab swap start")
|
||||
return set_hat_adapter_options(adapter)
|
||||
end
|
||||
if hat_options_choice == options.length #cancel
|
||||
return nil
|
||||
end
|
||||
is_secondary = hat_options_choice ==1
|
||||
adapter.set_secondary_hat(is_secondary)
|
||||
return adapter
|
||||
end
|
||||
|
||||
def openSelectOutfitMenu(stock = [], itemType)
|
||||
adapter = getAdapter(itemType, stock, false)
|
||||
if adapter.is_a?(HatsMartAdapter)
|
||||
adapter = set_hat_adapter_options(adapter)
|
||||
return if !adapter
|
||||
end
|
||||
view = ClothesShopView.new()
|
||||
presenter = ClothesShopPresenter.new(view, stock, adapter)
|
||||
presenter.pbBuyScreen
|
||||
|
||||
@@ -2,23 +2,38 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
DEFAULT_NAME = "[unknown]"
|
||||
DEFAULT_DESCRIPTION = "A headgear that trainers can wear."
|
||||
|
||||
def initialize(stock = nil, isShop = nil)
|
||||
super
|
||||
def initialize(stock = nil, isShop = nil, isSecondaryHat = false)
|
||||
super(stock,isShop)
|
||||
@is_secondary_hat = isSecondaryHat
|
||||
end
|
||||
|
||||
def toggleEvent(item)
|
||||
if !@isShop
|
||||
$Trainer.hat = nil
|
||||
@worn_clothes = nil
|
||||
if @is_secondary_hat
|
||||
$Trainer.hat2 = nil
|
||||
@worn_clothes = nil
|
||||
|
||||
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
|
||||
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
|
||||
$Trainer.hat2 = nil
|
||||
@worn_clothes = nil
|
||||
end
|
||||
else
|
||||
$Trainer.hat = nil
|
||||
@worn_clothes = nil
|
||||
|
||||
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
|
||||
$Trainer.hat = nil
|
||||
@worn_clothes = nil
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_secondary_hat(value)
|
||||
@is_secondary_hat = value
|
||||
end
|
||||
|
||||
def toggleText()
|
||||
return
|
||||
# return if @isShop
|
||||
@@ -48,14 +63,27 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def updateTrainerPreview(item, previewWindow)
|
||||
if item.is_a?(Outfit)
|
||||
previewWindow.hat = item.id
|
||||
$Trainer.hat = item.id# unless $Trainer.hat==nil
|
||||
set_dye_color(item,previewWindow)
|
||||
if @is_secondary_hat
|
||||
if item.is_a?(Outfit)
|
||||
previewWindow.hat2 = item.id
|
||||
$Trainer.hat2 = item.id# unless $Trainer.hat==nil
|
||||
set_dye_color(item,previewWindow)
|
||||
else
|
||||
$Trainer.hat2=nil
|
||||
previewWindow.hat2= nil
|
||||
end
|
||||
else
|
||||
$Trainer.hat=nil
|
||||
previewWindow.hat= nil
|
||||
if item.is_a?(Outfit)
|
||||
previewWindow.hat = item.id
|
||||
$Trainer.hat = item.id# unless $Trainer.hat==nil
|
||||
set_dye_color(item,previewWindow)
|
||||
else
|
||||
$Trainer.hat=nil
|
||||
previewWindow.hat= nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
pbRefreshSceneMap
|
||||
previewWindow.updatePreview()
|
||||
end
|
||||
@@ -91,7 +119,7 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
|
||||
def addItem(item)
|
||||
return unless item.is_a?(Outfit)
|
||||
changed_clothes = obtainHat(item.id)
|
||||
changed_clothes = obtainHat(item.id,@is_secondary_hat)
|
||||
if changed_clothes
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
@@ -103,13 +131,23 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
|
||||
def putOnOutfit(item)
|
||||
return unless item.is_a?(Outfit)
|
||||
putOnHat(item.id)
|
||||
if @is_secondary_hat
|
||||
echoln "broder"
|
||||
putOnSecondaryHat(item.id)
|
||||
else
|
||||
putOnHat(item.id)
|
||||
end
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
|
||||
def reset_player_clothes()
|
||||
$Trainer.hat = @worn_clothes
|
||||
$Trainer.hat_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
|
||||
if @is_secondary_hat
|
||||
$Trainer.hat2 = @worn_clothes
|
||||
$Trainer.hat2_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
|
||||
else
|
||||
$Trainer.hat = @worn_clothes
|
||||
$Trainer.hat_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
|
||||
end
|
||||
end
|
||||
|
||||
def get_unlocked_items_list()
|
||||
|
||||
Reference in New Issue
Block a user