设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
楼主: Majirefy
打印 上一主题 下一主题

[已发主站] 【VA】地图名显示美化版

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
317 小时
注册时间
2009-1-18
帖子
177
跳转到指定楼层
1
发表于 2012-5-2 18:09:58 | 显示全部楼层 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 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~~~


范例工程:
AceTest.7z (279.83 KB, 下载次数: 1988)

评分

参与人数 8星屑 +348 +6 收起 理由
倾灬城 + 7 可以用这个做出游戏剧情章节名的效果o(∩_.
89444640 + 6 名字大亮
876加几 + 5 好好看,我非加分不可!
Munchen1921 + 6 我很赞同
Shy07 + 6 主站收录
lsu666666 + 200
Shure + 24 加油!希望你能做出更好的脚本。.
RXVincent + 100 随手

查看全部评分

Lv1.梦旅人

梦石
0
星屑
60
在线时间
317 小时
注册时间
2009-1-18
帖子
177
2
 楼主| 发表于 2012-5-2 19:56:14 | 显示全部楼层
仲秋启明 发表于 2012-5-2 19:49
这货是国外的脚本?

不是……自己随便写的……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
317 小时
注册时间
2009-1-18
帖子
177
3
 楼主| 发表于 2012-5-2 20:18:40 | 显示全部楼层
diablo2x 发表于 2012-5-2 20:14
這個腳本不錯
的確比默認的好看多了

咱也不知道…………
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
317 小时
注册时间
2009-1-18
帖子
177
4
 楼主| 发表于 2012-5-3 10:50:24 | 显示全部楼层
洛迪基尔 发表于 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补充以下内容

那个……明明在代码中有写啊……使用的方法……
好吧,下次写正规点。
’’

点评

现在可以了!  发表于 2012-5-3 15:59
哦哦!对喔!这脚本写得很好,是我没仔细看清楚!希望LZ继续有佳作出品^^  发表于 2012-5-3 15:59
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
317 小时
注册时间
2009-1-18
帖子
177
5
 楼主| 发表于 2013-1-16 19:44:33 | 显示全部楼层
视觉诱惑 发表于 2013-1-13 04:48
我用怎么报错?  修改了 脚本的 新地图 那个位置 然后 是160行报错

有问题请截图说明~~~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
317 小时
注册时间
2009-1-18
帖子
177
6
 楼主| 发表于 2013-1-19 21:41:34 | 显示全部楼层
明日不愁 发表于 2013-1-18 19:47
额,这个,XP能用不?

抱歉,没有测试过
应该不可以,使用了大量了RGSS3的模块和功能~~~

点评

XP不能用,但不与XP脚本冲突  发表于 2013-7-30 08:39
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
317 小时
注册时间
2009-1-18
帖子
177
7
 楼主| 发表于 2013-1-20 15:28:13 | 显示全部楼层
明日不愁 发表于 2013-1-20 10:40
想用啊,很好看,残念……

因为文字的勾边效果在RGSS3中是现成的,但是RGSS中貌似没有提供(?,手头没有XP)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-13 18:43

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表