Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #------------------------------------------------
- #Script de Menu circular, creado por Polectron
- #------------------------------------------------
- #Este script pertenece a la colección de scripts Gwengardia Mod
- #Todos sabemos que el menú propio de pokémon essentials está un poco anticuadillo, y no es lo más bonito del mundo. Por eso he hecho #este script que crea un menú algo más bonito.
- #Evidentemente los gráficos los puedes cambiar por otros, siempre y cuando se respeten las dimensiones. Añadir más elementos también es #posible, pero ya requiere un poco de maña con ruby, aunque no es nada dificil.
- #Descarga los graficos desde este link
- #http://www.mediafire.com/file/qwaazct3ns6xmwp/menu_circular.zip/file
- #-----------------------------------------------
- class Scene_Map
- def call_menu
- $game_temp.menu_calling = false
- $game_player.straighten
- $game_map.update
- pbCallMenu2
- end
- end
- class Menu2
- def update;end
- def initialize
- @selected_item = 0
- @last_item = 0
- @items = []
- @bagCmd = addCmd(["bolsa","Mochila","openBag"])
- @partyCmd = addCmd(["pokeball","Equipo","openParty"]) if $Trainer.party.length>0
- @trainerCmd = addCmd(["trainer","Trainer ID","openTrainerCard"])
- @saveCmd = addCmd(["save","Guardar","openSave"])
- @optionsCmd = addCmd(["options","Opciones","openOptions"])
- @debugCmd = addCmd(["debug","Debug","pbDebugMenu"]) if $DEBUG
- @exitCmd = addCmd(["exit","Salir","exitMenu"])
- @angle_per_item = 360/@items.length
- @exit = false
- end
- def pbStartScene # CARGA LAS COSAS
- @sprites={}
- @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
- @viewport.z=99999
- @sprites["bg"]=Sprite.new(@viewport)
- @sprites["bg"].bitmap=RPG::Cache.picture("menu_bg")
- @totalElements = @items.length
- @radius = 100
- counter = 0
- for item in @items
- #p item[0]
- @sprites["item_#{counter}"] = Sprite.new(@viewport)
- @sprites["item_#{counter}"].bitmap=RPG::Cache.picture(item[0])
- @sprites["item_#{counter}"].x=getXPolygon(counter, @totalElements, Graphics.width/2, 0) - (@sprites["item_#{counter}"].bitmap.width/2)
- @sprites["item_#{counter}"].y=getYPolygon(counter, @totalElements, Graphics.height/2, 0) - (@sprites["item_#{counter}"].bitmap.height/2)
- @sprites["item_#{counter}"].z = 999
- counter += 1
- end
- time = 0.8
- fps = 20.0
- ellapsed_frames = 0
- loop do
- ellapsed_frames += 1
- offset = (ellapsed_frames/(fps*time))*@radius
- # p ellapsed_frames.to_s + "/(" + time.to_s + "*" + fps.to_s + ")*"+index_direction.to_s + "->" + (ellapsed_frames/(time*fps)*index_direction).to_s
- counter = 0
- for item in @items
- @sprites["item_#{counter}"].x=getXPolygon(counter, @totalElements, Graphics.width/2, offset) - (@sprites["item_#{counter}"].bitmap.width/2)
- @sprites["item_#{counter}"].y=getYPolygon(counter, @totalElements, Graphics.height/2, offset) - (@sprites["item_#{counter}"].bitmap.height/2)
- counter += 1
- end
- Graphics.update
- break if ellapsed_frames/fps == time
- end
- @sprites["selector"]=Sprite.new(@viewport)
- @sprites["selector"].bitmap=RPG::Cache.picture("menu_selection.png")
- redrawSelector
- #@sprites["selector"].z
- pbSEPlay("menu")
- end
- def pbEndScene # CUANDO TERMINA...
- pbDisposeSpriteHash(@sprites)
- @viewport.dispose if @viewport
- end
- def pbUpdate
- @xcount=999
- @posible1=0
- @posible2=0
- @posible3=0
- loop do
- Input.update
- ################### FUNCIONES AQUÍ #######
- if Input.trigger?(Input::RIGHT)
- pbSEPlay("GUI sel cursor")
- @last_item = @selected_item
- @selected_item+=1
- drawIcons
- end
- if Input.trigger?(Input::LEFT)
- pbSEPlay("GUI sel cursor")
- @last_item = @selected_item
- @selected_item-=1
- drawIcons
- end
- if (@selected_item < 0)
- @selected_item = @items.length-1
- end
- if (@selected_item >= @items.length)
- @selected_item = 0
- end
- if Input.trigger?(Input::C)
- send(@items[(@selected_item-@items.length).abs%@items.length][2])
- end
- break if Input.trigger?(Input::B) # CIERRA EL MENÚ
- break if @exit
- #redrawSelector
- Graphics.update
- end # loop
- time = 0.8
- fps = 20.0
- ellapsed_frames = 0
- loop do
- ellapsed_frames += 1
- radius = @radius - (ellapsed_frames/(fps*time))*@radius
- # p ellapsed_frames.to_s + "/(" + time.to_s + "*" + fps.to_s + ")*"+index_direction.to_s + "->" + (ellapsed_frames/(time*fps)*index_direction).to_s
- counter = 0
- for item in @items
- @sprites["item_#{counter}"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius, @selected_item) - (@sprites["item_#{counter}"].bitmap.width/2)
- @sprites["item_#{counter}"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius, @selected_item) - (@sprites["item_#{counter}"].bitmap.height/2)
- counter += 1
- end
- Graphics.update
- break if ellapsed_frames/fps == time
- end
- end # update
- def drawIcons
- index_direction = @selected_item - @last_item
- # p index_direction
- time = 0.8
- fps = 20.0
- ellapsed_frames = 0
- loop do
- ellapsed_frames += 1
- offset = @last_item+ellapsed_frames/(time*fps)*index_direction
- # p ellapsed_frames.to_s + "/(" + time.to_s + "*" + fps.to_s + ")*"+index_direction.to_s + "->" + (ellapsed_frames/(time*fps)*index_direction).to_s
- counter = 0
- for item in @items
- @sprites["item_#{counter}"].x=getXPolygon(counter, @totalElements, Graphics.width/2, @radius, offset) - (@sprites["item_#{counter}"].bitmap.width/2)
- @sprites["item_#{counter}"].y=getYPolygon(counter, @totalElements, Graphics.height/2, @radius, offset) - (@sprites["item_#{counter}"].bitmap.height/2)
- counter += 1
- end
- Graphics.update
- break if ellapsed_frames/fps == time
- end
- end
- def redrawSelector
- @sprites["selector"].x=getXPolygon(@selected_item, @totalElements, Graphics.width/2, @radius) - (@sprites["item_#{@selected_item}"].bitmap.width/2)
- @sprites["selector"].y=getYPolygon(@selected_item, @totalElements, Graphics.height/2, @radius) - (@sprites["item_#{@selected_item}"].bitmap.height/2)
- end
- def addCmd(item)
- return @items.push(item).length-1
- end
- end # Cierra la class
- ###################################################
- def waitForXFrames(x)
- end
- def pbCallMenu2
- scene=Menu2.new
- scene.pbStartScene
- scene.pbUpdate
- scene.pbEndScene
- end
- def deg2rad(deg)
- return deg*Math::PI/180
- end
- def getXPolygon(element, total, x_centre, radius, offset=0)
- return radius * Math.cos(2*Math::PI*(element+offset)/total + (Math::PI*1.5)) + x_centre
- end
- def getYPolygon(element, total, y_centre, radius, offset=0)
- return radius * Math.sin(2*Math::PI*(element+offset)/total + (Math::PI*1.5)) + y_centre
- end
- def exitMenu
- @exit = true
- end
- def openOptions
- if defined?(PokemonOptionScene) == 'constant' && PokemonOptionScene.class == Class
- scene=PokemonOptionScene.new
- screen=PokemonOption.new(scene)
- pbFadeOutIn(99999) { screen.pbStartScreen(true) }
- else
- pbFadeOutIn(99999){
- scene = PokemonOption_Scene.new
- screen = PokemonOptionScreen.new(scene)
- screen.pbStartScreen(true)
- }
- end
- end
- def openBag
- item=0
- scene=PokemonBag_Scene.new
- screen=PokemonBagScreen.new(scene,$PokemonBag)
- pbFadeOutIn(99999) {
- item=screen.pbStartScreen
- if item>0
- pbEndScene
- else
- #@scene.pbRefresh
- end
- }
- if item>0
- Kernel.pbUseKeyItemInField(item)
- exitMenu #Corrección 01-11-2018
- return
- end
- end
- def openParty
- if defined?(PokemonScreen_Scene) == 'constant' && PokemonScreen_Scene.class == Class
- if Input.trigger?(Input::C)
- sscene=PokemonScreen_Scene.new
- sscreen=PokemonScreen.new(sscene,$Trainer.party)
- hiddenmove=nil
- pbFadeOutIn(99999) {
- hiddenmove=sscreen.pbPokemonScreen
- if hiddenmove
- pbEndScene
- else
- #@scene.pbRefresh
- end
- }
- if hiddenmove
- Kernel.pbUseHiddenMove(hiddenmove[0],hiddenmove[1])
- exitMenu #Corrección 01-11-2018
- return
- end
- end
- else
- if Input.trigger?(Input::C)
- sscene=PokemonParty_Scene.new
- sscreen=PokemonPartyScreen.new(sscene,$Trainer.party)
- hiddenmove=nil
- pbFadeOutIn(99999) {
- hiddenmove=sscreen.pbPokemonScreen
- if hiddenmove
- pbEndScene
- else
- #@scene.pbRefresh
- end
- }
- if hiddenmove
- Kernel.pbUseHiddenMove(hiddenmove[0],hiddenmove[1])
- exitMenu #Corrección 01-11-2018
- return
- end
- end
- end
- end
- def openTrainerCard
- if defined?(PokemonTrainerCardScene) == 'constant' && PokemonTrainerCardScene.class == Class
- scene=PokemonTrainerCardScene.new
- screen=PokemonTrainerCard.new(scene)
- pbFadeOutIn(99999) {
- screen.pbStartScreen
- }
- else
- scene=PokemonTrainerCard_Scene.new
- screen=PokemonTrainerCardScreen.new(scene)
- pbFadeOutIn(99999) {
- screen.pbStartScreen
- }
- end
- end
- def openSave
- if defined?(PokemonSaveScene) == 'constant' && PokemonSaveScene.class == Class
- scene=PokemonSaveScene.new
- screen=PokemonSave.new(scene)
- if screen.pbSaveScreen
- endscene=false
- @exit = true
- #break
- end
- else
- scene=PokemonSave_Scene.new
- screen=PokemonSaveScreen.new(scene)
- if screen.pbSaveScreen
- endscene=false
- @exit = true
- #break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement