查看: 2378|回复: 5

[已经解决] 【专业伸手党】请教一下如何实现随机下拉菜单?谢谢啦

[复制链接]

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
回帖
11727

贵宾第6届短篇游戏比赛季军

发表于 2013-3-14 23:04:57 | 显示全部楼层 |阅读模式
悬赏10星屑已解决

看到手机游戏里面有一个文字置放型游戏。
里面的迷宫行动,都用一行行文字来显示,
蛮好玩啊,VX怎么才能显示一行行文字这样的方式呢?
(每行文字都是独立的框,并且选择进入后可以看到下一阶的内容。)

比如:

进入迷宫第\v[1]层

得到一个宝箱(进入查看) ==》 打开宝箱得到100G

遇见一群怪物(进入查看) ==》 战斗过程。。。。



如果不进入查看的话,就显示第一阶的文字

所有的文字都可以上拉下拉来查看,最多可以保存999+行文字


谢谢啦,给你们带来困扰了。


101APPLE_IMG_1110.PNG

101APPLE_IMG_1111.PNG

101APPLE_IMG_1112.PNG

101APPLE_IMG_1113.PNG

101APPLE_IMG_1114.PNG

101APPLE_IMG_1115.PNG

最佳答案

查看完整内容

小瞬你看看这个《P叔的动作列表》是否满足你的要求。 [hr] 范例: 截图: 脚本(使用时务必注明来源): [pre lang="ruby" line="1"]#============================================================================== # ■ P叔的动作列表 #------------------------------------------------------------------------------ # 请设定动作列表保留的最大行数: Line_Max = 999 # 三点注意事项: # 1、需要保留动作的文章, ...

八宝粥的基叔

梦石
0
星屑
4957
在线时间
5234 小时
注册时间
2009-4-29
回帖
14054

贵宾

发表于 2013-3-14 23:04:58 | 显示全部楼层
本帖最后由 protosssonny 于 2013-3-15 19:08 编辑

小瞬你看看这个《P叔的动作列表》是否满足你的要求。


范例: P叔的动作列表.rar (249.93 KB, 下载次数: 83)
截图:
1.PNG 2.PNG 3.PNG 4.PNG 5.PNG
脚本(使用时务必注明来源):
  1. #==============================================================================
  2. # ■ P叔的动作列表
  3. #------------------------------------------------------------------------------
  4. # 请设定动作列表保留的最大行数:
  5.   Line_Max = 999
  6. # 三点注意事项:  
  7. # 1、需要保留动作的文章,在文章开头打上符号 \+
  8. # 2、不需要保留动作的文章,直接打字即可
  9. # 3、文章不要太长,一般不要超过一行,不然会显示不全
  10. # 4、对于颜色显示、队员名称显示、变量显示都支持
  11. #------------------------------------------------------------------------------
  12. #                      请注明脚本来源:
  13. #                  本脚本来自[url]www.66rpg.com[/url]
  14. #==============================================================================


  15. #==============================================================================
  16. # ■ Game_Message
  17. #------------------------------------------------------------------------------
  18. #  处理讯息窗口状态、执行文字显示、选项等的类。 本类的实例请参考 $game_message。
  19. #==============================================================================

  20. class Game_Message
  21.   #--------------------------------------------------------------------------
  22.   # ● 定义实例变量
  23.   #--------------------------------------------------------------------------
  24.   attr_accessor :action_table               # 行动列表
  25.   #--------------------------------------------------------------------------
  26.   # ● 初始化对像
  27.   #--------------------------------------------------------------------------
  28.   def initialize
  29.     @action_table = [] if @action_table.nil?
  30.     clear
  31.     @visible = false
  32.   end
  33. end

  34. #==============================================================================
  35. # ■ Window_Message
  36. #------------------------------------------------------------------------------
  37. #  显示文章的信息窗口。
  38. #==============================================================================

  39. class Window_Message < Window_Selectable
  40.   #--------------------------------------------------------------------------
  41.   # ● 转换特殊符号
  42.   #--------------------------------------------------------------------------
  43.   def convert_special_characters
  44.     @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  45.     @text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
  46.     @text.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
  47.     @text.gsub!(/\\G/)              { "\x02" }
  48.     @text.gsub!(/\\\./)             { "\x03" }
  49.     @text.gsub!(/\\\|/)             { "\x04" }
  50.     @text.gsub!(/\\!/)              { "\x05" }
  51.     @text.gsub!(/\\>/)              { "\x06" }
  52.     @text.gsub!(/\\</)              { "\x07" }
  53.     @text.gsub!(/\\\^/)             { "\x08" }
  54.     @text.gsub!(/\\\\/)             { "\" }
  55.     @text.gsub!(/\\\+/)             { "" }
  56.   end
  57. end  

  58. #==============================================================================
  59. # ■ Game_Interpreter
  60. #------------------------------------------------------------------------------
  61. #  执行事件命令的解释器。本类在 Game_Map 类、Game_Troop 类、与
  62. # Game_Event 类的内部使用。
  63. #==============================================================================

  64. class Game_Interpreter
  65.   #--------------------------------------------------------------------------
  66.   # ● 显示文章
  67.   #--------------------------------------------------------------------------
  68.   def command_101
  69.     unless $game_message.busy
  70.       $game_message.face_name = @params[0]
  71.       $game_message.face_index = @params[1]
  72.       $game_message.background = @params[2]
  73.       $game_message.position = @params[3]
  74.       text = ""
  75.       @index += 1
  76.       while @list[@index].code == 401       # 文章数据
  77.         $game_message.texts.push(@list[@index].parameters[0])
  78.         @index += 1
  79.       end
  80.       for i in 0...2
  81.         text += $game_message.texts[i] unless $game_message.texts[i].nil?
  82.       end
  83.       text = convert_special_characters(text)
  84.       $game_message.action_table.push(text) if text.include?("\x09")
  85.       if $game_message.action_table.size > 999
  86.         $game_message.action_table.delete_at(0)
  87.       end  
  88.       if @list[@index].code == 102          # 显示选择项
  89.         setup_choices(@list[@index].parameters)
  90.       elsif @list[@index].code == 103       # 数值输入处理
  91.         setup_num_input(@list[@index].parameters)
  92.       end
  93.       set_message_waiting                   # 设置等待信息结束
  94.     end
  95.     return false
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 转换特殊符号
  99.   #--------------------------------------------------------------------------
  100.   def convert_special_characters(texts)
  101.     text = texts.dup
  102.     text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  103.     text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
  104.     text.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
  105.     text.gsub!(/\\G/)              { "" }
  106.     text.gsub!(/\\\./)             { "" }
  107.     text.gsub!(/\\\|/)             { "" }
  108.     text.gsub!(/\\!/)              { "" }
  109.     text.gsub!(/\\>/)              { "" }
  110.     text.gsub!(/\\</)              { "" }
  111.     text.gsub!(/\\\^/)             { "" }
  112.     text.gsub!(/\\\\/)             { "\" }
  113.     text.gsub!(/\\\+/)             { "\x09" }
  114.     return text
  115.   end
  116. end  

  117. #==============================================================================
  118. # ■ Window_Action
  119. #------------------------------------------------------------------------------
  120. #  显示行动列表的窗口。
  121. #==============================================================================

  122. class Window_Action < Window_Base
  123.   #--------------------------------------------------------------------------
  124.   # ● 初始化对像
  125.   #     x      : 窗口 X 座标
  126.   #     y      : 窗口 Y 座标
  127.   #--------------------------------------------------------------------------
  128.   def initialize(x, y)
  129.     super(x, y, 544, 416)
  130.     @self_index = 0
  131.     @contents_x = 4
  132.     refresh
  133.   end
  134.   def update
  135.     max = $game_message.action_table.size
  136.     max = 999 if max > 999
  137.     if Input.trigger?(Input::B)
  138.       Sound.play_cancel
  139.       $scene = Scene_Map.new
  140.     elsif Input.repeat?(Input::UP)
  141.       if @self_index < max - 16
  142.         @self_index += 1
  143.         refresh
  144.       else
  145.         Sound.play_buzzer
  146.       end  
  147.     elsif Input.repeat?(Input::DOWN)
  148.       if @self_index > 0
  149.         @self_index -= 1
  150.         refresh
  151.       else
  152.         Sound.play_buzzer
  153.       end  
  154.     elsif Input.repeat?(Input::L)
  155.       if @self_index < max - 16
  156.         @self_index += 16
  157.         @self_index = max - 16 if @self_index > max - 16
  158.         refresh
  159.       else
  160.         Sound.play_buzzer
  161.       end  
  162.     elsif Input.repeat?(Input::R)
  163.       if @self_index > 0
  164.         @self_index -= 16
  165.         @self_index = 0 if @self_index < 0
  166.         refresh
  167.       else
  168.         Sound.play_buzzer
  169.       end   
  170.     end
  171.   end  
  172.   #--------------------------------------------------------------------------
  173.   # ● 刷新
  174.   #--------------------------------------------------------------------------
  175.   def refresh
  176.     self.contents.clear
  177.     max = $game_message.action_table.size
  178.     max = 16 if max > 16
  179.     action_table = $game_message.action_table
  180.     for i in 0...max
  181.       text = action_table[action_table.size - i - @self_index - 1]
  182.       update_message(text, i)
  183.     end
  184.   end
  185.   
  186.   def update_message(text, i)
  187.     dupped_text = text.dup
  188.     @contents_x = 4
  189.     join = false
  190.     loop do
  191.       c = dupped_text.slice!(/./m)             # 获取一个文字
  192.       case c
  193.       when nil                          # 无法获取文字时
  194.         break
  195.       when "\n"                         # 新行

  196.       when "\x01"                       # \C[n](文字变色)
  197.         dupped_text.sub!(/\[([0-9]+)\]/, "")
  198.         contents.font.color = text_color($1.to_i)
  199.         next  
  200.       when "\x09"                       # \+(需要加入动作)
  201.         join = true
  202.       else  
  203.         if join
  204.           contents.draw_text(@contents_x, WLH * (15 - i), 544, WLH, c)
  205.           c_width = contents.text_size(c).width
  206.           @contents_x += c_width  
  207.         end
  208.       end
  209.     end   
  210.   end
  211. end

  212. #==============================================================================
  213. # ■ Scene_Action
  214. #------------------------------------------------------------------------------
  215. #  处理战斗画面的类。
  216. #==============================================================================

  217. class Scene_Action < Scene_Base
  218.   #--------------------------------------------------------------------------
  219.   # ● 开始处理
  220.   #--------------------------------------------------------------------------
  221.   def start
  222.     super
  223.     @action_window = Window_Action.new(0, 0)
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 结束处理
  227.   #--------------------------------------------------------------------------
  228.   def terminate
  229.     super
  230.     @action_window.dispose
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ● 更新画面
  234.   #--------------------------------------------------------------------------
  235.   def update
  236.     super
  237.     @action_window.update
  238.   end
  239. end  
复制代码

点评

P叔V5...  发表于 2013-3-30 10:52
五个节操掉到洞里了  发表于 2013-3-16 06:45

评分

参与人数 3星屑 +72 收起 理由
0newing + 7 P叔V5!
houyuxiaoyang + 15 P叔V5!
Password + 50 P叔V5……

查看全部评分

《逝去的回忆3:四叶草之梦》真情发布,欢迎点击图片下载试玩喵。

《逝去的回忆3》的讨论群:
一群:192885514
二群:200460747
回复

使用道具 举报

梦石
0
星屑
50
在线时间
23 小时
注册时间
2013-3-12
回帖
64
发表于 2013-3-14 23:16:04 | 显示全部楼层
话说,这是什么游戏啊,头一次见呢,感觉还挺有意思,有点像塞班系统的文字网游。

点评

置放式游戏,以后消磨时光的好类型  发表于 2013-3-14 23:29
回复

使用道具 举报

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
回帖
11727

贵宾第6届短篇游戏比赛季军

 楼主| 发表于 2013-3-24 23:49:31 | 显示全部楼层
protosssonny 发表于 2013-3-14 23:04
小瞬你看看这个《P叔的动作列表》是否满足你的要求。


范例:

有什么办法,让每行文字都能独立存在?

我可能表达不清楚,是这样的
进入这个界面后,是有那个闪动的光框在第一行文字上的
之所以要这个光框模式因为小瞬不仅仅想要看到历史文字
更想对文字进行操作:

操作一:光框所在位置点击一下确定键就能进入下一层的解释
操作二:光框所在行数,文字超过一行的会进行滚动播出
操作三:进入界面时,光框永远停留在最近一次信息位置上。

关于【操作一】的解释:

文字信息分两层
第一层是简介,第二层是内容
就像论坛里面的帖子一样
第一层就是帖子标题,第二层就是帖子内容


希望P叔把剩下的节操都给我
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部