Project1
标题:
夜想曲快捷键右置。悬赏2V
[打印本页]
作者:
Ж纯Ж蓝Ж
时间:
2011-1-29 16:37
标题:
夜想曲快捷键右置。悬赏2V
#==============================================================================
# ■ Window_Item_KeyCommand
#------------------------------------------------------------------------------
# 选择快捷键的窗口
#==============================================================================
class Window_Item_KeyCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(160-16, 480-78, 346, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@item_max = 7
@column_max = 7
@commands = ["Z", "X", "C","V","B","N","M"]
refresh
self.index = -1
self.active = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(actor=nil)
self.contents.clear
if actor != nil
u = 0
for key in ["Z", "X", "C","V","B","N","M"]
item = $data_items[actor.item_key[key]]
if !item.nil?
if $game_party.item_number(item.id) == 0
actor.item_key[key] = 0
refresh(actor)
return
end
bitmap = RPG::Cache.icon(item.icon_name)
x = 58 + u * (320-32)/4
self.contents.font.size = 12
self.contents.font.color = Color.new(255,255,255,255)
self.contents.blt(x,16,bitmap,Rect.new(0,0,30,30))
self.contents.draw_text(x, 24, 128, 32, item.name)
self.contents.draw_text(x+25, 12, 128, 32, "x")
self.contents.draw_text(x+32, 12, 128, 32, "#{$game_party.item_number(item.id)}")
end
u += 1
end
end
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
x = 53 + index * (320-32)/4
self.contents.font.size = 16
self.contents.font.color = Color.new(20,20,20)
self.contents.draw_text(x+1, 1, 128, 32, @commands[index])
self.contents.font.color = Color.new(135,175,255)
self.contents.draw_text(x, 0, 128, 32, @commands[index])
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 * (320-32)/4
y = @index / @column_max * 32 - self.oy
# 更新国标矩形
self.cursor_rect.set(48+x, y+8, 64, 40)
end
end
#==============================================================================
# ■ Scene_Key
#------------------------------------------------------------------------------
# 处理中快捷键的类。
#==============================================================================
class Scene_Item_Key < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
super()
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main_start
super
# 获取角色
@actor = $game_party.actors[@actor_index]
# 生成帮助窗口、状态窗口、特技窗口
@help_window = Window_Help.new
@item_window = Window_Item.new#(@actor)
@item_window.z -= 98
@item_window.height = 256
@item_window.back_opacity = 160
@help_window.back_opacity = 160
@key_window = Window_Item_KeyCommand.new
@key_window.refresh(@actor)
# 关联帮助窗口
@item_window.help_window = @help_window
@windows.push(@help_window)
@windows.push(@item_window)
@windows.push(@key_window)
end
def make_sprite
@spriteset = Spriteset_Map.new
@arpg_actor = ARPG_Actor.new
end
def dispose_sprite
@spriteset.dispose
@arpg_actor.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新命令窗口
@arpg_actor.update
if @item_window.active
update_item
return
end
if @key_window.active
update_key
return
end
end
#--------------------------------------------------------------------------
# ● 刷新技能窗口
#--------------------------------------------------------------------------
def update_item
@item_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Map.new
return
end
# 按下 C 键的场合下
if Input.trigger?(Input::C)
item = @item_window.item
return if !$game_party.item_can_use?(item.id)
M.ok
@item_window.active = false
@key_window.active = true
@key_window.index = 0
end
end
#--------------------------------------------------------------------------
# ● 刷新选择键位
#--------------------------------------------------------------------------
def update_key
@key_window.update
if Input.trigger?(Input::C)
item = @item_window.item
case @key_window.index
when 0
key_start("Z",item)
when 1
key_start("X",item)
when 2
key_start("C",item)
when 3
key_start("V",item)
when 4
key_start("B",item)
when
key_start("N",item)
when 6
key_start("M",item)
end
end
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@item_window.active = true
@key_window.active = false
@key_window.index = -1
return
end
end
#--------------------------------------------------------------------------
# ● 设置键位
#--------------------------------------------------------------------------
def key_start(key,item)
if item.nil?
@actor.item_key[key] = 0
else
@actor.item_key[key] = item.id
end
@item_window.active = true
@key_window.active = false
@key_window.index = -1
@key_window.refresh(@actor)
M.eq
return
end
end
复制代码
#==============================================================================
# ■ Window_KeyCommand
#------------------------------------------------------------------------------
# 选择快捷键的窗口
#==============================================================================
class Window_KeyCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(73-16, 480-106, 520, 155)#(73-16, 480-71, 520, 155)
self.contents = Bitmap.new(width - 29, height - 29)
self.opacity = 0
@item_max = 7
@column_max = 7
@commands = ["A", "S", "D", "F","G","H","J"]
refresh
self.index = -1
self.active = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(actor=nil)
self.contents.clear
if actor != nil
u = 0
for key in ["A", "S", "D", "F","G","H","J"]
skill = $game_skills[actor.key[key]]
if !skill.nil?
bitmap = RPG::Cache.icon(skill.icon_name)
x = 305 + u * (180)/6
self.contents.font.size = 12
self.contents.font.color = Color.new(255,255,255,255)
self.contents.blt(x,16,bitmap,Rect.new(0,0,30,30))
self.contents.draw_text(x+16, 8, 128, 32, skill.name)
self.contents.draw_text(x, 24, 128, 32, "SP:#{skill.sp_cost}")
end
u += 1
end
end
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
x = 315 + index * (180)/6
self.contents.font.size = 16
self.contents.font.color = Color.new(20,20,20)
self.contents.draw_text(x+1, 1, 128, 32, @commands[index])
self.contents.font.color = Color.new(135,175,255)
self.contents.draw_text(x, 0, 128, 32, @commands[index])
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 - 30
# 计算光标坐标
x = @index % @column_max * (180)/6
y = @index / @column_max * 32 - self.oy
# 更新国标矩形
self.cursor_rect.set(305+x, y+8, 30, 40)
end
end
#==============================================================================
# ■ Scene_Key
#------------------------------------------------------------------------------
# 处理中快捷键的类。
#==============================================================================
class Scene_Key < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
super()
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main_start
super
@actor = $game_party.actors[@actor_index]
# 生成帮助窗口、状态窗口、特技窗口
@help_window = Window_Help.new
@skill_window = Window_Skill.new(@actor)
@skill_window.z -= 98
@skill_window.height = 256
@skill_window.back_opacity = 160
@help_window.back_opacity = 160
@key_window = Window_KeyCommand.new
@key_window.refresh(@actor)
# 关联帮助窗口
@skill_window.help_window = @help_window
@windows.push(@help_window)
@windows.push(@skill_window)
@windows.push(@key_window)
end
def make_sprite
@spriteset = Spriteset_Map.new
@arpg_actor = ARPG_Actor.new
end
def dispose_sprite
@spriteset.dispose
@arpg_actor.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新命令窗口
@arpg_actor.update
if @skill_window.active
update_skill
return
end
if @key_window.active
update_key
return
end
end
#--------------------------------------------------------------------------
# ● 刷新技能窗口
#--------------------------------------------------------------------------
def update_skill
@skill_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Map.new
return
end
# 按下 C 键的场合下
if Input.trigger?(Input::C)
M.ok
@skill_window.active = false
@key_window.active = true
@key_window.index = 0
end
end
#--------------------------------------------------------------------------
# ● 刷新选择键位
#--------------------------------------------------------------------------
def update_key
@key_window.update
if Input.trigger?(Input::C)
skill = @skill_window.skill
case @key_window.index
when 0
key_start("A",skill)
when 1
key_start("S",skill)
when 2
key_start("D",skill)
when 3
key_start("F",skill)
when 4
key_start("G",skill)
when 5
key_start("H",skill)
when 6
key_start("J",skill)
end
end
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@key_window.active = false
@key_window.index = -1
return
end
end
#--------------------------------------------------------------------------
# ● 设置键位
#--------------------------------------------------------------------------
def key_start(key,skill)
if skill.nil?
@actor.key[key] = 0
else
@actor.key[key] = skill.id
end
@skill_window.active = true
@key_window.active = false
@key_window.index = -1
@key_window.refresh(@actor)
M.eq
return
end
end
复制代码
技能栏的脚本是上面那个,物品栏是下面那个。自己折腾不出来 - -。
然后效果如下。
112.jpg
(159.6 KB, 下载次数: 38)
下载附件
保存到相册
2011-1-29 16:34 上传
坐标是…X565 Y145 左边这一排第一格的左上角坐标。 X605 Y145 右边这一排第一格的左上角坐标。
然后目的是把这个技能栏和物品栏丢进格子里- -。
还有光标的描绘。就这样。恩= =
作者:
fux2
时间:
2011-1-29 16:37
本帖最后由 fux2 于 2011-1-30 09:14 编辑
站位不解释
替换为
特技:
#==============================================================================
# ■ Window_KeyCommand
#------------------------------------------------------------------------------
# 选择快捷键的窗口
#==============================================================================
class Window_KeyCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(553, 83, 144, 600)
self.contents = Bitmap.new(width - 29, height - 29)
self.opacity = 0
@item_max = 7
@column_max = 7
@commands = ["A", "S", "D", "F","G","H","J"]
refresh
self.index = -1
self.active = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(actor=nil)
self.contents.clear
if actor != nil
u = 0
for key in ["A", "S", "D", "F","G","H","J"]
skill = $game_skills[actor.key[key]]
if !skill.nil?
bitmap = RPG::Cache.icon(skill.icon_name)
y = u * 32 - 10
self.contents.font.size = 12
self.contents.font.color = Color.new(255,255,255,255)
self.contents.blt(4,y+35,bitmap,Rect.new(0,0,30,30))
self.contents.draw_text(4, y+44, 128, 32, "SP:#{skill.sp_cost}")
end
u += 1
end
end
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
y = index * 32
self.contents.font.size = 16
self.contents.font.color = Color.new(20,20,20)
self.contents.draw_text(25, y+33, 128, 32, @commands[index])
self.contents.font.color = Color.new(135,175,255)
self.contents.draw_text(24, y+32, 128, 32, @commands[index])
end
#--------------------------------------------------------------------------
# ● 更新光标举行
#--------------------------------------------------------------------------
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index
# 当前行被显示开头行前面的情况下
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
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::DOWN)
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::UP)
if @column_max >= 2 and @index > 0
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
end
# 计算光标的宽
cursor_width = self.width / @column_max - 30
# 计算光标坐标
y = @index * 32
# 更新国标矩形
self.cursor_rect.set(6, y+26, 28, 28)
end
end
#==============================================================================
# ■ Scene_Key
#------------------------------------------------------------------------------
# 处理中快捷键的类。
#==============================================================================
class Scene_Item_Key < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
super()
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main_start
super
# 获取角色
@actor = $game_party.actors[@actor_index]
# 生成帮助窗口、状态窗口、特技窗口
@help_window = Window_Help.new
@item_window = Window_Item.new#(@actor)
@item_window.z -= 98
@item_window.height = 256
@item_window.back_opacity = 160
@help_window.back_opacity = 160
@key_window = Window_Item_KeyCommand.new
@key_window.refresh(@actor)
# 关联帮助窗口
@item_window.help_window = @help_window
@windows.push(@help_window)
@windows.push(@item_window)
@windows.push(@key_window)
end
def make_sprite
@spriteset = Spriteset_Map.new
@arpg_actor = ARPG_Actor.new
end
def dispose_sprite
@spriteset.dispose
@arpg_actor.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新命令窗口
@arpg_actor.update
if @item_window.active
update_item
return
end
if @key_window.active
update_key
return
end
end
#--------------------------------------------------------------------------
# ● 刷新技能窗口
#--------------------------------------------------------------------------
def update_item
@item_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Map.new
return
end
# 按下 C 键的场合下
if Input.trigger?(Input::C)
item = @item_window.item
return if !$game_party.item_can_use?(item.id)
M.ok
@item_window.active = false
@key_window.active = true
@key_window.index = 0
end
end
#--------------------------------------------------------------------------
# ● 刷新选择键位
#--------------------------------------------------------------------------
def update_key
@key_window.update
if Input.trigger?(Input::C)
item = @item_window.item
case @key_window.index
when 0
key_start("Z",item)
when 1
key_start("X",item)
when 2
key_start("C",item)
when 3
key_start("V",item)
when 4
key_start("B",item)
when
key_start("N",item)
when 6
key_start("M",item)
end
end
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@item_window.active = true
@key_window.active = false
@key_window.index = -1
return
end
end
#--------------------------------------------------------------------------
# ● 设置键位
#--------------------------------------------------------------------------
def key_start(key,item)
if item.nil?
@actor.item_key[key] = 0
else
@actor.item_key[key] = item.id
end
@item_window.active = true
@key_window.active = false
@key_window.index = -1
@key_window.refresh(@actor)
M.eq
return
end
end
复制代码
物品:
#==============================================================================
# ■ Window_Item_KeyCommand
#------------------------------------------------------------------------------
# 选择快捷键的窗口
#==============================================================================
class Window_Item_KeyCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(585, 83, 144, 600)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@item_max = 7
@column_max = 7
@commands = ["Z", "X", "C","V","B","N","M"]
refresh
self.index = -1
self.active = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(actor=nil)
self.contents.clear
if actor != nil
u = 0
for key in ["Z", "X", "C","V","B","N","M"]
item = $data_items[actor.item_key[key]]
if !item.nil?
if $game_party.item_number(item.id) == 0
actor.item_key[key] = 0
refresh(actor)
return
end
bitmap = RPG::Cache.icon(item.icon_name)
y = u * 32 - 10
self.contents.font.size = 12
self.contents.font.color = Color.new(255,255,255,255)
self.contents.blt(0,y+35,bitmap,Rect.new(0,0,32,32))
self.contents.draw_text(6, y+44, 128, 32, "x")
self.contents.draw_text(13, y+44, 128, 32, "#{$game_party.item_number(item.id)}")
end
u += 1
end
end
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
y = index * 32
self.contents.font.size = 16
self.contents.font.color = Color.new(20,20,20)
self.contents.draw_text(25, y+33, 128, 32, @commands[index])
self.contents.font.color = Color.new(135,175,255)
self.contents.draw_text(24, y+32, 128, 32, @commands[index])
end
#--------------------------------------------------------------------------
# ● 更新光标举行
#--------------------------------------------------------------------------
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index
# 当前行被显示开头行前面的情况下
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
# 计算光标的宽
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::DOWN)
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::UP)
if @column_max >= 2 and @index > 0
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
end
cursor_width = self.width / @column_max - 32
# 计算光标坐标
y = @index * 32
# 更新国标矩形
self.cursor_rect.set(6, y+26, 28, 28)
end
end
#==============================================================================
# ■ Scene_Key
#------------------------------------------------------------------------------
# 处理中快捷键的类。
#==============================================================================
class Scene_Key < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
super()
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main_start
super
@actor = $game_party.actors[@actor_index]
# 生成帮助窗口、状态窗口、特技窗口
@help_window = Window_Help.new
@skill_window = Window_Skill.new(@actor)
@skill_window.z -= 98
@skill_window.height = 256
@skill_window.back_opacity = 160
@help_window.back_opacity = 160
@key_window = Window_KeyCommand.new
@key_window.refresh(@actor)
# 关联帮助窗口
@skill_window.help_window = @help_window
@windows.push(@help_window)
@windows.push(@skill_window)
@windows.push(@key_window)
end
def make_sprite
@spriteset = Spriteset_Map.new
@arpg_actor = ARPG_Actor.new
end
def dispose_sprite
@spriteset.dispose
@arpg_actor.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新命令窗口
@arpg_actor.update
if @skill_window.active
update_skill
return
end
if @key_window.active
update_key
return
end
end
#--------------------------------------------------------------------------
# ● 刷新技能窗口
#--------------------------------------------------------------------------
def update_skill
@skill_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Map.new
return
end
# 按下 C 键的场合下
if Input.trigger?(Input::C)
M.ok
@skill_window.active = false
@key_window.active = true
@key_window.index = 0
end
end
#--------------------------------------------------------------------------
# ● 刷新选择键位
#--------------------------------------------------------------------------
def update_key
@key_window.update
if Input.trigger?(Input::C)
skill = @skill_window.skill
case @key_window.index
when 0
key_start("A",skill)
when 1
key_start("S",skill)
when 2
key_start("D",skill)
when 3
key_start("F",skill)
when 4
key_start("G",skill)
when 5
key_start("H",skill)
when 6
key_start("J",skill)
end
end
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@key_window.active = false
@key_window.index = -1
return
end
end
#--------------------------------------------------------------------------
# ● 设置键位
#--------------------------------------------------------------------------
def key_start(key,skill)
if skill.nil?
@actor.key[key] = 0
else
@actor.key[key] = skill.id
end
@skill_window.active = true
@key_window.active = false
@key_window.index = -1
@key_window.refresh(@actor)
M.eq
return
end
end
复制代码
作者:
shanruiwen
时间:
2011-1-29 16:56
情况不明
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1