赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 1210 |
最后登录 | 2016-4-17 |
在线时间 | 26 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 26 小时
- 注册时间
- 2007-12-29
- 帖子
- 13
|
3楼
楼主 |
发表于 2008-1-30 08:49:25
|
只看该作者
好的,主要是選人的畫面無法像滾輪般滾動
還有要如何讓人物頭像第一隻左第二隻右
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
# 顯示菜單畫面和同伴狀態的窗口。
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化目標
#--------------------------------------------------------------------------
def initialize
super(0, 0, 480, 480)
self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
refresh
@top_row = 0
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 = 64
y = i * 112
if i <=3
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(x,y,340,32,"[出戰]",2)
self.contents.font.color = normal_color
else
self.contents.font.color = Color.new(128,128,128,255)
self.contents.draw_text(x,y,340,32,"[待機]",2)
self.contents.font.color = normal_color
end
actor = $game_party.actors
draw_actor_face(actor, 32, y)
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x, y + 32)
draw_actor_state(actor, x + 90, y + 32)
draw_actor_exp(actor, x, y + 64)
draw_actor_hp(actor, x + 236, y + 32)
draw_actor_sp(actor, x + 236, y + 64)
end
end
#--------------------------------------------------------------------------
# ● 刷新光標矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
tpy = @index * 112 - self.oy
self.cursor_rect.set(0, tpy, self.width - 32, 96)
if @index < @top_row
@top_row = @index
self.oy = @top_row *112
end
if @index > @top_row+3
@top_row = @index-3
self.oy = @top_row *112
end
end
end
end
class Game_Party
#--------------------------------------------------------------------------
# ● 全滅判定
#--------------------------------------------------------------------------
def all_dead?
# 同伴人數為 0 的情況下
if $game_party.actors.size == 0
return false
end
# 同伴中無人 HP 在 0 以上
for i in 0..3
if @actors != nil and@actors.hp >0
return false
end
end
# 全滅
return true
end
#--------------------------------------------------------------------------
# ● 加入同伴
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
# 獲取角色
actor = $game_actors[actor_id]
# 同伴人數未滿 4 人、本角色不在隊伍中的情況下
if not @actors.include?(actor)
# 添加角色
@actors.push(actor)
# 還原主角
$game_player.refresh
end
end
end
#--------------------------------------------------------------------------
# ● 轉到輸入下一個角色的命令
#--------------------------------------------------------------------------
def phase3_next_actor
# 循環
begin
# 角色的明滅效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最後的角色的情況
if @actor_index == [$game_party.actors.size-1,3].min
# 開始主回合
start_phase4
return
end
# 推進角色索引
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# 如果角色是在無法接受指令的狀態就再試
end until @active_battler.inputable?
# 設置角色的命令窗口
phase3_setup_command_window
end
class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# ● 刷新畫面
#--------------------------------------------------------------------------
def update
super
# 光標右
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= [$game_party.actors.size,4].min
end
# 光標左
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= [$game_party.actors.size,4].min
end
# 設置活動塊坐標
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
end
#==============================================================================
# ■ Window_Target
#------------------------------------------------------------------------------
# 物品畫面與特技畫面的、使用對像角色選擇窗口。
#==============================================================================
class Window_Target < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化對像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 336, 480)
self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
self.z += 10
@item_max = $game_party.actors.size
@top_row = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 112
actor = $game_party.actors
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x + 8, y + 32)
draw_actor_state(actor, x + 8, y + 64)
draw_actor_hp(actor, x + 152, y + 32)
draw_actor_sp(actor, x + 152, y + 64)
end
end
#--------------------------------------------------------------------------
# ● 刷新光標矩形
#--------------------------------------------------------------------------
def update_cursor_rect
# 光標位置 -1 為全選、-2 以下為單獨選擇 (使用者自身)
if @index <= -2
self.cursor_rect.set(0, (@index + 10) * 112, self.width - 32, 96)
elsif @index == -1
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 112 - 20)
else
tpy = @index * 112 - self.oy
self.cursor_rect.set(0, tpy, self.width - 32, 96)
if @index < @top_row
@top_row = @index
self.oy = @top_row *112
end
if @index > @top_row+3
@top_row = @index-3
self.oy = @top_row *112
end
end
end
end
#========================================
#■ Window_Base
#----------------------------------------
# Setting functions for the "Base"
#========================================
class Window_Base < Window
def draw_actor_face(actor, x, y)
face=Bitmap.new("Graphics/heads/#{actor.character_name}")
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, 100, 100)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
end
def draw_actor_battler_graphic(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
src_rect = Rect.new(0, 0, 100, 100)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#========================================
#■ Game_Map
#----------------------------------------
# Setting functions for the Map
#========================================
class Game_Map
def name
$map_infos[@map_id]
end
end
#========================================
#■ Window_Title
#----------------------------------------
# Setting functions for the Title
#========================================
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_MenuStatus
#------------------------------------------------------------------------------
# Sets up the Choosing.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 560, 454)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "標楷體"
self.contents.font.size = 20
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# Drawing Info on Screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 94
y = i * 110
actor = $game_party.actors
draw_actor_face(actor, 12, y + 90)
#draw_actor_graphic(actor, 48, y + 65) #and delete the "#" infront of draw of this line
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 120, y)
draw_actor_level(actor, x, y + 18)
draw_actor_state(actor, x + 200, y)
draw_actor_exp(actor, x+ 144, y + 38)
draw_actor_hp(actor, x, y + 38)
draw_actor_sp(actor, x, y + 58)
end
end
#--------------------------------------------------------------------------
# Update of Cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
#=======================================#
# ■Window_GameStats #
# written by AcedentProne #
#------------------------------------------------------------------------------#
class Window_GameStats < Window_Base
def initialize
super(0, 0, 160, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "標楷體"
self.contents.font.size = 18
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
# Draw "Time"
@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 = normal_color
self.contents.draw_text(4, 6, 120, 32, text, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, -10, 120, 32, "Temps")
#Drawing Gold
self.contents.font.color = normal_color
self.contents.draw_text(4, 22, 120, 32,$game_party.gold.to_s + " " +$data_system.words.gold, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 22, 120, 32, $data_system.words.gold, 2)
end
#--------------------------------------------------------------------------
# Update of The count
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ■ Window_Mapname
#------------------------------------------------------------------------------
# Draws the Map name
#==============================================================================
class Window_Mapname < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 60)
self.contents = Bitmap.new(width - 52, height - 32)
self.contents.font.name = "標楷體"
self.contents.font.size = 20
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Map Name
#map = $game_map.name
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 220, 32, "所在地圖")
self.contents.font.color = normal_color
self.contents.draw_text(175, 0, 80, 32, $game_map.name)
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# FF7 menu laytout as requested by AcedentProne.
#==============================================================================
class Scene_Menu
#--------------------------- edit-------------------------------
attr_reader :status_window
#/--------------------------- edit-------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "查看人物狀態"
s5 = "儲存進度"
s6 = "退出遊戲"
#--------------------------- edit-------------------------------
# Command menu
# Size = Screen height - border sizes -
# GameStatus menu - Spacing from GameStatus
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.x = 640 - @command_window.width
@command_window.y = 0
@command_window.z = 110
@command_window.index = @menu_index
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
@map = Window_Mapname.new
@map.x = 640 - @map.width
@map.y = 480 - @map.height - 1
@map.z = 110
# Lower right box
@game_stats_window = Window_GameStats.new
@game_stats_window.x = 640 - @game_stats_window.width
@game_stats_window.y = 640 - @command_window.height - @game_stats_window.height + 3
@game_stats_window.z =110
# Status window
@status_window = Window_MenuStatus.new
@status_window.x = 0
@status_window.y = 8
@status_window.z = 100
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@game_stats_window.dispose
@status_window.dispose
@map.dispose
end
#--------------------------------------------------------------------------
# Updating
#--------------------------------------------------------------------------
def update
@command_window.update
@game_stats_window.update
@status_window.update
@map.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# Updating the Command Selection
#--------------------------------------------------------------------------
def update_command
# If B button is pused
if Input.trigger?(Input::B)
# Plays assigned SE
$game_system.se_play($data_system.cancel_se)
# Go to Map
$scene = Scene_Map.new
return
end
# If C button is pused
if Input.trigger?(Input::C)
# Checks actor size
if $game_party.actors.size == 0 and @command_window.index < 4
# plays SE
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# Updating Status Screen
#--------------------------------------------------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
#==============================================================================
# 本腳本來自www.66RPG.com,使用和轉載請保留此信息
#==============================================================================
|
|