Ogłoszenie |
Administracja Forum
|
Zamknięty przez: Viuu Pią 23 Lis, 2012 14:25 |
Usunięcie komendy z menu |
Autor |
Wiadomość |
filiotef
Preferowany:
Dołączył: 08 Lip 2011 Posty: 29
|
Wysłany: Czw 22 Lis, 2012 23:44
|
|
Usunięcie komendy z menu
|
Witam ( Tak jak zawsze )
Przepraszam, że ciągle proszę o pomoc ale to dlatego,że nie znam się na skryptach ale wracając do tematu to chciałbym usunąć komendy tych skryptów z menu i nie wiem jak to zrobić
Mógłby ktoś to zrobić dla mnie ?
Music Box
Kod: | #==============================================================================
# +++ MOG - MUSIC BOX (v1.1) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema que permite escutar as músicas tocadas durante o jogo.
#==============================================================================
#==============================================================================
# UTILIZAÇÃO
#
# 1 - Crie uma pasta com o nome MUSIC COVER
# /Graphics/Music_Cover/
#
# 2 - Copie os seguintes arquivos contidos na Demo.
# Layout.png
# Layout2.png
#
#==============================================================================
# OPCIONAL
#
# Para adicionar imagens vinculadas as músicas nomeie as imagens da
# seguinte forma.
#
# FILE_NAME + _B1
# FILE_NAME + _B2
#
# Exemplo (eg)
#
# Nome da música
# Theme5.MP3 (Ogg/mid/etc...)
#
# Nome dos arquivos gráficos que ficarão na pasta /Graphics/Music_Cover/
# Theme5_B1.png
# Theme5_B2.png
#
# NOTA - O Sufixo _B1 é a imagem que terá o efeito scrolling, caso não queira
# o efeito de deslizar a imagem basta criar apenas um arquivo de
# imagem e nomea-lo com o sufixo _B2
#
#==============================================================================
# Para chamar o script use o comando abaixo.
#
# SceneManager.call(Scene_Music_Box)
#
#==============================================================================
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 1.1 - Melhoria no sistema de dispose.
#==============================================================================
module MOG_MUSIC_BOX
# Posição da janela da lista de músicas.
MUSIC_LIST_POSITION_TEXT = [0, 200]
# Posição do layout da lista de músicas.
MUSIC_LIST_POSITION_LAYOUT = [0, 195]
# Tempo para ocultar a janela de lista de músicas.
MUSICLIST_FADE_TIME = 2#(Sec)
# Definição da velocidade de deslizar a imagem de fundo. [X,Y]
BACKGROUND_SCROLL_SPEED = [2,0]
# Ativar a animação do gráfico do personagem. *(Não é obrigatório ser
# a imagem de um personagem, você pode criar outros efeitos de animações
# no lugar do personagem.
CHARACTER_SPRITE = true
# Velociadade da animação do personagem.
CHARACTER_ANIMATION_SPEED = 30
# Posição do personagem
CHARACTER_POSITION = [300,140]
# Definição da palavra Completado.
COMPLETED_WORD = "Completed"
# Posição do texto de informação.
INFO_POSITION = [0,373]
# Incluir músicas contidas no RTP.
INCLUDE_RTP = true
# Definição do diretório que foi instalado o RTP.
# Por padrão o caminho do diretório foi baseado no Windows 7 (64Bits).
# Outros sistemas operacionais o caminho do diretório é diferente.
RTP_PATH = "C:/Program Files (x86)/Common Files/Enterbrain/RGSS3/RPGVXAce/Audio/BGM/"
# Ativar o comando Music Box no menu principal.
MENU_COMMAND = true
# Nome do comando
MENU_COMMAND_NAME = "Music Box"
end
#===============================================================================
# ■ Game System
#===============================================================================
class Game_System
attr_accessor :music_book_list
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_music_book_initialize initialize
def initialize
mog_music_book_initialize
music_book_setup
end
#--------------------------------------------------------------------------
# ● Music Book Setup
#--------------------------------------------------------------------------
def music_book_setup
return if !SceneManager.scene_is?(Scene_Title)
@music_book_list = []
@music_book_list.push([$data_system.title_bgm.name,true]) if $data_system.title_bgm.name != ""
path = "Audio/BGM/"
make_music_list(path)
if MOG_MUSIC_BOX::INCLUDE_RTP
path = MOG_MUSIC_BOX::RTP_PATH
make_music_list(path)
end
end
#--------------------------------------------------------------------------
# ● Make_Music_List
#--------------------------------------------------------------------------
def make_music_list(path)
return if !File.directory?(path)
list = Dir.entries(path)
for i in 2...list.size
file_name = File.basename(list[i].to_s, ".*")
@music_book_list.push([file_name,false]) unless repeated_song?(file_name)
end
end
#--------------------------------------------------------------------------
# ● Repeated Song?
#--------------------------------------------------------------------------
def repeated_song?(file_name)
for i in 0...@music_book_list.size
return true if @music_book_list[i].include?(file_name)
end
return false
end
end
#===============================================================================
# ■ RPG AudioFile
#===============================================================================
class RPG::BGM < RPG::AudioFile
#--------------------------------------------------------------------------
# ● Play
#--------------------------------------------------------------------------
alias mog_music_book_play play
def play(pos = 0)
mog_music_book_play(pos)
check_music_book
end
#--------------------------------------------------------------------------
# ● Check Music Book
#--------------------------------------------------------------------------
def check_music_book
return if $game_system.music_book_list == nil
return if @name.empty?
for i in 0...$game_system.music_book_list.size
if $game_system.music_book_list[i][0] == @name
$game_system.music_book_list[i][1] = true
break
end
end
end
end
#===============================================================================
# ■ RPG Cache
#===============================================================================
module Cache
#--------------------------------------------------------------------------
# ● Music Cover
#--------------------------------------------------------------------------
def self.music_cover(filename)
load_bitmap("Graphics/Music_Cover/", filename)
end
end
#===============================================================================
# ■ RPG_FileTest
#===============================================================================
module RPG_FileTest
#--------------------------------------------------------------------------
# ● RPG_FileTest.music_cover_exist?
#--------------------------------------------------------------------------
def RPG_FileTest.music_cover_exist?(filename)
return Cache.music_cover(filename) rescue return false
end
end
#==============================================================================
# ■ Window_Picture
#==============================================================================
class Window_Music_List < Window_Selectable
#------------------------------------------------------------------------------
# ● Initialize
#------------------------------------------------------------------------------
def initialize
super(0, 0, 544, 160)
self.opacity = 0
@index = -1
@item_max = $game_system.music_book_list.size
refresh
select(0)
activate
end
#------------------------------------------------------------------------------
# ● Refresh
#------------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
if @item_max > 0
self.contents = Bitmap.new(width - 32, 24 * @item_max)
for i in 0...@item_max
draw_item(i)
end
return
end
self.contents = Bitmap.new(width - 32, 24)
self.contents.draw_text(x,y,440,32,"No Data",0)
end
#------------------------------------------------------------------------------
# ● draw_item
#------------------------------------------------------------------------------
def draw_item(index)
x = 0
y = 24 * index
if $game_system.music_book_list[index][1]
change_color(normal_color,true)
music = "N" + sprintf("%02d", index + 1).to_s + " - "+ $game_system.music_book_list[index][0].to_s
else
change_color(normal_color,false)
music = "N" + sprintf("%02d", index + 1).to_s + " - Not Available"
end
self.contents.draw_text(x,y,440,32,music,0)
end
#------------------------------------------------------------------------------
# ● Col Max
#------------------------------------------------------------------------------
def col_max
return 1
end
#------------------------------------------------------------------------------
# ● Item Max
#------------------------------------------------------------------------------
def item_max
return @item_max == nil ? 0 : @item_max
end
end
#===============================================================================
# ■ Scene Music Box
#===============================================================================
class Scene_Music_Box
include MOG_MUSIC_BOX
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_dispose
create_music_list
create_layout
create_sprite_now_playing
create_character
execute_loop
execute_dispose
end
#--------------------------------------------------------------------------
# ● Execute Loop
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition
loop do
Graphics.update
Input.update
update
break if SceneManager.scene != self
end
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@background = Plane.new
@background.z = 1
@background2 = Sprite.new
@background2.z = 2
@layout = Sprite.new
@layout.bitmap = Cache.music_cover("Layout")
@layout.z = 90
@old_index = -1
end
#--------------------------------------------------------------------------
# ● create Sprite now Playing
#--------------------------------------------------------------------------
def create_sprite_now_playing
@now_playing = Plane.new
@now_playing.bitmap = Bitmap.new(544,416)
@now_playing.z = 100
check_completion
make_now_playing(true)
end
#--------------------------------------------------------------------------
# ● Check Completion
#--------------------------------------------------------------------------
def check_completion
comp = 0
for i in 0...$game_system.music_book_list.size
comp += 1 if $game_system.music_book_list[i][1]
end
if $game_system.music_book_list.size > 0
@completed = "( " + COMPLETED_WORD + " " + (comp.to_f / $game_system.music_book_list.size * 100).truncate.to_s + "% )"
else
@completed = "( " + COMPLETED_WORD + " )"
end
end
#--------------------------------------------------------------------------
# ● Create_Character
#--------------------------------------------------------------------------
def create_character
return if !CHARACTER_SPRITE
@character_index = 0
@character_animation_speed = 0
@character = Sprite.new
@character.z = 80
@character_image = Cache.music_cover("Character")
@character_frame_max = @character_image.width / @character_image.height
@character_width = @character_image.width / @character_frame_max
@character.bitmap = Bitmap.new(@character_width,@character_image.height)
@character.x = CHARACTER_POSITION[0]
@character.y = CHARACTER_POSITION[1]
make_character_bitmap
end
#--------------------------------------------------------------------------
# ● Make Now Playing
#--------------------------------------------------------------------------
def make_now_playing(init = false)
@now_playing.bitmap.clear
@now_playing.bitmap.font.size = 20
@now_playing.bitmap.font.bold = true
text = song_name + " " + @completed
text = @completed if init
@now_playing.bitmap.draw_text(INFO_POSITION[0],INFO_POSITION[1], 544, 32, text.to_s,1)
@now_playing.opacity = 0
end
#--------------------------------------------------------------------------
# ● Make Background
#--------------------------------------------------------------------------
def make_background
if @background.bitmap != nil
@background.bitmap.dispose
@background.bitmap = nil
end
if RPG_FileTest.music_cover_exist?(song_name + "_B1")
@background.bitmap = Cache.music_cover(song_name + "_B1")
else
@background.bitmap = Cache.music_cover("")
end
@background.opacity = 0
if @background2.bitmap != nil
@background2.bitmap.dispose
@background2.bitmap = nil
end
if RPG_FileTest.music_cover_exist?(song_name + "_B2")
@background2.bitmap = Cache.music_cover(song_name + "_B2")
else
@background2.bitmap = Cache.music_cover("")
end
@background2.opacity = 0
end
#--------------------------------------------------------------------------
# ● Song Name
#--------------------------------------------------------------------------
def song_name
if $game_system.music_book_list.size == 0
return ""
end
return $game_system.music_book_list[@music_list_window.index][0].to_s
end
#--------------------------------------------------------------------------
# ● Create_Music_List
#--------------------------------------------------------------------------
def create_music_list
@stop = true
@layout2 = Sprite.new
@layout2.bitmap = Cache.music_cover("Layout2")
@layout_org_position = [MUSIC_LIST_POSITION_LAYOUT[0],MUSIC_LIST_POSITION_LAYOUT[1]]
@layout2.y = @layout_org_position[1]
@layout2.z = 90
@music_list_window = Window_Music_List.new
@music_list_window.z = 100
@music_list_window_org = [MUSIC_LIST_POSITION_TEXT[0],MUSIC_LIST_POSITION_TEXT[1]]
@music_list_window.y = @music_list_window_org[1]
@music_index = @music_list_window.index
@fade_max = 60 + 60 * MUSICLIST_FADE_TIME
@fade_time = @fade_max
@music_list_window.x = -544
@music_list_window.contents_opacity = 0
@layout2.x = -544
@layout2.opacity = 0
end
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
BattleManager.save_bgm_and_bgs
RPG::BGM.fade(2 * 1000)
RPG::BGS.fade(2 * 1000)
@w_visible = true
end
#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
return if @layout == nil
Graphics.freeze
@music_list_window.dispose
if @background.bitmap != nil
@background.bitmap.dispose
end
@background.dispose
if @background2.bitmap != nil
@background2.bitmap.dispose
end
@background2.dispose
@layout.bitmap.dispose
@layout.dispose
@layout = nil
@layout2.bitmap.dispose
@layout2.dispose
@now_playing.bitmap.dispose
@now_playing.dispose
if CHARACTER_SPRITE
@character.bitmap.dispose
@character.dispose
@character_image.dispose
end
RPG::BGM.stop
BattleManager.replay_bgm_and_bgs
end
#--------------------------------------------------------------------------
# ● Hide_Layout
#--------------------------------------------------------------------------
def hide_layout
Sound.play_ok
@w_visible = @w_visible == true ? false : true
@fade_time = @w_visible ? @fade_max : 0
@layout.visible = @w_visible
if CHARACTER_SPRITE
@character.visible = @w_visible
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_commands
update_animation
end
#--------------------------------------------------------------------------
# ● Update Animation
#--------------------------------------------------------------------------
def update_animation
@now_playing.opacity += 2
@now_playing.ox += 1
update_list_fade
update_character_animation
update_background_animation
end
#--------------------------------------------------------------------------
# ● Update Background Animation
#--------------------------------------------------------------------------
def update_background_animation
@background.opacity += 1
@background2.opacity += 1
@background.ox += BACKGROUND_SCROLL_SPEED[0]
@background.oy += BACKGROUND_SCROLL_SPEED[1]
end
#--------------------------------------------------------------------------
# ● Update Character Animation
#--------------------------------------------------------------------------
def update_character_animation
return if !CHARACTER_SPRITE or @stop
@character_animation_speed += 1
if @character_animation_speed > CHARACTER_ANIMATION_SPEED
@character_animation_speed = 0
@character_index += 1
@character_index = 0 if @character_index >= @character_frame_max
make_character_bitmap
end
end
#--------------------------------------------------------------------------
# ● Make Character_bitmap
#--------------------------------------------------------------------------
def make_character_bitmap
@character.bitmap.clear
src_rect_back = Rect.new(@character_width * @character_index, 0,@character_width,@character_image.height)
@character.bitmap.blt(0,0, @character_image, src_rect_back)
end
#--------------------------------------------------------------------------
# ● Update List Fade
#--------------------------------------------------------------------------
def update_list_fade
@fade_time = @fade_max if moved?
slide_speed = 5
fade_speed = 3
if @fade_time > 0
@fade_time -= 1
@layout2.opacity += fade_speed * 2
@music_list_window.contents_opacity += fade_speed * 2
if @music_list_window.x < @music_list_window_org[0]
@music_list_window.x += slide_speed * 2
@layout2.x += slide_speed * 2
if @music_list_window.x >= @music_list_window_org[0]
@music_list_window.x = @music_list_window_org[0]
@layout2.x = @layout_org_position[0]
end
end
else
@music_list_window.x -= slide_speed
@music_list_window.contents_opacity -= fade_speed
@layout2.x -= slide_speed
@layout2.opacity -= fade_speed
if @music_list_window.x < -544
@music_list_window.x = -544
@music_list_window.contents_opacity = 0
@layout2.x = -544
@layout2.opacity = 0
end
end
end
#--------------------------------------------------------------------------
# ● Moved?
#--------------------------------------------------------------------------
def moved?
return true if Input.trigger?(:C)
return true if Input.trigger?(:B)
return true if Input.trigger?(:X)
return true if Input.trigger?(:R)
return true if Input.trigger?(:L)
return true if Input.press?(Input.dir4)
return false
end
#--------------------------------------------------------------------------
# ● Update Commands
#--------------------------------------------------------------------------
def update_commands
@music_list_window.update
if Input.trigger?(:B)
return_to_scene
elsif Input.trigger?(:C)
play_song
elsif Input.trigger?(:X)
stop_song
elsif Input.trigger?(:Y)
hide_layout
end
end
#--------------------------------------------------------------------------
# ● Return to Scene
#--------------------------------------------------------------------------
def return_to_scene
return if @fade_time == 0 and @layout2.opacity == 0
Sound.play_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ● index_changed?
#--------------------------------------------------------------------------
def index_changed?
if @old_index != @music_list_window.index
@old_index = @music_list_window.index
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Play Song
#--------------------------------------------------------------------------
def play_song
return if $game_system.music_book_list.size == 0
return if @fade_time == 0 and @layout2.opacity == 0
if $game_system.music_book_list[@music_list_window.index][1]
if index_changed? or @stop
Sound.play_ok
@stop = false
Audio.bgm_play("Audio/BGM/" + song_name, 100, 100) rescue nil
make_background
make_now_playing
end
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● Stop Song
#--------------------------------------------------------------------------
def stop_song
Sound.play_ok
@stop = true
RPG::BGM.fade(3 * 1000)
make_now_playing(true)
end
end
if MOG_MUSIC_BOX::MENU_COMMAND
#==============================================================================
# ■ Window Menu Command
#==============================================================================
class Window_MenuCommand < Window_Command
#------------------------------------------------------------------------------
# ● Add Main Commands
#------------------------------------------------------------------------------
alias mog_musicbox_add_main_commands add_main_commands
def add_main_commands
mog_musicbox_add_main_commands
add_command(MOG_MUSIC_BOX::MENU_COMMAND_NAME, :musicbox, main_commands_enabled)
end
end
#==============================================================================
# ■ Scene Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#------------------------------------------------------------------------------
# ● Create Command Windows
#------------------------------------------------------------------------------
alias mog_musicbox_create_command_window create_command_window
def create_command_window
mog_musicbox_create_command_window
@command_window.set_handler(:musicbox, method(:Music_Box))
end
#------------------------------------------------------------------------------
# ● Music Box
#------------------------------------------------------------------------------
def Music_Box
SceneManager.call(Scene_Music_Box)
end
end
end
$mog_rgss3_music_box = true |
i Galeria
Kod: | #==============================================================================
# +++ MOG - Picture Gallery ACE (v1.3) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de galeria de imagens.
#==============================================================================
# Para ativar o script use o comando abaixo através de um evento usando o
# comando chamar script. (Call Script)
#
# SceneManager.call(Scene_Picture_Gallery)
#
#==============================================================================
# Para disponibilizar as imagens na galeria você deverá usar o seguinte
# código através do comando chamar script.
#
# $game_system.gallery[ID] = true
#
# EX $game_system.gallery[10] = true
#
#==============================================================================
# Você deverá criar uma pasta com o nome "Gallery" onde as imagens deverão
# ser gravadas.
#
# Graphics/Gallery/
#
# A nomeação das imagens devem ser numéricas. (ID da imagem)
# 0.jpg (Imagem não disponível.)
# 1.jpg
# 2.jpg
# 3.jpg
# ...
#
# Prefira usar imagens com resoluções igual ou maior a 544x416 pixels.
#==============================================================================
# Histórico
# 1.3 - Movimento da imagem na diagonal.
# - Melhoria no sistema de dispose.
# 1.2 - Compatibilidade com o sistema de cursor.
# 1.1 - Opção de adicionar o command Picture Gallery no Menu principal.
#
#==============================================================================
module MOG_PICTURE_GALLERY
#Quantidade maxima de imagens na galeria.
MAX_PICTURES = 40
#Ativar o Scene Picture Gallery no Menu
PICTURE_GALLERY_MENU_COMMAND = true
#Nome do comando apresentado no menu.
PICTURE_GALLERY_COMMAND_NAME = "Picture Gallery"
end
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :gallery
#------------------------------------------------------------------------------
# ● Initialize
#------------------------------------------------------------------------------
alias art_picture_initialize initialize
def initialize
art_picture_initialize
@gallery = []
end
end
#==============================================================================
# ■ RPG
#==============================================================================
module Cache
def self.gallery(filename)
load_bitmap("Graphics/Gallery/", filename)
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● Draw_Thumbnail
#--------------------------------------------------------------------------
def draw_thumbnail(x,y,id)
bitmap = Cache.gallery(id.to_s) rescue nil
return if bitmap == nil
src_rect = Rect.new(0, 0, bitmap.width , bitmap.height )
src_rect2 = Rect.new(x, y, 118, 59)
self.contents.stretch_blt(src_rect2, bitmap, src_rect)
bitmap.dispose
end
end
#==============================================================================
# ■ Window_Picture
#==============================================================================
class Window_Picture < Window_Selectable
#------------------------------------------------------------------------------
# ● Initialize
#------------------------------------------------------------------------------
def initialize(page)
super(0, 64, 544, 370)
self.opacity = 0
@index = -1
@page = page
@pic_max = MOG_PICTURE_GALLERY::MAX_PICTURES
@pic_max = 1 if @pic_max <= 0
@pag_max = @pic_max / 9
if @pag_max == page
o = @pag_max * 9
o2 = @pic_max - o
@item_max = o2
else
@item_max = 9
end
@i_max = @item_max
refresh(page)
select(0)
activate
end
#------------------------------------------------------------------------------
# ● Refresh
#------------------------------------------------------------------------------
def refresh(page = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
if @item_max > 0
self.contents = Bitmap.new(width - 32, 6 * 89)
for i in 0...@item_max
draw_item(i,page)
end
end
end
#------------------------------------------------------------------------------
# ● draw_item
#------------------------------------------------------------------------------
def draw_item(index,page)
np = 9 * page
picture_number = index + 1 + np
x = 16 + index % 3 * 183
y = 12 + index / 3 * 89
s = picture_number
s = 0 if $game_system.gallery[picture_number] == nil
draw_thumbnail(x,y,s)
self.contents.draw_text(x + 30,y + 49, 64, 32, "N - " + picture_number.to_s,1)
end
#------------------------------------------------------------------------------
# ● item_rect
#------------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = 150
rect.height = 90
rect.x = @index % col_max * (rect.width + 32)
rect.y = @index / col_max * 90
return rect
end
#------------------------------------------------------------------------------
# ● Col Max
#------------------------------------------------------------------------------
def col_max
return 3
end
#------------------------------------------------------------------------------
# ● Item Max
#------------------------------------------------------------------------------
def item_max
return @item_max == nil ? 0 : @item_max
end
end
#==============================================================================
# ■ Scene_ArtPictures
#==============================================================================
class Scene_Picture_Gallery
include MOG_PICTURE_GALLERY
#------------------------------------------------------------------------------
# ● Main
#------------------------------------------------------------------------------
def main
setup
execute_dispose
create_image
create_background
create_loading_text
create_window
create_cursor
create_button
execute_loop
execute_dispose
end
#------------------------------------------------------------------------------
# ● Create_Loading
#------------------------------------------------------------------------------
def create_loading_text
@loading = Sprite.new
@loading.bitmap = Bitmap.new(100,32)
@loading.z = 300
@loading.bitmap.font.size = 20
@loading.bitmap.font.bold = true
@loading.bitmap.font.name = "Georgia"
@loading.bitmap.draw_text(0,0, 100, 32, "Loading...",1)
@loading.x = (544 / 2) - 50
@loading.y = (416 / 2)
Graphics.transition(20)
end
#------------------------------------------------------------------------------
# ● Setup
#------------------------------------------------------------------------------
def setup
@max_pictures = MAX_PICTURES
@max_pictures = 1 if @max_pictures <= 0
v = (@max_pictures / 9)
v2 = (v - 1) * 9
v3 = (@max_pictures - v2) - 9
if v3 != 0
@max_pages = (@max_pictures / 9) + 1
else
@max_pages = (@max_pictures / 9)
end
@max_pages = 1 if @max_pages == 0
@aw_center = 0
@aw_left = 0
@aw_right = 0
@slide_type = 0
@page_old = 0
@picture_id = 0
@image_active = false
@old_index = 0
@picures_enabled = 0
@comp = 0
@ex = 0
@ey = 0
@ex_max = 0
@ey_max = 0
@ex_max_zoom = 0
@ey_max_zoom = 0
for i in 0..MAX_PICTURES
@picures_enabled += 1 if $game_system.gallery[i]
end
end
#------------------------------------------------------------------------------
# ● create_background
#------------------------------------------------------------------------------
def create_background
@background = Sprite.new
@background.bitmap = Cache.gallery("Background")
@background.z = 0
@background2 = Plane.new
@background2.bitmap = Cache.gallery("Background2")
@background2.z = -1
end
#------------------------------------------------------------------------------
# ● Create Window
#------------------------------------------------------------------------------
def create_window
@info = Window_Help.new
@info.y = 360
@info.opacity = 0
@wp_page = 0
@wp_page_old = @wp_page
@wp_index = 0
@wp =[]
for i in 0...@max_pages
@wp[i] = Window_Picture.new(i)
end
check_active_window(true)
refresh_info_window(true)
#@wp[@wp_page].x = 0
end
#------------------------------------------------------------------------------
# ● Create_image
#------------------------------------------------------------------------------
def create_image
@picture = Sprite.new
@picture.bitmap = Cache.gallery("")
@picture.z = 100
@picture.opacity = 0
end
#------------------------------------------------------------------------------
# ● Check Active Window
#------------------------------------------------------------------------------
def check_active_window(starting = false)
for i in 0...@max_pages
if i == @wp_page
@wp[@wp_page].active = true
@wp[@wp_page].visible = true
if @slide_type == 0
@wp[@wp_page].x = 544
else
@wp[@wp_page].x = -544
end
elsif i == @page_old and starting == false
@wp[@page_old].active = false
@wp[@page_old].visible = true
@wp[@page_old].visible = false if starting
@wp[@page_old].x = 0
else
@wp[i].active = false
@wp[i].visible = false
end
end
end
#------------------------------------------------------------------------------
# ● Create Button
#------------------------------------------------------------------------------
def create_button
@button_image = Cache.gallery("Button")
@button_bitmap = Bitmap.new(@button_image.width, @button_image.height)
@cw = @button_image.width
@ch = @button_image.height / 2
src_rect = Rect.new(0, 0, @cw, @ch)
@button_bitmap .blt(0,0, @button_image, src_rect)
@button = Sprite.new
@button.bitmap = @button_bitmap
@button.y = 443
@button.z = 250
@button.opacity = 0
@button_fade_time = 0
end
#------------------------------------------------------------------------------
# ● Create Cursor
#------------------------------------------------------------------------------
def create_cursor
@cx1 = 0
@cx2 = 0
@cursor_speed = 0
image = Cache.gallery("Cursor")
@bitmap = Bitmap.new(image.width, image.height)
cw = image.width / 2
ch = image.height
src_rect = Rect.new(cw, 0, cw, ch)
@bitmap.blt(0,0, image, src_rect)
@cursor1 = Sprite.new
@cursor1.bitmap = @bitmap
@cursor1.x = 0 + @cx1
@cursor1.y = 190
@cursor1.z = 200
@bitmap2 = Bitmap.new(image.width, image.height)
src_rect2 = Rect.new(0, 0, cw, ch)
@bitmap2.blt(0,0, image, src_rect2)
@cursor2 = Sprite.new
@cursor2.bitmap = @bitmap2
@cursor2.x = 514 + @cx2
@cursor2.y = 190
@cursor2.z = 200
image.dispose
if @max_pages == 1
@cursor1.visible = false
@cursor2.visible = false
end
end
#------------------------------------------------------------------------------
# ● Execute Loop
#------------------------------------------------------------------------------
def execute_loop
loop do
Graphics.update
Input.update
update
if SceneManager.scene != self
break
end
end
end
#------------------------------------------------------------------------------
# ● Execute Dispose
#------------------------------------------------------------------------------
def execute_dispose
return if @background == nil
Graphics.freeze
for i in 0...@max_pages
@wp[i].dispose
end
@info.dispose
if @picture.bitmap != nil
@picture.bitmap.dispose
end
@picture.dispose
@background.bitmap.dispose
@background.dispose
@background = nil
@background2.bitmap.dispose
@background2.dispose
@bitmap.dispose
@bitmap2.dispose
@cursor1.bitmap.dispose
@cursor1.dispose
@cursor2.bitmap.dispose
@cursor2.dispose
@button_bitmap.dispose
@button.bitmap.dispose
@button.dispose
@button_image.dispose
if @loading != nil
@loading.bitmap.dispose
@loading.dispose
end
end
#------------------------------------------------------------------------------
# ● Update
#------------------------------------------------------------------------------
def update
@wp.each {|wid| wid.update}
@info.update
if @image_active
update_command_image
else
update_command
end
update_slide
update_image_effect
update_cursor_animation
refresh_info_window
end
#------------------------------------------------------------------------------
# ● update_cursor_animation
#------------------------------------------------------------------------------
def update_cursor_animation
@cursor_speed += 1
case @cursor_speed
when 1..20
@cx1 += 1
@cx2 -= 1
when 21..40
@cx1 -= 1
@cx2 += 1
else
@cursor_speed = 0
@cx1 = 0
@cx2 = 0
end
@cursor1.x = 0 + @cx1
@cursor2.x = 514 + @cx2
end
#------------------------------------------------------------------------------
# ● Update Image Effect
#------------------------------------------------------------------------------
def update_image_effect
return if @wp[@wp_page].x != 0
@button_fade_time -= 1 if @button_fade_time > 0
if @image_active
@picture.opacity += 15
if @button_fade_time != 0
@button.opacity += 5
else
if @button.y < 416
@button.opacity -= 10
@button.y += 1
end
end
@wp[@wp_page].contents_opacity -= 15
@info.contents_opacity -= 15
@background.opacity -= 15
@cursor1.opacity -= 15
@cursor2.opacity -= 15
else
@picture.opacity -= 10
@button.opacity -= 15
@wp[@wp_page].contents_opacity += 15
@info.contents_opacity += 15
@background.opacity += 15
@cursor1.opacity += 15
@cursor2.opacity += 15
end
end
#------------------------------------------------------------------------------
# ● Refresh Info Window
#------------------------------------------------------------------------------
def refresh_info_window(starting = false)
return if @image_active
return if @wp_page_old == @wp_page and starting == false
@wp_page_old = @wp_page
page = @wp_page + 1
@picture_id = (9 * @wp_page) + @wp[@wp_page].index + 1
p_pages = "Page - " + page.to_s + " / " + @max_pages.to_s
comp = " Completed " + (@picures_enabled.to_f / @max_pictures.to_f * 100).truncate.to_s + "%"
p_number = " Pictures " + @picures_enabled.to_s + " / " + @max_pictures.to_s
@info.set_text(" " + p_pages + comp + p_number)
end
#------------------------------------------------------------------------------
# ● Update Slide
#------------------------------------------------------------------------------
def update_slide
@background2.ox += 1
if @loading != nil
@loading.opacity -= 5
if @loading.opacity <= 0
@loading.bitmap.dispose
@loading.dispose
@loading = nil
end
end
return if @wp[@wp_page].x == 0
slide_speed = 25
@picture.opacity = 0
@background.opacity = 255
if @slide_type == 1
if @wp[@wp_page].x < 0
@wp[@wp_page].x += slide_speed
if @wp[@wp_page].x >= 0
@wp[@wp_page].x = 0
end
end
if @wp[@page_old].x < 640
@wp[@page_old].x += slide_speed
if @wp[@page_old].x >= 544
@wp[@page_old].x = 544
end
end
else
if @wp[@wp_page].x > 0
@wp[@wp_page].x -= slide_speed
if @wp[@wp_page].x <= 0
@wp[@wp_page].x = 0
end
end
if @wp[@page_old].x > -544
@wp[@page_old].x -= slide_speed
if @wp[@page_old].x <= -544
@wp[@page_old].x = -544
end
end
end
if @slide_type == 0
@wp[@wp_page].x = 0 if @wp[@wp_page].x <= 0
else
@wp[@wp_page].x = 0 if @wp[@wp_page].x >= 0
end
end
#------------------------------------------------------------------------------
# ● Check_limite
#------------------------------------------------------------------------------
def check_limit
if @wp_page < 0
@wp_page = @max_pages - 1
elsif @wp_page >= @max_pages
@wp_page = 0
end
check_active_window
end
#------------------------------------------------------------------------------
# ● Update Command Image
#------------------------------------------------------------------------------
def update_command_image
if Input.trigger?(Input::B) or Input.trigger?(Input::C)
Sound.play_cursor
@image_active = false
@wp[@wp_page].active = true
return
end
if Input.trigger?(Input::R) or Input.trigger?(Input::L)
Sound.play_cursor
execute_zoom
end
@ex += 4 if Input.press?(Input::RIGHT)
@ex -= 4 if Input.press?(Input::LEFT)
@ey += 4 if Input.press?(Input::DOWN)
@ey -= 4 if Input.press?(Input::UP)
@ex = @ex_max + @ex_max_zoom if @ex > @ex_max + @ex_max_zoom
@ex = 0 if @ex < 0
@ey = @ey_max + @ey_max_zoom if @ey > @ey_max + @ey_max_zoom
@ey = 0 if @ey < 0
@picture.x = -@ex
@picture.y = -@ey
end
#------------------------------------------------------------------------------
# ● Execute Zoom
#------------------------------------------------------------------------------
def execute_zoom
if @picture.zoom_x == 1.0
@picture.zoom_x = 1.5
@picture.zoom_y = 1.5
refresh_button(1)
@ex_max_zoom = (@picture.bitmap.width / 2)
if @ex != @ex_max
@ex += @ex_max_zoom / 2
else
if @ex_max != 0
@ex += @ex_max_zoom
else
@ex += @ex_max_zoom / 2
end
end
@ey_max_zoom = (@picture.bitmap.height / 2)
if @ey != @ey_max
@ey += @ey_max_zoom / 2
else
if @ey_max != 0
@ey += @ey_max_zoom
else
@ey += @ey_max_zoom / 2
end
end
else
if @picture.bitmap.width > 640 or
@picture.bitmap.height > 480
refresh_button(1)
else
refresh_button(0)
end
@ex -= @ex_max_zoom / 2
@ey -= @ey_max_zoom / 2
@picture.zoom_x = 1.0
@picture.zoom_y = 1.0
@ex_max_zoom = 0
@ey_max_zoom = 0
end
end
#------------------------------------------------------------------------------
# ● check_avaliable_picture?
#------------------------------------------------------------------------------
def check_avaliable_picture?
@picture_id = (9 * @wp_page) + @wp[@wp_page].index + 1
return false if $game_system.gallery[@picture_id] == nil
return true
end
#------------------------------------------------------------------------------
# ● create_bitmap
#------------------------------------------------------------------------------
def create_bitmap
@picture.opacity = 0
@picture.bitmap.dispose
@picture.bitmap = Cache.gallery(@picture_id.to_s) rescue nil
@ex = 0
@ey = 0
@ex_max_zoom = 0
@ey_max_zoom = 0
@picture.zoom_x = 1.0
@picture.zoom_y = 1.0
if @picture.bitmap == nil
@picture.bitmap = Cache.gallery("")
refresh_button(0)
return
end
if @picture.bitmap.width > 544
@ex_max = @picture.bitmap.width - 544
else
@ex_max = 0
end
if @picture.bitmap.height > 416
@ey_max = @picture.bitmap.height - 416
else
@ey_max = 0
end
if @picture.bitmap.width > 544 or
@picture.bitmap.height > 416
refresh_button(1)
else
refresh_button(0)
end
end
#------------------------------------------------------------------------------
# ● Refresh Button
#------------------------------------------------------------------------------
def refresh_button(type = 0)
@button.bitmap.clear
if type == 0
src_rect = Rect.new(0, 0, @cw, @ch)
else
src_rect = Rect.new(0, @ch, @cw, @ch)
end
@button_bitmap .blt(0,0, @button_image, src_rect)
@button.y = 379
@button_fade_time = 120
@button.opacity = 0 unless @button.y == 379
end
#------------------------------------------------------------------------------
# ● Update Command
#------------------------------------------------------------------------------
def update_command
return if @wp[@wp_page].x != 0
if Input.trigger?(Input::B)
Sound.play_cancel
SceneManager.return
return
end
if Input.trigger?(Input::C)
if check_avaliable_picture?
Sound.play_ok
@image_active = true
@wp[@wp_page].active = false
create_bitmap
else
Sound.play_buzzer
end
return
end
if Input.trigger?(Input::L) and @max_pages != 1
Sound.play_cursor
@page_old = @wp_page
@wp_page -= 1
@slide_type = 1
check_limit
return
elsif Input.trigger?(Input::R) and @max_pages != 1
Sound.play_cursor
@page_old = @wp_page
@wp_page += 1
@slide_type = 0
check_limit
return
end
end
end
if MOG_PICTURE_GALLERY::PICTURE_GALLERY_MENU_COMMAND
#==============================================================================
# ■ Window Menu Command
#==============================================================================
class Window_MenuCommand < Window_Command
#------------------------------------------------------------------------------
# ● Add Main Commands
#------------------------------------------------------------------------------
alias mog_picture_gallery_add_main_commands add_main_commands
def add_main_commands
mog_picture_gallery_add_main_commands
add_command(MOG_PICTURE_GALLERY::PICTURE_GALLERY_COMMAND_NAME, :picture, main_commands_enabled)
end
end
#==============================================================================
# ■ Scene Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#------------------------------------------------------------------------------
# ● Create Command Windows
#------------------------------------------------------------------------------
alias mog_picture_gallery_create_command_window create_command_window
def create_command_window
mog_picture_gallery_create_command_window
@command_window.set_handler(:picture, method(:Picture_Gallery))
end
#------------------------------------------------------------------------------
# ● Picture Gallery
#------------------------------------------------------------------------------
def Picture_Gallery
SceneManager.call(Scene_Picture_Gallery)
end
end
end
$mog_rgss3_picture_gallery = true |
Bardzo prosiłbym o pomoc i z góry dziękuję ! ! ! !
No i przy okazji macie dwa darmowe skrypty |
________________________
|
|
|
|
Viuu
Project-Ayus
Preferowany:
Pomógł: 15 razy Dołączył: 21 Maj 2010 Posty: 106 Skąd: Gdańsk
|
Wysłany: Pią 23 Lis, 2012 03:57
|
|
|
Emm gdzie tu jest coś trudnego...
W obydwu skryptach masz coś takiego jak "Menu Command", zamiast "true" wpisz "false" -.- |
________________________
|
|
|
|
filiotef
Preferowany:
Dołączył: 08 Lip 2011 Posty: 29
|
Wysłany: Pią 23 Lis, 2012 13:39
|
|
|
Dzięki
( Napisałem, że nie znam się na skryptach ) |
________________________
|
|
|
|
Viuu
Project-Ayus
Preferowany:
Pomógł: 15 razy Dołączył: 21 Maj 2010 Posty: 106 Skąd: Gdańsk
|
Wysłany: Pią 23 Lis, 2012 14:24
|
|
|
Cytat: | ( Napisałem, że nie znam się na skryptach ) |
Do tego nie trzeba znać się na skryptach.
Przeważnie na początku skryptu (po instrukcji) masz kilka linijek prostej konfiguracji skryptu. Następnym razem przejrzyj je, a dopiero potem pytaj ^ ^ |
________________________
|
|
|
|
|
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum
|
Dodaj temat do Ulubionych Wersja do druku
|
|