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

Project1

 找回密码
 注册会员
搜索
查看: 10543|回复: 6
打印 上一主题 下一主题

[RMVX发布] 仿XXX按钮风格选项框

[复制链接]

Lv1.梦旅人

旅之愚者

梦石
0
星屑
240
在线时间
812 小时
注册时间
2007-7-28
帖子
2148

贵宾

跳转到指定楼层
1
发表于 2010-10-13 21:16:57 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x

【求配色啊求配色】

【事件设置方法,以54号变量记录选择项,中间的等待4帧必须有,否则有bug】

范例:
54窗口运动.rar (239.65 KB, 下载次数: 906)

【继续唠叨】模仿css利用偏移和四边阴影变化来模拟按钮的做法,在RM中也可以实现类似的,以window为容器,改变ox和oy,偏移2px,并改变window边阴影的效果做到了。【不过愚者的配色功底要多丑有多丑啊……】
希望可以将一些其它【如css】中的优秀做法吸收到RM中,应该可以产生效果不错的UI

Lv1.梦旅人

旅之愚者

梦石
0
星屑
240
在线时间
812 小时
注册时间
2007-7-28
帖子
2148

贵宾

2
 楼主| 发表于 2010-10-13 21:17:48 | 只看该作者
  1. module Choice_Configuration
  2.   ColorLeft = Color.new(255,0,0,125)
  3.   ColorRight = Color.new(0,0,255,125)
  4.   WindowHeight = 58
  5.   WindowWidth = 306
  6.   WindowSpacing = 16
  7.   ColorShadow = Color.new(0,0,0,200)
  8.   VariableId = 54
  9. end

  10. class Scene_Choice < Scene_Base
  11.   include Choice_Configuration
  12.   def initialize(*list)
  13.     @list = list   
  14.   end
  15.   
  16.   def start
  17.     @spriteset = Spriteset_Map.new
  18.     @choice_windows = []
  19.     @choice_number = @list.size
  20.     start_y = (416 - @choice_number * WindowHeight - (@choice_number - 1) * WindowSpacing) / 2
  21.     start_x = (544 - WindowWidth) / 2
  22.     @list.each_with_index do |choice,index|
  23.       window = Window_Base.new(start_x,start_y + index * (WindowHeight + WindowSpacing),WindowWidth,WindowHeight)
  24.       window.contents.dispose
  25.       window.contents = Bitmap.new(WindowWidth - 34,WindowHeight - 34)
  26.       window.contents.gradient_fill_rect(2,2,WindowWidth - 32 - 2,22,ColorLeft,ColorRight)
  27.       window.contents.draw_text(0,0,WindowWidth - 32,24,choice,1)
  28.       window.opacity = 0
  29.       @choice_windows.push(window)
  30.     end
  31.     for i in 0...@choice_number
  32.       set_unactive(i)
  33.     end
  34.     @index = 0
  35.     set_active(@index)
  36.   end
  37.   
  38.   def terminate
  39.     @spriteset.dispose
  40.     @choice_windows.each{|window| window.dispose}
  41.   end
  42.   
  43.   def set_unactive(index)
  44.     target = @choice_windows[index]
  45.     target.contents.clear_rect(0,0,WindowWidth - 32 - 2,2)
  46.     target.contents.clear_rect(0,0,2,22)
  47.     target.contents.fill_rect(2,22,WindowWidth - 32 - 2,2,ColorShadow)
  48.     target.contents.fill_rect(WindowWidth - 32 - 2,2,2,22,ColorShadow)
  49.     target.ox = -2
  50.     target.oy = -2
  51.   end
  52.   
  53.   def set_active(index)
  54.     target = @choice_windows[index]
  55.     target.contents.clear_rect(2,22,WindowWidth - 32 - 2,2)
  56.     target.contents.clear_rect(WindowWidth - 32 - 2,2,2,22)
  57.     target.contents.fill_rect(0,0,WindowWidth - 32 - 2,2,ColorShadow)
  58.     target.contents.fill_rect(0,0,2,22,ColorShadow)
  59.     target.ox = 0
  60.     target.oy = 0
  61.   end
  62.   
  63.   def update
  64.     @choice_windows.each{|window| window.update}
  65.     if Input.trigger?(Input::DOWN)
  66.       Sound.play_cursor
  67.       set_unactive(@index)
  68.       @index += 1
  69.       @index %= @choice_number
  70.       set_active(@index)
  71.     end
  72.     if Input.trigger?(Input::UP)
  73.       Sound.play_cursor
  74.       set_unactive(@index)
  75.       @index -= 1
  76.       @index %= @choice_number
  77.       set_active(@index)
  78.     end
  79.     if Input.trigger?(Input::C)
  80.       Sound.play_decision
  81.       $game_variables[VariableId] = @index + 1
  82.       $scene = Scene_Map.new
  83.     end
  84.   end
  85. end
复制代码

评分

参与人数 2星屑 +1200 收起 理由
fux2 + 2 填满600
九夜神尊 + 1198 很适合追求华丽效果的作者!

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1316
在线时间
831 小时
注册时间
2007-12-25
帖子
1558
3
发表于 2010-10-13 21:33:53 | 只看该作者
67估计是没人给你布置作业了。真囧呀!!
:o 9给你个建议!!用一个开关控制该功能与原功能的切换,那么则使用方便很多。
但是,如果选项超过4个呢?
这样:(不知道冲突大不大)打开开关以后,用批量输入模式直接可以输入无限
个选项。每行一项(就像本论坛的投票那样。)
然后再用你发明的那个标签方式分歧每一个选项!!!!:lol
乃等尽请BS我吧!!!!

点评

最多可以有6个选项  发表于 2010-10-14 06:35
嘛,貌似没试过选项更多会怎么样,可以调整选项的高度和间隙  发表于 2010-10-13 22:03
嘛~这个是用脚本语句调用的,不占用默认功能…  发表于 2010-10-13 22:02
精卫赤龙腾   
总是存在一种强大,去完成似乎不可能的事情.
无畏战乾程   
或是需要一种勇气,去挑战几乎不存在的胜利.
一味玄真魂     
这是拥有一种恒心,去化解根本没有解的困难.
烈卫开天径    
只是带着一种决心,去争取残存的最后的希望。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

战国美少年森兰丸

梦石
0
星屑
204
在线时间
852 小时
注册时间
2008-7-20
帖子
3705
4
发表于 2010-10-13 21:59:55 | 只看该作者
看到这个我就激动,再次谢啦:P

点评

发布版本更新了按键音效【嘛……上次给的太偷懒了不是么。。。】  发表于 2010-10-13 22:01
回复 支持 反对

使用道具 举报

Lv3.寻梦者

弓箭手?剑兰

梦石
0
星屑
4809
在线时间
833 小时
注册时间
2010-11-17
帖子
1140
5
发表于 2010-12-4 14:13:05 | 只看该作者
中间一定要隔4帧,无奈。。挺麻烦的
能直接在脚本里加进等待四帧或者在:
$game_variables[VariableId] = @index + 1
$scene = Scene_Map.new
之间加入四帧以作缓冲?
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2011-8-10
帖子
5
6
发表于 2011-8-10 17:36:05 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
34 小时
注册时间
2011-7-7
帖子
32
7
发表于 2011-8-28 09:21:45 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 04:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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