赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2557 |
最后登录 | 2013-10-5 |
在线时间 | 1 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 51
- 在线时间
- 1 小时
- 注册时间
- 2010-7-21
- 帖子
- 180
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- #▼▼▼通用变量、方法、模块、类▼▼▼
- #==============================================================================
- # ■ (模块)T_m
- #------------------------------------------------------------------------------
- # 用来存储常用常量
- #=============================================================================
- module T_m
- #-----------------------------------------------------------------------------
- # ● 地名窗口常量
- #-----------------------------------------------------------------------------
- #▼地名窗口
- WIDTH = 150 # 窗口宽度最小值
- IN_TIME = 35 # 窗口出现时间
- SHOW_TIME = 180 # 窗口显示时间
- FADE_TIME = 30 # 窗口淡去时间
- TEXT1_SIZE = 19 # 地图名,区域名的字体大小
- TEXT2_SIZE = 13 # 地区名的字体大小
- TEXT1_COLOR = Color.new(255,255,255) # 地图名,区域名的默认颜色
- TEXT2_COLOR = Color.new(255,60,60) # 地区名的默认颜色
- SKIN = "window" # 窗口皮肤的文件名
- VX_H = 416 # VX窗口高度
- VX_W = 544 # VX窗口宽度
- ZONE_NUM =8 # 地区名占用角色名的编号
- Map_W_S=1 # 控制是否显示的开关
- #▼地区名窗口
- Z_IN_TIME = 30 # 窗口出现时间
- Z_SHOW_TIME = 70 # 窗口显示时间
- Z_FADE_TIME = 30 # 窗口淡去时间
- ZONE_W_S=2 # 控制是否显示开关
- #▼计算
- HEIGHT = TEXT1_SIZE + TEXT2_SIZE + 34 # 窗口高度
- MWINDOW_Y = VX_H - HEIGHT - 16 # 窗口Y坐标
- #----------------------------------------------------------------------------
- # ● 路牌门牌NPC常量
- #----------------------------------------------------------------------------
- #▼路口窗口
- RT_WIDTH=240 #窗口宽度的最小值
- RT_Y=30 #窗口Y值
- RT_INTIME=20 #窗口出现时间
- RT_ONTIME=60 #窗口持续时间
- RT_FADETIME=20 #窗口消失时间
- RT_S=3 #控制开关
- RT_TEXTSIZE=20 #字体大小
- RT_TEXTCOLOR=Color.new(255,255,255) #字体颜色
- #▼NPC窗口
- NPC_ICON_TALK="talk" #「谈话」图标名
- NPC_ICON_TRADE="trade" #「交易」图标名
- NPC_ICON_CHECK="check" #「调查」图标名
- NPC_NAME_SIZE=16 #「NPC」人名字号
- NPC_S=4 #「NPC控制开关」编号
- #▼门牌窗口
- DOOR_NAME_SIZE=22 #门牌「名称」字号
- DOOR_TYPE_SIZE =16 #门牌「类型」字号
- DOOR_S=5 #「门牌」控制开关编号
- #----------------------------------------------------------------------------
- # ●其他
- #----------------------------------------------------------------------------
- def self.preview_dis
- return @preview_dis
- end
- def self.preview_dis=(a)
- return @preview_dis=a
- end
- @preview_dis=false
- end
- #----------------------------------------------------------------------------
- # ● 方法:读取属性
- #----------------------------------------------------------------------------
- def readattr(str,section,ignore_caps = false)
- str="" if str.class!=String
- result=''
- section.upcase! if ignore_caps
- s = section.to_sym
- temp = str.split(/=/)
- temp.each{|i|i.strip!}
- temp[0].upcase! if ignore_caps
- temp[0]=" " if temp[0]==nil
- if temp[0].to_sym==s
- unless temp[1]==nil
- result=temp[1]
- end
- end
- return result
- end
- #==============================================================================
- # ■ Game_Map
- #------------------------------------------------------------------------------
- # 对Game_Map类的追加定义。
- #=============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # ● 获取所在场景名称
- #--------------------------------------------------------------------------
- def name
- load_data("Data/MapInfos.rvdata")
- end
- end
- #==============================================================================
- # ■ Game_Character
- #------------------------------------------------------------------------------
- # 判断当前人物所在区域id(by beside)。
- #=============================================================================
- class Game_Character
- def area_id
- for area in $data_areas.values
- if in_area?(area)
- return area.id
- end
- end
- end
- end
-
- #==============================================================================
- # ◎ GPRA_Bitmap
- #------------------------------------------------------------------------------
- # ◎ Bitmap功能加强
- #------------------------------------------------------------------------------
- # 制作者:绿梨子红苹果
- # 个人主页:vbgm.9126.com
- # E-Mail:[email protected]
- # QQ:42378361
- #==============================================================================
- class Bitmap
- # 影子字
- def draw_text_s(x, y, width, height, str, align=0)
- # 保存当前颜色
- r=self.font.color.red
- g=self.font.color.green
- b=self.font.color.blue
- # 颜色更改成黑色
- self.font.color.set(0, 0, 0)
- # 绘制影子
- self.draw_text(x+2, y+2, width, height, str, align)
- # 恢复原始字色
- self.font.color.set(r,g,b)
- # 绘制原来的字
- self.draw_text(x, y, width, height, str, align)
- end
- # 描边字
- def draw_text_f(x, y, width, height, str, align=0)
- # 保存当前颜色
- r=self.font.color.red
- g=self.font.color.green
- b=self.font.color.blue
- # 颜色更改成黑色
- self.font.color.set(0, 0, 0)
- # 绘制边框
- self.draw_text(x-1, y-1, width, height, str, align)
- self.draw_text(x-1, y+1, width, height, str, align)
- self.draw_text(x+1, y-1, width, height, str, align)
- self.draw_text(x+1, y+1, width, height, str, align)
- self.draw_text(x, y-1, width, height, str, align)
- self.draw_text(x, y+1, width, height, str, align)
- self.draw_text(x-1, y, width, height, str, align)
- self.draw_text(x+1, y, width, height, str, align)
- # 恢复原始字色
- self.font.color.set(r,g,b)
- # 绘制原来的字
- self.draw_text(x, y, width, height, str, align)
- end
- end
复制代码 分隔符分隔符分隔符分隔符- #▼▼▼区域,地图,地区名显示▼▼▼ by trentswd
- #==============================================================================
- # ■ Map_Window
- #------------------------------------------------------------------------------
- # 游戏中显示地名的窗口。
- #=============================================================================
- class Map_Window<Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(-(5+T_m::WIDTH),T_m::MWINDOW_Y,T_m::WIDTH,T_m::HEIGHT)
- self.windowskin = Cache.system(T_m::SKIN)
- create_contents
- self.opacity = 255
- self.contents_opacity = 255
- self.contents.font.name=["华文细黑","STXihei","微软雅黑"]
- @id=$game_map.map_id
- @time=0
- @a_id=$game_player.area_id
- @zone_change=false
- @a_name=""
- @a_name=area_name if @a_id.is_a?(Numeric)
- @preview_not_dis=true
- end
- #--------------------------------------------------------------------------
- # ● 地区标记为改变
- #--------------------------------------------------------------------------
- def zone_change
- @zone_change=true
- end
- #--------------------------------------------------------------------------
- # ● 得到地名
- #--------------------------------------------------------------------------
- def name(id=$game_map.map_id)
- name=$game_map.name[id].name.split(/@/)[0]
- return name
- end
- #--------------------------------------------------------------------------
- # ● 得到区域名
- #--------------------------------------------------------------------------
- def area_name(id=$game_player.area_id)
- name=$data_areas[id].name.split(/@/)[0]
- return name
- end
- #--------------------------------------------------------------------------
- # ● 得到地区名
- #--------------------------------------------------------------------------
- def zone(id=$game_map.map_id)
- name=$game_map.name[id].name.split(/@/)[1]
- return name
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if @a_id!=$game_player.area_id
- @a_id=$game_player.area_id
- if @a_id.is_a?(Numeric) && $game_switches[T_m::Map_W_S] == true && (area_name.split(/,/)[0]!="2"&&area_name.split(/,/)[0]!="6"&&area_name.split(/,/)[0]!="4"&&area_name.split(/,/)[0]!="8")&&self.area_name!=@a_name
- @a_name=self.area_name
- @preview_not_dis=false
- T_m::preview_dis=false
- self.width=[T_m::WIDTH,T_m::TEXT1_SIZE*self.name.size/3+50].max
- if @time==0
- self.x=-5-self.width
- end
- create_contents
- self.contents.font.size=T_m::TEXT1_SIZE
- self.contents.font.color=T_m::TEXT1_COLOR
- self.contents.draw_text(0,0,self.width-32,T_m::TEXT1_SIZE,self.area_name)
- self.contents.font.size=T_m::TEXT2_SIZE
- self.contents.font.color=T_m::TEXT2_COLOR
- self.contents.draw_text(0,T_m::TEXT1_SIZE+2,self.width-32,T_m::TEXT2_SIZE,$game_actors[T_m::ZONE_NUM].name)
- #~ if @time==0
- @time=T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ elsif @time>T_m::SHOW_TIME+T_m::FADE_TIME
- #~ @time=@time
- #~ elsif @time>T_m::FADE_TIME
- #~ @time=T_m::SHOW_TIME+T_m::FADE_TIME
- #~ else
- #~ @time=T_m::IN_TIME+(-self.width-5-self.x)/(self.width/T_m::IN_TIME)+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ end
- elsif $game_switches[T_m::Map_W_S] == true && $game_player.area_id.is_a?(Numeric)==false
- @a_name=self.name
- if T_m::preview_dis
- T_m::preview_dis=false
- else
- self.width=[T_m::WIDTH,T_m::TEXT1_SIZE*self.name.size/3+50].max
- if @time==0
- self.x=-5-self.width
- end
- create_contents
- self.contents.font.size=T_m::TEXT1_SIZE
- self.contents.font.color=T_m::TEXT1_COLOR
- self.contents.draw_text(0,0,self.width-32,T_m::TEXT1_SIZE,self.name)
- self.contents.font.size=T_m::TEXT2_SIZE
- self.contents.font.color=T_m::TEXT2_COLOR
- self.contents.draw_text(0,T_m::TEXT1_SIZE+2,self.width-32,T_m::TEXT2_SIZE,$game_actors[T_m::ZONE_NUM].name)
- #~ if @time==0
- @time=T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ elsif @time>T_m::SHOW_TIME+T_m::FADE_TIME
- #~ @time=@time
- #~ elsif @time>T_m::FADE_TIME
- #~ @time=T_m::SHOW_TIME+T_m::FADE_TIME
- #~ else
- #~ @time=T_m::IN_TIME+(-self.width-5-self.x)/(self.width/T_m::IN_TIME)+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ end
- end
- end
- end
- if @id!=$game_map.map_id
- self.contents.clear
- @id=$game_map.map_id
- if $game_switches[T_m::Map_W_S] == true
- if @zone_change == true
- if self.zone==nil || self.zone==""
- else
- $game_actors[T_m::ZONE_NUM].name=self.zone
- end
- end
- self.width=[T_m::WIDTH,T_m::TEXT1_SIZE*self.name.size/3+50].max
- if @time==0
- self.x=-5-self.width
- end
- create_contents
- self.contents.font.size=T_m::TEXT1_SIZE
- self.contents.font.color=T_m::TEXT1_COLOR
- if $game_player.area_id.is_a?(Numeric)
- mapname=self.area_name if (self.area_name!= nil && self.area_name!= "")
- else
- mapname=self.name
- end
- self.contents.draw_text(0,0,self.width-32,T_m::TEXT1_SIZE,mapname)
- self.contents.font.size=T_m::TEXT2_SIZE
- self.contents.font.color=T_m::TEXT2_COLOR
- self.contents.draw_text(0,T_m::TEXT1_SIZE+2,self.width-32,T_m::TEXT2_SIZE,$game_actors[T_m::ZONE_NUM].name)
- #~ if @time==0
- @time=T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ elsif @time>T_m::SHOW_TIME+T_m::FADE_TIME
- #~ @time=@time
- #~ elsif @time>T_m::FADE_TIME
- #~ @time=T_m::SHOW_TIME+T_m::FADE_TIME
- #~ else
- #~ @time=T_m::IN_TIME+(-self.width-5-self.x)/(self.width/T_m::IN_TIME)+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ end
- end
- end
- if @direct==1
- self.contents.clear
- self.width=[T_m::WIDTH,T_m::TEXT1_SIZE*self.name.size/3+50].max
- if @time==0
- self.x=-5-self.width
- end
- create_contents
- self.contents.font.size=T_m::TEXT1_SIZE
- self.contents.font.color=T_m::TEXT1_COLOR
- dname=@a_name
- self.contents.draw_text(0,0,self.width-32,T_m::TEXT1_SIZE,dname)
- self.contents.font.size=T_m::TEXT2_SIZE
- self.contents.font.color=T_m::TEXT2_COLOR
- self.contents.draw_text(0,T_m::TEXT1_SIZE+2,self.width-32,T_m::TEXT2_SIZE,$game_actors[T_m::ZONE_NUM].name)
- @time=T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME
- @direct=0
- end
- if @time>T_m::SHOW_TIME+T_m::FADE_TIME
- self.opacity = 255*(T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME-@time)/(T_m::IN_TIME-1)
- self.contents_opacity = 255*(T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME-@time)/(T_m::IN_TIME-1)
- self.x = -self.width-5+self.width*(T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME-@time)/(T_m::IN_TIME-1)
- @time-=1
- elsif @time>T_m::FADE_TIME
- @time-=1
- elsif @time>0
- self.opacity = 255*(@time-1)/(T_m::FADE_TIME-1)
- self.contents_opacity = 255*(@time-1)/(T_m::FADE_TIME-1)
- self.x = -self.width-5+self.width*(@time-1)/(T_m::FADE_TIME-1)
- @time-=1
- else
- self.opacity = 0
- self.contents_opacity = 0
- self.x = -self.width-5
- end
- end
- #--------------------------------------------------------------------------
- # ● 直接显示
- #--------------------------------------------------------------------------
- def d_display
- @direct=1
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 对Scene_Map的追加定义。
- #==============================================================================
- class Scene_Map < Scene_Base
- def map_window
- return @map_window
- end
- def zone_window
- return @zone_window
- end
- #--------------------------------------------------------------------------
- # ● 开始处理时建立对象
- #--------------------------------------------------------------------------
- alias _start start
- def start
- @map_window = Map_Window.new
- @zone_window = Zone_Window.new
- _start
- end
- #--------------------------------------------------------------------------
- # ● 释放时释放对象
- #--------------------------------------------------------------------------
- alias _terminate terminate
- def terminate
- @map_window.dispose
- @zone_window.dispose
- _terminate
- end
- #--------------------------------------------------------------------------
- # ● 刷新时刷新对象
- #--------------------------------------------------------------------------
- alias _update update
- def update
- @zone_window.refresh
- @map_window.refresh
- _update
- end
- #--------------------------------------------------------------------------
- # ● 标记为地区已改变(这个参数传递的很囧我承认)
- #--------------------------------------------------------------------------
- def zone_change
- @map_window.zone_change
- end
- end
- #==============================================================================
- # ■ Zone_Window
- #------------------------------------------------------------------------------
- # 显示地区名的类
- #=============================================================================
- class Zone_Window<Window_Base
- #--------------------------------------------------------------------------
- # ● 新建对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,50,50)
- create_contents
- self.opacity = 0
- self.contents_opacity = 0
- @time=0
- self.contents.font.shadow = false
- end
- #--------------------------------------------------------------------------
- # ● 直接显示
- #--------------------------------------------------------------------------
- def d_display
- @direct=1
- end
- #--------------------------------------------------------------------------
- # ● 得到地区名
- #--------------------------------------------------------------------------
- def zone(id=$game_map.map_id)
- name=$data_areas[$game_player.area_id].name.split(/@/)[1] if $game_player.area_id.is_a?(Numeric)
- if name==nil || name==""
- name=$game_map.name[id].name.split(/@/)[1]
- end
- #~ p name
- return name
- end
- #--------------------------------------------------------------------------
- # ● 得到地区英文名
- #--------------------------------------------------------------------------
- def zonee(id=$game_map.map_id)
- name=$game_map.name[id].name.split(/@/)[2]
- if $game_player.area_id.is_a?(Numeric)
- if $data_areas[$game_player.area_id].name.split(/@/)[1]!=nil &&
- $data_areas[$game_player.area_id].name.split(/@/)[1]!=""
- name=$data_areas[$game_player.area_id].name.split(/@/)[2]
- end
- end
- name="" if name==nil
- return name
- end
- #--------------------------------------------------------------------------
- # ● 描绘中文名
- #--------------------------------------------------------------------------
- def drawtext(x)
- self.contents.font.name=["华文中宋","STZhongsong","宋体","黑体"]
- self.contents.font.size=36
- self.contents.font.shadow=false
- self.contents.font.color=Color.new(255,255,255)
- self.contents.draw_text_f(x,0,self.contents.width,36,@text)
- end
- #--------------------------------------------------------------------------
- # ● 描绘英文名
- #--------------------------------------------------------------------------
- def drawtexten(x)
- self.contents.font.name=["Copperplate Gothic Light"]
- self.contents.font.size=12
- self.contents.font.shadow=false
- self.contents.font.color=Color.new(255,255,255)
- self.contents.draw_text_f(x,49,self.contents.width,12,@texten)
- end
- #--------------------------------------------------------------------------
- # ● 描绘横线
- #--------------------------------------------------------------------------
- def drawline
- self.contents.fill_rect(self.contents.width-5-@textw-1, 40, @textw+2, 5, Color.new(0,0,0,255))
- self.contents.fill_rect(self.contents.width-5-@textw, 41, @textw, 3, Color.new(255,255,255,255))
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if (self.zone != $game_actors[T_m::ZONE_NUM].name && self.zone != "" && self.zone != nil)||@direct==1
- $game_actors[T_m::ZONE_NUM].name=self.zone
- $scene.zone_change
- if ($game_switches[T_m::ZONE_W_S] == true)|| @direct==1
- @text=self.zone
- @texten=self.zonee
- @[email protected]*36/3
- @[email protected]*6
- @textw=[@textl,@textenl].max+24
- @l=@textw/12
- self.x=T_m::VX_W-@textw-@textl-5-16
- self.y=0
- self.width=@textw+@textl+5+32
- self.height=32+12+12+36
- @time=T_m::Z_IN_TIME+T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME
- @direct=0
- create_contents
- end
- end
- if @time>T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME
- self.contents_opacity = 255*(T_m::Z_IN_TIME+T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME-@time)/(T_m::Z_IN_TIME-1)
- drawline
- if @time%2==1
- self.contents.clear
- drawline
- drawtext((self.contents.width-5-(@textw-@textl)/2-@textl)*(T_m::Z_IN_TIME+T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME-@time)/(T_m::Z_IN_TIME-1))
- drawtexten(self.contents.width-(5+(@textw-@textenl)/2+@textenl)*(T_m::Z_IN_TIME+T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME-@time)/(T_m::Z_IN_TIME-1))
- end
- @time-=1
- elsif @time>T_m::Z_FADE_TIME
- @time-=1
- elsif @time>0
- self.contents_opacity = 255*(@time-1)/(T_m::Z_FADE_TIME-1)
- if @time%2==1
- self.contents.clear
- drawline
- drawtext(self.contents.width-(5+(@textw-@textl)/2+@textl)*(@time-1)/(T_m::Z_FADE_TIME-1))
- drawtexten((self.contents.width-5-(@textw-@textenl)/2-@textenl)*(@time-1)/(T_m::Z_FADE_TIME-1))
- self.contents.blur
- end
- @time-=1
- else
- self.opacity=0
- self.contents_opacity=0
- end
- end
- end
复制代码 |
|