#==============================================================================
# ■ $scene =Scene_cunli.new
#------------------------------------------------------------------------------
module CUNLI
#列表
CL_LB = {
4 => ["休息","镇街","兽栏","探险"], #主角家
6 => ["传授间","怪伴间","道具间","回家"], #兽栏
7 => ["食品店","装备店","宠物店","镇街"], #商店街
14 => ["竞技","决斗街"], #竞技场
21 => ["商店街","决斗街","公园","回家"] , #镇街
33 => ["买卖","商店街"] , #食品店
34 => ["买卖","商店街"] , #装备店
35 => ["买卖","商店街"] , #道具店
38 => [] , #休息
39 => ["竞技场","比赛","镇街"] , #决斗街
40 => ["竞技场","比赛","镇街"] #公园
}
end
class Scene_cunli
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
#清理变量
$game_temp.common_event_id = 5
# 生成活动块
@spriteset = Spriteset_Map.new
# 生成信息窗口
@message_window = Window_Message.new
#生成对话框
@duihua_window = Window_Duihua.new
@duihua_window.z = 0
@duihua_window.opacity = 255
@duihua_window.back_opacity = 255
# 生成介绍窗口
@jies_window = Window_cunlijies.new
@jies_window.z =10
#生成选择窗口
@cunlicommand_window = Window_cunliCommand.new
@cunlicommand_window.z =10
@cunlicommand_window.index = 0
@cunlicommand_window.opacity = 255
@cunlicommand_window.back_opacity = 255
$game_map.autoplay
# 执行过度
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
# 释放窗口
@message_window.dispose
@spriteset.dispose
@jies_window.dispose
@cunlicommand_window.dispose
@duihua_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
if $game_switches[51] == true
@duihua_window.z = 20
else
@duihua_window.z = 0
end
#对话以及奖励
duihua_jiangli
updatenew
# 更新判断
update_command
#对话中不能选项
if $game_switches[51] == false
# 光标下 (+1)
if Input.trigger?(Input::UP)
#播放SE
$game_system.se_play($data_system.cursor_se)
@cunlicommand_window.index -= 1
@cunlicommand_window.index = CUNLI::CL_LB[$game_map.map_id].size - 1 if @cunlicommand_window.index < 0
end
# 光标上 (-1)
if Input.trigger?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@cunlicommand_window.index += 1
@cunlicommand_window.index = 0 if @cunlicommand_window.index > CUNLI::CL_LB[$game_map.map_id].size - 1
end
end
#介绍窗口
@jies_window.set_ren(@cunlicommand_window.index)
end
def update_command
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换的菜单画面
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::C) and $game_switches[51] == false and @duihua_window.z == 0
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
if $game_map.map_id == 4 #主角的房间
if @cunlicommand_window.index == 0 #休息
$scene = Scene_Save.new
if $game_variables[74] == 0
$game_variables[72] = "初梦"
$game_variables[57] = "ZZZZZZZZZ/"
$game_party.gb_quan_huifu
$game_switches[51] = true
$game_switches[52] = true
end
return
elsif @cunlicommand_window.index == 1 #镇街
# 设置新地图
$game_map.setup(21)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 2 #兽栏
# 设置新地图
$game_map.setup(6)
# 设置主角位置
$game_player.moveto(9, 9)
elsif @cunlicommand_window.index == 3 #探险
$game_temp.common_event_id = 1
# 设置新地图
$game_map.setup(11)
# 设置主角位置
$game_player.moveto(0,15)
end
elsif $game_map.map_id == 6 #兽栏
if @cunlicommand_window.index == 0 #传授间
#队伍刷新
$game_variables[1] = 7
$game_party.refresh_fbs
$game_party.friend_party_update
BFS_Friends.weapon_recheck
$game_temp.friends_need_refresh
$scene = Scene_jiaojineng_xuanren.new
return
elsif @cunlicommand_window.index == 1 #怪伴间
$scene = Chaochao_Scene_Party.new
return
elsif @cunlicommand_window.index == 2 #道具间
$scene = Scene_Warehouse.new
return
elsif @cunlicommand_window.index == 3 #回家
# 设置新地图
$game_map.setup(4)
# 设置主角位置
$game_player.moveto(9,9)
end
elsif $game_map.map_id == 7 #商店街
if @cunlicommand_window.index == 0 #食品店
# 设置新地图
$game_map.setup(33)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 1 #装备店
# 设置新地图
$game_map.setup(34)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 2 #道具店
# 设置新地图
$game_map.setup(35)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 3 #镇街
# 设置新地图
$game_map.setup(21)
# 设置主角位置
$game_player.moveto(9,9)
end
elsif $game_map.map_id == 33 #食品店
if @cunlicommand_window.index == 0 #买卖
$game_temp.shop_goods = []
for i in 1..6
$game_temp.shop_goods.push([0,i])
end
for i in 35..43
$game_temp.shop_goods.push([0,i])
end
# 清除商店调用标志
$game_temp.shop_calling = false
# 矫正主角姿势
$game_player.straighten
# 切换到商店画面
$scene = Scene_Shop.new
return
elsif @cunlicommand_window.index == 1 #商店街
# 设置新地图
$game_map.setup(7)
# 设置主角位置
$game_player.moveto(9,9)
end
elsif $game_map.map_id == 34 #装备店
if @cunlicommand_window.index == 0 #买卖
$game_temp.shop_goods = []
for i in 11..25
$game_temp.shop_goods.push([2,i])
end
# 清除商店调用标志
$game_temp.shop_calling = false
# 矫正主角姿势
$game_player.straighten
# 切换到商店画面
$scene = Scene_Shop.new
return
elsif @cunlicommand_window.index == 1 #商店街
# 设置新地图
$game_map.setup(7)
# 设置主角位置
$game_player.moveto(9,9)
end elsif $game_map.map_id == 35 #道具店
if @cunlicommand_window.index == 0 #买卖
$game_temp.shop_goods = []
for i in 100..102
$game_temp.shop_goods.push([0,i])
end
# 清除商店调用标志
$game_temp.shop_calling = false
# 矫正主角姿势
$game_player.straighten
# 切换到商店画面
$scene = Scene_Shop.new
return
elsif @cunlicommand_window.index == 1 #商店街
# 设置新地图
$game_map.setup(7)
# 设置主角位置
$game_player.moveto(9,9)
end
elsif $game_map.map_id == 21 #镇街
if @cunlicommand_window.index == 0 #商店街
# 设置新地图
$game_map.setup(7)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 1 #决斗街
# 设置新地图
$game_map.setup(39)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 2 #公园
# 设置新地图
$game_map.setup(40)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 3 #回家
# 设置新地图
$game_map.setup(4)
# 设置主角位置
$game_player.moveto(9,9)
end
elsif $game_map.map_id == 39 #决斗街
if @cunlicommand_window.index == 0 #竞技场
# 设置新地图
$game_map.setup(14)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 1 #比赛
# 设置新地图
$game_map.setup(8)
# 设置主角位置
$game_player.moveto(9,9)
elsif @cunlicommand_window.index == 2 #镇街
# 设置新地图
$game_map.setup(21)
# 设置主角位置
$game_player.moveto(9, 9)
end
elsif $game_map.map_id == 14 #竞技场
if @cunlicommand_window.index == 0 #竞技
$scene =Scene_jjc.new
return
elsif @cunlicommand_window.index == 1 #决斗街
# 设置新地图
$game_map.setup(39)
# 设置主角位置
$game_player.moveto(9,9)
end
elsif $game_map.map_id == 40 #公园
end
$scene = Scene_Map.new
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def updatenew
$game_party.refresh_fbs if $game_variables[49] != $game_map.map_id
$game_variables[49] = $game_map.map_id
# 循环
loop do
# 按照地图、实例、主角的顺序刷新
# (本更新顺序不会在满足事件的执行条件下成为给予角色瞬间移动
# 的机会的重要因素)
$game_map.update
# $game_system.map_interpreter.update
$game_player.update
# 系统 (计时器)、画面刷新
$game_system.update
$game_screen.update
# 如果主角在场所移动中就中断循环
unless $game_temp.player_transferring
break
end
# 执行场所移动
transfer_player
# 处理过渡中的情况下、中断循环
if $game_temp.transition_processing
break
end
end
# 刷新活动块
@spriteset.update
# 刷新信息窗口
@message_window.update
# 游戏结束的情况下
# if $game_temp.gameover
# 切换的游戏结束画面
# $scene = Scene_Gameover.new
# return
# end
# 返回标题画面的情况下
# if $game_temp.to_title
# 切换到标题画面
# $scene = Scene_Title.new
# return
# end
# 处理过渡中的情况下
if $game_temp.transition_processing
# 清除过渡处理中标志
$game_temp.transition_processing = false
# 执行过渡
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# 显示信息窗口中的情况下
# if $game_temp.message_window_showing
# return
# end
end
end
##########
#光标窗口
class Window_cunliCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize
# 由命令的个数计算出窗口的高
super(0, 320, 120, 160)
self.contents = Bitmap.new(width - 32, height - 32)
$cunliCommands = CUNLI::CL_LB[$game_map.map_id]
refresh
self.opacity = 255
self.back_opacity = 255
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...CUNLI::CL_LB[$game_map.map_id].size
draw_lieb(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_lieb(index, color)
self.contents.font.color = color
rect = Rect.new(20, 32 * index, 64, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
name_lb = []
suoyou_gb = [] if suoyou_gb == nil
suoyou_gb = $game_party.actors + $game_party.waiting_actors + $game_party.actors2
self.contents.draw_text(rect, $cunliCommands[index]) if index < $cunliCommands.size
self.contents.font.color.set(200, 200, 0)
rectid = Rect.new(0, 32 * index, 32 , 32)
self.contents.draw_text(rectid, (index+1).to_s)
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_lieb(index)
draw_lieb(index, disabled_color)
end
end
################
#################
class Window_cunlijies < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
#坐标,长宽
super(120, 320, 520, 160)
#位图大小
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 255
self.back_opacity = 255
end
#--------------------------------------------------------------------------
# ● 设置敌人
# enemy : 要显示名字和状态的敌人
#--------------------------------------------------------------------------
def set_ren(ren)
draw_cunli_graphic($cunliCommands[ren],ren) unless $cunliCommands == nil
end
#########################################
def draw_cunli_graphic(name,id)
self.contents.font.color = system_color
bitmap = RPG::Cache.Panoramas($cunliCommands[id]) rescue nil
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(0,0, bitmap, src_rect)
end
###########################################
end