赞 | 1 |
VIP | 38 |
好人卡 | 7 |
积分 | 3 |
经验 | 52355 |
最后登录 | 2024-11-29 |
在线时间 | 855 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 325
- 在线时间
- 855 小时
- 注册时间
- 2014-5-5
- 帖子
- 948
|
- #=========================================================
- # This is the ffx-2 Custom Menu System by Catchm.
- # It is a long script and includes many alterations and images attached to it.
- # These images can be edited, and the script can be edited, you are free to do so
- # credit to Catchm is the only thing needed.
- # this is to be copied into a new script in the script editor
- #
- # Have fun with the script!
- #=========================================================
- class Bitmap
- def draw_text_shadow_rect(rect, text, align = 0)
- self.font.size -= 2
- old_col = self.font.color.clone
- # Dark shadow
- self.font.color = Color.new(0,0,0, 255)
- draw_text(Rect.new(rect.x+1, rect.y+1, rect.width,
- rect.height), text, align)
- # Small outline
- self.font.color = Color.new(96,96,96,96)
- draw_text(Rect.new(rect.x+1, rect.y, rect.width,
- rect.height), text, align)
- draw_text(Rect.new(rect.x-1, rect.y, rect.width,
- rect.height), text, align)
- draw_text(Rect.new(rect.x, rect.y-1, rect.width,
- rect.height), text, align)
- draw_text(Rect.new(rect.x, rect.y+1, rect.width,
- rect.height), text, align)
- # Normal text
- self.font.color = old_col
- draw_text(rect, text, align)
- self.font.size += 2
- end
- def draw_text_shadow(x, y, wid, hei, text, align = 0)
- self.font.size -= 2
- old_col = self.font.color.clone
- # Dark shadow
- self.font.color = Color.new(0,0,0, 255)
- draw_text(x+1,y+1,wid,hei,text, align)
- # Small outline
- self.font.color = Color.new(96,96,96,96)
- draw_text(x+1,y,wid,hei,text, align)
- draw_text(x+2,y,wid,hei,text, align)
- draw_text(x+2,y,wid,hei,text, align)
- draw_text(x,y-1,wid,hei,text, align)
- draw_text(x,y+1,wid,hei,text, align)
- draw_text(x,y+2,wid,hei,text, align)
- # Normal
- self.font.color = old_col
- draw_text(x,y,wid,hei,text, align)
- self.font.size += 2
- end
- def draw_text_outline(x, y, wid, hei, text, align = 0)
- self.font.color = Color.new(0, 0, 0, 255)
- draw_text(x + 1,y + 1,wid,hei,text, align)
- draw_text(x + 1,y - 1,wid,hei,text, align)
- draw_text(x - 1,y - 1,wid,hei,text, align)
- draw_text(x - 1,y + 1,wid,hei,text, align)
- self.font.color = Color.new(255, 255, 255, 255)
- draw_text(x,y,wid,hei,text, align)
- end
- def draw_text_outline2(x, y, wid, hei, text, align = 0)
- self.font.color = Color.new(0, 0, 0, 255)
- draw_text(x + 1,y + 1,wid,hei,text, align)
- draw_text(x + 1,y - 1,wid,hei,text, align)
- draw_text(x - 1,y - 1,wid,hei,text, align)
- draw_text(x - 1,y + 1,wid,hei,text, align)
- self.font.color = Color.new(255, 255, 255, 200)
- draw_text(x,y,wid,hei,text, align)
- end
- def draw_text_outline3(x, y, wid, hei, text, align = 0)
- self.font.color = Color.new(0, 0, 0, 255)
- draw_text(x + 1,y + 1,wid,hei,text, align)
- draw_text(x + 1,y - 1,wid,hei,text, align)
- draw_text(x - 1,y - 1,wid,hei,text, align)
- draw_text(x - 1,y + 1,wid,hei,text, align)
- self.font.color = Color.new(192, 224, 255, 255)
- draw_text(x,y,wid,hei,text, align)
- end
- def draw_text_outline4(x, y, wid, hei, text, align = 0)
- self.font.color = Color.new(0, 0, 0, 190)
- draw_text(x + 1,y + 1,wid,hei,text, align)
- draw_text(x + 1,y - 1,wid,hei,text, align)
- draw_text(x - 1,y - 1,wid,hei,text, align)
- draw_text(x - 1,y + 1,wid,hei,text, align)
- self.font.color = Color.new(255, 255, 255, 255)
- draw_text(x,y,wid,hei,text, align)
- end
- end
- class Window_Base < Window
- #=====================================
- # Gradient Bars , thanks to Acedent Prone
- def draw_normal_barz(x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
- if type == "horizontal"
- width = length
- height = thick
- self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
- self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
- w = width * e1 / e2
- for i in 0..height
- r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
- g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
- b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
- a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
- self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
- end
- elsif type == "vertical"
- width = thick
- height = length
- self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
- self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
- h = height * e1 / e2
- for i in 0..width
- r = c1.red + (c2.red - c1.red) * (width -i)/width + 0 * i/width
- g = c1.green + (c2.green - c1.green) * (width -i)/width + 0 * i/width
- b = c1.blue + (c2.blue - c1.blue) * (width -i)/width + 0 * i/width
- a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width + 255 * i/width
- self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
- end
- end
- end
- def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
- if type == "horizontal"
- width = length
- height = thick
- self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(0, 0, 0, 255))
- self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
- w = width * e1 / e2
- for i in 0..height
- r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
- g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
- b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
- a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
- self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
- end
- elsif type == "vertical"
- width = thick
- height = length
- self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
- self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
- h = height * e1 / e2
- for i in 0..width
- r = c1.red + (c2.red - c1.red) * (width -i)/width + 0 * i/width
- g = c1.green + (c2.green - c1.green) * (width -i)/width + 0 * i/width
- b = c1.blue + (c2.blue - c1.blue) * (width -i)/width + 0 * i/width
- a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width + 255 * i/width
- self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
- end
- end
- end
- #=====================================
- # New definitions状态栏里的战斗图位置
- def draw_battlegraphic(actor, x, y)
- bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
- cw = bitmap.width
- ch = bitmap.height
- src_rect = Rect.new(0, 0, cw, ch)
- self.contents.blt(x - cw / 2, y - ch+50, bitmap, src_rect)#战斗图位置
- end
- #======================================
- def draw_actor_statuswindow(actor, x, y)
- bitmap = RPG::Cache.picture(actor.character_name, actor.character_hue)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- src_rect = Rect.new(0, 0, cw, ch)
- self.contents.blt(x - cw / 2, y - ch , bitmap, src_rect)
- end
- #=====================================
- def draw_actor_face(actor, x, y)
- face = RPG::Cache.character("Faces/" + actor.character_name, actor.character_hue)
- fw = face.width
- fh = face.height
- src_rect = Rect.new(0, 0, fw, fh)
- self.contents.blt(x - fw / 23, y - fh, face, src_rect)
- end
- #=====================================
- def draw_actor_name2(actor, x, y)
- self.contents.font.name = $fontface
- self.contents.font.color = outline_color
- self.contents.draw_text(x - 1, y - 1, 120, 32, actor.name)
- self.contents.draw_text(x + 1, y - 1, 120, 32, actor.name)
- self.contents.draw_text(x + 1, y + 1, 120, 32, actor.name)
- 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_level2(actor, x, y)
- self.contents.font.name = $fontface
- self.contents.font.color = outline_color
- self.contents.draw_text(x - 1, y - 1, 32, 32, "Lv")
- self.contents.draw_text(x - 1, y + 1, 32, 32, "Lv")
- self.contents.draw_text(x + 1, y - 1, 32, 32, "Lv")
- self.contents.draw_text(x + 1, y + 1, 32, 32, "Lv")
- self.contents.font.color = Color.new(254, 230, 159, 255)
- self.contents.draw_text(x, y, 32, 32, "Lv")
- self.contents.font.color = outline_color
- self.contents.draw_text(x + 31, y + 1, 24, 32, actor.level.to_s, 2)
- self.contents.draw_text(x + 31, y - 1, 24, 32, actor.level.to_s, 2)
- self.contents.draw_text(x + 33, y + 1, 24, 32, actor.level.to_s, 2)
- self.contents.draw_text(x + 33, y - 1, 24, 32, actor.level.to_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
- end
- #=====================================
- def draw_actor_class2(actor, x, y)
- self.contents.font.name = "Black Chancery"
- self.contents.font.color = outline_color
- self.contents.draw_text(x + 1, y + 1, 236, 32, actor.class_name)
- self.contents.draw_text(x + 1, y - 1, 236, 32, actor.class_name)
- self.contents.draw_text(x - 1, y + 1, 236, 32, actor.class_name)
- self.contents.draw_text(x - 1, y - 1, 236, 32, actor.class_name)
- self.contents.font.color = Color.new(238, 139, 254, 255)
- self.contents.draw_text(x, y, 236, 32, actor.class_name)
- end
- #======================================
- def draw_actor_hp2(actor, x, y, width = 144)
- self.contents.font.name = "Tahoma"
- # 文字列 "HP" を描画
- self.contents.font.size = 24
- self.contents.font.color = outline_color
- self.contents.draw_text(x + 1, y + 1, 32, 32, $data_system.words.hp)
- self.contents.draw_text(x + 1, y - 1, 32, 32, $data_system.words.hp)
- self.contents.draw_text(x - 1, y - 1, 32, 32, $data_system.words.hp)
- self.contents.draw_text(x - 1, y + 1, 32, 32, $data_system.words.hp)
- self.contents.font.color = Color.new(254, 238, 189, 255)
- self.contents.draw_text(x, y-5, 32, 32, $data_system.words.hp)
- # MaxHP を描画するスペースがあるか計算
- if width - 32 >= 108
- hp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- hp_x = x + width - 48
- flag = false
- end
- # HP を描画
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- self.contents.font.color = outline_color
- self.contents.draw_text(hp_x - 1, y - 1, 48, 32, actor.hp.to_s, 2)
- self.contents.draw_text(hp_x - 1, y + 1, 48, 32, actor.hp.to_s, 2)
- self.contents.draw_text(hp_x + 1, y + 1, 48, 32, actor.hp.to_s, 2)
- 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)
- # MaxHP を描画
- if flag
- self.contents.font.color = outline_color
- self.contents.draw_text(hp_x + 60 - 1, y - 1, 48, 32, actor.maxhp.to_s)
- self.contents.draw_text(hp_x + 60 - 1, y + 1, 48, 32, actor.maxhp.to_s)
- self.contents.draw_text(hp_x + 60 + 1, y - 1, 48, 32, actor.maxhp.to_s)
- self.contents.draw_text(hp_x + 60 + 1, y + 1, 48, 32, actor.maxhp.to_s)
- self.contents.draw_text(hp_x + 48 - 1, y - 1, 12, 32, "/", 1)
- self.contents.draw_text(hp_x + 48 + 1, y + 1, 12, 32, "/", 1)
- self.contents.draw_text(hp_x + 48 - 1, y + 1, 12, 32, "/", 1)
- self.contents.draw_text(hp_x + 48 + 1, y - 1, 12, 32, "/", 1)
- 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_sp2(actor, x, y, width = 144)
- self.contents.font.name = "Tahoma"
- # 文字列 "SP" を描画
- self.contents.font.size = 24
- self.contents.font.color = outline_color
- self.contents.draw_text(x + 1, y + 1, 32, 32, $data_system.words.sp)
- self.contents.draw_text(x + 1, y - 1, 32, 32, $data_system.words.sp)
- self.contents.draw_text(x - 1, y - 1, 32, 32, $data_system.words.sp)
- self.contents.draw_text(x - 1, y + 1, 32, 32, $data_system.words.sp)
- self.contents.font.color = Color.new(74, 230, 51, 225)
- self.contents.draw_text(x, y-5, 32, 32, $data_system.words.sp)
- # MaxSP を描画するスペースがあるか計算
- if width - 32 >= 108
- sp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- sp_x = x + width - 48
- flag = false
- end
- # SP を描画
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- self.contents.font.color = outline_color
- self.contents.draw_text(sp_x - 1, y - 1, 48, 32, actor.sp.to_s, 2)
- self.contents.draw_text(sp_x - 1, y + 1, 48, 32, actor.sp.to_s, 2)
- self.contents.draw_text(sp_x + 1, y - 1, 48, 32, actor.sp.to_s, 2)
- 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)
- # MaxSP を描画
- if flag
- self.contents.font.color = outline_color
- self.contents.draw_text(sp_x + 60 - 1, y - 1, 48, 32, actor.maxsp.to_s)
- self.contents.draw_text(sp_x + 60 - 1, y + 1, 48, 32, actor.maxsp.to_s)
- self.contents.draw_text(sp_x + 60 + 1, y + 1, 48, 32, actor.maxsp.to_s)
- self.contents.draw_text(sp_x + 60 + 1, y - 1, 48, 32, actor.maxsp.to_s)
- self.contents.draw_text(sp_x + 48 - 1, y - 1, 12, 32, "/", 1)
- self.contents.draw_text(sp_x + 48 - 1, y - 1, 12, 32, "/", 1)
- self.contents.draw_text(sp_x + 48 + 1, y + 1, 12, 32, "/", 1)
- self.contents.draw_text(sp_x + 48 + 1, y + 1, 12, 32, "/", 1)
- 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
- #=========================================
- def draw_actor_state2(actor, x, y, width = 120)
- self.contents.font.name = $fontface
- text = make_battler_state_text(actor, width, true)
- self.contents.font.color = outline_color
- self.contents.draw_text(x - 1, y - 1, width, 32, text)
- self.contents.draw_text(x - 1, y + 1, width, 32, text)
- self.contents.draw_text(x + 1, y + 1, width, 32, text)
- self.contents.draw_text(x + 1, y - 1, width, 32, text)
- self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
- self.contents.draw_text(x, y, width, 32, text)
- end
- #=====================================
- def draw_actor_parameter2(actor, x, y, type)
- case type
- when 0
- parameter_name = $data_system.words.atk
- parameter_value = actor.atk
- when 1
- parameter_name = $data_system.words.pdef
- parameter_value = actor.pdef
- when 2
- parameter_name = "法防"
- parameter_value = actor.mdef
- when 3
- parameter_name = $data_system.words.str
- parameter_value = actor.str
- when 4
- parameter_name = $data_system.words.dex
- parameter_value = actor.dex
- when 5
- parameter_name = $data_system.words.agi
- parameter_value = actor.agi
- when 6
- parameter_name = $data_system.words.int
- parameter_value = actor.int
- end
- self.contents.font.color = system_color
- self.contents.draw_text_outline(x, y-5, 120, 32, parameter_name)#状态里数值坐标
- self.contents.font.color = normal_color
- self.contents.draw_text_outline(x + 130, y-5, 36, 32, parameter_value.to_s, 2)
- end
- #=========================================
- def draw_item_name2(item, x, y)
- if item == nil
- self.contents.draw_text_outline(x + 28, y, 212, 32, "未装备")
- return
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.draw_text_outline(x + 28, y, 212, 32, item.name)
- end
- # New colour for outlining text - Black
- def outline_color
- return Color.new(0, 0, 0, 255)
- end
- end
- #==============================================================================
- # ■ Window_Selectable
- #------------------------------------------------------------------------------
- # カーソルの移動やスクロールの機能を持つウィンドウクラスです。
- #==============================================================================
- class Window_Itemselectable < Window_Base
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :index # カーソル位置
- attr_reader :help_window # ヘルプウィンドウ
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # x : ウィンドウの X 座標
- # y : ウィンドウの Y 座標
- # width : ウィンドウの幅
- # height : ウィンドウの高さ
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @item_max = 1
- @column_max = 1
- @index = -1
- end
- #--------------------------------------------------------------------------
- # ● カーソル位置の設定
- # index : 新しいカーソル位置
- #--------------------------------------------------------------------------
- def index=(index)
- @index = index
- # ヘルプテキストを更新 (update_help は継承先で定義される)
- if self.active and @help_window != nil
- update_help
- end
- # カーソルの矩形を更新
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # ● 行数の取得
- #--------------------------------------------------------------------------
- def row_max
- # 項目数と列数から行数を算出
- return (@item_max + @column_max - 1) / @column_max
- end
- #--------------------------------------------------------------------------
- # ● 先頭の行の取得
- #--------------------------------------------------------------------------
- def top_row
- # ウィンドウ内容の転送元 Y 座標を、1 行の高さ 32 で割る
- return self.oy / 32
- end
- #--------------------------------------------------------------------------
- # ● 先頭の行の設定
- # row : 先頭に表示する行
- #--------------------------------------------------------------------------
- def top_row=(row)
- # row が 0 未満の場合は 0 に修正
- if row < 0
- row = 0
- end
- # row が row_max - 1 超の場合は row_max - 1 に修正
- if row > row_max - 1
- row = row_max - 1
- end
- # row に 1 行の高さ 32 を掛け、ウィンドウ内容の転送元 Y 座標とする
- self.oy = row * 32
- end
- #--------------------------------------------------------------------------
- # ● 1 ページに表示できる行数の取得
- #--------------------------------------------------------------------------
- def page_row_max
- # ウィンドウの高さから、フレームの高さ 32 を引き、1 行の高さ 32 で割る
- return (self.height - 32) / 32
- end
- #--------------------------------------------------------------------------
- # ● 1 ページに表示できる項目数の取得
- #--------------------------------------------------------------------------
- def page_item_max
- # 行数 page_row_max に 列数 @column_max を掛ける
- return page_row_max * @column_max
- end
- #--------------------------------------------------------------------------
- # ● ヘルプウィンドウの設定
- # help_window : 新しいヘルプウィンドウ
- #--------------------------------------------------------------------------
- def help_window=(help_window)
- @help_window = help_window
- # ヘルプテキストを更新 (update_help は継承先で定義される)
- if self.active and @help_window != nil
- update_help
- end
- end
- #--------------------------------------------------------------------------
- # ● カーソルの矩形更新
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # カーソル位置が 0 未満の場合
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 現在の行を取得
- row = @index / @column_max
- # 現在の行が、表示されている先頭の行より前の場合
- if row < self.top_row
- # 現在の行が先頭になるようにスクロール
- self.top_row = row
- end
- # 現在の行が、表示されている最後尾の行より後ろの場合
- if row > self.top_row + (self.page_row_max - 1)
- # 現在の行が最後尾になるようにスクロール
- self.top_row = row - (self.page_row_max - 1)
- end
- # カーソルの幅を計算
- cursor_width = self.width / @column_max - 32
- # カーソルの座標を計算
- x = @index % @column_max * (cursor_width + 6) + 10
- y = @index / @column_max * 32 - self.oy
- # カーソルの矩形を更新
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- # カーソルの移動が可能な状態の場合
- if self.active and @item_max > 0 and @index >= 0
- # 方向ボタンの下が押された場合
- if Input.repeat?(Input::DOWN)
- # 列数が 1 かつ 方向ボタンの下の押下状態がリピートでない場合か、
- # またはカーソル位置が(項目数 - 列数)より前の場合
- if (@column_max == 1 and Input.trigger?(Input::DOWN)) 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::UP)
- # 列数が 1 かつ 方向ボタンの上の押下状態がリピートでない場合か、
- # またはカーソル位置が列数より後ろの場合
- if (@column_max == 1 and Input.trigger?(Input::UP)) or
- @index >= @column_max
- # カーソルを上に移動
- $game_system.se_play($data_system.cursor_se)
- @index = (@index - @column_max + @item_max) % @item_max
- end
- end
- # 方向ボタンの右が押された場合
- if Input.repeat?(Input::RIGHT)
- # 列数が 2 以上で、カーソル位置が(項目数 - 1)より前の場合
- if @column_max >= 2 and @index < @item_max - 1
- # カーソルを右に移動
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- end
- end
- # 方向ボタンの左が押された場合
- if Input.repeat?(Input::LEFT)
- # 列数が 2 以上で、カーソル位置が 0 より後ろの場合
- if @column_max >= 2 and @index > 0
- # カーソルを左に移動
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- end
- end
- # R ボタンが押された場合
- if Input.repeat?(Input::R)
- # 表示されている最後尾の行が、データ上の最後の行よりも前の場合
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- # カーソルを 1 ページ後ろに移動
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- end
- # L ボタンが押された場合
- if Input.repeat?(Input::L)
- # 表示されている先頭の行が 0 より後ろの場合
- if self.top_row > 0
- # カーソルを 1 ページ前に移動
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- # ヘルプテキストを更新 (update_help は継承先で定義される)
- if self.active and @help_window != nil
- update_help
- end
- # カーソルの矩形を更新
- update_cursor_rect
- end
- end
- #==============================================================================
- # ■ Window_Menuselectable
- #------------------------------------------------------------------------------
- # カーソルの移動やスクロールの機能を持つウィンドウクラスです。
- #==============================================================================
- class Window_Menuselectable < Window_Base
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :index # カーソル位置
- attr_reader :help_window # ヘルプウィンドウ
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # x : ウィンドウの X 座標
- # y : ウィンドウの Y 座標
- # width : ウィンドウの幅
- # height : ウィンドウの高さ
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @item_max = 1
- @column_max = 1
- @index = -1
- end
- #--------------------------------------------------------------------------
- # ● カーソル位置の設定
- # index : 新しいカーソル位置
- #--------------------------------------------------------------------------
- def index=(index)
- @index = index
- # ヘルプテキストを更新 (update_help は継承先で定義される)
- if self.active and @help_window != nil
- update_help
- end
- # カーソルの矩形を更新
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # ● 行数の取得
- #--------------------------------------------------------------------------
- def row_max
- # 項目数と列数から行数を算出
- return (@item_max + @column_max - 1) / @column_max
- end
- #--------------------------------------------------------------------------
- # ● 先頭の行の取得
- #--------------------------------------------------------------------------
- def top_row
- # ウィンドウ内容の転送元 Y 座標を、1 行の高さ 32 で割る
- return self.oy / 32
- end
- #--------------------------------------------------------------------------
- # ● 先頭の行の設定
- # row : 先頭に表示する行
- #--------------------------------------------------------------------------
- def top_row=(row)
- # row が 0 未満の場合は 0 に修正
- if row < 0
- row = 0
- end
- # row が row_max - 1 超の場合は row_max - 1 に修正
- if row > row_max - 1
- row = row_max - 1
- end
- # row に 1 行の高さ 32 を掛け、ウィンドウ内容の転送元 Y 座標とする
- self.oy = row * 32
- end
- #--------------------------------------------------------------------------
- # ● 1 ページに表示できる行数の取得
- #--------------------------------------------------------------------------
- def page_row_max
- # ウィンドウの高さから、フレームの高さ 32 を引き、1 行の高さ 32 で割る
- return (self.height - 32) / 32
- end
- #--------------------------------------------------------------------------
- # ● 1 ページに表示できる項目数の取得
- #--------------------------------------------------------------------------
- def page_item_max
- # 行数 page_row_max に 列数 @column_max を掛ける
- return page_row_max * @column_max
- end
- #--------------------------------------------------------------------------
- # ● ヘルプウィンドウの設定
- # help_window : 新しいヘルプウィンドウ
- #--------------------------------------------------------------------------
- def help_window=(help_window)
- @help_window = help_window
- # ヘルプテキストを更新 (update_help は継承先で定義される)
- if self.active and @help_window != nil
- update_help
- end
- end
- #--------------------------------------------------------------------------
- # ● カーソルの矩形更新
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # カーソル位置が 0 未満の場合
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 現在の行を取得
- row = @index / @column_max
- # 現在の行が、表示されている先頭の行より前の場合
- if row < self.top_row
- # 現在の行が先頭になるようにスクロール
- self.top_row = row
- end
- # 現在の行が、表示されている最後尾の行より後ろの場合
- if row > self.top_row + (self.page_row_max - 1)
- # 現在の行が最後尾になるようにスクロール
- self.top_row = row - (self.page_row_max - 1)
- end
- # カーソルの幅を計算
- cursor_width = self.width / @column_max - 32
- # カーソルの座標を計算
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 40 - self.oy
- # カーソルの矩形を更
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- # カーソルの移動が可能な状態の場合
- if self.active and @item_max > 0 and @index >= 0
- # 方向ボタンの下が押された場合
- if Input.repeat?(Input::DOWN)
- # 列数が 1 かつ 方向ボタンの下の押下状態がリピートでない場合か、
- # またはカーソル位置が(項目数 - 列数)より前の場合
- if (@column_max == 1 and Input.trigger?(Input::DOWN)) 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::UP)
- # 列数が 1 かつ 方向ボタンの上の押下状態がリピートでない場合か、
- # またはカーソル位置が列数より後ろの場合
- if (@column_max == 1 and Input.trigger?(Input::UP)) or
- @index >= @column_max
- # カーソルを上に移動
- $game_system.se_play($data_system.cursor_se)
- @index = (@index - @column_max + @item_max) % @item_max
- end
- end
- # 方向ボタンの右が押された場合
- if Input.repeat?(Input::RIGHT)
- # 列数が 2 以上で、カーソル位置が(項目数 - 1)より前の場合
- if @column_max >= 2 and @index < @item_max - 1
- # カーソルを右に移動
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- end
- end
- # 方向ボタンの左が押された場合
- if Input.repeat?(Input::LEFT)
- # 列数が 2 以上で、カーソル位置が 0 より後ろの場合
- if @column_max >= 2 and @index > 0
- # カーソルを左に移動
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- end
- end
- # R ボタンが押された場合
- if Input.repeat?(Input::R)
- # 表示されている最後尾の行が、データ上の最後の行よりも前の場合
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- # カーソルを 1 ページ後ろに移動
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- end
- # L ボタンが押された場合
- if Input.repeat?(Input::L)
- # 表示されている先頭の行が 0 より後ろの場合
- if self.top_row > 0
- # カーソルを 1 ページ前に移動
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- # ヘルプテキストを更新 (update_help は継承先で定義される)
- if self.active and @help_window != nil
- update_help
- end
- # カーソルの矩形を更新
- update_cursor_rect
- end
- end
- #==============================================================================
- # ■ Window_Menucommand
- #------------------------------------------------------------------------------
- # 一般的なコマンド選択を行うウィンドウです。
- #==============================================================================
- class Window_Menucommand < Window_Menuselectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # width : ウィンドウの幅
- # commands : コマンド文字列の配列
- #--------------------------------------------------------------------------
- def initialize(width, commands)
- # コマンドの個数からウィンドウの高さを算出
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index])
- end
- #--------------------------------------------------------------------------
- # ● 項目の無効化
- # index : 項目番号
- #--------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #==============================================================================
- # ■ Window_Help
- #------------------------------------------------------------------------------
- # スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
- #==============================================================================
- class Window_Menuhelp < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, - 77, 640, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 18
- self.opacity = 0
- end
- #--------------------------------------------------------------------------
- # ● テキスト設定
- # text : ウィンドウに表示する文字列
- # align : アラインメント (0..左揃え、1..中央揃え、2..右揃え)
- #--------------------------------------------------------------------------
- def set_text(text, align = 0)
- # テキストとアラインメントの少なくとも一方が前回と違っている場合
- if text != @text or align != @align
- # テキストを再描画
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
- @text = text
- @align = align
- @actor = nil
- end
- self.visible = true
- end
- #--------------------------------------------------------------------------
- # ● アクター設定
- # actor : ステータスを表示するアクター
- #--------------------------------------------------------------------------
- def set_actor(actor)
- if actor != @actor
- self.contents.clear
- draw_actor_name(actor, 4, 0)
- draw_actor_state(actor, 140, 0)
- draw_actor_hp(actor, 284, 0)
- draw_actor_sp(actor, 460, 0)
- @actor = actor
- @text = nil
- self.visible = true
- end
- end
- #--------------------------------------------------------------------------
- # ● エネミー設定
- # enemy : 名前とステートを表示するエネミー
- #--------------------------------------------------------------------------
- def set_enemy(enemy)
- text = enemy.name
- state_text = make_battler_state_text(enemy, 112, false)
- if state_text != ""
- text += " " + state_text
- end
- set_text(text, 1)
- end
- end
- #==============================================================================
- # ■ Window_Gold
- #------------------------------------------------------------------------------
- # ゴールドを表示するウィンドウです。
- #==============================================================================
- class Window_Gold < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 200, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 21
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- cx = contents.text_size("金币").width
- self.contents.font.color = outline_color
- self.contents.draw_text(60, 1, 120-cx-2, 32, $game_party.gold.to_s, 2)
- self.contents.draw_text(61, 1, 120-cx-2, 32, $game_party.gold.to_s, 2)
- self.contents.draw_text(61, 1, 120-cx-2, 32, $game_party.gold.to_s, 2)
- self.contents.draw_text(62, 1, 120-cx-2, 32, $game_party.gold.to_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(61, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
- self.contents.font.color = outline_color
- self.contents.draw_text(1, 1, cx, 32, "金币", 2)
- self.contents.draw_text(1, 1, cx, 32, "金币", 2)
- self.contents.draw_text(1, 1, cx, 32, "金币", 2)
- self.contents.draw_text(1, - 1, cx, 32, "金币", 2)
- self.contents.font.color = Color.new(254, 230, 159, 255)
- self.contents.draw_text(0, 0, cx, 32, "金币", 2)
- end
- end
- #==============================================================================
- # ■ Window_PlayTime
- #------------------------------------------------------------------------------
- # メニュー画面でプレイ時間を表示するウィンドウです。
- #==============================================================================
- class Window_PlayTime < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 200, 70)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 21
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = outline_color
- self.contents.draw_text(1, - 1, 120, 32, "时间")
- self.contents.draw_text(1, 1, 120, 32, "时间")
- self.contents.draw_text(-1, - 1, 120, 32, "时间")
- self.contents.draw_text(-1, 1, 120, 32, "时间")
- self.contents.font.color = Color.new(254, 230, 159, 255)
- self.contents.draw_text(0, 0, 120, 32, "时间")
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- text = sprintf("%02d:%02d:%02d", hour, min, sec)
- self.contents.font.color = outline_color
- self.contents.draw_text(39, - 1, 120, 32, text, 2)
- self.contents.draw_text(39, 1, 120, 32, text, 2)
- self.contents.draw_text(41, 1, 120, 32, text, 2)
- self.contents.draw_text(41, -1, 120, 32, text, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(40, 0, 120, 32, text, 2)
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- if Graphics.frame_count / Graphics.frame_rate != @total_sec
- refresh
- end
- end
- end
- #==============================================================================
- # ■ Window_MenuStatus
- #------------------------------------------------------------------------------
- # メニュー画面でパーティメンバーのステータスを表示するウィンドウです。
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 480, 430)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- refresh
- self.active = false
- self.index = -1
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- x = 100 - i * 18
- y = i * 100
- actor = $game_party.actors[i]
- draw_actor_face(actor, x - 40, y + 80)
- draw_actor_name2(actor, x + 50, y)
- draw_actor_class2(actor, x + 50, y + 50)
- draw_actor_level2(actor, x + 50, y + 25)
- draw_actor_state2(actor, x + 155, y + 50)
- draw_actor_hp2(actor, x + 140, y )
- draw_actor_sp2(actor, x + 140, y + 25)
- draw_actor_barz(actor, x + 140, y + 25, "horizontal", 130, 1, actor.hp, actor.maxhp, Color.new(254, 238, 189, 255), Color.new(182, 137, 2, 255))
- draw_actor_barz(actor, x + 140, y + 50, "horizontal", 130, 1, actor.sp, actor.maxsp, Color.new(74, 230, 51, 225), Color.new(35, 150, 19, 225))
- end
- end
- #--------------------------------------------------------------------------
- # ● カーソルの矩形更新
- #--------------------------------------------------------------------------
- def update_cursor_rect
- self.cursor_rect.empty
- end
- end
- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # アイテム画面、バトル画面で、所持アイテムの一覧を表示するウィンドウです。
- #==============================================================================
- class Window_Menuitem < Window_Itemselectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 500, 640, 380)
- @column_max = 2
- refresh
- self.index = 0
- self.opacity = 0
- # 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- # アイテムを追加
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- # 戦闘中以外なら武器と防具も追加
- unless $game_temp.in_battle
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data.push($data_weapons[i])
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- end
- # 項目数が 0 でなければビットマップを作成し、全項目を描画
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = Color.new(255, 255, 255, 200)
- end
- x = 4 + index % 2 * (270 + 25) + 12
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.draw_text_outline(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text_outline(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text_outline(x + 256, y, 24, 32, number.to_s, 2)
- else
- self.contents.draw_text_outline2(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text_outline2(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text_outline2(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_Menuskill
- #------------------------------------------------------------------------------
- #
- #==============================================================================
- class Window_Menuskill < Window_Itemselectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(- 3, 531, 640, 352)
- @actor = actor
- @column_max = 2
- refresh
- self.index = 0
- # 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # ● スキルの取得
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in [email protected]
- skill = $data_skills[@actor.skills[i]]
- if skill != nil
- @data.push(skill)
- end
- end
- # 項目数が 0 でなければビットマップを作成し、全項目を描画
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = Color.new(255, 255, 255, 200)
- end
- x = 4 + index % 2 * (270 + 25) + 12
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- if @actor.skill_can_use?(skill.id)
- self.contents.draw_text_outline(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text_outline(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- else
- self.contents.draw_text_outline2(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text_outline2(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- end
- end
- #==============================================================================
- # ■ Window_SkillStatus
- #------------------------------------------------------------------------------
- # スキル画面で、スキル使用者のステータスを表示するウィンドウです。
- #==============================================================================
- class Window_SkillStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(630, 35, 410, 109)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- self.opacity = 0
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- x = 100
- y = 0
- draw_actor_face(@actor, x - 40, y + 80)
- draw_actor_name2(@actor, x + 50, y)
- draw_actor_class2(@actor, x + 50, y + 50)
- draw_actor_level2(@actor, x + 50, y + 25)
- draw_actor_state2(@actor, x + 155, y + 50)
- draw_actor_hp2(@actor, x + 140, y )
- draw_actor_sp2(@actor, x + 140, y + 25)
- draw_actor_barz(@actor, x + 140, y + 25, "horizontal", 130, 1, @actor.hp, @actor.maxhp, Color.new(254, 238, 189, 255), Color.new(182, 137, 2, 255))
- draw_actor_barz(@actor, x + 140, y + 50, "horizontal", 130, 1, @actor.sp, @actor.maxsp, Color.new(74, 230, 51, 225), Color.new(35, 150, 19, 225))
- end
- end
- #==============================================================================
- # ■ Window_Target
- #------------------------------------------------------------------------------
- # アイテム画面とスキル画面で、使用対象のアクターを選択するウィンドウです。
- #==============================================================================
- class Window_Target < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 336, 480)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- self.z += 10
- @item_max = $game_party.actors.size
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...$game_party.actors.size
- x = 4
- y = i * 116
- actor = $game_party.actors[i]
- draw_actor_name2(actor, x, y)
- draw_actor_class2(actor, x + 144, y)
- draw_actor_level2(actor, x + 8, y + 32)
- draw_actor_state2(actor, x + 8, y + 64)
- draw_actor_hp2(actor, x + 152, y + 32)
- draw_actor_sp2(actor, x + 152, y + 64)
- draw_actor_barz(actor, x + 152, y + 57, "horizontal", 130, 1, actor.hp, actor.maxhp, Color.new(254, 238, 189, 255), Color.new(182, 137, 2, 255))
- draw_actor_barz(actor, x + 152, y + 89, "horizontal", 130, 1, actor.sp, actor.maxsp, Color.new(74, 230, 51, 225), Color.new(35, 150, 19, 225))
- end
- end
- #--------------------------------------------------------------------------
- # ● カーソルの矩形更新
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # カーソル位置 -1 は全選択、-2 以下は単独選択 (使用者自身)
- if @index <= -2
- self.cursor_rect.set(0, (@index + 10) * 116, self.width - 32, 96)
- elsif @index == -1
- self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
- else
- self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
- end
- end
- end
- #==============================================================================
- # ■ Window_EquipRight
- #------------------------------------------------------------------------------
- # 装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
- #==============================================================================
- class Window_EquipRight < Window_Menuselectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(- 100, 125, 200, 350)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- self.opacity = 0
- @actor = actor
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @data = []
- @data.push($data_weapons[@actor.weapon_id])
- @data.push($data_armors[@actor.armor1_id])
- @data.push($data_armors[@actor.armor2_id])
- @data.push($data_armors[@actor.armor3_id])
- @data.push($data_armors[@actor.armor4_id])
- @item_max = @data.size
- draw_item_name2(@data[0], 0, 68 * 0)
- draw_item_name2(@data[1], 0, 68 * 1)
- draw_item_name2(@data[2], 0, 68 * 2)
- draw_item_name2(@data[3], 0, 68 * 3)
- draw_item_name2(@data[4], 0, 68 * 4 - 2)
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_EquipItem
- #------------------------------------------------------------------------------
- # 装備画面で、装備変更の候補となるアイテムの一覧を表示するウィンドウです。
- #==============================================================================
- class Window_EquipItem < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- # equip_type : 装備部位 (0~3)
- #--------------------------------------------------------------------------
- def initialize(actor, equip_type)
- super(233, 573, 413, 224)
- @actor = actor
- @equip_type = equip_type
- @column_max = 2
- refresh
- self.active = false
- self.index = -1
- self.opacity = 0
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- # 装備可能な武器を追加
- if @equip_type == 0
- weapon_set = $data_classes[@actor.class_id].weapon_set
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
- @data.push($data_weapons[i])
- end
- end
- end
- # 装備可能な防具を追加
- if @equip_type != 0
- armor_set = $data_classes[@actor.class_id].armor_set
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0 and armor_set.include?(i)
- if $data_armors[i].kind == @equip_type-1
- @data.push($data_armors[i])
- end
- end
- end
- end
- # 空白を追加
- @data.push(nil)
- # ビットマップを作成し、全項目を描画
- @item_max = @data.size
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 22
- for i in 0...@item_max-1
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- x = 4 + index % 2 * (176 + 16)
- y = index / 2 * 32
- case item
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.color = normal_color
- self.contents.draw_text_shadow(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text_shadow(x + 140, y, 16, 32, ":", 1)
- self.contents.draw_text_shadow(x + 156, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # カーソル位置が 0 未満の場合
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 現在の行を取得
- row = @index / @column_max
- # 現在の行が、表示されている先頭の行より前の場合
- if row < self.top_row
- # 現在の行が先頭になるようにスクロール
- self.top_row = row
- end
- # 現在の行が、表示されている最後尾の行より後ろの場合
- if row > self.top_row + (self.page_row_max - 1)
- # 現在の行が最後尾になるようにスクロール
- self.top_row = row - (self.page_row_max - 1)
- end
- # カーソルの幅を計算
- cursor_width = self.width / @column_max - 32
- # カーソルの座標を計算
- x = @index % @column_max * (cursor_width + 16)
- y = @index / @column_max * 32 - self.oy
- # カーソルの矩形を更新
- self.cursor_rect.set(x + 2, y, cursor_width + 15, 32)
- end
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_Status
- #------------------------------------------------------------------------------
- # ステータス画面で表示する、フル仕様のステータスウィンドウです。
- #==============================================================================
- class Window_Status < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 0, 418, 133)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_actor_face(@actor, 0, 90)
- draw_actor_name2(@actor, 90, 0)
- draw_actor_class2(@actor, 250, 0)
- draw_actor_level2(@actor, 90, 32)
- draw_actor_state2(@actor, 90, 64)
- draw_actor_hp2(@actor, 210, 32, 172)
- draw_actor_sp2(@actor, 210, 64, 172)
- draw_actor_barz(@actor, 210, 57, "horizontal", 158, 1, @actor.hp, @actor.maxhp, Color.new(254, 238, 189, 255), Color.new(182, 137, 2, 255))
- draw_actor_barz(@actor, 210, 89, "horizontal", 158, 1, @actor.sp, @actor.maxsp, Color.new(74, 230, 51, 225), Color.new(35, 150, 19, 225))
- end
- end
- #==============================================================================
- # ■ Window_Status2
- #------------------------------------------------------------------------------
- # ステータス画面で表示する、フル仕様のステータスウィンドウです。
- #==============================================================================
- class Window_Status2 < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 0, 418, 178)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.size = 24
- draw_actor_parameter2(@actor, 0, 10, 0)
- draw_actor_parameter2(@actor, 0, 40, 1)
- draw_actor_parameter2(@actor, 0, 70, 2)
- draw_actor_parameter2(@actor, 0, 100, 3)
- draw_actor_parameter2(@actor, 190, 20, 4)
- draw_actor_parameter2(@actor, 190, 50, 5)
- draw_actor_parameter2(@actor, 190, 80, 6)
- draw_actor_barz(@actor, 0, 37, "horizontal", 168, 1, @actor.atk, 500, Color.new(242, 2, 6, 255), Color.new(253, 53, 56, 255))
- draw_actor_barz(@actor, 0, 67, "horizontal", 168, 1, @actor.pdef, 500, Color.new(228, 253, 48, 255), Color.new(238, 254, 124, 255))
- draw_actor_barz(@actor, 0, 97, "horizontal", 168, 1, @actor.mdef, 500, Color.new(229, 78, 253, 255), Color.new(237, 134, 254, 255))
- draw_actor_barz(@actor, 0, 127, "horizontal", 168, 1, @actor.str, 500, Color.new(254, 209, 154, 255), Color.new(253, 163, 53, 255))
- draw_actor_barz(@actor, 190, 47, "horizontal", 168, 1, @actor.dex, 500, Color.new(222, 222, 222, 255), Color.new(255, 255, 255, 255))
- draw_actor_barz(@actor, 190, 77, "horizontal", 168, 1, @actor.agi, 500, Color.new(8, 160, 253, 255), Color.new(119, 203, 254, 255))
- draw_actor_barz(@actor, 190, 107, "horizontal", 168, 1, @actor.int, 500, Color.new(33, 253, 86, 255), Color.new(124, 254, 155, 255))
- if @new_atk != nil
- draw_actor_barz(@actor, 0, 37, "horizontal", 168, 1, @new_atk, 500, Color.new(255, 0, 0, 255), Color.new(255, 0, 0, 255))
- end
- if @new_pdef != nil
- draw_actor_barz(@actor, 0, 67, "horizontal", 168, 1, @new_pdef, 500, Color.new(228, 253, 48, 255), Color.new(238, 254, 124, 255))
- end
- if @new_mdef != nil
- draw_actor_barz(@actor, 0, 97, "horizontal", 168, 1, @new_mdef, 500, Color.new(229, 78, 253, 255), Color.new(237, 134, 254, 255))
- end
- if @new_str != nil
- draw_actor_barz(@actor, 0, 127, "horizontal", 168, 1, @new_str, 500, Color.new(254, 209, 154, 255), Color.new(253, 163, 53, 255))
- end
- if @new_dex != nil
- draw_actor_barz(@actor, 190, 47, "horizontal", 168, 1, @new_dex, 500, Color.new(222, 222, 222, 255), Color.new(255, 255, 255, 255))
- end
- if @new_agi != nil
- draw_actor_barz(@actor, 190, 77, "horizontal", 168, 1, @new_agi, 500, Color.new(8, 160, 253, 255), Color.new(119, 203, 254, 255))
- end
- if @new_int != nil
- draw_actor_barz(@actor, 190, 107, "horizontal", 168, 1, @new_int, 500, Color.new(33, 253, 86, 255), Color.new(124, 254, 155, 255))
- end
- end
- def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
- if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or
- @new_agi != new_agi or @new_int != new_int
- @new_atk = new_atk
- @new_pdef = new_pdef
- @new_mdef = new_mdef
- @new_str = new_str
- @new_dex = new_dex
- @new_agi = new_agi
- @new_int = new_int
- refresh
- end
- end
- end
- #==============================================================================
- # ■ Window_Status3
- #------------------------------------------------------------------------------
- # ステータス画面で表示する、フル仕様のステータスウィンドウです。
- #==============================================================================
- class Window_Status3 < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 0, 418, 229)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.size = 24
- self.contents.font.color = system_color
- self.contents.draw_text_outline3(150, 0, 96, 32, "身上装备")
- draw_item_name2($data_weapons[@actor.weapon_id], 15 + 16, 48)
- draw_item_name2($data_armors[@actor.armor1_id], 15 + 16, 86)
- draw_item_name2($data_armors[@actor.armor2_id], 15 + 16, 124)
- draw_item_name2($data_armors[@actor.armor3_id], 15 + 186, 68)
- draw_item_name2($data_armors[@actor.armor4_id], 15 + 186, 106)
- end
- end
- #==============================================================================
- # ■ Window_Status4
- #------------------------------------------------------------------------------
- # ステータス画面で表示する、フル仕様のステータスウィンドウです。
- #==============================================================================
- class Window_Status4 < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 0, 252, 100)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.size = 22
- self.contents.font.color = system_color
- self.contents.draw_text_outline3(10, 0, 80, 32, "经验值")
- self.contents.draw_text_outline3(10, 32, 80, 32, "下一级")
- self.contents.font.color = normal_color
- self.contents.draw_text_outline(10 + 80, 0, 84, 32, @actor.exp_s, 2)
- self.contents.draw_text_outline(10 + 80, 32, 84, 32, @actor.next_rest_exp_s, 2)
- end
- end
- #==============================================================================
- # ■ Window_Status5
- #------------------------------------------------------------------------------
- # ステータス画面で表示する、フル仕様のステータスウィンドウです。
- #==============================================================================
- class Window_Status5 < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 0, 300, 380)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_battlegraphic(@actor, 100, 300)
- end
- end
- #==============================================================================
- # ■ Window_SaveFile
- #------------------------------------------------------------------------------
- # セーブ画面およびロード画面で表示する、セーブファイルのウィンドウです。
- #==============================================================================
- class Window_SaveFile < Window_Base
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :filename # ファイル名
- attr_reader :selected # 選択状態
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # file_index : セーブファイルのインデックス (0~3)
- # filename : ファイル名
- #--------------------------------------------------------------------------
- def initialize(file_index, filename)
- super(0, 64 + file_index % 4 * 104, 640, 104)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- self.opacity = 0
- @file_index = file_index
- @filename = "Save#{@file_index + 1}.rxdata"
- @time_stamp = Time.at(0)
- @file_exist = FileTest.exist?(@filename)
- if @file_exist
- file = File.open(@filename, "r")
- @time_stamp = file.mtime
- @characters = Marshal.load(file)
- @frame_count = Marshal.load(file)
- @game_system = Marshal.load(file)
- @game_switches = Marshal.load(file)
- @game_variables = Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- end
- refresh
- @selected = false
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- # ファイル番号を描画
- self.contents.font.color = normal_color
- name = "文件 #{@file_index + 1}"
- self.contents.draw_text_outline(4, 0, 600, 32, name)
- @name_width = contents.text_size(name).width
- # セーブファイルが存在する場合
- if @file_exist
- # キャラクターを描画
- for i in [email protected]
- bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
- cw = bitmap.rect.width / 4
- ch = bitmap.rect.height / 4
- src_rect = Rect.new(0, 0, cw, ch)
- x = 300 - @characters.size * 32 + i * 64 - cw / 2
- self.contents.blt(x, 68 - ch, bitmap, src_rect)
- end
- # プレイ時間を描画
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
- self.contents.font.color = normal_color
- self.contents.draw_text_outline(4, 8, 600, 32, time_string, 2)
- # タイムスタンプを描画
- self.contents.font.color = normal_color
- time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
- self.contents.draw_text_outline(4, 40, 600, 32, time_string, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● 選択状態の設定
- # selected : 新しい選択状態 (true=選択 false=非選択)
- #--------------------------------------------------------------------------
- def selected=(selected)
- @selected = selected
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # ● カーソルの矩形更新
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @selected
- self.cursor_rect.set(0, 0, @name_width + 8, 32)
- else
- self.cursor_rect.empty
- end
- end
- end
- #==============================================================================
- # ■ Window_Location
- #------------------------------------------------------------------------------
- # メニュー画面で歩数を表示するウィンドウです。
- class Game_Map
- def name
- $map_infos[@map_id]
- end
- end
- class Scene_Title
- $map_infos = load_data("Data/MapInfos.rxdata")
- for key in $map_infos.keys
- $map_infos[key] = $map_infos[key].name
- end
- end
- #==============================================================================
- # ■ Window_Mapname
- #------------------------------------------------------------------------------
- # メニュー画面でプレイ時間を表示するウィンドウです。
- #==============================================================================
- class Window_Mapname < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 240, 96)
- self.contents = Bitmap.new(width - 52, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- # Map Name
- #map = $game_map.name
- self.contents.font.color = system_color
- self.contents.font.size = 14
- self.contents.draw_text(4, 0, 220, 32, "现在的位置")
- self.contents.font.size = $fontsize
- self.contents.font.color = normal_color
- self.contents.draw_text(110, 15, 80, 32, $game_map.name)
- end
- end
- #==================================================
- class Window_End < Window_Base
- def initialize
- super(0, 0, 240, 150)
- self.contents = Bitmap.new(width - 52, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 30
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.draw_text_outline(24, 0, 240, 32, "返回标题")
- self.contents.draw_text_outline(10, 45, 240, 32, " 结束游戏")
- self.contents.draw_text_outline(25, 85, 240, 32, "取消")
- end
- #==========================================
- end
- #==============================================================================
- # ■ Scene_Menu
- #------------------------------------------------------------------------------
- # メニュー画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # menu_index : コマンドのカーソル初期位置
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- #========================================
- # This is setting up the background picture
- @background = Sprite.new
- @background.bitmap = RPG::Cache.picture("background")
- @background.x = 0
- @background.y = 0
- #========================================
- # This is setting up the command pictures for 'item' etc..
- @command1 = Sprite.new
- @command1.bitmap = RPG::Cache.picture("cmscommand1")
- @command1.x = 15
- @command1.y = 40
- @command1.z = 100
- #========================================
- @command2 = Sprite.new
- @command2.bitmap = RPG::Cache.picture("cmscommand2")
- @command2.x = 15
- @command2.y = 40
- @command2.z = 100
- #========================================
- @command3 = Sprite.new
- @command3.bitmap = RPG::Cache.picture("cmscommand3")
- @command3.x = 15
- @command3.y = 40
- @command3.z = 100
- #========================================
- @command4 = Sprite.new
- @command4.bitmap = RPG::Cache.picture("cmscommand4")
- @command4.x = 15
- @command4.y = 40
- @command4.z = 100
- #========================================
- @command5 = Sprite.new
- @command5.bitmap = RPG::Cache.picture("cmscommand5")
- @command5.x = 15
- @command5.y = 40
- @command5.z = 100
- #========================================
- @command6 = Sprite.new
- @command6.bitmap = RPG::Cache.picture("cmscommand6")
- @command6.x = 15
- @command6.y = 40
- @command6.z = 100
- #========================================
- # This setting up the shadows for the commands.
- @commands1 = Sprite.new
- @commands1.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands1.x = 20
- @commands1.y = 45
- @commands1.z = 1
- @commands1.opacity = 155
- @commands1.visible = false
- #========================================
- @commands2 = Sprite.new
- @commands2.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands2.x = 20
- @commands2.y = 45
- @commands2.z = 1
- @commands2.opacity = 155
- @commands2.visible = false
- #========================================
- @commands3 = Sprite.new
- @commands3.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands3.x = 20
- @commands3.y = 45
- @commands3.z = 1
- @commands3.opacity = 155
- @commands3.visible = false
- #========================================
- @commands4 = Sprite.new
- @commands4.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands4.x = 20
- @commands4.y = 45
- @commands4.z = 1
- @commands4.opacity = 155
- @commands4.visible = false
- #========================================
- @commands5 = Sprite.new
- @commands5.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands5.x = 20
- @commands5.y = 45
- @commands5.z = 1
- @commands5.opacity = 155
- @commands5.visible = false
- #========================================
- @commands6 = Sprite.new
- @commands6.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands6.x = 20
- @commands6.y = 45
- @commands6.z = 1
- @commands6.opacity = 155
- @commands6.visible = false
- #========================================
- # This is setting up the arrow cursor used in the command window..
- @arrow = Sprite.new
- @arrow.bitmap = RPG::Cache.picture("arrow4")
- @arrow.x = 18
- @arrow.y = 50
- @arrow.z = 1000
- #========================================
- # This is setting up the arrow for the status window
- @arrow_status = Sprite.new
- @arrow_status.bitmap = RPG::Cache.picture("arrow4")
- @arrow_status.x = 300
- @arrow_status.y = 30
- @arrow_status.z = 1000
- @arrow_status.visible = false
- #========================================
- # This is setting up the status windows, making them not visible for the moment..
- @status_window1 = Sprite.new
- @status_window1.bitmap = RPG::Cache.picture("status window 1")
- @status_window1.x = 690
- @status_window1.y = 5
- @status_window1.z = 100
- @status_window1.visible = false
- #========================================
- @status_window2 = Sprite.new
- @status_window2.bitmap = RPG::Cache.picture("status window 2")
- @status_window2.x = 676
- @status_window2.y = 106
- @status_window2.z = 100
- @status_window2.visible = false
- #========================================
- @status_window3 = Sprite.new
- @status_window3.bitmap = RPG::Cache.picture("status window 3")
- @status_window3.x = 659
- @status_window3.y = 206
- @status_window3.z = 100
- @status_window3.visible = false
- #========================================
- @status_window4 = Sprite.new
- @status_window4.bitmap = RPG::Cache.picture("status window 4")
- @status_window4.x = 640
- @status_window4.y = 306
- @status_window4.z = 100
- @status_window4.visible = false
- #========================================
- # The shadows are set up for the status windows..
- @status_windowshadow1 = Sprite.new
- @status_windowshadow1.bitmap = RPG::Cache.picture("blackwindow2")
- @status_windowshadow1.x = 697
- @status_windowshadow1.y = 13
- @status_windowshadow1.z = 1
- @status_windowshadow1.opacity = 155
- @status_windowshadow1.visible = false
- #========================================
- @status_windowshadow2 = Sprite.new
- @status_windowshadow2.bitmap = RPG::Cache.picture("blackwindow2")
- @status_windowshadow2.x = 681
- @status_windowshadow2.y = 112
- @status_windowshadow2.z = 1
- @status_windowshadow2.opacity = 155
- @status_windowshadow2.visible = false
- #========================================
- @status_windowshadow3 = Sprite.new
- @status_windowshadow3.bitmap = RPG::Cache.picture("blackwindow2")
- @status_windowshadow3.x = 664
- @status_windowshadow3.y = 212
- @status_windowshadow3.z = 1
- @status_windowshadow3.opacity = 155
- @status_windowshadow3.visible = false
- #========================================
- @status_windowshadow4 = Sprite.new
- @status_windowshadow4.bitmap = RPG::Cache.picture("blackwindow2")
- @status_windowshadow4.x = 645
- @status_windowshadow4.y = 312
- @status_windowshadow4.z = 1
- @status_windowshadow4.opacity = 155
- @status_windowshadow4.visible = false
- #========================================
- # Here, certain status window pictures are made visible depending on
- # how many actors or players there are..
- if $game_party.actors.size == 1
- @status_window1.visible = true
- @status_windowshadow1.visible = true
- end
- if $game_party.actors.size == 2
- @status_window1.visible = true
- @status_windowshadow1.visible = true
- @status_window2.visible = true
- @status_windowshadow2.visible = true
- end
- if $game_party.actors.size == 3
- @status_window1.visible = true
- @status_windowshadow1.visible = true
- @status_window2.visible = true
- @status_windowshadow2.visible = true
- @status_window3.visible = true
- @status_windowshadow3.visible = true
- end
- if $game_party.actors.size == 4
- @status_window1.visible = true
- @status_windowshadow1.visible = true
- @status_window2.visible = true
- @status_windowshadow2.visible = true
- @status_window3.visible = true
- @status_windowshadow3.visible = true
- @status_window4.visible = true
- @status_windowshadow4.visible = true
- end
- #===========================================
- # The window displaying the gold, and playtime is set up...
- @playtimegoldpicture = Sprite.new
- @playtimegoldpicture.bitmap = RPG::Cache.picture("goldplaytimewindow")
- @playtimegoldpicture.x = 646
- @playtimegoldpicture.y = 404
- @playtimegoldpicture.z = 100
- #============================================
- # And its shadow
- @playtimegoldshadow = Sprite.new
- @playtimegoldshadow.bitmap = RPG::Cache.picture("goldplaytimeshadow")
- @playtimegoldshadow.x = 651
- @playtimegoldshadow.y = 409
- @playtimegoldshadow.z = 1
- @playtimegoldshadow.opacity = 155
- #============================================
- # Setting up the location window's bar....
- @location_bar = Sprite.new
- @location_bar.bitmap = RPG::Cache.picture("locationbar")
- @location_bar.x = 15
- @location_bar.y = 635
- #============================================
- # Setting up the actual window for the map, opacity - 0
- @location_window = Window_Mapname.new
- @location_window.x = 0
- @location_window.y = 609
- #============================================
- # Setting up a white bar below the location
- @location_white = Sprite.new
- @location_white.bitmap = RPG::Cache.picture("locationwhite")
- @location_white.x = - 8
- @location_white.y = 622
- @location_white.z = 120
- #============================================
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 645
- @playtime_window.y = 390
- # コマンドウィンドウを作成
- # Command window, opacity - 0 so it is invisible, and commands are set to ""
- # - nothing so no text shows, as there is pictures used instead..
- s1 = ""
- s2 = ""
- s3 = ""
- s4 = ""
- s5 = ""
- s6 = ""
- @command_window = Window_Menucommand.new(200, [s1, s2, s3, s4, s5, s6])
- @command_window.opacity = 0
- @command_window.index = @menu_index
- # パーティ人数が 0 人の場合
- 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
- # ゴールドウィンドウを作成
- @gold_window = Window_Gold.new
- @gold_window.x = 645
- @gold_window.y = 415
- @gold_window.opacity = 0
- # ステータスウィンドウを作成
- @status_window = Window_MenuStatus.new
- @status_window.x = 630
- @status_window.y = - 6
- @status_window.opacity = 0
- @status_window.visible = true
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @command_window.dispose
- @gold_window.dispose
- @status_window.dispose
- @background.dispose
- @command1.dispose
- @command2.dispose
- @command3.dispose
- @command4.dispose
- @command5.dispose
- @command6.dispose
- @commands1.dispose
- @commands2.dispose
- @commands3.dispose
- @commands4.dispose
- @commands5.dispose
- @commands6.dispose
- @arrow.dispose
- @status_window1.dispose
- @status_window2.dispose
- @status_window3.dispose
- @status_window4.dispose
- @status_windowshadow1.dispose
- @status_windowshadow2.dispose
- @status_windowshadow3.dispose
- @status_windowshadow4.dispose
- @playtimegoldpicture.dispose
- @playtimegoldshadow.dispose
- @location_bar.dispose
- @location_window.dispose
- @location_white.dispose
- @playtime_window.dispose
- @arrow_status.dispose
- end
- #--------------------------------------------------------------------------
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- if @command2.y < 100
- @command2.y += 20
- end
- if @command3.y < 160
- @command3.y += 20
- end
- if @command4.y < 220
- @command4.y += 20
- end
- if @command5.y < 280
- @command5.y += 20
- end
- if @command6.y < 340
- @command6.y += 20
- end
- if @command6.y >= 340
- @commands1.visible = true
- @commands2.visible = true
- @commands3.visible = true
- @commands4.visible = true
- @commands5.visible = true
- @commands6.visible = true
- end
- if @status_window1.x > 293
- @status_window1.x -= 50
- end
- if @status_window2.x > 276
- @status_window2.x -= 50
- end
- if @status_window3.x > 259
- @status_window3.x -= 50
- end
- if @status_window4.x > 240
- @status_window4.x -= 50
- end
- if @status_windowshadow1.x > 297
- @status_windowshadow1.x -= 50
- end
- if @status_windowshadow2.x > 281
- @status_windowshadow2.x -= 50
- end
- if @status_windowshadow3.x > 264
- @status_windowshadow3.x -= 50
- end
- if @status_windowshadow4.x > 245
- @status_windowshadow4.x -= 50
- end
- if @status_window.x > 230
- @status_window.x -= 50
- end
- if @playtimegoldpicture.x > 446
- @playtimegoldpicture.x -= 25
- end
- if @playtimegoldshadow.x > 451
- @playtimegoldshadow.x -= 25
- end
- if @playtime_window.x > 445
- @playtime_window.x -= 25
- end
- if @gold_window.x > 445
- @gold_window.x -= 25
- end
- if @location_bar.y > 435
- @location_bar.y -= 25
- end
- if @location_window.y > 409
- @location_window.y -= 25
- end
- if @location_white.y > 422
- @location_white.y -= 25
- end
- # ウィンドウを更新
- @command_window.update
- @playtime_window.update
- @gold_window.update
- @status_window.update
- @arrow.update
- @playtime_window.update
- # コマンドウィンドウがアクティブの場合: update_command を呼ぶ
- if @command_window.active
- update_command
- return
- end
- # ステータスウィンドウがアクティブの場合: update_status を呼ぶ
- if @status_window.active
- update_status
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_command
- case @command_window.index
- when 0
- @arrow.y = 45
- @commands1.y = 45
- @commands2.y = 105
- @commands3.y = 165
- @commands4.y = 225
- @commands5.y = 285
- @commands6.y = 345
- @status_windowshadow1.y = 13
- @status_windowshadow2.y = 112
- @status_windowshadow3.y = 212
- @status_windowshadow4.y = 312
- @playtimegoldshadow.y = 409
- when 1
- @arrow.y = 105
- @commands1.y = 42
- @commands2.y = 100
- @commands3.y = 162
- @commands4.y = 222
- @commands5.y = 282
- @commands6.y = 342
- @status_windowshadow1.y = 11
- @status_windowshadow2.y = 110
- @status_windowshadow3.y = 210
- @status_windowshadow4.y = 310
- @playtimegoldshadow.y = 406
- when 2
- @arrow.y = 165
- @commands1.y = 39
- @commands2.y = 97
- @commands3.y = 159
- @commands4.y = 219
- @commands5.y = 279
- @commands6.y = 339
- @status_windowshadow1.y = 8
- @status_windowshadow2.y = 107
- @status_windowshadow3.y = 207
- @status_windowshadow4.y = 307
- @playtimegoldshadow.y = 403
- when 3
- @arrow.y = 225
- @commands1.y = 36
- @commands2.y = 94
- @commands3.y = 156
- @commands4.y = 216
- @commands5.y = 276
- @commands6.y = 336
- @status_windowshadow1.y = 5
- @status_windowshadow2.y = 104
- @status_windowshadow3.y = 204
- @status_windowshadow4.y = 304
- @playtimegoldshadow.y = 400
- when 4
- @arrow.y = 285
- @commands1.y = 33
- @commands2.y = 91
- @commands3.y = 153
- @commands4.y = 213
- @commands5.y = 273
- @commands6.y = 333
- @status_windowshadow1.y = 2
- @status_windowshadow2.y = 101
- @status_windowshadow3.y = 201
- @status_windowshadow4.y = 301
- @playtimegoldshadow.y = 397
- when 5
- @arrow.y = 345
- @commands1.y = 30
- @commands2.y = 88
- @commands3.y = 150
- @commands4.y = 210
- @commands5.y = 270
- @commands6.y = 330
- @status_windowshadow1.y = - 1
- @status_windowshadow2.y = 99
- @status_windowshadow3.y = 199
- @status_windowshadow4.y = 299
- @playtimegoldshadow.y = 394
- end
- #======================
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- @arrow.visible = false
- loop do
- if @command1.x > - 200
- @command1.x -= 40
- end
- if @command2.x > - 200
- @command2.x -= 40
- end
- if @command3.x > - 200
- @command3.x -= 40
- end
- if @command4.x > - 200
- @command4.x -= 40
- end
- if @command5.x > - 200
- @command5.x -= 40
- end
- if @command6.x > - 200
- @command6.x -= 40
- end
- @commands1.visible = false
- @commands2.visible = false
- @commands3.visible = false
- @commands4.visible = false
- @commands5.visible = false
- @commands6.visible = false
- if @status_window1.x < 640
- @status_window1.x += 50
- end
- if @status_window2.x < 640
- @status_window2.x += 50
- end
- if @status_window3.x < 640
- @status_window3.x += 50
- end
- if @status_window4.x < 640
- @status_window4.x += 50
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 50
- end
- if @status_windowshadow2.x < 640
- @status_windowshadow2.x += 50
- end
- if @status_windowshadow3.x < 640
- @status_windowshadow3.x += 50
- end
- if @status_windowshadow4.x < 640
- @status_windowshadow4.x += 50
- end
- if @status_window.x < 640
- @status_window.x += 50
- end
- if @playtimegoldpicture.x < 640
- @playtimegoldpicture.x += 25
- end
- if @playtimegoldshadow.x < 640
- @playtimegoldshadow.x += 25
- end
- if @playtime_window.x < 640
- @playtime_window.x += 25
- end
- if @gold_window.x < 640
- @gold_window.x += 25
- end
- if @location_bar.y < 480
- @location_bar.y += 25
- end
- if @location_window.y < 480
- @location_window.y += 25
- end
- if @location_white.y < 480
- @location_white.y += 25
- end
- delay(0.1)
- if @status_window.x >= 640
- break
- end
- end
- $game_system.se_play($data_system.cancel_se)
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
- if $game_party.actors.size == 0 and @command_window.index < 4
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # コマンドウィンドウのカーソル位置で分岐
- case @command_window.index
- when 0 # アイテム
- @command1.z = 999
- loop do
- if @status_window.x < 640
- @status_window.x += 50
- end
- if @status_window1.x < 640
- @status_window1.x += 50
- end
- if @status_window2.x < 640
- @status_window2.x += 50
- end
- if @status_window3.x < 640
- @status_window3.x += 50
- end
- if @status_window4.x < 640
- @status_window4.x += 50
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 50
- end
- if @status_windowshadow2.x < 640
- @status_windowshadow2.x += 50
- end
- if @status_windowshadow3.x < 640
- @status_windowshadow3.x += 50
- end
- if @status_windowshadow4.x < 640
- @status_windowshadow4.x += 50
- end
- if @playtimegoldpicture.x < 640
- @playtimegoldpicture.x += 50
- end
- if @playtimegoldshadow.x < 640
- @playtimegoldshadow.x += 50
- end
- if @gold_window.x < 640
- @gold_window.x += 50
- end
- if @playtime_window.x < 640
- @playtime_window.x += 50
- end
- if @command2.y > 40
- @command2.y -= 30
- end
- if @command3.y > 40
- @command3.y -= 30
- end
- if @command4.y > 40
- @command4.y -= 30
- end
- if @command5.y > 40
- @command5.y -= 30
- end
- if @command6.y > 40
- @command6.y -= 30
- end
- @commands2.visible = false
- @commands3.visible = false
- @commands4.visible = false
- @commands5.visible = false
- @commands6.visible = false
- @arrow.visible = false
- if @location_bar.y < 480
- @location_bar.y += 30
- end
- if @location_white.y < 480
- @location_white.y += 30
- end
- if @location_window.y < 480
- @location_window.y += 30
- end
- delay(0.1)
- if @command6.y <= 40
- break
- end
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # アイテム画面に切り替え
- $scene = Scene_Item.new
- when 1 # スキル
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # ステータスウィンドウをアクティブにする
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- @arrow_status.visible = true
- when 2 # 装備
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # ステータスウィンドウをアクティブにする
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- @arrow_status.visible = true
- when 3 # ステータス
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # ステータスウィンドウをアクティブにする
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- @arrow_status.visible = true
- when 4 # セーブ
- # セーブ禁止の場合
- if $game_system.save_disabled
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- #=====================
- @command5.z = 999
- loop do
- if @status_window.x < 640
- @status_window.x += 50
- end
- if @status_window1.x < 640
- @status_window1.x += 50
- end
- if @status_window2.x < 640
- @status_window2.x += 50
- end
- if @status_window3.x < 640
- @status_window3.x += 50
- end
- if @status_window4.x < 640
- @status_window4.x += 50
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 50
- end
- if @status_windowshadow2.x < 640
- @status_windowshadow2.x += 50
- end
- if @status_windowshadow3.x < 640
- @status_windowshadow3.x += 50
- end
- if @status_windowshadow4.x < 640
- @status_windowshadow4.x += 50
- end
- if @playtimegoldpicture.x < 640
- @playtimegoldpicture.x += 50
- end
- if @playtimegoldshadow.x < 640
- @playtimegoldshadow.x += 50
- end
- if @gold_window.x < 640
- @gold_window.x += 50
- end
- if @playtime_window.x < 640
- @playtime_window.x += 50
- end
- if @command2.y > 40
- @command2.y -= 30
- end
- if @command3.y > 40
- @command3.y -= 30
- end
- if @command4.y > 40
- @command4.y -= 30
- end
- if @command5.y > 40
- @command5.y -= 30
- end
- if @command6.y > 40
- @command6.y -= 30
- end
- @commands2.visible = false
- @commands3.visible = false
- @commands4.visible = false
- @commands5.visible = false
- @commands6.visible = false
- @arrow.visible = false
- if @location_bar.y < 480
- @location_bar.y += 30
- end
- if @location_white.y < 480
- @location_white.y += 30
- end
- if @location_window.y < 480
- @location_window.y += 30
- end
- delay(0.1)
- if @command6.y <= 40
- break
- end
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # セーブ画面に切り替え
- $scene = Scene_Save.new
- when 5 # ゲーム終了
- @command6.z = 999
- loop do
- if @status_window.x < 640
- @status_window.x += 50
- end
- if @status_window1.x < 640
- @status_window1.x += 50
- end
- if @status_window2.x < 640
- @status_window2.x += 50
- end
- if @status_window3.x < 640
- @status_window3.x += 50
- end
- if @status_window4.x < 640
- @status_window4.x += 50
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 50
- end
- if @status_windowshadow2.x < 640
- @status_windowshadow2.x += 50
- end
- if @status_windowshadow3.x < 640
- @status_windowshadow3.x += 50
- end
- if @status_windowshadow4.x < 640
- @status_windowshadow4.x += 50
- end
- if @playtimegoldpicture.x < 640
- @playtimegoldpicture.x += 50
- end
- if @playtimegoldshadow.x < 640
- @playtimegoldshadow.x += 50
- end
- if @gold_window.x < 640
- @gold_window.x += 50
- end
- if @playtime_window.x < 640
- @playtime_window.x += 50
- end
- if @command2.y > 40
- @command2.y -= 30
- end
- if @command3.y > 40
- @command3.y -= 30
- end
- if @command4.y > 40
- @command4.y -= 30
- end
- if @command5.y > 40
- @command5.y -= 30
- end
- if @command6.y > 40
- @command6.y -= 30
- end
- @commands2.visible = false
- @commands3.visible = false
- @commands4.visible = false
- @commands5.visible = false
- @commands6.visible = false
- @arrow.visible = false
- if @location_bar.y < 480
- @location_bar.y += 30
- end
- if @location_white.y < 480
- @location_white.y += 30
- end
- if @location_window.y < 480
- @location_window.y += 30
- end
- delay(0.1)
- if @command6.y <= 40
- break
- end
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # ゲーム終了画面に切り替え
- $scene = Scene_End.new
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (ステータスウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_status
- case @command_window.index
- when 1
- @arrow.y = 105
- @commands1.y = 42
- @commands2.y = 100
- @commands3.y = 162
- @commands4.y = 222
- @commands5.y = 282
- @commands6.y = 342
- @status_windowshadow1.y = 11
- @status_windowshadow2.y = 110
- @status_windowshadow3.y = 210
- @status_windowshadow4.y = 310
- @playtimegoldshadow.y = 406
- when 2
- @arrow.y = 165
- @commands1.y = 39
- @commands2.y = 97
- @commands3.y = 159
- @commands4.y = 219
- @commands5.y = 279
- @commands6.y = 339
- @status_windowshadow1.y = 8
- @status_windowshadow2.y = 107
- @status_windowshadow3.y = 207
- @status_windowshadow4.y = 307
- @playtimegoldshadow.y = 403
- when 3
- @arrow.y = 225
- @commands1.y = 36
- @commands2.y = 94
- @commands3.y = 156
- @commands4.y = 216
- @commands5.y = 276
- @commands6.y = 336
- @status_windowshadow1.y = 5
- @status_windowshadow2.y = 104
- @status_windowshadow3.y = 204
- @status_windowshadow4.y = 304
- @playtimegoldshadow.y = 400
- end
- #========================
- case @status_window.index
- when 0
- @arrow_status.y = 37
- @arrow_status.x = 260
- when 1
- @arrow_status.y = 137
- @arrow_status.x = 265 - @status_window.index * 25
- when 2
- @arrow_status.y = 237
- @arrow_status.x = 265 - @status_window.index * 25
- when 3
- @arrow_status.y = 337
- @arrow_status.x = 265 - @status_window.index * 23
- end
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # コマンドウィンドウをアクティブにする
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- @arrow_status.visible = false
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # コマンドウィンドウのカーソル位置で分岐
- case @command_window.index
- when 1 # スキル
- # このアクターの行動制限が 2 以上の場合
- if $game_party.actors[@status_window.index].restriction >= 2
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @command2.z = 999
- loop do
- if @status_window.x < 640
- @status_window.x += 50
- end
- if @status_window1.x < 640
- @status_window1.x += 50
- end
- if @status_window2.x < 640
- @status_window2.x += 50
- end
- if @status_window3.x < 640
- @status_window3.x += 50
- end
- if @status_window4.x < 640
- @status_window4.x += 50
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 50
- end
- if @status_windowshadow2.x < 640
- @status_windowshadow2.x += 50
- end
- if @status_windowshadow3.x < 640
- @status_windowshadow3.x += 50
- end
- if @status_windowshadow4.x < 640
- @status_windowshadow4.x += 50
- end
- if @playtimegoldpicture.x < 640
- @playtimegoldpicture.x += 50
- end
- if @playtimegoldshadow.x < 640
- @playtimegoldshadow.x += 50
- end
- if @gold_window.x < 640
- @gold_window.x += 50
- end
- if @playtime_window.x < 640
- @playtime_window.x += 50
- end
- if @command2.y > 40
- @command2.y -= 30
- end
- if @command3.y > 40
- @command3.y -= 30
- end
- if @command4.y > 40
- @command4.y -= 30
- end
- if @command5.y > 40
- @command5.y -= 30
- end
- if @command6.y > 40
- @command6.y -= 30
- end
- @commands2.visible = false
- @commands3.visible = false
- @commands4.visible = false
- @commands5.visible = false
- @commands6.visible = false
- @arrow.visible = false
- @arrow_status.visible = false
- if @location_bar.y < 480
- @location_bar.y += 30
- end
- if @location_white.y < 480
- @location_white.y += 30
- end
- if @location_window.y < 480
- @location_window.y += 30
- end
- delay(0.1)
- if @command6.y <= 40
- break
- end
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # スキル画面に切り替え
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # 装備
- @command3.z = 999
- loop do
- if @status_window.x < 640
- @status_window.x += 50
- end
- if @status_window1.x < 640
- @status_window1.x += 50
- end
- if @status_window2.x < 640
- @status_window2.x += 50
- end
- if @status_window3.x < 640
- @status_window3.x += 50
- end
- if @status_window4.x < 640
- @status_window4.x += 50
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 50
- end
- if @status_windowshadow2.x < 640
- @status_windowshadow2.x += 50
- end
- if @status_windowshadow3.x < 640
- @status_windowshadow3.x += 50
- end
- if @status_windowshadow4.x < 640
- @status_windowshadow4.x += 50
- end
- if @playtimegoldpicture.x < 640
- @playtimegoldpicture.x += 50
- end
- if @playtimegoldshadow.x < 640
- @playtimegoldshadow.x += 50
- end
- if @gold_window.x < 640
- @gold_window.x += 50
- end
- if @playtime_window.x < 640
- @playtime_window.x += 50
- end
- if @command2.y > 40
- @command2.y -= 30
- end
- if @command3.y > 40
- @command3.y -= 30
- end
- if @command4.y > 40
- @command4.y -= 30
- end
- if @command5.y > 40
- @command5.y -= 30
- end
- if @command6.y > 40
- @command6.y -= 30
- end
- @commands2.visible = false
- @commands3.visible = false
- @commands4.visible = false
- @commands5.visible = false
- @commands6.visible = false
- @arrow.visible = false
- @arrow_status.visible = false
- if @location_bar.y < 480
- @location_bar.y += 30
- end
- if @location_white.y < 480
- @location_white.y += 30
- end
- if @location_window.y < 480
- @location_window.y += 30
- end
- delay(0.1)
- if @command6.y <= 40
- break
- end
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # 装備画面に切り替え
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # ステータス
- @command4.z = 999
- loop do
- if @status_window.x < 640
- @status_window.x += 50
- end
- if @status_window1.x < 640
- @status_window1.x += 50
- end
- if @status_window2.x < 640
- @status_window2.x += 50
- end
- if @status_window3.x < 640
- @status_window3.x += 50
- end
- if @status_window4.x < 640
- @status_window4.x += 50
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 50
- end
- if @status_windowshadow2.x < 640
- @status_windowshadow2.x += 50
- end
- if @status_windowshadow3.x < 640
- @status_windowshadow3.x += 50
- end
- if @status_windowshadow4.x < 640
- @status_windowshadow4.x += 50
- end
- if @playtimegoldpicture.x < 640
- @playtimegoldpicture.x += 50
- end
- if @playtimegoldshadow.x < 640
- @playtimegoldshadow.x += 50
- end
- if @gold_window.x < 640
- @gold_window.x += 50
- end
- if @playtime_window.x < 640
- @playtime_window.x += 50
- end
- if @command2.y > 40
- @command2.y -= 30
- end
- if @command3.y > 40
- @command3.y -= 30
- end
- if @command4.y > 40
- @command4.y -= 30
- end
- if @command5.y > 40
- @command5.y -= 30
- end
- if @command6.y > 40
- @command6.y -= 30
- end
- @commands2.visible = false
- @commands3.visible = false
- @commands4.visible = false
- @commands5.visible = false
- @commands6.visible = false
- @arrow.visible = false
- @arrow_status.visible = false
- if @location_bar.y < 480
- @location_bar.y += 30
- end
- if @location_white.y < 480
- @location_white.y += 30
- end
- if @location_window.y < 480
- @location_window.y += 30
- end
- delay(0.1)
- if @command6.y <= 40
- break
- end
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # ステータス画面に切り替え
- $scene = Scene_Status.new(@status_window.index)
- end
- return
- end
- end
- end
- #==============================================================================
- # ■ Scene_Item
- #------------------------------------------------------------------------------
- # アイテム画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Item
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- #==============================================
- # Setting up all the images
- @background = Sprite.new
- @background.bitmap = RPG::Cache.picture("background")
- @background.x = 0
- @background.y = 0
- #================help window pic====================
- @help_picture = Sprite.new
- @help_picture.bitmap = RPG::Cache.picture("helpwindow12")
- @help_picture.x = 0
- @help_picture.y = - 52
- #=================Command=======================
- @command1 = Sprite.new
- @command1.bitmap = RPG::Cache.picture("cmscommand1")
- @command1.x = 15
- @command1.y = 40
- @command1.z = 100
- #=====================shadow=======================
- @commands1 = Sprite.new
- @commands1.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands1.x = 20
- @commands1.y = 45
- @commands1.z = 1
- @commands1.opacity = 155
- #===================item window======================
- @item_picture = Sprite.new
- @item_picture.bitmap = RPG::Cache.picture("itemwindow")
- @item_picture.x = 7
- @item_picture.y = 509
- @item_picture.z = 11
- #===============================================
- @item_shadow = Sprite.new
- @item_shadow.bitmap = RPG::Cache.picture("itemshadow")
- @item_shadow.x = 12
- @item_shadow.y = 514
- @item_shadow.z = 1
- @item_shadow.opacity = 155
- #===============================================
- @help_window = Window_Menuhelp.new
- @item_window = Window_Menuitem.new
- @item_window.z = 100
- @item_window.help_window = @help_window
- # ターゲットウィンドウを作成 (不可視・非アクティブに設定)
- @target_picture = Sprite.new
- @target_picture.bitmap = RPG::Cache.picture("targetwindow")
- @target_picture.z = 998
- @target_picture.visible = false
- @target_window = Window_Target.new
- @target_window.z = 999
- @target_window.opacity = 0
- @target_window.visible = false
- @target_window.active = false
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @help_window.dispose
- @item_window.dispose
- @target_window.dispose
- @background.dispose
- @command1.dispose
- @commands1.dispose
- @help_picture.dispose
- @item_shadow.dispose
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # ウィンドウを更新
- @help_window.update
- @item_window.update
- @target_window.update
- @command1.update
- # enter animation
- if @item_shadow.y > 114
- @item_shadow.y -= 50
- end
- if @item_picture.y > 109
- @item_picture.y -= 50
- end
- if @item_window.y > 100
- @item_window.y -= 50
- end
- if @help_picture.y < - 4
- @help_picture.y += 24
- end
- if @help_window.y < - 7
- @help_window.y += 35
- end
- if @command1.x < 215
- @command1.x += 100
- end
- if @command1.y < 50
- @command1.y += 5
- end
- if @commands1.x < 220
- @commands1.x += 100
- end
- if @commands1.y < 55
- @commands1.y += 5
- end
- # アイテムウィンドウがアクティブの場合: update_item を呼ぶ
- if @item_window.active
- update_item
- return
- end
- # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
- if @target_window.active
- update_target
- return
- end
- end
- #--------------------------------------------------------------------------
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_item
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # exit animation
- $game_system.se_play($data_system.cancel_se)
- loop do
- if @item_shadow.y < 480
- @item_shadow.y += 50
- end
- if @item_picture.y < 480
- @item_picture.y += 50
- end
- if @item_window.y < 480
- @item_window.y += 50
- end
- if @help_picture.y > - 50
- @help_picture.y -= 30
- end
- if @help_window.y > - 64
- @help_window.y -= 30
- end
- if @command1.x > 15
- @command1.x -= 100
- end
- if @command1.y > 40
- @command1.y -= 5
- end
- if @commands1.x > 20
- @commands1.x -= 100
- end
- if @commands1.y > 45
- @commands1.y -= 5
- end
- delay(0.2)
- if @item_picture.y >= 480
- break
- end
- end
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(0)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # アイテムウィンドウで現在選択されているデータを取得
- @item = @item_window.item
- # 使用アイテムではない場合
- unless @item.is_a?(RPG::Item)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 使用できない場合
- unless $game_party.item_can_use?(@item.id)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # 効果範囲が味方の場合
- if @item.scope >= 3
- # ターゲットウィンドウをアクティブ化
- @item_window.active = false
- @target_window.x = (@item_window.index + 1) % 2 * 304
- @target_picture.x = (@item_window.index + 1) % 2 * 304
- @target_picture.visible = true
- @target_window.visible = true
- @target_window.active = true
- # 効果範囲 (単体/全体) に応じてカーソル位置を設定
- if @item.scope == 4 || @item.scope == 6
- @target_window.index = -1
- else
- @target_window.index = 0
- end
- # 効果範囲が味方以外の場合
- else
- # コモンイベント ID が有効の場合
- if @item.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @item.common_event_id
- # アイテムの使用時 SE を演奏
- $game_system.se_play(@item.menu_se)
- # 消耗品の場合
- if @item.consumable
- # 使用したアイテムを 1 減らす
- $game_party.lose_item(@item.id, 1)
- # アイテムウィンドウの項目を再描画
- @item_window.draw_item(@item_window.index)
- end
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_target
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # アイテム切れなどで使用できなくなった場合
- unless $game_party.item_can_use?(@item.id)
- # アイテムウィンドウの内容を再作成
- @item_window.refresh
- end
- # ターゲットウィンドウを消去
- @item_window.active = true
- @target_window.visible = false
- @target_picture.visible = false
- @target_window.active = false
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # アイテムを使い切った場合
- if $game_party.item_number(@item.id) == 0
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # ターゲットが全体の場合
- if @target_window.index == -1
- # パーティ全体にアイテムの使用効果を適用
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- # ターゲットが単体の場合
- if @target_window.index >= 0
- # ターゲットのアクターにアイテムの使用効果を適用
- target = $game_party.actors[@target_window.index]
- used = target.item_effect(@item)
- end
- # アイテムを使った場合
- if used
- # アイテムの使用時 SE を演奏
- $game_system.se_play(@item.menu_se)
- # 消耗品の場合
- if @item.consumable
- # 使用したアイテムを 1 減らす
- $game_party.lose_item(@item.id, 1)
- # アイテムウィンドウの項目を再描画
- @item_window.draw_item(@item_window.index)
- end
- # ターゲットウィンドウの内容を再作成
- @target_window.refresh
- # 全滅の場合
- if $game_party.all_dead?
- # ゲームオーバー画面に切り替え
- $scene = Scene_Gameover.new
- return
- end
- # コモンイベント ID が有効の場合
- if @item.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @item.common_event_id
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- # アイテムを使わなかった場合
- unless used
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- #==============================================================================
- # ■ Scene_Skill
- #------------------------------------------------------------------------------
- # スキル画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Skill
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor_index : アクターインデックス
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- end
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- #==============================================
- # Setting up all the images
- @background = Sprite.new
- @background.bitmap = RPG::Cache.picture("background")
- @background.x = 0
- @background.y = 0
- #================help window image=====================
- @help_picture = Sprite.new
- @help_picture.bitmap = RPG::Cache.picture("helpwindow12")
- @help_picture.x = 0
- @help_picture.y = - 52
- #==============Command image=====================
- @command2 = Sprite.new
- @command2.bitmap = RPG::Cache.picture("cmscommand2")
- @command2.x = 15
- @command2.y = 40
- @command2.z = 100
- #==============shadow================================
- @commands2 = Sprite.new
- @commands2.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands2.x = 20
- @commands2.y = 45
- @commands2.z = 1
- @commands2.opacity = 155
- #==============status window==========================
- @status_window1 = Sprite.new
- @status_window1.bitmap = RPG::Cache.picture("status window 1")
- @status_window1.x = 690
- @status_window1.y = 45
- @status_window1.z = 100
- #============shadow================================
- @status_windowshadow1 = Sprite.new
- @status_windowshadow1.bitmap = RPG::Cache.picture("blackwindow2")
- @status_windowshadow1.x = 697
- @status_windowshadow1.y = 50
- @status_windowshadow1.z = 1
- @status_windowshadow1.opacity = 155
- #==================skill window pic====================
- @skill_picture = Sprite.new
- @skill_picture.bitmap = RPG::Cache.picture("skillwindow")
- @skill_picture.x = 7
- @skill_picture.y = 540
- @skill_picture.z = 2
- #================skill shadow pic=====================
- @skill_shadow = Sprite.new
- @skill_shadow.bitmap = RPG::Cache.picture("skillshadow")
- @skill_shadow.x = 14
- @skill_shadow.y = 545
- @skill_shadow.z = 1
- @skill_shadow.opacity = 155
- #===============target window========================
- @target_picture = Sprite.new
- @target_picture.bitmap = RPG::Cache.picture("targetwindow")
- @target_picture.z = 998
- @target_picture.visible = false
- # アクターを取得
- @actor = $game_party.actors[@actor_index]
- # ヘルプウィンドウ、ステータスウィンドウ、スキルウィンドウを作成
- @help_window = Window_Menuhelp.new
- @help_window.opacity = 0
- @status_window = Window_SkillStatus.new(@actor)
- @skill_window = Window_Menuskill.new(@actor)
- @skill_window.opacity = 0
- # ヘルプウィンドウを関連付け
- @skill_window.help_window = @help_window
- # ターゲットウィンドウを作成 (不可視・非アクティブに設定)
- @target_window = Window_Target.new
- @target_window.z = 999
- @target_window.opacity = 0
- @target_window.visible = false
- @target_window.active = false
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @help_window.dispose
- @status_window.dispose
- @skill_window.dispose
- @target_window.dispose
- @background.dispose
- @help_picture.dispose
- @commands2.dispose
- @command2.dispose
- @status_window1.dispose
- @status_windowshadow1.dispose
- @skill_picture.dispose
- @skill_shadow.dispose
- end
- #--------------------------------------------------------------------------
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # enter animation
- if @help_picture.y < - 4
- @help_picture.y += 24
- end
- if @help_window.y < - 7
- @help_window.y += 35
- end
- if @command2.y < 60
- @command2.y += 20
- end
- if @commands2.y < 65
- @commands2.y += 20
- end
- if @skill_shadow.y > 145
- @skill_shadow.y -= 50
- end
- if @skill_picture.y > 140
- @skill_picture.y -= 50
- end
- if @skill_window.y > 131
- @skill_window.y -= 50
- end
- if @status_window1.x > 293
- @status_window1.x -= 100
- end
- if @status_window.x > 230
- @status_window.x -= 100
- end
- if @status_windowshadow1.x > 297
- @status_windowshadow1.x -= 100
- end
- # ウィンドウを更新
- @help_window.update
- @status_window.update
- @skill_window.update
- @target_window.update
- # スキルウィンドウがアクティブの場合: update_skill を呼ぶ
- if @skill_window.active
- update_skill
- return
- end
- # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
- if @target_window.active
- update_target
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (スキルウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_skill
- if Input.trigger?(Input::B)
- # exit animation
- loop do
- if @skill_shadow.y < 480
- @skill_shadow.y += 50
- end
- if @skill_picture.y < 480
- @skill_picture.y += 50
- end
- if @skill_window.y < 480
- @skill_window.y += 50
- end
- if @help_picture.y > - 50
- @help_picture.y -= 30
- end
- if @help_window.y > - 64
- @help_window.y -= 30
- end
- if @command2.x > 15
- @command2.x -= 100
- end
- if @command2.y > 40
- @command2.y -= 10
- end
- if @commands2.x > 20
- @commands2.x -= 100
- end
- if @commands2.y > 45
- @commands2.y -= 10
- end
- if @status_window1.x < 640
- @status_window1.x += 100
- end
- if @status_window.x < 640
- @status_window.x += 100
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 100
- end
- delay(0.2)
- if @skill_picture.y >= 480
- break
- end
- end
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(1)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # スキルウィンドウで現在選択されているデータを取得
- @skill = @skill_window.skill
- # 使用できない場合
- if @skill == nil or not @actor.skill_can_use?(@skill.id)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # 効果範囲が味方の場合
- if @skill.scope >= 3
- # ターゲットウィンドウをアクティブ化
- @skill_window.active = false
- @target_window.x = (@skill_window.index + 1) % 2 * 304
- @target_picture.x = (@skill_window.index + 1) % 2 * 304
- @target_window.visible = true
- @target_window.active = true
- @target_picture.visible = true
- # 効果範囲 (単体/全体) に応じてカーソル位置を設定
- if @skill.scope == 4 || @skill.scope == 6
- @target_window.index = -1
- elsif @skill.scope == 7
- @target_window.index = @actor_index - 10
- else
- @target_window.index = 0
- end
- # 効果範囲が味方以外の場合
- else
- # コモンイベント ID が有効の場合
- if @skill.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @skill.common_event_id
- # スキルの使用時 SE を演奏
- $game_system.se_play(@skill.menu_se)
- # SP 消費
- @actor.sp -= @skill.sp_cost
- # 各ウィンドウの内容を再作成
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- # R ボタンが押された場合
- if Input.trigger?(Input::R)
- # カーソル SE を演奏
- $game_system.se_play($data_system.cursor_se)
- # 次のアクターへ
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # 別のスキル画面に切り替え
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- # L ボタンが押された場合
- if Input.trigger?(Input::L)
- # カーソル SE を演奏
- $game_system.se_play($data_system.cursor_se)
- # 前のアクターへ
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # 別のスキル画面に切り替え
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_target
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # ターゲットウィンドウを消去
- @skill_window.active = true
- @target_window.visible = false
- @target_window.active = false
- @target_picture.visible = false
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # SP 切れなどで使用できなくなった場合
- unless @actor.skill_can_use?(@skill.id)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # ターゲットが全体の場合
- if @target_window.index == -1
- # パーティ全体にスキルの使用効果を適用
- used = false
- for i in $game_party.actors
- used |= i.skill_effect(@actor, @skill)
- end
- end
- # ターゲットが使用者の場合
- if @target_window.index <= -2
- # ターゲットのアクターにスキルの使用効果を適用
- target = $game_party.actors[@target_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- # ターゲットが単体の場合
- if @target_window.index >= 0
- # ターゲットのアクターにスキルの使用効果を適用
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- # スキルを使った場合
- if used
- # スキルの使用時 SE を演奏
- $game_system.se_play(@skill.menu_se)
- # SP 消費
- @actor.sp -= @skill.sp_cost
- # 各ウィンドウの内容を再作成
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # 全滅の場合
- if $game_party.all_dead?
- # ゲームオーバー画面に切り替え
- $scene = Scene_Gameover.new
- return
- end
- # コモンイベント ID が有効の場合
- if @skill.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @skill.common_event_id
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- # スキルを使わなかった場合
- unless used
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- #==============================================================================
- # ■ Scene_Equip
- #------------------------------------------------------------------------------
- # 装備画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Equip
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor_index : アクターインデックス
- # equip_index : 装備インデックス
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- @equip_index = equip_index
- end
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- # This is setting up the background picture
- @background = Sprite.new
- @background.bitmap = RPG::Cache.picture("background")
- @background.x = 0
- @background.y = 0
- #=============the equip command pic========================
- @command3 = Sprite.new
- @command3.bitmap = RPG::Cache.picture("cmscommand3")
- @command3.x = 15
- @command3.y = 40
- @command3.z = 100
- #=================the shadow of it=======================
- @commands3 = Sprite.new
- @commands3.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands3.x = 20
- @commands3.y = 45
- @commands3.z = 1
- @commands3.opacity = 155
- #================the status window pic====================
- @status_window1 = Sprite.new
- @status_window1.bitmap = RPG::Cache.picture("status window")
- @status_window1.x = 570
- @status_window1.y = 30
- @status_window1.z = 100
- #=============the shadow of it===========================
- @status_windowshadow1 = Sprite.new
- @status_windowshadow1.bitmap = RPG::Cache.picture("blackwindow2")
- @status_windowshadow1.x = 697
- @status_windowshadow1.y = 50
- @status_windowshadow1.z = 1
- @status_windowshadow1.opacity = 155
- #================help window image=====================
- @help_picture = Sprite.new
- @help_picture.bitmap = RPG::Cache.picture("helpwindow12")
- @help_picture.x = 0
- @help_picture.y = - 52
- #==============This sets up the 3rd status picture=============
- @picture_status2 = Sprite.new
- @picture_status2.bitmap = RPG::Cache.picture("windowstatus2")
- @picture_status2.x = 850
- @picture_status2.y = 135
- @picture_status2.z = 3
- #============the shadow of the 2nd status pic================
- @picture_shadow2 = Sprite.new
- @picture_shadow2.bitmap = RPG::Cache.picture("windowstatus2shadow")
- @picture_shadow2.x = 855
- @picture_shadow2.y = 140
- @picture_shadow2.z = 1
- @picture_shadow2.opacity = 155
- #======the pic for equip left (status window 2 in this script)==========
- @equip_window1 = Sprite.new
- @equip_window1.bitmap = RPG::Cache.picture("equipwindow1")
- @equip_window1.x = - 113
- @equip_window1.y = 117
- @equip_window1.z = 2
- #============the equipment selection window pic===============
- @equip_window2 = Sprite.new
- @equip_window2.bitmap = RPG::Cache.picture("equipwindow2")
- @equip_window2.x = 245
- @equip_window2.y = 585
- @equip_window2.z = 2
- #================the shadow of it==========================
- @equip_shadow2 = Sprite.new
- @equip_shadow2.bitmap = RPG::Cache.picture("equipwindow2shadow")
- @equip_shadow2.x = 250
- @equip_shadow2.y = 590
- @equip_shadow2.opacity = 155
- @equip_shadow2.z = 1
- #================the selection arrow=========================
- @arrow = Sprite.new
- @arrow.bitmap = RPG::Cache.picture("arrow4")
- @arrow.x = 12
- @arrow.y = 150
- @arrow.z = 1000
- # アクターを取得
- @actor = $game_party.actors[@actor_index]
- # ウィンドウを作成
- @status_window = Window_SkillStatus.new(@actor)
- @status_window2 = Window_Status2.new(@actor)
- @status_window2.x = 850
- @status_window2.y = 120
- @status_window2.opacity = 0
- @help_window = Window_Menuhelp.new
- @help_window.opacity = 0
- @right_window = Window_EquipRight.new(@actor)
- @right_window.visible = true
- @item_window1 = Window_EquipItem.new(@actor, 0)
- @item_window2 = Window_EquipItem.new(@actor, 1)
- @item_window3 = Window_EquipItem.new(@actor, 2)
- @item_window4 = Window_EquipItem.new(@actor, 3)
- @item_window5 = Window_EquipItem.new(@actor, 4)
- # ヘルプウィンドウを関連付け
- @right_window.help_window = @help_window
- @item_window1.help_window = @help_window
- @item_window2.help_window = @help_window
- @item_window3.help_window = @help_window
- @item_window4.help_window = @help_window
- @item_window5.help_window = @help_window
- # カーソル位置を設定
- @right_window.index = @equip_index
- refresh
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @help_window.dispose
- @right_window.dispose
- @item_window1.dispose
- @item_window2.dispose
- @item_window3.dispose
- @item_window4.dispose
- @item_window5.dispose
- @background.dispose
- @command3.dispose
- @commands3.dispose
- @status_window1.dispose
- @status_windowshadow1.dispose
- @help_picture.dispose
- @status_window.dispose
- @status_window2.dispose
- @equip_window1.dispose
- @equip_window2.dispose
- @picture_status2.dispose
- @arrow.dispose
- @equip_shadow2.dispose
- @picture_shadow2.dispose
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- # アイテムウィンドウの可視状態設定
- @item_window1.visible = (@right_window.index == 0)
- @item_window2.visible = (@right_window.index == 1)
- @item_window3.visible = (@right_window.index == 2)
- @item_window4.visible = (@right_window.index == 3)
- @item_window5.visible = (@right_window.index == 4)
- # 現在装備中のアイテムを取得
- item1 = @right_window.item
- # 現在のアイテムウィンドウを @item_window に設定
- case @right_window.index
- when 0
- @item_window = @item_window1
- when 1
- @item_window = @item_window2
- when 2
- @item_window = @item_window3
- when 3
- @item_window = @item_window4
- when 4
- @item_window = @item_window5
- end
- # ライトウィンドウがアクティブの場合
- if @right_window.active
- # 装備変更後のパラメータを消去
- @status_window2.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
- end
- # アイテムウィンドウがアクティブの場合
- if @item_window.active
- # 現在選択中のアイテムを取得
- item2 = @item_window.item
- # 装備を変更
- last_hp = @actor.hp
- last_sp = @actor.sp
- @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
- # 装備変更後のパラメータを取得
- new_atk = @actor.atk
- new_pdef = @actor.pdef
- new_mdef = @actor.mdef
- new_str = @actor.str
- new_dex = @actor.dex
- new_agi = @actor.agi
- new_int = @actor.int
- # 装備を戻す
- @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
- @actor.hp = last_hp
- @actor.sp = last_sp
- # レフトウィンドウに描画
- @status_window2.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
- @status_window2.refresh
- end
- end
- #--------------------------------------------------------------------------
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- @status_window.update
- if @command3.y < 60
- @command3.y += 20
- end
- if @commands3.y < 65
- @commands3.y += 20
- end
- if @help_picture.y < - 4
- @help_picture.y += 24
- end
- if @help_window.y < - 7
- @help_window.y += 35
- end
- if @status_window1.x > 293
- @status_window1.x -= 80
- end
- if @status_windowshadow1.x > 297
- @status_windowshadow1.x -= 80
- end
- if @status_window.x > 230
- @status_window.x -= 50
- end
- if @status_window2.x > 250
- @status_window2.x -= 100
- end
- if @picture_status2.x > 250
- @picture_status2.x -= 100
- end
- if @picture_shadow2.x > 255
- @picture_shadow2.x -= 100
- end
- if @equip_window1.x < 7
- @equip_window1.x += 20
- end
- if @right_window.x < 20
- @right_window.x += 20
- end
- if @equip_window2.y > 285
- @equip_window2.y -= 50
- end
- if @equip_shadow2.y > 290
- @equip_shadow2.y -= 50
- end
- if @arrow.x < - 10
- @arrow.x += 10
- end
- if @item_window1.y > 273
- @item_window1.y -= 50
- end
- if @item_window2.y > 273
- @item_window2.y -= 50
- end
- if @item_window3.y > 273
- @item_window3.y -= 50
- end
- if @item_window4.y > 273
- @item_window4.y -= 50
- end
- if @item_window5.y > 273
- @item_window5.y -= 50
- end
- # ウィンドウを更新
- @right_window.update
- @item_window.update
- refresh
- # ライトウィンドウがアクティブの場合: update_right を呼ぶ
- if @right_window.active
- update_right
- return
- end
- # アイテムウィンドウがアクティブの場合: update_item を呼ぶ
- if @item_window.active
- update_item
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (ライトウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_right
- case @right_window.index
- when 0
- @arrow.y = 141
- when 1
- @arrow.y = 208
- when 2
- @arrow.y = 276
- when 3
- @arrow.y = 344
- when 4
- @arrow.y = 408
- end
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- loop do
- if @command3.x > 15
- @command3.x -= 100
- end
- if @command3.y > 40
- @command3.y -= 10
- end
- if @commands3.x > 20
- @commands2.x -= 100
- end
- if @commands3.y > 45
- @commands3.y -= 10
- end
- if @help_picture.y > - 50
- @help_picture.y -= 30
- end
- if @help_window.y > - 64
- @help_window.y -= 30
- end
- if @status_window1.x < 640
- @status_window1.x += 100
- end
- if @status_window.x < 640
- @status_window.x += 100
- end
- if @status_windowshadow1.x < 640
- @status_windowshadow1.x += 100
- end
- if @status_window2.x < 640
- @status_window2.x += 100
- end
- if @picture_status2.x < 640
- @picture_status2.x += 100
- end
- if @picture_shadow2.x < 640
- @picture_shadow2.x += 100
- end
- if @equip_window1.x > - 250
- @equip_window1.x -= 50
- end
- if @right_window.x > - 250
- @right_window.x -= 50
- end
- if @equip_window2.y < 480
- @equip_window2.y += 50
- end
- if @equip_shadow2.y < 480
- @equip_shadow2.y += 50
- end
- if @item_window1.y < 480
- @item_window1.y += 50
- end
- if @item_window2.y < 480
- @item_window2.y += 50
- end
- if @item_window3.y < 480
- @item_window3.y += 50
- end
- if @item_window4.y < 480
- @item_window4.y += 50
- end
- if @item_window5.y < 480
- @item_window5.y += 50
- end
- @arrow.visible = false
- delay(0.1)
- if @equip_window1.x <= - 250
- break
- end
- end
- $game_system.se_play($data_system.cancel_se)
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(2)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # 装備固定の場合
- if @actor.equip_fix?(@right_window.index)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # アイテムウィンドウをアクティブ化
- @right_window.active = false
- @item_window.active = true
- @item_window.index = 0
- return
- end
- # R ボタンが押された場合
- if Input.trigger?(Input::R)
- # カーソル SE を演奏
- $game_system.se_play($data_system.cursor_se)
- # 次のアクターへ
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # 別の装備画面に切り替え
- $scene = Scene_Equip.new(@actor_index, @right_window.index)
- return
- end
- # L ボタンが押された場合
- if Input.trigger?(Input::L)
- # カーソル SE を演奏
- $game_system.se_play($data_system.cursor_se)
- # 前のアクターへ
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # 別の装備画面に切り替え
- $scene = Scene_Equip.new(@actor_index, @right_window.index)
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_item
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # ライトウィンドウをアクティブ化
- @right_window.active = true
- @status_window2.refresh
- @item_window.active = false
- @item_window.index = -1
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # 装備 SE を演奏
- $game_system.se_play($data_system.equip_se)
- # アイテムウィンドウで現在選択されているデータを取得
- item = @item_window.item
- # 装備を変更
- @actor.equip(@right_window.index, item == nil ? 0 : item.id)
- # ライトウィンドウをアクティブ化
- @right_window.active = true
- @item_window.active = false
- @item_window.index = -1
- # ライトウィンドウ、アイテムウィンドウの内容を再作成
- @right_window.refresh
- @item_window.refresh
- return
- end
- end
- end
- #==============================================================================
- # ■ Scene_Status
- #------------------------------------------------------------------------------
- # ステータス画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Status
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # actor_index : アクターインデックス
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- end
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- #========================================
- # This is setting up the background picture
- @background = Sprite.new
- @background.bitmap = RPG::Cache.picture("background")
- @background.x = 0
- @background.y = 0
- #========================================
- # This sets up the command picture & shadow
- @command4 = Sprite.new
- @command4.bitmap = RPG::Cache.picture("cmscommand4")
- @command4.x = 15
- @command4.y = 40
- @command4.z = 100
- #========================================
- @commands4 = Sprite.new
- @commands4.bitmap = RPG::Cache.picture("cmscommandshadow")
- @commands4.x = 20
- @commands4.y = 45
- @commands4.z = 1
- @commands4.opacity = 155
- #==============This sets up the 1st status picture=============
- @picture_status1 = Sprite.new
- @picture_status1.bitmap = RPG::Cache.picture("windowstatus1")
- @picture_status1.x = 230
- @picture_status1.y = - 120
- @picture_status1.z = 2
- #=============This sets up the 2nd status picture==============
- @picture_status2 = Sprite.new
- @picture_status2.bitmap = RPG::Cache.picture("windowstatus2")
- @picture_status2.x = 830
- @picture_status2.y = 115
- @picture_status2.z = 2
- #==============This sets up the 3rd status picture=============
- @picture_status3 = Sprite.new
- @picture_status3.bitmap = RPG::Cache.picture("windowstatus3")
- @picture_status3.x = 230
- @picture_status3.y = 480
- @picture_status3.z = 2
- #===============This sets up the 4th status picture==============
- @picture_status4 = Sprite.new
- @picture_status4.bitmap = RPG::Cache.picture("windowstatus4")
- @picture_status4.x = - 280
- @picture_status4.y = 388
- @picture_status4.z = 2
- #============the shadow of the 1st status pic==================
- @picture_shadow1 = Sprite.new
- @picture_shadow1.bitmap = RPG::Cache.picture("windowstatus1shadow")
- @picture_shadow1.x = 235
- @picture_shadow1.y = - 115
- @picture_shadow1.z = 1
- @picture_shadow1.opacity = 155
- #============the shadow of the 2nd status pic==================
- @picture_shadow2 = Sprite.new
- @picture_shadow2.bitmap = RPG::Cache.picture("windowstatus2shadow")
- @picture_shadow2.x = 835
- @picture_shadow2.y = 120
- @picture_shadow2.z = 1
- @picture_shadow2.opacity = 155
- #============the shadow of the 3rd status pic==================
- @picture_shadow3 = Sprite.new
- @picture_shadow3.bitmap = RPG::Cache.picture("windowstatus3shadow")
- @picture_shadow3.x = 235
- @picture_shadow3.y = 485
- @picture_shadow3.z = 1
- @picture_shadow3.opacity = 155
- #============the shadow of the 4th status pic==================
- @picture_shadow4 = Sprite.new
- @picture_shadow4.bitmap = RPG::Cache.picture("windowstatus4shadow")
- @picture_shadow4.x = - 275
- @picture_shadow4.y = 393
- @picture_shadow4.z = 1
- @picture_shadow4.opacity = 155
- # アクターを取得
- @actor = $game_party.actors[@actor_index]
- # Sets up the 1st status window
- @status_window1 = Window_Status.new(@actor)
- @status_window1.x = 220
- @status_window1.y = - 160
- @status_window1.opacity = 0
- #=============Sets up the 2nd status window==================
- @status_window2 = Window_Status2.new(@actor)
- @status_window2.x = 830
- @status_window2.y = 100
- @status_window2.opacity = 0
- #============Sets up the 3rd status window===================
- @status_window3 = Window_Status3.new(@actor)
- @status_window3.x = 220
- @status_window3.y = 700
- @status_window3.opacity = 0
- #=============Sets up the 4th status window==================
- @status_window4 = Window_Status4.new(@actor)
- @status_window4.x = - 280
- @status_window4.y = 385
- @status_window4.opacity = 0
- #============Sets up the 5th status window - battler=============
- @status_window5 = Window_Status5.new(@actor)
- @status_window5.x = - 300
- @status_window5.y = 0
- @status_window5.opacity = 0
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @background.dispose
- @command4.dispose
- @commands4.dispose
- @picture_status1.dispose
- @picture_status2.dispose
- @picture_status3.dispose
- @picture_status4.dispose
- @status_window1.dispose
- @status_window2.dispose
- @status_window3.dispose
- @status_window4.dispose
- @status_window5.dispose
- @picture_shadow1.dispose
- @picture_shadow2.dispose
- @picture_shadow3.dispose
- @picture_shadow4.dispose
- end
- #--------------------------------------------------------------------------
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- #===========================================
- # enter animation
- if @picture_status1.y < 15
- @picture_status1.y += 45
- end
- if @picture_shadow1.y < 20
- @picture_shadow1.y += 45
- end
- if @picture_status2.x > 230
- @picture_status2.x -= 150
- end
- if @picture_shadow2.x > 235
- @picture_shadow2.x -= 150
- end
- if @picture_status3.y > 262
- @picture_status3.y -= 109
- end
- if @picture_shadow3.y > 267
- @picture_shadow3.y -= 109
- end
- if @picture_status4.x < 5
- @picture_status4.x += 95
- end
- if @picture_shadow4.x < 10
- @picture_shadow4.x += 95
- end
- if @status_window1.y < 0
- @status_window1.y += 80
- end
- if @status_window2.x > 230
- @status_window2.x -= 150
- end
- if @status_window3.y > 250
- @status_window3.y -= 150
- end
- if @status_window4.x < 5
- @status_window4.x += 95
- end
- if @status_window5.x < 0
- @status_window5.x += 100
- end
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # exit animation
- loop do
- if @picture_status1.y > - 400
- @picture_status1.y -= 100
- end
- if @picture_shadow1.y > - 400
- @picture_shadow1.y -= 100
- end
- if @picture_status2.x < 640
- @picture_status2.x += 100
- end
- if @picture_shadow2.x < 640
- @picture_shadow2.x += 100
- end
- if @picture_status3.y < 480
- @picture_status3.y += 100
- end
- if @picture_shadow3.y < 480
- @picture_shadow3.y += 100
- end
- if @picture_status4.x > - 300
- @picture_status4.x -= 100
- end
- if @picture_shadow4.x > - 400
- @picture_shadow4.x -= 100
- end
- if @status_window1.y > - 400
- @status_window1.y -= 100
- end
- if @status_window2.x < 640
- @status_window2.x += 100
- end
- if @status_window3.y < 640
- @status_window3.y += 100
- end
- if @status_window4.x > - 200
- @status_window4.x -= 100
- end
- if @status_window5.x > - 300
- @status_window5.x -= 100
- end
- delay(0.1)
- if @status_window2.x >= 640
- break
- end
- end
- $game_system.se_play($data_system.cancel_se)
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(3)
- return
- end
- # R ボタンが押された場合
- if Input.trigger?(Input::R)
- # カーソル SE を演奏
- $game_system.se_play($data_system.cursor_se)
- # 次のアクターへ
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # 別のステータス画面に切り替え
- $scene = Scene_Status.new(@actor_index)
- return
- end
- # L ボタンが押された場合
- if Input.trigger?(Input::L)
- # カーソル SE を演奏
- $game_system.se_play($data_system.cursor_se)
- # 前のアクターへ
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # 別のステータス画面に切り替え
- $scene = Scene_Status.new(@actor_index)
- return
- end
- end
- end
- #==============================================================================
- # ■ Scene_File
- #------------------------------------------------------------------------------
- # セーブ画面およびロード画面のスーパークラスです。
- #==============================================================================
- class Scene_File
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # help_text : ヘルプウィンドウに表示する文字列
- #--------------------------------------------------------------------------
- def initialize(help_text)
- @help_text = help_text
- end
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- # This is setting up the background picture
- @background = Sprite.new
- @background.bitmap = RPG::Cache.picture("save window")
- @background.x = 0
- @background.y = 0
- # ヘルプウィンドウを作成
- @help_window = Window_Help.new
- @help_window.opacity = 0
- @help_window.set_text(@help_text)
- # セーブファイルウィンドウを作成
- @savefile_windows = []
- for i in 0..3
- @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
- end
- # 最後に操作したファイルを選択
- @file_index = $game_temp.last_file_index
- @savefile_windows[@file_index].selected = true
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @background.dispose
- @help_window.dispose
- for i in @savefile_windows
- i.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # ウィンドウを更新
- @help_window.update
- for i in @savefile_windows
- i.update
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # メソッド on_decision (継承先で定義) を呼ぶ
- on_decision(make_filename(@file_index))
- $game_temp.last_file_index = @file_index
- return
- end
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # メソッド on_cancel (継承先で定義) を呼ぶ
- on_cancel
- return
- end
- # 方向ボタンの下が押された場合
- if Input.repeat?(Input::DOWN)
- # 方向ボタンの下の押下状態がリピートでない場合か、
- # またはカーソル位置が 3 より前の場合
- if Input.trigger?(Input::DOWN) or @file_index < 3
- # カーソル SE を演奏
- $game_system.se_play($data_system.cursor_se)
- # カーソルを下に移動
- @savefile_windows[@file_index].selected = false
- @file_index = (@file_index + 1) % 4
- @savefile_windows[@file_index].selected = true
- return
- end
- end
- # 方向ボタンの上が押された場合
- if Input.repeat?(Input::UP)
- # 方向ボタンの上の押下状態がリピートでない場合か、
- # またはカーソル位置が 0 より後ろの場合
- if Input.trigger?(Input::UP) or @file_index > 0
- # カーソル SE を演奏
- $game_system.se_play($data_system.cursor_se)
- # カーソルを上に移動
- @savefile_windows[@file_index].selected = false
- @file_index = (@file_index + 3) % 4
- @savefile_windows[@file_index].selected = true
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● ファイル名の作成
- # file_index : セーブファイルのインデックス (0~3)
- #--------------------------------------------------------------------------
- def make_filename(file_index)
- return "Save#{file_index + 1}.rxdata"
- end
- end
- #==============================================================================
- # ■ Scene_End
- #------------------------------------------------------------------------------
- # ゲーム終了画面の処理を行うクラスです。
- #==============================================================================
- class Scene_End
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- # This is setting up the background picture
- @background = Sprite.new
- @background.bitmap = RPG::Cache.picture("background")
- @background.x = 0
- @background.y = 0
- @background.opacity = 255
- # コマンドウィンドウを作成
- s1 = ""
- s2 = ""
- s3 = ""
- @command_window = Window_Command.new(192, [s1, s2, s3])
- @command_window.x = 320 - @command_window.width / 2
- @command_window.y = 240 - @command_window.height / 2
- @command_window.opacity = 0
- @command_window.visible = false
- #===============Arrow selection pic======================
- @arrow = Sprite.new
- @arrow.bitmap = RPG::Cache.picture("arrow4")
- @arrow.x = 340 - @command_window.width / 2 - 30
- @arrow.y = 175
- @arrow.z = 999
- #=======the end window - replaces command window===========
- @end_window = Window_End.new
- @end_window.x = 320 - @command_window.width / 2 + 8
- @end_window.y = 240 - @command_window.height / 2 - 15
- #=============end window pic============================
- @endwindow = Sprite.new
- @endwindow.bitmap = RPG::Cache.picture("endwindow")
- @endwindow.opacity = 255
- @endwindow.x = 320 - @command_window.width / 2 - 10
- @endwindow.y = 240 - @command_window.height / 2 - 10
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @endwindow.dispose
- @command_window.dispose
- @end_window.dispose
- @arrow.dispose
- @background.dispose
- # タイトル画面に切り替え中の場合
- if $scene.is_a?(Scene_Title)
- # 画面をフェードアウト
- Graphics.transition
- Graphics.freeze
- end
- end
- #--------------------------------------------------------------------------
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # Little effect added
- if @background.opacity > 100
- @background.opacity -= 2
- end
- if @endwindow.opacity > 150
- @endwindow.opacity -= 1
- end
- case @command_window.index
- when 0
- @arrow.y = 175
- when 1
- @arrow.y = 220
- when 2
- @arrow.y = 265
- end
- # コマンドウィンドウを更新
- @command_window.update
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(5)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # コマンドウィンドウのカーソル位置で分岐
- case @command_window.index
- when 0 # タイトルへ
- command_to_title
- when 1 # シャットダウン
- command_shutdown
- when 2 # やめる
- command_cancel
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● コマンド [タイトルへ] 選択時の処理
- #--------------------------------------------------------------------------
- def command_to_title
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # BGM、BGS、ME をフェードアウト
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- # タイトル画面に切り替え
- $scene = Scene_Title.new
- end
- #--------------------------------------------------------------------------
- # ● コマンド [シャットダウン] 選択時の処理
- #--------------------------------------------------------------------------
- def command_shutdown
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # BGM、BGS、ME をフェードアウト
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- # シャットダウン
- $scene = nil
- end
- #--------------------------------------------------------------------------
- # ● コマンド [やめる] 選択時の処理
- #--------------------------------------------------------------------------
- def command_cancel
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(5)
- end
- end
复制代码 好人做到底,把我找的素材也给你把
如果想自己更换就对照我给的素材的大小去该就可以了
|
评分
-
查看全部评分
|