Elekami Fondateur
Messages postés : 19071 Date d'inscription : 19/07/2008 Jauge LPC :
| Sujet: [XP] Menu Lun 19 Juil 2010 - 10:24 | |
| Voici un nouveau style de menu... Les images parleront mieux que moi: Auteur: Prexus Allez dans l'éditeur de script et créez un script au dessus de " Main " et nommez ce script " Advanced CMS " . - Code:
-
# Advanced CMS Menu by Prexus # Created on Monday July 4th 2005 # All Rights Reserved # Made Specially for Naramura Sensei's Battlers
class Scene_Menu def initialize(menu_index = 0) @menu_index = menu_index end def main s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "Statut" s5 = "Sauvegarder" s6 = "Quitter" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index if $game_party.actors.size == 0 @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end if $game_system.save_disabled @command_window.disable_item(4) end @command_window.x = 32 @command_window.y = 32 @command_window.z = 3005 @command_window.back_opacity = 128 @playtime_window = Window_PlayTime.new @playtime_window.x = 32 @playtime_window.y = 480-32-@playtime_window.height @playtime_window.back_opacity = 128 @playtime_window.z = 3005 @gold_window = Window_Gold.new @gold_window.x = 640-32-@gold_window.width @gold_window.y = 480-32-@gold_window.height @gold_window.back_opacity = 128 @gold_window.z = 3005 @chr_status = Window_CharacterStatus.new @chr_status.visible = false @status_window = Window_MenuStatus.new @status_window.chr_status = @chr_status Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @command_window.dispose @chr_status.dispose @status_window.dispose @gold_window.dispose @playtime_window.dispose end def update if @status_window.active and (@command_window.x != -128 or @playtime_window.x != 32-@playtime_window.width) if @command_window.x != -128 @command_window.z = 3001 @command_window.x -= 5 end if @playtime_window.x != 32-@playtime_window.width @playtime_window.x -= 5 end return end if @command_window.active and (@command_window.x != 32 or @playtime_window.x != 32) if @command_window.x != 32 @command_window.z = 3005 @command_window.x += 5 end if @playtime_window.x != 32 @playtime_window.x += 5 end return end @command_window.update @status_window.update @gold_window.update @playtime_window.update @chr_status.update if @command_window.active update_command @chr_status.visible = false return end if @status_window.active update_status @chr_status.visible = true return end end def update_command if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end if Input.trigger?(Input::C) if $game_party.actors.size == 0 and @command_window.index < 4 $game_system.se_play($data_system.buzzer_se) return end case @command_window.index when 0 $game_system.se_play($data_system.decision_se) $scene = Scene_Item.new when 1 $game_system.se_play($data_system.decision_se) @command_window.active = false @status_window.active = true @status_window.index = 0 when 2 $game_system.se_play($data_system.decision_se) @command_window.active = false @status_window.active = true @status_window.index = 0 when 3 $game_system.se_play($data_system.decision_se) @command_window.active = false @status_window.active = true @status_window.index = 0 when 4 if $game_system.save_disabled $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Scene_Save.new when 5 $game_system.se_play($data_system.decision_se) $scene = Scene_End.new end return end end def update_status if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @status_window.active = false @status_window.index = -1 return end if Input.trigger?(Input::C) case @command_window.index when 1 if $game_party.actors[@status_window.index].restriction >= 2 $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Scene_Skill.new(@status_window.index) when 2 $game_system.se_play($data_system.decision_se) $scene = Scene_Equip.new(@status_window.index) when 3 $game_system.se_play($data_system.decision_se) $scene = Scene_Status.new(@status_window.index) end return end end end
class Window_CharacterStatus < Window_Base def initialize super(480-32, 0, 192, 128) self.contents = Bitmap.new(width-32, height-32) self.contents.font.name = $fontface self.contents.font.size = $fontsize self.back_opacity = 0 self.z = 3006 end def refresh(index) self.contents.clear if index >= 0 actor = $game_party.actors[index] draw_actor_name(actor, 0, 0) draw_actor_level(actor, 0, 24) draw_actor_hp(actor, 0, 48) draw_actor_sp(actor, 0, 72) end end end
class Window_MenuStatus < Window_Base attr_reader :index attr_reader :chr_status def initialize @viewport = Viewport.new(0, 0, 640, 480) @viewport.z = 3001 super(-16, -16, 640+32, 480+32) self.contents = Bitmap.new(width-32, height-32) self.contents.font.name = $fontface self.contents.font.size = $fontsize self.active = false self.z = 3000 @index = -1 @column_max = 1 @sprites = [] refresh end def index=(index) @index = index if self.active and @chr_status != nil update_chr_status end update_cursor_rect refresh end def refresh self.contents.clear for i in 0...@sprites.size @sprites[i].dispose end @sprites = [] @item_max = $game_party.actors.size for i in 0...@item_max actor = $game_party.actors[@item_max-i-1] @sprites[@item_max-i-1] = Sprite.new(@viewport) @sprites[@item_max-i-1].bitmap = RPG::Cache.picture(actor.image_name) @sprites[@item_max-i-1].x = 560-((i+1)*120) @sprites[@item_max-i-1].y = 480-@sprites[@item_max-i-1].bitmap.height @sprites[@item_max-i-1].opacity = 255 @sprites[@item_max-i-1].z = 3004-i end end def update_cursor_rect if @index < 0 for i in 0...@sprites.size @sprites[i].opacity = 255 end else for i in 0...@sprites.size if i == @index @sprites[i].opacity = 255 @sprites[i].z += 4 else @sprites[i].opacity = 200 @sprites[i].z = 3001+i end end end end def dispose super for i in 0...@sprites.size @sprites[i].dispose end end def chr_status=(chr_status) @chr_status = chr_status if self.active and @chr_status != nil update_chr_status end end def update super if self.active and @item_max > 0 and @index >= 0 if Input.repeat?(Input::RIGHT) if Input.trigger?(Input::RIGHT) or @index < @item_max - @column_max $game_system.se_play($data_system.cursor_se) @index = (@index + @column_max) % @item_max end end if Input.repeat?(Input::LEFT) if Input.trigger?(Input::LEFT) or @index >= @column_max $game_system.se_play($data_system.cursor_se) @index = (@index - @column_max + @item_max) % @item_max end end end if self.active and @chr_status != nil update_chr_status elsif @chr_status != nil @chr_status.refresh(-1) end update_cursor_rect end def update_chr_status @chr_status.refresh(@index) end end
class Window_Base def shadow_color return Color.new(0, 0, 0, 255) end def draw_actor_name(actor, x, y) self.contents.font.color = shadow_color self.contents.draw_text(x+1, y+1, 120, 32, actor.name) self.contents.font.color = normal_color self.contents.draw_text(x, y, 120, 32, actor.name) end def draw_actor_level(actor, x, y) self.contents.font.color = shadow_color self.contents.draw_text(x+1, y+1, 32, 32, "Lv") self.contents.draw_text(x + 33, y + 1, 24, 32, actor.level.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, "Lv") self.contents.font.color = normal_color self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2) end def draw_actor_hp(actor, x, y, width = 144) self.contents.font.color = shadow_color self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.hp) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.hp) if width - 32 >= 108 hp_x = x + width - 108 flag = true elsif width - 32 >= 48 hp_x = x + width - 48 flag = false end self.contents.font.color = shadow_color self.contents.draw_text(hp_x+1, y+1, 48, 32, actor.hp.to_s, 2) self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2) if flag self.contents.font.color = shadow_color self.contents.draw_text(hp_x + 49, y+1, 12, 32, "/", 1) self.contents.draw_text(hp_x + 61, y+1, 48, 32, actor.maxhp.to_s) self.contents.font.color = normal_color self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1) self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s) end end def draw_actor_sp(actor, x, y, width = 144) self.contents.font.color = shadow_color self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.sp) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.sp) if width - 32 >= 108 sp_x = x + width - 108 flag = true elsif width - 32 >= 48 sp_x = x + width - 48 flag = false end self.contents.font.color = shadow_color self.contents.draw_text(sp_x+1, y+1, 48, 32, actor.sp.to_s, 2) self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2) if flag self.contents.font.color = shadow_color self.contents.draw_text(sp_x + 49, y+1, 12, 32, "/", 1) self.contents.draw_text(sp_x + 61, y+1, 48, 32, actor.maxsp.to_s) self.contents.font.color = normal_color self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1) self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s) end end end class Game_Actor < Game_Battler
attr_reader :image_name
def initialize(actor_id) super() setup(actor_id) @image_name = @name end end
|
|