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

Project1

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

[已经解决] 请问怎么做计时的选项

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2865
在线时间
427 小时
注册时间
2014-11-21
帖子
144
跳转到指定楼层
1
发表于 2020-7-23 09:40:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
打算在剧情中加入一个审问环节,为了体现出紧迫感,想加入之前在某些游戏中看到过的计时选项。会有时间条,限时内不回答就进入额外选项,有没有比较好的思路?

Lv3.寻梦者

梦石
0
星屑
1502
在线时间
115 小时
注册时间
2020-5-10
帖子
82
2
发表于 2020-7-23 14:43:05 | 只看该作者
关注 同问
"明るい夜"のために
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
37779
在线时间
5395 小时
注册时间
2006-11-10
帖子
6546
3
发表于 2020-7-23 15:57:47 | 只看该作者
本帖最后由 灯笼菜刀王 于 2020-7-23 16:00 编辑
  1. TIME_OUT_SW = 10086 #时间到打开的开关编号
  2. class Window_Message < Window_Selectable
  3.   def update
  4.     super
  5.     # 渐变的情况下
  6.     if @fade_in
  7.       self.contents_opacity += 24
  8.       if @input_number_window != nil
  9.         @input_number_window.contents_opacity += 24
  10.       end
  11.       if self.contents_opacity == 255
  12.         @fade_in = false
  13.       end
  14.       return
  15.     end
  16.     # 输入数值的情况下
  17.     if @input_number_window != nil
  18.       @input_number_window.update
  19.       if Input.trigger?(Input::C)
  20.         $game_system.se_play($data_system.decision_se)
  21.         $game_variables[$game_temp.num_input_variable_id] =
  22.           @input_number_window.number
  23.         $game_map.need_refresh = true
  24.         @input_number_window.dispose
  25.         @input_number_window = nil
  26.         terminate_message
  27.       end
  28.       return
  29.     end
  30.     if @contents_showing
  31.       if $game_temp.choice_max == 0
  32.         self.pause = true
  33.       end
  34.       if $game_switches[TIME_OUT_SW]
  35.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  36.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  37.           terminate_message
  38.         end
  39.         $game_switches[TIME_OUT_SW] = false
  40.       end
  41.       # 取消
  42.       if Input.trigger?(Input::B)
  43.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  44.           $game_system.se_play($data_system.cancel_se)
  45.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  46.           terminate_message
  47.         end
  48.       end
  49.       # 确定
  50.       if Input.trigger?(Input::C)
  51.         if $game_temp.choice_max > 0
  52.           $game_system.se_play($data_system.decision_se)
  53.           $game_temp.choice_proc.call(self.index)
  54.         end
  55.         terminate_message
  56.       end
  57.       return
  58.     end
  59.     if @fade_out == false and $game_temp.message_text != nil
  60.       @contents_showing = true
  61.       $game_temp.message_window_showing = true
  62.       reset_window
  63.       refresh
  64.       Graphics.frame_reset
  65.       self.visible = true
  66.       self.contents_opacity = 0
  67.       if @input_number_window != nil
  68.         @input_number_window.contents_opacity = 0
  69.       end
  70.       @fade_in = true
  71.       return
  72.     end
  73.     # 没有可以显示的信息、但是窗口为可见的情况下
  74.     if self.visible
  75.       @fade_out = true
  76.       self.opacity -= 48
  77.       if self.opacity == 0
  78.         self.visible = false
  79.         @fade_out = false
  80.         $game_temp.message_window_showing = false
  81.       end
  82.       return
  83.     end
  84.   end
  85. end
复制代码


把这个塞到MAIN前, 第一行设置好编号, 打开这个开关的时候就会强制执行选择"取消"的选项

然后在选项之前启动一个并行处理, 内容为等待XX帧, 然后打开时间到开关(记得关闭自身,避免一直处于并行处理状态) 就实现了限时回答的功能

至于计时条的UI什么的,用图片一起并行处理显示就好啦

点评

进行参考自己写了脚本,解决了,谢谢!  发表于 2020-7-29 03:01

评分

参与人数 1星屑 +50 +1 收起 理由
RyanBern + 50 + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-23 20:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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