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

Project1

 找回密码
 注册会员
搜索

仿XXX按钮风格选项框

查看数: 10575 | 评论数: 6 | 收藏 1
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2010-10-13 21:16

正文摘要:

【继续唠叨】模仿css利用偏移和四边阴影变化来模拟按钮的做法,在RM中也可以实现类似的,以window为容器,改变ox和oy,偏移2px,并改变window边阴影的效果做到了。【不过愚者的配色功底要多丑有多丑啊……】 希 ...

回复

qq175908660 发表于 2011-8-28 09:21:45
提示: 作者被禁止或删除 内容自动屏蔽
绯红枫 发表于 2011-8-10 17:36:05
提示: 作者被禁止或删除 内容自动屏蔽
一箭烂YiJL 发表于 2010-12-4 14:13:05
中间一定要隔4帧,无奈。。挺麻烦的
能直接在脚本里加进等待四帧或者在:
$game_variables[VariableId] = @index + 1
$scene = Scene_Map.new
之间加入四帧以作缓冲?
夕阳武士 发表于 2010-10-13 21:59:55
看到这个我就激动,再次谢啦:P

点评

发布版本更新了按键音效【嘛……上次给的太偷懒了不是么。。。】  发表于 2010-10-13 22:01
九夜神尊 发表于 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
六祈 发表于 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 很适合追求华丽效果的作者!

查看全部评分

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

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

GMT+8, 2024-5-4 23:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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