赞 | 0 |
VIP | 1 |
好人卡 | 0 |
积分 | 1 |
经验 | 3179 |
最后登录 | 2013-10-25 |
在线时间 | 140 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 66
- 在线时间
- 140 小时
- 注册时间
- 2012-2-6
- 帖子
- 384
|
本帖最后由 杂兵天下 于 2012-3-5 01:08 编辑
看了之后,收回刚才说的话,LZ是一个连alias法冲突避免都不知道的可爱的天朝人
class Game_Mission def initialize @texts = "" @titletext = "" @imtext = "" @NPC1 = "" @NPC2 = "" @bool_mission = false end def setText(text);@texts=text;end def setTitle(text);@titletext=text;end def setImText(text);@imtext=text;end def setNPC(t1, t2);@NPC1=t1;@NPC2=t2;end def setStatus(b);@bool_mission=b;end def getText;@texts;end def getTitle;@titletext;end def getImText;@imtext;end def getNPC1;@NPC1;end def getNPC2;@NPC2;end def getStatus;@bool_mission;end def clear @texts = "" @titletext = "" @imtext = "" @NPC1 = "" @NPC2 = "" @bool_mission = false end end class Game_Missions def initialize @mission_array=Array.new for i in 0...100 @mission_array[i]=Game_Mission.new end end def mission(t);@mission_array[t];end def getNoMission for i in 99..0 if @mission_array[i].getStatus==false return i end end end def clear for i in 0...100 @mission_array[i].clear end end def serMission(titletext) for i in 0...100 if @mission_array[i].getTitle==titletext && @mission_array[i].getStatus==true then return i end end return -1 end end class Window_MissionShow < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, window_width, Graphics.height) self.openness = 0 open end def setNumber(numbers) @Mnumber=numbers refresh end #-------------------------------------------------------------------------- # ● 获取窗口的宽度 #-------------------------------------------------------------------------- def window_width return Graphics.width - 256 end def draw_title(text , line, size ,dwhere ,color) self.contents.font.color=color self.contents.font.size=size draw_text(4, 0 , window_width-40, fitting_height(line+1), text ,dwhere) self.contents.font.color=normal_color self.contents.font.size=Font.default_size end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh @texts= $game_missions.mission(@Mnumber).getTitle draw_title(@texts,0,48,1,Color.new(255,100,100)) draw_title("任务介绍",4,22,0,Color.new(100,255,255)) draw_title($game_missions.mission(@Mnumber).getText,6,18,0,Color.new(255,255,255)) draw_title("任务奖励/重要信息",9,22,0,Color.new(100,255,255)) draw_title($game_missions.mission(@Mnumber).getImText,11,18,0,Color.new(255,255,255)) draw_title("领取任务NPC",14,22,0,Color.new(100,255,255)) draw_title($game_missions.mission(@Mnumber).getNPC1,16,18,0,Color.new(255,255,255)) draw_title("交接任务NPC",19,22,0,Color.new(100,255,255)) draw_title($game_missions.mission(@Mnumber).getNPC2,21,18,0,Color.new(255,255,255)) end end #encoding:utf-8 class Window_MissionCommand < Window_Command #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize super(0, 0) end #-------------------------------------------------------------------------- # ● 获取窗口的宽度 #-------------------------------------------------------------------------- def window_width return 256 end #-------------------------------------------------------------------------- # ● 获取显示行数 #-------------------------------------------------------------------------- def visible_line_number 10 end #-------------------------------------------------------------------------- # ● 生成指令列表 #-------------------------------------------------------------------------- def make_command_list add_original_commands add_return_command end #-------------------------------------------------------------------------- # ● 独自添加指令用 #-------------------------------------------------------------------------- def add_original_commands for i in 0...100 @r=i+1 @t="mission" + i.to_s if $game_missions.mission(i).getStatus==true add_command($game_missions.mission(i).getTitle, @t.to_sym) end end end #-------------------------------------------------------------------------- # ● 结束指令用 #-------------------------------------------------------------------------- def add_return_command add_command("返回", :returnsc) end #-------------------------------------------------------------------------- # ● 按下确定键时的处理 #-------------------------------------------------------------------------- def process_ok super end def call_handler(symbol) @handler[symbol].call(symbol.id2name[7,symbol.id2name.size-7].to_i) if handle?(symbol) end end #encoding:utf-8 class Scene_Mission < Scene_MenuBase def start super create_command_window end def create_command_window @command_window = Window_MissionCommand.new @window_missionShow=Window_MissionShow.new(256,0) @window_missionShow.hide @command_window.set_handler(:returnsc, method(:scenereturns)) @command_window.set_handler(:cancel, method(:scenereturns)) @window_missionShow.set_handler(:cancel, method(:missionHide)) @window_missionShow.set_handler(:ok, method(:missionHide)) for i in 0...100 @r=i @t="mission" + i.to_s @command_window.set_handler(@t.to_sym, method(:missionShow)) end end def scenereturns( t) SceneManager.return end def missionShow( t) @window_missionShow.setNumber(t) @command_window.deactivate @window_missionShow.activate @window_missionShow.openness=0 @window_missionShow.show @window_missionShow.open end def missionHide @command_window.activate @window_missionShow.deactivate @window_missionShow.close update until @window_missionShow.close? @window_missionShow.hide end end #encoding:utf-8 module DataManager class <<self alias make_save_contents_task_zabing make_save_contents alias create_game_objects_task_zabing create_game_objects alias extract_save_contents_task_zabing extract_save_contents end def self.create_game_objects create_game_objects_task_zabing $game_missions = Game_Missions.new end def make_save_contents contents = make_save_contents_task_zabing contents[:missions] = $game_missions contents end def self.extract_save_contents(contents) extract_save_contents_task_zabing(contents) $game_missions = contents[:missions] end end class Window_MenuCommand < Window_Command alias add_original_commands_task_zabing add_original_commands def add_original_commands add_original_commands_task_zabing add_command("任务", :maphint) end end class Scene_Menu < Scene_MenuBase alias create_command_window_task_zabing create_command_window def create_command_window create_command_window_task_zabing @command_window.set_handler(:maphint, method(:command_maphint)) end def command_maphint SceneManager.call(Scene_Mission) end end
class Game_Mission
def initialize
@texts = ""
@titletext = ""
@imtext = ""
@NPC1 = ""
@NPC2 = ""
@bool_mission = false
end
def setText(text);@texts=text;end
def setTitle(text);@titletext=text;end
def setImText(text);@imtext=text;end
def setNPC(t1, t2);@NPC1=t1;@NPC2=t2;end
def setStatus(b);@bool_mission=b;end
def getText;@texts;end
def getTitle;@titletext;end
def getImText;@imtext;end
def getNPC1;@NPC1;end
def getNPC2;@NPC2;end
def getStatus;@bool_mission;end
def clear
@texts = ""
@titletext = ""
@imtext = ""
@NPC1 = ""
@NPC2 = ""
@bool_mission = false
end
end
class Game_Missions
def initialize
@mission_array=Array.new
for i in 0...100
@mission_array[i]=Game_Mission.new
end
end
def mission(t);@mission_array[t];end
def getNoMission
for i in 99..0
if @mission_array[i].getStatus==false
return i
end
end
end
def clear
for i in 0...100
@mission_array[i].clear
end
end
def serMission(titletext)
for i in 0...100
if @mission_array[i].getTitle==titletext && @mission_array[i].getStatus==true then
return i
end
end
return -1
end
end
class Window_MissionShow < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, Graphics.height)
self.openness = 0
open
end
def setNumber(numbers)
@Mnumber=numbers
refresh
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return Graphics.width - 256
end
def draw_title(text , line, size ,dwhere ,color)
self.contents.font.color=color
self.contents.font.size=size
draw_text(4, 0 , window_width-40, fitting_height(line+1), text ,dwhere)
self.contents.font.color=normal_color
self.contents.font.size=Font.default_size
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@texts= $game_missions.mission(@Mnumber).getTitle
draw_title(@texts,0,48,1,Color.new(255,100,100))
draw_title("任务介绍",4,22,0,Color.new(100,255,255))
draw_title($game_missions.mission(@Mnumber).getText,6,18,0,Color.new(255,255,255))
draw_title("任务奖励/重要信息",9,22,0,Color.new(100,255,255))
draw_title($game_missions.mission(@Mnumber).getImText,11,18,0,Color.new(255,255,255))
draw_title("领取任务NPC",14,22,0,Color.new(100,255,255))
draw_title($game_missions.mission(@Mnumber).getNPC1,16,18,0,Color.new(255,255,255))
draw_title("交接任务NPC",19,22,0,Color.new(100,255,255))
draw_title($game_missions.mission(@Mnumber).getNPC2,21,18,0,Color.new(255,255,255))
end
end
#encoding:utf-8
class Window_MissionCommand < Window_Command
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0)
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 256
end
#--------------------------------------------------------------------------
# ● 获取显示行数
#--------------------------------------------------------------------------
def visible_line_number
10
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_original_commands
add_return_command
end
#--------------------------------------------------------------------------
# ● 独自添加指令用
#--------------------------------------------------------------------------
def add_original_commands
for i in 0...100
@r=i+1
@t="mission" + i.to_s
if $game_missions.mission(i).getStatus==true
add_command($game_missions.mission(i).getTitle, @t.to_sym)
end
end
end
#--------------------------------------------------------------------------
# ● 结束指令用
#--------------------------------------------------------------------------
def add_return_command
add_command("返回", :returnsc)
end
#--------------------------------------------------------------------------
# ● 按下确定键时的处理
#--------------------------------------------------------------------------
def process_ok
super
end
def call_handler(symbol)
@handler[symbol].call(symbol.id2name[7,symbol.id2name.size-7].to_i) if handle?(symbol)
end
end
#encoding:utf-8
class Scene_Mission < Scene_MenuBase
def start
super
create_command_window
end
def create_command_window
@command_window = Window_MissionCommand.new
@window_missionShow=Window_MissionShow.new(256,0)
@window_missionShow.hide
@command_window.set_handler(:returnsc, method(:scenereturns))
@command_window.set_handler(:cancel, method(:scenereturns))
@window_missionShow.set_handler(:cancel, method(:missionHide))
@window_missionShow.set_handler(:ok, method(:missionHide))
for i in 0...100
@r=i
@t="mission" + i.to_s
@command_window.set_handler(@t.to_sym, method(:missionShow))
end
end
def scenereturns( t)
SceneManager.return
end
def missionShow( t)
@window_missionShow.setNumber(t)
@command_window.deactivate
@window_missionShow.activate
@window_missionShow.openness=0
@window_missionShow.show
@window_missionShow.open
end
def missionHide
@command_window.activate
@window_missionShow.deactivate
@window_missionShow.close
update until @window_missionShow.close?
@window_missionShow.hide
end
end
#encoding:utf-8
module DataManager
class <<self
alias make_save_contents_task_zabing make_save_contents
alias create_game_objects_task_zabing create_game_objects
alias extract_save_contents_task_zabing extract_save_contents
end
def self.create_game_objects
create_game_objects_task_zabing
$game_missions = Game_Missions.new
end
def make_save_contents
contents = make_save_contents_task_zabing
contents[:missions] = $game_missions
contents
end
def self.extract_save_contents(contents)
extract_save_contents_task_zabing(contents)
$game_missions = contents[:missions]
end
end
class Window_MenuCommand < Window_Command
alias add_original_commands_task_zabing add_original_commands
def add_original_commands
add_original_commands_task_zabing
add_command("任务", :maphint)
end
end
class Scene_Menu < Scene_MenuBase
alias create_command_window_task_zabing create_command_window
def create_command_window
create_command_window_task_zabing
@command_window.set_handler(:maphint, method(:command_maphint))
end
def command_maphint
SceneManager.call(Scene_Mission)
end
end
减少冲突,优化程序外观,去除奇怪的地图提示功能后的程序。 |
|