赞 | 0 |
VIP | 0 |
好人卡 | 7 |
积分 | 2 |
经验 | 2033 |
最后登录 | 2024-8-5 |
在线时间 | 56 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 210
- 在线时间
- 56 小时
- 注册时间
- 2011-11-22
- 帖子
- 57
|
- #==============================================================================
- # 地图名及区域名显示 by Beside
- #------------------------------------------------------------------------------
- # 功能: 动态显示玩家所在区域及地图名。
- #==============================================================================
- MWINDOW_X = 20 # 窗口X坐标
- MWINDOW_Y = 20 # 窗口Y坐标
- WEIGH = 200 # 窗口宽度
- START_TIME = 30 # 窗口出现时间
- COUN_TIME = 50 # 窗口持续时间
- FADE_TIME = 30 # 窗口淡去时间
- TEXT1_SIZE = 20 # 地图名的字体大小
- TEXT2_SIZE = 18 # 区域名的字体大小
- TEXT3_SIZE = 18 # 附加名的字体大小
- TEXT1_COLOR = Color.new(255,255,255) # 地图名的默认颜色
- TEXT2_COLOR = 0 # 区域名的默认颜色代码(0-31)
- TEXT3_COLOR = 0 # 附加名的默认颜色代码(0-31)
- SKIN = "window" # 窗口皮肤的文件名
- HEIGHT = TEXT1_SIZE + TEXT2_SIZE + TEXT3_SIZE + 32
- #==============================================================================
- # ■ Window_Map
- #------------------------------------------------------------------------------
- # 显示当前进度中的所在场景名称的窗口。
- #==============================================================================
- class Window_Map < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- @id = 0
- @a_id = 0
- super(MWINDOW_X, MWINDOW_Y, WEIGH, HEIGHT)
- self.opacity = 0
- self.contents_opacity = 0
- self.windowskin = Cache.system(SKIN)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @map_id = $game_map.map_id
- locationname = load_data("Data/MapInfos.rvdata")[@map_id].name
- if $game_player.area_id.is_a?(Numeric)
- if $game_player.area_id != @a_id or @map_id != @id
- self.contents.clear
- if @map_id != @id
- @id = @map_id
- @time_count = START_TIME + COUN_TIME + FADE_TIME
- self.contents.font.color = TEXT1_COLOR
- self.contents.font.size = TEXT1_SIZE
- self.contents.draw_text(0, 0, WEIGH-32, TEXT1_SIZE, locationname, 1)
- end
- @time_count = START_TIME + COUN_TIME + FADE_TIME
- @a_id = $game_player.area_id
- area_name = $data_areas[@a_id].name_p1
- other_name = $data_areas[@a_id].name_p2
- self.contents.font.size = TEXT2_SIZE
- self.contents.font.color = text_color($data_areas[@a_id].color_1)
- self.contents.draw_text(0, TEXT1_SIZE, WEIGH-32, TEXT2_SIZE, area_name, 1)
- self.contents.font.size = TEXT3_SIZE
- self.contents.font.color = text_color($data_areas[@a_id].color_2)
- self.contents.draw_text(0, TEXT1_SIZE+TEXT2_SIZE, WEIGH-32, TEXT3_SIZE, other_name, 1)
- end
- elsif @map_id != @id
- @id = @map_id
- @time_count = START_TIME + COUN_TIME + FADE_TIME
- self.contents.clear
- self.contents.font.color = TEXT1_COLOR
- self.contents.font.size = TEXT1_SIZE
- self.contents.draw_text(0, (HEIGHT-TEXT1_SIZE)/2-16, WEIGH-32, TEXT1_SIZE, locationname, 1)
- elsif @a_id != 0
- @a_id = 0
- @time_count = START_TIME + COUN_TIME + FADE_TIME
- self.contents.clear
- self.contents.font.color = TEXT1_COLOR
- self.contents.font.size = TEXT1_SIZE
- self.contents.draw_text(0, (HEIGHT-TEXT1_SIZE)/2-16, WEIGH-32, TEXT1_SIZE, locationname, 1)
- end
- if @time_count > COUN_TIME + FADE_TIME
- self.opacity += 255 / START_TIME
- self.contents_opacity += 255 / START_TIME
- @time_count -= 1
- elsif @time_count > FADE_TIME
- self.opacity = 255
- self.contents_opacity = 255
- @time_count -= 1
- elsif @time_count > 0
- self.opacity -= 255 / FADE_TIME
- self.contents_opacity -= 255 / FADE_TIME
- @time_count -= 1
- else
- @time_count = 0
- self.opacity = 0
- self.contents_opacity = 0
- end
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。
- #==============================================================================
- class Scene_Map < Scene_Base
- alias _start start
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- @map_window = Window_Map.new
- _start
- end
-
- alias _terminate terminate
- def terminate
- @map_window.dispose
- _terminate
- end
-
- alias _update update
- def update
- @map_window.refresh
- _update
- end
- end
- module RPG
- class Area
- def name_p1
- name = @name.split(/#/)[0]
- return name != nil ? name : ""
- end
- def name_p2
- name = @name.split(/#/)[1]
- return name != nil ? name : ""
- end
- def color_1
- color = @name.split(/#/)[2]
- return color != nil ? color.to_i : TEXT2_COLOR
- end
- def color_2
- color = @name.split(/#/)[3]
- return color != nil ? color.to_i : TEXT3_COLOR
- end
- end
- end
- class Game_Character
- def area_id
- for area in $data_areas.values
- if in_area?(area)
- return area.id
- end
- end
- end
- end
复制代码 貌似把此代码放在main前就可以了 |
|