赞 | 3 |
VIP | 0 |
好人卡 | 0 |
积分 | 14 |
经验 | 0 |
最后登录 | 2023-1-26 |
在线时间 | 148 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1410
- 在线时间
- 148 小时
- 注册时间
- 2018-3-24
- 帖子
- 145
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
=============================================================================
# ■ Scene_By
#------------------------------------------------------------------------------
# 乘降画面
#==============================================================================
class Scene_By < Scene_ByBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_command_window
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_By.new
@command_window.set_handler(:all_actor_up, method(:all_actor_up))
@command_window.set_handler(:all_actor_down, method(:all_actor_down))
@command_window.set_handler(:ok, method(:ok ))
@command_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 窗口进入
#--------------------------------------------------------------------------
def move_start
Window_move::speed(@command_window,3)
end
#--------------------------------------------------------------------------
# ● 窗口离开
#--------------------------------------------------------------------------
def move_end
Window_move::speed_back(@command_window,3)
end
#--------------------------------------------------------------------------
# ● 指令“全体上车”
#--------------------------------------------------------------------------
def all_actor_up
for i in 0...$game_party.actors.size
if $game_party.actors[i] <= $game_party.bus_actor
bus_up($game_party.actors[i])
end
end
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 指令“全体下车”
#--------------------------------------------------------------------------
def all_actor_down
for i in 0...$game_party.actors.size
if $game_party.actors[i] > $game_party.bus_actor
a = $game_party.actors[i]-$game_party.bus_actor
b = $game_party.bus[a*7+5]
bus_down(b)
end
end
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 指令“个别乘降”
#--------------------------------------------------------------------------
def ok
actor = @command_window.current_ext
bus(actor.id)
end
#--------------------------------------------------------------------------
# ● 个别角色判定
#--------------------------------------------------------------------------
def bus(actor)
#判定坐标
if $game_actors[actor].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
elsif $game_actors[actor].index == nil
actor_id_i = $game_party.actor_by[actor]
if $game_actors[actor_id_i].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
else
x = $game_player.followers[$game_actors[actor_id_i].index-1].x
y = $game_player.followers[$game_actors[actor_id_i].index-1].y
d = $game_player.followers[$game_actors[actor_id_i].index-1].direction
end
else
x = $game_player.followers[$game_actors[actor].index-1].x
y = $game_player.followers[$game_actors[actor].index-1].y
d = $game_player.followers[$game_actors[actor].index-1].direction
end
for i in 1..$game_party.bus_max
#如果这辆车没有得到,直接往下判断,本质没什么用,但可以优化一下内存
if $game_party.bus[i*7+6] == false
next
end
#车与角色的位置判定
if $game_party.bus[i*7+4] == false and x == $game_party.bus[i*7] and y == $game_party.bus[i*7+1] and $game_party.bus[i*7+3] == $game_map.map_id
$game_party.bus[i*7+4] = true #更改停放状态
$game_party.bus[i*7+5] = actor #更改此车被几号角色所称
#更改角色所乘战车ID
$game_party.actor_by[actor] = i+$game_party.bus_actor
$game_party.add_actor(i+$game_party.bus_actor) #加人战车
#替换战车与角色位置
$game_party.swap_order($game_actors[actor].index,$game_actors[i+$game_party.bus_actor].index)
$game_party.remove_actor(actor) #角色离队
Audio.se_play("Audio/SE/001-上下车",100,100) #播放上车音效
break #跳出循环
elsif $game_party.bus[i*7+4] == true and $game_party.bus[i*7+5] == actor
$game_party.add_actor($game_party.bus[i*7+5]) #加人角色
$game_party.bus[i*7+4] = false #更改停放状态
#更改角色所乘战车ID
$game_party.actor_by[actor] = nil
a = $game_actors[$game_party.bus[i*7+5]].index
$game_party.bus[i*7+5] = nil #清空车内角色id
#记录战车停放位置
$game_party.bus[i*7] = x
$game_party.bus[i*7+1] = y
$game_party.bus[i*7+2] = d
$game_party.bus[i*7+3] = $game_map.map_id
#替换战车与角色位置
b = $game_actors[i+$game_party.bus_actor].index
$game_party.swap_order(a, b)
$game_party.remove_actor(i+$game_party.bus_actor) #战车离队
Audio.se_play("Audio/SE/001-上下车",100,100) #播放下车音效
break #跳出循环
end
end
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 上车判定
#--------------------------------------------------------------------------
def bus_up(actor)
#判定坐标
if $game_actors[actor].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
elsif $game_actors[actor].index == nil
actor_id_i = $game_party.actor_by[actor]
if $game_actors[actor_id_i].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
else
x = $game_player.followers[$game_actors[actor_id_i].index-1].x
y = $game_player.followers[$game_actors[actor_id_i].index-1].y
d = $game_player.followers[$game_actors[actor_id_i].index-1].direction
end
else
x = $game_player.followers[$game_actors[actor].index-1].x
y = $game_player.followers[$game_actors[actor].index-1].y
d = $game_player.followers[$game_actors[actor].index-1].direction
end
for i in 1..$game_party.bus_max
#如果这辆车没有得到,直接往下判断,本质没什么用,但可以优化一下内存
if $game_party.bus[i*7+6] == false
next
end
#车与角色的位置判定
if $game_party.bus[i*7+4] == false and x == $game_party.bus[i*7] and y == $game_party.bus[i*7+1] and $game_party.bus[i*7+3] == $game_map.map_id
$game_party.bus[i*7+4] = true #更改停放状态
$game_party.bus[i*7+5] = actor #更改此车被几号角色所称
#更改角色所乘战车ID
$game_party.actor_by[actor] = i+$game_party.bus_actor
$game_party.add_actor(i+$game_party.bus_actor) #加人战车
#替换战车与角色位置
$game_party.swap_order($game_actors[actor].index,$game_actors[i+$game_party.bus_actor].index)
$game_party.remove_actor(actor) #角色离队
Audio.se_play("Audio/SE/001-上下车",100,100) #播放上车音效
break #跳出循环
end
end
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 下车判定
#--------------------------------------------------------------------------
def bus_down(actor)
#判定坐标
if $game_actors[actor].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
elsif $game_actors[actor].index == nil
actor_id_i = $game_party.actor_by[actor]
if $game_actors[actor_id_i].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
else
x = $game_player.followers[$game_actors[actor_id_i].index-1].x
y = $game_player.followers[$game_actors[actor_id_i].index-1].y
d = $game_player.followers[$game_actors[actor_id_i].index-1].direction
end
else
x = $game_player.followers[$game_actors[actor].index-1].x
y = $game_player.followers[$game_actors[actor].index-1].y
d = $game_player.followers[$game_actors[actor].index-1].direction
end
for i in 1..$game_party.bus_max
#如果这辆车没有得到,直接往下判断,本质没什么用,但可以优化一下内存
if $game_party.bus[i*7+6] == false
next
end
if $game_party.bus[i*7+4] == true and $game_party.bus[i*7+5] == actor
$game_party.add_actor($game_party.bus[i*7+5]) #加人角色
$game_party.bus[i*7+4] = false #更改停放状态
#更改角色所乘战车ID
$game_party.actor_by[actor] = nil
a = $game_actors[$game_party.bus[i*7+5]].index
$game_party.bus[i*7+5] = nil #清空车内角色id
#记录战车停放位置
$game_party.bus[i*7] = x
$game_party.bus[i*7+1] = y
$game_party.bus[i*7+2] = d
$game_party.bus[i*7+3] = $game_map.map_id
#替换战车与角色位置
b = $game_actors[i+$game_party.bus_actor].index
$game_party.swap_order(a, b)
$game_party.remove_actor(i+$game_party.bus_actor) #战车离队
Audio.se_play("Audio/SE/001-上下车",100,100) #播放下车音效
break #跳出循环
end
SceneManager.goto(Scene_Map)
end
end
end
|
|