Project1

标题: 【VA】地图名显示美化版 [打印本页]

作者: Majirefy    时间: 2012-5-2 18:09
标题: 【VA】地图名显示美化版
本帖最后由 Sion 于 2013-12-17 16:06 编辑


Ace有默认的地图名显示功能,但是自己觉得有点不是非常好看,所以自己修改了一下。
先上代码:
  1. # encoding: utf-8
  2. #==============================================================================
  3. # ** Window_MapNamePlus
  4. #------------------------------------------------------------------------------
  5. #  This window displays the map name.
  6. #------------------------------------------------------------------------------
  7. #  使用方法:
  8. #    新建脚本页,复制粘贴
  9. #    在“Scene_Map”中找到“Window_MapName.new”,改成"Window_MapNamePlus.new"(大概在
  10. #     159行左右)
  11. #    在地图属性的设置窗口,“显示名称”中的地图名格式:“中文名@EnglishName”,即用“@”分割中文
  12. #     和英文地图名
  13. #==============================================================================

  14. class Window_MapNamePlus < Window_Base
  15.   #--------------------------------------------------------------------------
  16.   # * Settings
  17.   #--------------------------------------------------------------------------
  18.   FONT_NAME_CH = ["PMingLiU", "FangSong"]       # Chinese Font Name
  19.   FONT_SIZE_CH = 42                             # Chinese Font Size
  20.   FONT_NAME_EN = ["Monotype Corsiva"]           # English Font Name
  21.   FONT_SIZE_EN = 28                             # English Font Size
  22.   FONT_BOLD    = false                          # True if Font in Bold
  23.   FONT_COLOR   = Color.new(255, 255, 255, 255)  # Color of Font
  24.   FONT_OUT     = true                           # True if Font Has Outline
  25.   OUT_COLOR    = Color.new(0, 0, 0, 200)        # Color of Outline Color of Font
  26.   FONT_SHADOW  = false                          # True if Text Drops Shadow
  27.   MODIFIER     = "~"                            # Modifier Added beside Map Name
  28.   PADDING      = 8                              # Padding between Window's Frame and Contents
  29.   LINE_HEIGHT  = 6                              # Height of Split Line
  30.   #--------------------------------------------------------------------------
  31.   # * Public Instance Variables
  32.   #--------------------------------------------------------------------------
  33.   attr_reader :map_name_ch                      # Chinese Map Name
  34.   attr_reader :map_name_en                      # English Map Name
  35.   attr_reader :line_x                           # Split Line X Coordinate
  36.   attr_reader :line_y                           # Split Line Y Coordinate
  37.   #--------------------------------------------------------------------------
  38.   # * Object Initialization
  39.   #--------------------------------------------------------------------------
  40.   def initialize
  41.     #----------------------------------------------------------------------
  42.     # * Set the window in the middle of screen.
  43.     #----------------------------------------------------------------------
  44.     super(((Graphics.width - window_width) / 2),
  45.       ((Graphics.height - (FONT_SIZE_CH + FONT_SIZE_EN + PADDING * 4 + LINE_HEIGHT)) / 2),
  46.       window_width, FONT_SIZE_CH + FONT_SIZE_EN + PADDING * 4 + LINE_HEIGHT)
  47.     #----------------------------------------------------------------------
  48.     # * Custom font and style.
  49.     #----------------------------------------------------------------------
  50.     contents.font.bold      = FONT_BOLD
  51.     contents.font.color     = FONT_COLOR
  52.     contents.font.outline   = FONT_OUT
  53.     contents.font.out_color = OUT_COLOR
  54.     contents.font.shadow    = FONT_SHADOW
  55.     #----------------------------------------------------------------------
  56.     # * Set Window Opacity
  57.     #----------------------------------------------------------------------
  58.     self.opacity = 0
  59.     self.contents_opacity = 0
  60.     @show_count = 0
  61.     refresh
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # * Get Window Width
  65.   #--------------------------------------------------------------------------
  66.   def window_width
  67.     return Graphics.width
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # * Frame Update
  71.   #--------------------------------------------------------------------------
  72.   def update
  73.     super
  74.     if @show_count > 0 && $game_map.name_display
  75.       update_fadein
  76.       @show_count -= 1
  77.     else
  78.       update_fadeout
  79.     end
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # * Update Fadein
  83.   #--------------------------------------------------------------------------
  84.   def update_fadein
  85.     self.contents_opacity += 16
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # * Update Fadeout
  89.   #--------------------------------------------------------------------------
  90.   def update_fadeout
  91.     self.contents_opacity -= 16
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # * Open Window
  95.   #--------------------------------------------------------------------------
  96.   def open
  97.     refresh
  98.     @show_count = 150
  99.     self.contents_opacity = 0
  100.     self
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # * Close Window
  104.   #--------------------------------------------------------------------------
  105.   def close
  106.     @show_count = 0
  107.     self
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # * Refresh
  111.   #--------------------------------------------------------------------------
  112.   def refresh
  113.     contents.clear
  114.     set_map_name
  115.     unless $game_map.display_name.empty?
  116.       draw_map_name
  117.     end
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # * Draw Line
  121.   #--------------------------------------------------------------------------
  122.   def draw_line(rect)
  123.     temp_rect = rect.clone
  124.     temp_rect.height = LINE_HEIGHT
  125.     temp_rect.width /= 4
  126.     contents.gradient_fill_rect(temp_rect, color2, color1)
  127.     temp_rect.x += temp_rect.width
  128.     temp_rect.width *= 2
  129.     contents.fill_rect(temp_rect, color1)
  130.     temp_rect.x += temp_rect.width
  131.     temp_rect.width /= 2
  132.     contents.gradient_fill_rect(temp_rect, color1, color2)
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # * Set Map Name
  136.   #--------------------------------------------------------------------------
  137.   def set_map_name
  138.     temp_map_name = $game_map.display_name.split("@")
  139.     @map_name_ch  = temp_map_name[0].to_s
  140.     @map_name_en  = MODIFIER + " " + temp_map_name[1].to_s + " " + MODIFIER
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # * Draw Map Name
  144.   #--------------------------------------------------------------------------
  145.   def draw_map_name
  146.     set_line_position
  147.     set_line_width
  148.     temp_line_rect = Rect.new(@line_x, @line_y, set_line_width, LINE_HEIGHT)
  149.     draw_line(temp_line_rect)
  150.     temp_name_rect_ch = Rect.new(0, 0, contents.width, FONT_SIZE_CH)
  151.     contents.font.name = FONT_NAME_CH
  152.     contents.font.size = FONT_SIZE_CH
  153.     draw_text(temp_name_rect_ch, @map_name_ch, 1)
  154.     temp_name_rect_en = Rect.new(0, FONT_SIZE_CH, contents.width, FONT_SIZE_EN)
  155.     contents.font.size = FONT_SIZE_EN
  156.     contents.font.name = FONT_NAME_EN
  157.     draw_text(temp_name_rect_en, @map_name_en, 1)
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # * Set Line Width
  161.   #--------------------------------------------------------------------------
  162.   def set_line_width
  163.     text_width_ch = text_size(@map_name_ch).width * 1.5
  164.     text_width_en = text_size(@map_name_en).width * 1.5
  165.     (text_width_ch >= text_width_en) ?
  166.       (text_width_ch) : (text_width_en)
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # * Set Line Position
  170.   #--------------------------------------------------------------------------
  171.   def set_line_position
  172.     @line_x = (contents.width - set_line_width) / 2
  173.     @line_y = (contents.height - LINE_HEIGHT) / 2
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # * Get Color 1
  177.   #--------------------------------------------------------------------------
  178.   def color1
  179.     Color.new(255, 255, 255, 255)
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * Get Color 2
  183.   #--------------------------------------------------------------------------
  184.   def color2
  185.     Color.new(255, 255, 255, 0)
  186.   end
  187. end
复制代码
详细的设置在脚本的一开始,注释虽然是英文但是也看得懂吧。
不过,真正的目的……{:2_250:}
还是希望有人指出错误不足鞭策一下的……
就这样,有问题就说吧,尽量修改……第一次写……
PS:中文字体大概大家都有,英文这个,改成大家喜欢的就OK~~~
[line]2[/line]
范例工程:
AceTest.7z (279.83 KB, 下载次数: 1988)
作者: Luciffer    时间: 2012-5-2 19:21
抢沙发!收脚本!
作者: 小凡哥    时间: 2012-5-2 19:27
看上去不错(不知这样算水吗?)
作者: 仲秋启明    时间: 2012-5-2 19:49
这货是国外的脚本?
作者: Majirefy    时间: 2012-5-2 19:56
仲秋启明 发表于 2012-5-2 19:49
这货是国外的脚本?

不是……自己随便写的……
作者: 1584927450    时间: 2012-5-2 19:57
这脚本真不错,很好。可见LZ是一个脚本高手哦!收一下,虽然我不用RMVX和ACE,但总有我用到的时候。
作者: diablo2x    时间: 2012-5-2 20:14
這個腳本不錯
的確比默認的好看多了

弱弱的問一下,有啥類型的腳本可能會和這腳本衝突嗎
作者: Majirefy    时间: 2012-5-2 20:18
diablo2x 发表于 2012-5-2 20:14
這個腳本不錯
的確比默認的好看多了

咱也不知道…………
作者: 蕉皮    时间: 2012-5-2 20:44
很不错的脚本很实用.希望LZ能做出更好更实用的脚本.特别是竖版战斗系统带武器的那种.加油!
作者: 洛迪基尔    时间: 2012-5-2 21:26
感觉比原来的地图显示好多了!
ps:我怎么感觉楼上的蕉皮“特别是*********”是让LZ给他写脚本的说



‘‘──洛迪基尔于2012-5-2 21:47补充以下内容

[@]Majirefy[/@]弱弱的问一下,中间分隔中英文的光条颜色应该能修改吧?
请问在哪里改光条的颜色呢?
(我对脚本不太懂!只知道文字修改,光条在哪里修改呢??
’’
作者: 小路比仔    时间: 2012-5-2 22:02
我怎么觉得那个地图下面的那些英文是【图片】啊……
作者: 皮卡星    时间: 2012-5-2 22:06
LS的回复都好水……话说关于修改Scene_Map什么的,修改下不就行了么……
LZ偷懒了吧……

  1. class Scene_Map < Scene_Base
  2.   def create_location_window
  3.     @map_name_window = Window_MapNamePlus.new
  4.   end
  5. end
复制代码

作者: 102045301    时间: 2012-5-2 22:34
有没有发现有点像DNF
作者: Majirefy    时间: 2012-5-3 10:50
洛迪基尔 发表于 2012-5-2 21:26
感觉比原来的地图显示好多了!
ps:我怎么感觉楼上的蕉皮“特别是*********”是让LZ给他写脚本的说
{:4_106: ...

改分割线的颜色啊……
脚本最后两个,定义了两个颜色,Color1和Color2
那个……颜色的代码应该懂吧?
Color.new(255, 255, 255, 255) 和Color.new(255, 255, 255, 0),只修改前面三个数字就可以了……


‘‘──Majirefy于2012-5-3 10:51补充以下内容

那个……明明在代码中有写啊……使用的方法……
好吧,下次写正规点。
’’
作者: neverqc    时间: 2012-5-6 15:35
太牛b了
作者: 我就是默    时间: 2012-6-11 01:06
非常有趣的美化脚本~十分感谢LZ的分享
作者: h469875130    时间: 2012-7-6 10:51
拿了东西要说谢谢
拿到东西要说好
作者: 视觉诱惑    时间: 2013-1-13 04:48
我用怎么报错?  修改了 脚本的 新地图 那个位置 然后 是160行报错
作者: Majirefy    时间: 2013-1-16 19:44
视觉诱惑 发表于 2013-1-13 04:48
我用怎么报错?  修改了 脚本的 新地图 那个位置 然后 是160行报错

有问题请截图说明~~~
作者: 明日不愁    时间: 2013-1-18 19:47
额,这个,XP能用不?
作者: Majirefy    时间: 2013-1-19 21:41
明日不愁 发表于 2013-1-18 19:47
额,这个,XP能用不?

抱歉,没有测试过
应该不可以,使用了大量了RGSS3的模块和功能~~~
作者: 明日不愁    时间: 2013-1-20 10:40
Majirefy 发表于 2013-1-19 21:41
抱歉,没有测试过
应该不可以,使用了大量了RGSS3的模块和功能~~~

想用啊,很好看,残念……
作者: Majirefy    时间: 2013-1-20 15:28
明日不愁 发表于 2013-1-20 10:40
想用啊,很好看,残念……

因为文字的勾边效果在RGSS3中是现成的,但是RGSS中貌似没有提供(?,手头没有XP)
作者: 梦·林夕    时间: 2013-1-20 15:51
嗯。。。。这不能用XP吧??
作者: 白之枭    时间: 2014-1-5 03:00
LZ好!脚本非常使用,很美观,真的很不错。
但发现了一个问题,应该可以改动(?)
假设初始是在主角的家,名字是:OOO@XXX,那么游戏一开始就不会出现这个标识(OOOXXX)
我对脚本只有浅浅的认知,不知道LZ怎么修改?
作者: 天地有正气    时间: 2014-1-5 13:16
白之枭 发表于 2014-1-5 03:00
LZ好!脚本非常使用,很美观,真的很不错。
但发现了一个问题,应该可以改动(?)
假设初始是在主角的家, ...

新建一个初始化地图,然后在初始化地图自动执行传送至主角家。
作者: My笨笨    时间: 2014-1-5 16:08
脚本好有神圣感!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1