| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2016-11-13 |
| 在线时间 | 135 小时 |
- 梦石
- 0
- 星屑
- 52
- 在线时间
- 135 小时
- 注册时间
- 2011-11-5
- 回帖
- 49
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 ji3rul4coco 于 2013-7-20 20:20 编辑
VA超级脚本整合(90个系统)的問題有三個,標題我有標上紅字,另兩個在腳本下面。
一、是關於怪物圖鑑系統:
1.不是很清楚怪物圖鑑系統怎麼設定「敵人類型」
2.還有,在測試時用此腳本,就會出現一個問題
不知為何,能用鍵盤左右健控制辨識度?
3.要如何設定一些怪物「不要列入圖鑑」?
要怎麼樣才能把這三個問題解決?
核心腳本如下
- module Snstar
- module EnemyList
- # 敵人類型 0 1 2 3 4
- ENEMY_TYPE = ["下級", "普通", "出色", "菁英", "未知"]
- ENEMY_TYPE_DEFAULT = 4 # 敵人的默認類型
- ENCOUNTER_PERCENT = 1 # 敵人現身所提升的辨識度
- DEFEAT_PERCENT = 5 # 敵人戰敗所提升的辨識度
- TEST_PERCENT = 5 # 測試用調整的辨識度
- INCLUDE_ALL_CATEGORY = true # 是否包含“全部”類型
- ALL_CATEGORY_TEXT = "全部" # “全部”類型的文字
- ENEMY_MORE_INFO_BUTTON = :X # 顯示敵人更多資訊的按鍵
- ENEMY_MORE_INFO = false # 是否顯示更多訊息(擴充用)
-
- DRAW_ENEMY_ICON = false # 需要使用繪製單張圖標才能使用
-
- # 敵人圖像大小限定
- ENEMY_IMAGE_MAX_WIDTH = 170 # 敵人圖像寬度限定
- ENEMY_IMAGE_MAX_HEIGHT = 192 # 敵人圖像高度限定
- ENEMY_IMAGE_FOLDER = "Graphics/EnemyImages/" # 敵人指定圖像資料夾
- ENEMY_HUE_SYNC_DB = false # 敵人指定圖像是否使用資料庫設定的色相
-
- # 文字設定
- ENEMY_LIST_COMMAND_TEXT = "怪物圖鑑" # 主選單命令用字
- ENEMY_LIST_SWITCH_ID = 0 # 主選單命令顯示的控制開關
- ENEMY_LIST_ENABLE_ID = 0 # 主選單命令有效的控制開關
-
- ENEMY_PERCENT_VOCAB = "辨識度" # 辨識度用字
- ENEMY_PERCENT_BASE_COLOR = Color.new(0, 255, 0)#Color.new(0, 0, 0)
- ENEMY_PERCENT_FILL_COLOR = Color.new(255, 255, 0)
- NO_DISPLAY_MASK = "??" # 無法顯示時的替代文字
- EST_DISPLAY_MASK = "大約是%s" # 顯示估算數值時的文字
- DROP_GOLD_VOCAB = "金錢"
- DROP_ITEM_VOCAB = "掉落物"
- FEA_WEAK_ELE_RATE = "弱點" # 屬性有效度 > 100% 的文字
- FEA_RES_ELE_RATE = "抵抗" # 屬性有效度 < 100% 的文字
- FEA_DEBUFF_RATE = "弱化屬性" # 弱化屬性的文字
- FEA_ATK_ELEMENT = "屬性" # 攻擊附帶屬性的文字
-
- # 辨識度提升數值
- PERCENTAGE_ON_ENCOUNTER = 0 # 敵人現身時提升辨識度
- PERCENTAGE_ON_DEFEAT = 5 # 敵人落敗時提升辨識度
-
- # 辨識度顯示參數數值
- NAME_DISPLAY_PERC = 1 # 名稱顯示百分比
- HP_EST_DISPLAY_PERC = 5 # HP估算顯示百分比
- HP_DISPLAY_PERC = 10 # HP顯示百分比
- MP_EST_DISPLAY_PERC = 10 # MP估算顯示百分比
- MP_DISPLAY_PERC = 15 # MP顯示百分比
- ATK_DISPLAY_PERC = 50 # 攻擊力顯示百分比
- DEF_DISPLAY_PERC = 50 # 防禦力顯示百分比
- MAT_DISPLAY_PERC = 75 # 魔法攻擊顯示百分比
- MDF_DISPLAY_PERC = 75 # 魔法防禦顯示百分比
- AGI_DISPLAY_PERC = 75 # 敏捷顯示百分比
- LUK_DISPLAY_PERC = 75 # 幸運顯示百分比
- GOLD_DISPLAY_PERC = 100 # 掉落金錢顯示百分比
- ITEM_DISPLAY_PERC = 100 # 掉落物顯示百分比
- #TYPE_BOSS
- end
- end
- class RPG::Enemy < RPG::BaseItem
- include Snstar::EnemyList
- def list_type
- self.note.split(/[\r\n]+/).each{ |line|
- if line =~ /\[(?:ltype) (\d+)\]/
- return $1 ? $1.to_i : ENEMY_TYPE_DEFAULT
- end}
- return ENEMY_TYPE_DEFAULT
- end
- def list_image
- self.note.split(/[\r\n]+/).each{ |line|
- if line =~ /\[(?:limage) (\S+)\]/
- return $1
- end}
- return nil # battler_name
- end
- def no_list?
- self.note.split(/[\r\n]+/).each{ |line|
- return true if line =~ /\[no_list\]/
- }
- return false
- end
- end
- class Game_Party < Game_Unit
- include Snstar::EnemyList
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- alias enemy_list_initialize initialize
- def initialize
- enemy_list_initialize
- @enemy_know_percentage=[]
- $data_enemies.each{ |e|
- next unless e
- set_enemy_percentage(e.id, 0)
- }
- end
- #--------------------------------------------------------------------------
- # ● 設置敵人百分比
- #--------------------------------------------------------------------------
- def set_enemy_percentage(e_id, percentage=100)
- temp_p = [[0, percentage].max ,100].min
- @enemy_know_percentage[e_id] = temp_p
- end
- #--------------------------------------------------------------------------
- # ● 獲取敵人百分比
- #--------------------------------------------------------------------------
- def enemy_percent(e_id)
- return 0 unless seen_enemy?(e_id)
- return @enemy_know_percentage[e_id]
- end
- #--------------------------------------------------------------------------
- # ● 提升敵人百分比
- #--------------------------------------------------------------------------
- def see_enemy(e_id, percentage = 1)
- temp_p = @enemy_know_percentage[e_id] + percentage
- set_enemy_percentage(e_id, temp_p)
- end
- def know_enemy(e_id)
- set_enemy_percentage(e_id, 100)
- end
- #--------------------------------------------------------------------------
- # ● 判斷是否見過敵人
- #--------------------------------------------------------------------------
- def seen_enemy?(e_id)
- return @enemy_know_percentage[e_id] > 0
- end
- #--------------------------------------------------------------------------
- # ● 判斷是否熟知敵人
- #--------------------------------------------------------------------------
- def known_enemy?(e_id, percentage=100)
- return false unless seen_enemy?(e_id)
- return enemy_percent(e_id) == percentage
- end
- #--------------------------------------------------------------------------
- # ● 戰鬥開始提升辨識度
- #--------------------------------------------------------------------------
- alias enemy_list_on_battle_start on_battle_start
- def on_battle_start
- enemy_list_on_battle_start
- $game_troop.members.each{ |m|
- e_id = m.enemy.id
- see_enemy(e_id, ENCOUNTER_PERCENT)
- }
- end
- end
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 敵人戰敗提升辨識度
- #--------------------------------------------------------------------------
- alias enemy_list_perform_collapse_effect perform_collapse_effect
- def perform_collapse_effect
- enemy_list_perform_collapse_effect
- $game_party.see_enemy(@enemy_id, Snstar::EnemyList::DEFEAT_PERCENT)
- end
- end
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ● 呼叫敵人圖鑒場景
- #--------------------------------------------------------------------------
- def call_enemy_list
- SceneManager.call(Scene_List)
- end
- #--------------------------------------------------------------------------
- # ● 提升敵人辨識度
- #--------------------------------------------------------------------------
- def gain_enemy_percentage(e_id, per)
- $game_party.see_enemy(e_id, per)
- end
- end
复制代码
二、是ace菜單
雖然她說很簡單,不過我還是不會用
請解釋一下用法
腳本如下
- #==============================================================================
- #
- # ▼ Yanfly Engine Ace - Ace Menu Engine v1.07
- # -- Last Updated: 2012.01.03
- # -- Level: Normal, Hard
- # -- Requires: n/a
- #
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["YEA-AceMenuEngine"] = true
- #==============================================================================
- # ▼ Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2012.01.03 - Compatibility Update: Ace Item Menu
- # 2012.01.01 - Compatibility Update: Kread-EX's Synthesis
- # - Compatibility Update: Kread-EX's Grathnode Install
- # - Compatibility Update: Yami's Slot Battle
- # 2011.12.23 - Script efficiency optimized.
- # 2011.12.19 - Compatibility Update: Class System
- # 2011.12.15 - Updated for better menu MP/TP gauge management.
- # 2011.12.13 - Compatibility Update: Ace Equip Engine
- # 2011.12.07 - Update to allow for switches to also hide custom commands.
- # 2011.12.06 - Started Script and Finished.
- #
- #==============================================================================
- # ▼ Introduction
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # The menu system in RPG Maker VX Ace is great. However, it lacks the user
- # customization that RPG Maker 2003 allowed. With this script, you can add,
- # remove, and rearrange menu commands as you see fit. In addition to that, you
- # can add in menu commands that lead to common events or even custom commands
- # provided through other scripts.
- #
- # This script also provides window appearance management such as setting almost
- # all command windows to be center aligned or changing the position of the
- # help window. You can also opt to show the TP Gauge in the main menu as well
- # as in the skill menu.
- #
- #==============================================================================
- # ▼ Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
- #
- # Edit the settings in the module below as you see fit.
- #
- #==============================================================================
- # ▼ Compatibility
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
- # it will run with RPG Maker VX without adjusting.
- #
- #==============================================================================
- module YEA
- module MENU
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - General Menu Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # This changes the way menus appear in your game. You can change their
- # alignment, and the location of the help window, Note that any non-Yanfly
- # Engine Ace scripts may not conform to these menu styles.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- HELP_WINDOW_LOCATION = 0 # 0-Top, 1-Middle, 2-Bottom.
- COMMAND_WINDOW_ALIGN = 1 # 0-Left, 1-Middle, 2-Right.
-
- # These settings below adjust the visual appearance of the main menu.
- # Change the settings as you see fit.
- MAIN_MENU_ALIGN = 0 # 0-Left, 1-Middle, 2-Right.
- MAIN_MENU_RIGHT = false # false-Left, true-Right.
- MAIN_MENU_ROWS = 14 # Maximum number of rows for main menu.
- DRAW_TP_GAUGE = true # If true, draws TP in the main menu.
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - Main Menu Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # These settings adjust the main menu, the order at which commands appear,
- # what text is displayed, and what the commands are linked to. Here's a
- # list of which commands do what:
- #
- # -------------------------------------------------------------------------
- # :command Description
- # -------------------------------------------------------------------------
- # :item Opens up the item menu. Default menu item.
- # :skill Opens up the skill menu. Default menu item.
- # :equip Opens up the equip menu. Default menu item.
- # :status Opens up the status menu. Default menu item.
- # :formation Lets player manage party. Default menu item.
- # :save Opens up the save menu. Default menu item.
- # :game_end Opens up the shutdown menu. Default menu item.
- #
- # :class Requires YEA - Class System
- #
- # :gogototori Requires Kread-EX's Go Go Totori! Synthesis
- # :grathnode Requires Kread-EX's Grathnote Install
- # :sslots Requires Yami's YSA - Slot Battle
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- COMMANDS =[
- :item, # Opens up the item menu. Default menu item.
- :skill, # Opens up the skill menu. Default menu item.
- :equip, # Opens up the equip menu. Default menu item.
- :class, # Requires YEA - Class System.
- :guardian,
- :formation,
- :status, # Opens up the status menu. Default menu item.
- #:formation, # Lets player manage party. Default menu item.
- :event_3, # Launches Common Event 3. Common Event Command.
- :event_4, # Launches Common Event 4. Common Event Command.
- :event_11, # Launches Common Event 13. Common Event Command.
- :event_12, # Launches Common Event 13. Common Event Command.
- :event_13, # Launches Common Event 13. Common Event Command.
- :event_14, # Launches Common Event 14. Common Event Command.
- :event_15, # Launches Common Event 15. Common Event Command.
- :event_16, # Launches Common Event 16. Common Event Command.
- :event_21, # Launches Common Event 16. Common Event Command.
- :event_22, # Launches Common Event 16. Common Event Command.
- :event_53, # Launches Common Event 16. Common Event Command.
- :event_54,
- :event_55,
- # :debug, # Opens up debug menu. Custom Command.
- :shop, # Opens up a shop to pawn items. Custom Command.
- :save, # Opens up the save menu. Default menu item.
- :game_end, # Opens up the shutdown menu. Default menu item.
- ] # Do not remove this.
-
- #--------------------------------------------------------------------------
- # - Common Event Commands -
- # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- # If you insert one of the following commands into the COMMANDS array, the
- # player can trigger a common event to launch. You can disable certain
- # commands in the menu by binding them to a switch. If you don't want to
- # disable them, set the switch to 0 and it will always be enabled. The
- # ShowSwitch will prevent a command from appear if that switch is false.
- # Set it to 0 for it to have no impact.
- #--------------------------------------------------------------------------
-
- #--------------------------------------------------------------------------
- # - Custom Commands -
- # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- # For those who use scripts that may lead to other menu scenes, use this
- # hash to manage custom commands that run specific script calls. You can
- # disable certain commands in the menu by binding them to a switch. If you
- # don't want to disable them, set the switch to 0. The ShowSwitch will
- # prevent a command from appear if that switch is false. Set it to 0 for
- # it to have no impact.
- #--------------------------------------------------------------------------
- CUSTOM_COMMANDS ={
- # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
- :debug => [ "Debug", 0, 0, :command_debug],
- :formation => ["整隊", 0, 0, :command_formation],
- :gogototori => ["Synthesis", 0, 0, :command_totori],
- :grathnode => [ "Grathnode", 0, 0, :command_install],
- :guardian => [ "御眾雇", 0, 0, :command_guardian],
- } # Do not remove this.
-
- end # MENU
- end # YEA
- #==============================================================================
- # ▼ Editting anything past this point may potentially result in causing
- # computer damage, incontinence, explosion of user's head, coma, death, and/or
- # halitosis so edit at your own risk.
- #==============================================================================
- #==============================================================================
- # ■ Window_MenuCommand
- #------------------------------------------------------------------------------
- # This class is kept towards the top of the script to provide easier access.
- #==============================================================================
- class Window_MenuCommand < Window_Command
-
- #--------------------------------------------------------------------------
- # overwrite method: make_command_list
- #--------------------------------------------------------------------------
- def make_command_list
- for command in YEA::MENU::COMMANDS
- case command
- #--- Default Commands ---
- when :item
- add_command(Vocab::item, :item, main_commands_enabled)
- when :skill
- add_command(Vocab::skill, :skill, main_commands_enabled)
- when :equip
- add_command(Vocab::equip, :equip, main_commands_enabled)
- when :status
- add_command(Vocab::status, :status, main_commands_enabled)
- when :formation
- add_formation_command
- when :save
- add_original_commands
- add_save_command
- when :game_end
- add_game_end_command
- #--- Yanfly Engine Ace Commands ---
- when :class
- next unless $imported["YEA-ClassSystem"]
- add_class_command
- #--- Imported Commands ---
- when :sslots
- next unless $imported["YSA-SlotBattle"]
- add_sslots_command
- when :grathnode
- next unless $imported["KRX-GrathnodeInstall"]
- process_custom_command(command)
- when :gogototori
- next unless $imported["KRX-AlchemicSynthesis"]
- process_custom_command(command)
- #--- Imported Commands ---
- else
- process_common_event_command(command)
- process_custom_command(command)
- end
- end
- end
-
- #--------------------------------------------------------------------------
- # new method: process_common_event_command
- #--------------------------------------------------------------------------
- def process_common_event_command(command)
- end
-
- #--------------------------------------------------------------------------
- # new method: process_custom_command
- #--------------------------------------------------------------------------
- def process_custom_command(command)
- return unless YEA::MENU::CUSTOM_COMMANDS.include?(command)
- show = YEA::MENU::CUSTOM_COMMANDS[command][2]
- continue = show <= 0 ? true : $game_switches[show]
- return unless continue
- text = YEA::MENU::CUSTOM_COMMANDS[command][0]
- switch = YEA::MENU::CUSTOM_COMMANDS[command][1]
- enabled = switch <= 0 ? true : $game_switches[switch]
- add_command(text, command, enabled)
- end
-
- end # Window_MenuCommand
- #==============================================================================
- # ■ Menu
- #==============================================================================
- module Menu
-
- #--------------------------------------------------------------------------
- # self.help_window_location
- #--------------------------------------------------------------------------
- def self.help_window_location
- return YEA::MENU::HELP_WINDOW_LOCATION
- end
-
- #--------------------------------------------------------------------------
- # self.command_window_align
- #--------------------------------------------------------------------------
- def self.command_window_align
- return YEA::MENU::COMMAND_WINDOW_ALIGN
- end
-
- #--------------------------------------------------------------------------
- # self.main_menu_align
- #--------------------------------------------------------------------------
- def self.main_menu_align
- return YEA::MENU::MAIN_MENU_ALIGN
- end
-
- #--------------------------------------------------------------------------
- # self.main_menu_right
- #--------------------------------------------------------------------------
- def self.main_menu_right
- return YEA::MENU::MAIN_MENU_RIGHT
- end
-
- end # Menu
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
-
- #--------------------------------------------------------------------------
- # new method: draw_mp?
- #--------------------------------------------------------------------------
- def draw_mp?
- return true unless draw_tp?
- for skill in skills
- next unless added_skill_types.include?(skill.stype_id)
- return true if skill.mp_cost > 0
- end
- return false
- end
-
- #--------------------------------------------------------------------------
- # new method: draw_tp?
- #--------------------------------------------------------------------------
- def draw_tp?
- return false unless $data_system.opt_display_tp
- for skill in skills
- next unless added_skill_types.include?(skill.stype_id)
- return true if skill.tp_cost > 0
- end
- return false
- end
-
- end # Game_Actor
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
-
- #--------------------------------------------------------------------------
- # overwrite method: draw_actor_simple_status
- #--------------------------------------------------------------------------
- def draw_actor_simple_status(actor, dx, dy)
- dy -= line_height / 2
- draw_actor_name(actor, dx, dy)
- draw_actor_level(actor, dx, dy + line_height * 1)
- draw_actor_icons(actor, dx, dy + line_height * 2)
- dw = contents.width - dx - 124
- draw_actor_class(actor, dx + 120, dy, dw)
- draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw)
- if YEA::MENU::DRAW_TP_GAUGE && actor.draw_tp? && !actor.draw_mp?
- draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw)
- elsif YEA::MENU::DRAW_TP_GAUGE && actor.draw_tp? && actor.draw_mp?
- if $imported["YEA-BattleEngine"]
- draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw/2 + 1)
- draw_actor_mp(actor, dx + 120 + dw/2, dy + line_height * 2, dw/2)
- else
- draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw/2 + 1)
- draw_actor_tp(actor, dx + 120 + dw/2, dy + line_height * 2, dw/2)
- end
- else
- draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw)
- end
- end
-
- end # Window_Base
- #==============================================================================
- # ■ Window_Command
- #==============================================================================
- class Window_Command < Window_Selectable
-
- #--------------------------------------------------------------------------
- # overwrite method: alignment
- #--------------------------------------------------------------------------
- def alignment
- return Menu.command_window_align
- end
-
- end # Window_Command
- #==============================================================================
- # ■ Window_MenuCommand
- #==============================================================================
- class Window_MenuCommand < Window_Command
-
- #--------------------------------------------------------------------------
- # alias method: init_command_position
- #--------------------------------------------------------------------------
- class <<self; alias init_command_position_ame init_command_position; end
- def self.init_command_position
- init_command_position_ame
- @@last_command_oy = nil
- end
-
- #--------------------------------------------------------------------------
- # overwrite method: visible_line_number
- #--------------------------------------------------------------------------
- def visible_line_number
- return [[item_max, YEA::MENU::MAIN_MENU_ROWS].min, 1].max
- end
-
- #--------------------------------------------------------------------------
- # overwrite method: alignment
- #--------------------------------------------------------------------------
- def alignment
- return Menu.main_menu_align
- end
-
- #--------------------------------------------------------------------------
- # alias method: process_ok
- #--------------------------------------------------------------------------
- alias window_menucommand_process_ok_ame process_ok
- def process_ok
- @@last_command_oy = self.oy
- window_menucommand_process_ok_ame
- end
-
- #--------------------------------------------------------------------------
- # alias method: select_last
- #--------------------------------------------------------------------------
- alias window_menucommand_select_last_ame select_last
- def select_last
- window_menucommand_select_last_ame
- self.oy = @@last_command_oy unless @@last_command_oy.nil?
- @@last_command_oy = nil
- end
-
- end # Window_MenuCommand
- #==============================================================================
- # ■ Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
-
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias scene_menu_start_ame start
- def start
- scene_menu_start_ame
- relocate_windows
- end
-
- #--------------------------------------------------------------------------
- # new method: relocate_windows
- #--------------------------------------------------------------------------
- def relocate_windows
- return unless Menu.main_menu_right
- @command_window.x = Graphics.width - @command_window.width
- @gold_window.x = Graphics.width - @gold_window.width
- @status_window.x = 0
- end
-
- def return_scene
- $game_map.autoplay
- SceneManager.return
- end
-
- end # Scene_Menu
- #==============================================================================
- # ■ Scene_Item
- #==============================================================================
- class Scene_Item < Scene_ItemBase
-
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias scene_item_start_ame start
- def start
- scene_item_start_ame
- return if $imported["YEA-ItemMenu"]
- relocate_windows
- end
-
- #--------------------------------------------------------------------------
- # new method: relocate_windows
- #--------------------------------------------------------------------------
- def relocate_windows
- case Menu.help_window_location
- when 0 # Top
- @help_window.y = 0
- @category_window.y = @help_window.height
- @item_window.y = @category_window.y + @category_window.height
- when 1 # Middle
- @category_window.y = 0
- @help_window.y = @category_window.height
- @item_window.y = @help_window.y + @help_window.height
- else # Bottom
- @category_window.y = 0
- @item_window.y = @category_window.height
- @help_window.y = @item_window.y + @item_window.height
- end
- if $imported["YEA-ItemMenu"]
- @types_window.y = @category_window.y
- @status_window.y = @category_window.y
- end
- end
-
- end # Scene_Item
- #==============================================================================
- # ■ Scene_Skill
- #==============================================================================
- class Scene_Skill < Scene_ItemBase
-
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias scene_skill_start_ame start
- def start
- scene_skill_start_ame
- relocate_windows
- end
-
- #--------------------------------------------------------------------------
- # new method: relocate_windows
- #--------------------------------------------------------------------------
- def relocate_windows
- case Menu.help_window_location
- when 0 # Top
- @help_window.y = 0
- @command_window.y = @help_window.height
- @status_window.y = @help_window.height
- @item_window.y = @status_window.y + @status_window.height
- when 1 # Middle
- @command_window.y = 0
- @status_window.y = 0
- @help_window.y = @status_window.y + @status_window.height
- @item_window.y = @help_window.y + @help_window.height
- else # Bottom
- @command_window.y = 0
- @status_window.y = 0
- @item_window.y = @status_window.y + @status_window.height
- @help_window.y = @item_window.y + @item_window.height
- end
- end
-
- end # Scene_Skill
- #==============================================================================
- # ■ Scene_Equip
- #==============================================================================
- class Scene_Equip < Scene_MenuBase
-
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias scene_equip_start_ame start
- def start
- scene_equip_start_ame
- relocate_windows
- relocate_aee_windows
- end
-
- #--------------------------------------------------------------------------
- # new method: relocate_windows
- #--------------------------------------------------------------------------
- def relocate_windows
- return if $imported["YEA-AceEquipEngine"]
- case Menu.help_window_location
- when 0 # Top
- @help_window.y = 0
- @status_window.y = @help_window.height
- @command_window.y = @help_window.height
- @slot_window.y = @command_window.y + @command_window.height
- @item_window.y = @slot_window.y + @slot_window.height
- when 1 # Middle
- @status_window.y = 0
- @command_window.y = 0
- @slot_window.y = @command_window.y + @command_window.height
- @help_window.y = @slot_window.y + @slot_window.height
- @item_window.y = @help_window.y + @help_window.height
- else # Bottom
- @status_window.y = 0
- @command_window.y = 0
- @slot_window.y = @command_window.y + @command_window.height
- @item_window.y = @slot_window.y + @slot_window.height
- @help_window.y = @item_window.y + @item_window.height
- end
- end
-
- #--------------------------------------------------------------------------
- # new method: relocate_aee_windows
- #--------------------------------------------------------------------------
- def relocate_aee_windows
- return unless $imported["YEA-AceEquipEngine"]
- case Menu.help_window_location
- when 0 # Top
- @help_window.y = 0
- @command_window.y = @help_window.height
- @slot_window.y = @command_window.y + @command_window.height
- when 1 # Middle
- @command_window.y = 0
- @help_window.y = @command_window.height
- @slot_window.y = @help_window.y + @help_window.height
- else # Bottom
- @command_window.y = 0
- @slot_window.y = @command_window.height
- @help_window.y = @slot_window.y + @slot_window.height
- end
- @actor_window.y = @command_window.y
- @item_window.y = @slot_window.y
- @status_window.y = @slot_window.y
- end
-
- end # Scene_Equip
- #==============================================================================
- # ■ Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
-
- #--------------------------------------------------------------------------
- # new method: process_common_event_commands
- #--------------------------------------------------------------------------
- def process_common_event_commands
- for command in YEA::MENU::COMMANDS
- next unless YEA::MENU::COMMON_EVENT_COMMANDS.include?(command)
- @command_window.set_handler(command, method(:command_common_event))
- end
- end
-
- #--------------------------------------------------------------------------
- # new method: command_common_event
- #--------------------------------------------------------------------------
- def command_common_event
- event_id = @command_window.current_ext
- return return_scene if event_id.nil?
- return return_scene if $data_common_events[event_id].nil?
- $game_temp.reserve_common_event(event_id)
- return_scene
- end
-
- #--------------------------------------------------------------------------
- # new method: command_debug
- #--------------------------------------------------------------------------
- def command_debug
- SceneManager.call(Scene_Debug)
- end
-
- #--------------------------------------------------------------------------
- # new method: command_shop
- #--------------------------------------------------------------------------
- def command_shop
- goods = []
- SceneManager.call(Scene_Shop)
- SceneManager.scene.prepare(goods, false)
- end
-
- #--------------------------------------------------------------------------
- # new method: command_totori
- #--------------------------------------------------------------------------
- def command_totori
- return unless $imported['KRX-AlchemicSynthesis']
- SceneManager.call(Scene_Alchemy)
- end
-
- end # Scene_Menu
- #==============================================================================
- #
- # ▼ End of File
- #
- #==============================================================================
复制代码
三、中英雙字體
我設定了,測試時還是不甩我
請解釋一下用法
腳本如下
- #encoding:utf-8
- #==============================================================================
- # ■ [PS0]雙默認字體
- # Draw_Text_DF
- #------------------------------------------------------------------------------
- # 對 Bitmap.draw_text 進行了重定義。
- #------------------------------------------------------------------------------
- # 若檢測為純中文,則使用默認字體;
- # 若檢測為純英文,則使用另一套字體。
- # 若檢測結果為中英文混雜,則逐字描繪。
- #==============================================================================
- # [更新記錄]
- # - 2012.01.27 By 各種壓力的貓君
- # * 新寫法自定義匹配更直觀;
- # * 更改一些語句的執行順序以優化效率;
- # * 重寫基礎x坐標獲取方法,以兼容非等寬字體;
- # * BUILD2: 修正基礎x坐標的一處筆誤
- # - 2012.01.26 By 各種壓力的貓君
- # * 修正居中及居右坐標計算錯誤
- # - 2012.01.25 By 各種壓力的貓君
- # * 重寫逐字描繪方法,修正當對齊方式不為0時的錯誤
- # - 2012.01.23 By 各種壓力的貓君
- # * 初版
- #------------------------------------------------------------------------------
- # [使用方法]
- # - 插入到MAIN以上即可。
- #==============================================================================
- $_PS0 = {} if $_PS0 == nil
- $_PS0["Draw_Text_DF"] = 20120127.2
- #==============================================================================
- # [PS0] 通用配置模塊
- #==============================================================================
- module PS0
- module Draw_Text_DF
-
- # 是否對str做前檢測(若設定為false則一直使用逐字描繪/兩次描繪)
- DO_PRE_CHECK = true
-
- # 默認字體(在這裡指定了就不要再在MAIN裡指定了)
- Font.default_name = "C"
-
- # 英文字體
- ENG_FONT = "E"
-
- # 作用範圍
- # 0:全部字體
- # 1:僅默認字體(即特殊指定的除外)
- DO_CHANGE = 1
-
- # 中英文混排時的描繪方式
- # 0:逐字描繪
- # 1:分段描繪
- DRAW_TYPE = 0
-
- # 自定義匹配
- # 若不需要符號請將REG2、REG3清空但保留外側半角雙引號
- REG1 = "0-9A-Za-z " # 數字、大小寫字母、半角空格
- REG2 = ";:?!@#%^&*(){}[]=-+_/|,.<>" # 一般符號
- REG3 = ""\'\$\" # 特殊符號(要在前面加"")
-
- # 生成真正的正則式(若不清楚切勿隨意修改下一行)
- REG = /[#{REG1 + (REG2+REG3).gsub!(/./) { "\" + $& }}]/
-
- end
- end
- #==============================================================================
-
- class Bitmap
- #--------------------------------------------------------------------------
- # ● Draw text
- #--------------------------------------------------------------------------
- alias old_draw_text draw_text
- def draw_text(*args)
- #--------------------------------------------------------------------------
- # 當特殊字體且設定為不對特殊字體進行替換時,直接調用原有方式
- if self.font.name != Font.default_name && PS0::Draw_Text_DF::DO_CHANGE == 1
- old_draw_text(*args)
- else
- #--------------------------------------------------------------------------
- # 記錄默認字體
- last_font_name = self.font.name
- # 獲取參數
- if args[0].is_a?(Rect)
- rect, str, align = args[0..2]
- x, y, width, height = rect.x, rect.y, rect.width, rect.height
- else
- x, y, width, height, str, align = args[0..5]
- end
- str = str.to_s
- align = 0 if align.nil?
- # 執行前檢測
- if PS0::Draw_Text_DF::DO_PRE_CHECK == true
- if str.scan(PS0::Draw_Text_DF::REG).size == 0 # 純中文
- old_draw_text(*args)
- elsif str.scan(PS0::Draw_Text_DF::REG).size == str.size # 純英文
- change_to_eng_font
- old_draw_text(*args)
- else
- case PS0::Draw_Text_DF::DRAW_TYPE
- when 0 ; draw_text_1by1(x, y, width, height, str, align)
- when 1 ; draw_text_npass(x, y, width, height, str, align)
- end
- end
- else
- case PS0::Draw_Text_DF::DRAW_TYPE
- when 0 ; draw_text_1by1(x, y, width, height, str, align)
- when 1 ; draw_text_npass(x, y, width, height, str, align)
- end
- end
- # 還原默認字體
- self.font.name = last_font_name
- end # <- 檢測特殊字體
- end
- #--------------------------------------------------------------------------
- # ○ 逐字描繪
- #--------------------------------------------------------------------------
- def draw_text_1by1(x, y, width, height, str, align)
- # 記錄默認字體
- last_font_name = self.font.name
- # 臨時變量(x坐標偏移量)
- ox = 0
- # 根據不同對齊方式計算基礎x坐標
- if align == 0 # 居左
- bx = x
- else
- # 分離兩種字體對應的str以實現非等寬字體的長度識別
- str1 = str.clone.gsub!(PS0::Draw_Text_DF::REG) { "" }
- str2 = str.clone.gsub!(/(?!#{PS0::Draw_Text_DF::REG})./) { "" }
- str_width = text_size(str1).width
- change_to_eng_font
- str_width += text_size(str2).width
- case align
- when 0 # 居左
- bx = x
- when 1 # 居中
- bx = x + (width - str_width) / 2
- when 2 # 居右
- bx = x + (width - str_width)
- end
- end
- # 給字符串結尾添加特殊符號
- str += "\P"
- # 提取單個文字
- while (!(c = str.slice!(/./m)).nil?)
- # 還原默認字體
- self.font.name = last_font_name
- # 當滿足正則匹配則替換字體
- change_to_eng_font if c.slice(PS0::Draw_Text_DF::REG)
- # 把前面的特殊符號刪去(兼容Window_Command類的矩形選框)
- if c == "\P"
- c = ""
- else
- # 調用原方法
- old_draw_text((bx + ox), y, width, height, c, 0)
- # 橫坐標偏移量
- ox += text_size(c).width
- end
- end
- end
- #--------------------------------------------------------------------------
- # ○ 變更為英文字體
- #--------------------------------------------------------------------------
- def change_to_eng_font
- self.font.name = PS0::Draw_Text_DF::ENG_FONT
- end
- end
复制代码
    |
|