查看: 3581|回复: 9

[已经解决] 请问特殊的数值输入如何制作

[复制链接]
梦石
0
星屑
2299
在线时间
142 小时
注册时间
2016-10-1
回帖
13
发表于 2020-4-27 08:34:17 | 显示全部楼层 |阅读模式

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

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

×
如题,平时的数字输入只能输入0~9一共10个数字,但是我的游戏中,希望出现一些特殊的数字输入,比如甲乙丙丁午己庚辛壬癸,子丑寅某辰巳无为申酉戌亥等等,而且也想通过上下翻页的形式实现,如图所示:
QQ图片20200427083426.png
但是,因为这样的密码在游戏中肯定不会出现次数太多,大多数的时候还是以0~9为主的,所以想求教一下这样的想法如何实现?
梦石
0
星屑
11809
在线时间
623 小时
注册时间
2016-8-25
回帖
1340

R考场第七期纪念奖

发表于 2020-4-27 08:39:16 | 显示全部楼层
本帖最后由 PLeaseS 于 2020-4-27 08:46 编辑

用输入名字处理

QQ图片20200427084039.png

QQ截图20200427083950.png

如图

参考用法

1

1


2

2


3

3


解  答  完  毕

感觉文字输入的话,没有必要上下翻页

上下翻页可以试试看“显示图片”

然后排5张图,用变量和按键判定来搞
回复 0 1

使用道具 举报

头像被屏蔽
梦石
0
星屑
5706
在线时间
922 小时
注册时间
2013-8-29
回帖
1401
发表于 2020-4-27 09:08:29 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

老鹰

梦石
40
星屑
37812
在线时间
7091 小时
注册时间
2012-5-26
回帖
3297

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2020-4-27 09:55:38 | 显示全部楼层
本帖最后由 百里_飞柳 于 2020-4-27 12:45 编辑

这个是文字密码类型的扩展,并不是文字输入(x)

大概就是调用事件脚本,然后把结果的字符串传递给一个变量,之后自己再依据条件分歧-变量等于脚本字符串,去判定输入的文字序列是否一致

可以输入的文字也是预先设定好的,它会帮忙打乱一次
文字输入处理
  1. #******************************************************************************
  2. #
  3. #   * 文字入力の処理 *
  4. #
  5. #                       for RGSS3
  6. #
  7. #        Ver 1.01   2015.02.08
  8. #
  9. #   提供者:睡工房 http://hime.be/
  10. #
  11. #******************************************************************************

  12. =begin
  13.     機能
  14.       イベントコマンド「数値入力の処理」に相当する文字版を実装します。
  15.       数値入力の処理コマンド同様、「文章の表示」コマンドの直後に指定すれば、
  16.       メッセージ枠を表示したまま文字入力の処理を表示することが可能です。

  17.     使い方
  18.     注釈に制御タグを記述して起動します。
  19.   
  20.     1.選択式
  21.       <schoice variable_id text>
  22.            variable_id : 結果を保存するゲーム変数のIDを指定します。
  23.            text        : 文字入力の正答を記述します。
  24.            
  25.       2.リール式
  26.       <sreel variable_id text> または、
  27.       <sreel variable_id reel_speed text>
  28.            variable_id : 結果を保存するゲーム変数のIDを指定します。
  29.            text        : 文字入力の正答を記述します。
  30.            reel_speed  : リールの回転スピードを指定します。
  31.                    1 が一番早く、数字が増えるほどに遅くなります。
  32.            
  33.       3.スロット式
  34.       <sslot variable_id text> または、
  35.       <sslot variable_id reel_speed text>
  36.            variable_id : 結果を保存するゲーム変数のIDを指定します。
  37.            text        : 文字入力の正答を記述します。
  38.            reel_speed  : リールの回転スピードを指定します。
  39.                    1 が一番早く、数字が増えるほどに遅くなります。

  40.          ※variable_idで指定した変数には以下の値が保存されます。
  41.           条件分岐等で処理を振り分けてください。
  42.              キャンセル時:-1
  43.              正解時   :1
  44.              不正解時  :0

  45.     お邪魔文字について
  46.      通常は正答テキストだけをシャッフルして選択するようになっています。
  47.      しかし、正答以外の文字も追加して難易度をあげたい場合、
  48.      注釈の2行目にテキストを記述することで更に選択肢を増やすことができます。
  49.    
  50.     使用できる制御文字について
  51.      正答テキスト、お邪魔文字については「文章の表示」コマンド同様、
  52.      制御文字を使用することができます。
  53.     使用できる制御文字は以下のとおりです。
  54.     \V[n]  \N[n]  \P[n]  \G  \I[n]
  55.       ※制御文字拡張素材により拡張される場合があります。
  56. =end

  57. #==============================================================================
  58. # コンフィグ項目
  59. #==============================================================================
  60. module SUI
  61. module STRINPUT
  62.   # スロットのリールを止めるときのSE
  63.   SLOT_SE = RPG::SE.new("Equip1", 100, 130)
  64.   
  65.   # 回転リールのデフォルト速度
  66.   DEFAULT_REEL_SPEED = 5
  67.   
  68.   # スロットの回転方向(8 で正転、 2 で逆転)
  69.   SLOT_DIRECTION = 2
  70. end
  71. end
  72. #==============================================================================
  73. # 設定完了
  74. #==============================================================================


  75. class Game_Message
  76.   attr_accessor :sui_sinput_type           # 文字入力のタイプ
  77.   attr_accessor :sui_sinput_text           # 文字入力用テキスト
  78.   attr_accessor :sui_sinput_add_text       # お邪魔文字用テキスト
  79.   attr_accessor :sui_sinput_variable_id    # 文字入力正否フラグ用変数
  80.   attr_accessor :sui_sinput_reel_speed     # リールの回転スピード
  81.   #--------------------------------------------------------------------------
  82.   # ○ 文字入力モード判定
  83.   #--------------------------------------------------------------------------
  84.   def sui_sinput?
  85.     return false unless @sui_sinput_text
  86.     !@sui_sinput_text.empty?
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● クリア
  90.   #--------------------------------------------------------------------------
  91.   alias sui_sinput_clear clear
  92.   def clear
  93.     sui_sinput_clear
  94.     @sui_sinput_type        = ""
  95.     @sui_sinput_text        = ""
  96.     @sui_sinput_add_text    = ""
  97.     @sui_sinput_variable_id = 0
  98.     @sui_sinput_reel_speed  = 0
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● ビジー判定
  102.   #--------------------------------------------------------------------------
  103.   alias sui_sinput_busy? busy?
  104.   def busy?
  105.     sui_sinput_busy? || sui_sinput?
  106.   end
  107. end


  108. class Game_Interpreter
  109.   #--------------------------------------------------------------------------
  110.   # ○ 注釈が文字入力タグとして使用されているか?
  111.   #    選択式  :<schoice variable text>
  112.   #    リール式 :<sreel variable speed text>
  113.   #    スロット式:<sslot variable speed text>
  114.   #--------------------------------------------------------------------------
  115.   def sui_sinput?(param)
  116.     if param[0] =~ /<schoice|sreel|sslot\s+\d+(\s+(\d+))?\s+.+?>/
  117.       return @sui_sinput = true
  118.     end
  119.     return false
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 次のイベントコマンドのコードを取得
  123.   #--------------------------------------------------------------------------
  124.   alias sui_sinput_next_event_code next_event_code
  125.   def next_event_code
  126.     code = sui_sinput_next_event_code
  127.     code = 103 if code == 108 && sui_sinput?(@list[@index + 1].parameters)
  128.     code
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 注釈
  132.   #--------------------------------------------------------------------------
  133.   alias sui_sinput_command_108 command_108
  134.   def command_108
  135.     if sui_sinput?(@params)
  136.       setup_num_input(@params)
  137.       Fiber.yield while $game_message.sui_sinput?
  138.     end
  139.     sui_sinput_command_108
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 数値入力のセットアップ
  143.   #--------------------------------------------------------------------------
  144.   alias sui_sinput_setup_num_input setup_num_input
  145.   def setup_num_input(params)
  146.     if @sui_sinput
  147.       sui_sinput_setup(params)
  148.     else
  149.       sui_sinput_setup_num_input(params)
  150.     end
  151.     @sui_sinput = false
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ○ 文字入力のセットアップ
  155.   #--------------------------------------------------------------------------
  156.   def sui_sinput_setup(params)
  157.     if params[0] =~ /<(schoice|sreel|sslot)\s+(\d+)(\s+(\d+))?\s+(.+?)>/
  158.       $game_message.sui_sinput_type = $1
  159.       $game_message.sui_sinput_variable_id = $2.to_i
  160.       $game_message.sui_sinput_text        = $5
  161.       $game_message.sui_sinput_reel_speed  = $4.to_i if $3
  162.     end
  163.     if @list[@index + 1].code == 408
  164.       $game_message.sui_sinput_add_text = @list[@index + 1].parameters[0]
  165.     end
  166.   end
  167. end


  168. class Sprite_Reel < Bitmap
  169.   #--------------------------------------------------------------------------
  170.   # ● 公開インスタンス変数
  171.   #--------------------------------------------------------------------------
  172.   attr_accessor :dest_rect               # 転送先矩形
  173.   #--------------------------------------------------------------------------
  174.   # ● オブジェクト初期化
  175.   #--------------------------------------------------------------------------
  176.   def initialize(target, words)
  177.     @target = target
  178.     @words = [words[-1]] + words + [words[0]]
  179.     @speed = $game_message.sui_sinput_reel_speed
  180.     @speed = SUI::STRINPUT::DEFAULT_REEL_SPEED if @speed == 0
  181.     @add_value = @target.line_height.to_f / @speed
  182.     @duration = 0
  183.     @dest_rect = Rect.new
  184.     super(@target.word_width, @words.size * @target.line_height)
  185.     create_bitmap
  186.     create_src_rect
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 解放
  190.   #--------------------------------------------------------------------------
  191.   def dispose
  192.     super
  193.     @target = nil
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ○ ビットマップの作成
  197.   #--------------------------------------------------------------------------
  198.   def create_bitmap
  199.     rect = Rect.new(0, 0, @target.word_width, @target.line_height)
  200.     @words.each do |c|
  201.       if c =~/^\eI\[(\d+)\]/
  202.         draw_icon($1.to_i, rect)
  203.       else
  204.         draw_text(rect, c, 1)
  205.       end
  206.       rect.y += @target.line_height
  207.     end
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ○ アイコンの描画
  211.   #--------------------------------------------------------------------------
  212.   def draw_icon(icon_index, rect)
  213.     bitmap = Cache.system("Iconset")
  214.     offset = (@target.word_width - 24) / 2
  215.     src_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  216.     self.blt(rect.x + offset, rect.y, bitmap, src_rect)
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ○ 転送元矩形の作成
  220.   #--------------------------------------------------------------------------
  221.   def create_src_rect
  222.     @src_rect = Rect.new
  223.     @src_rect.x = 0
  224.     @src_rect.y = @target.line_height / 2
  225.     @src_rect.width = @target.word_width
  226.     @src_rect.height = @target.line_height * 2
  227.     @rect_y = @src_rect.y.to_f
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● フレーム更新
  231.   #--------------------------------------------------------------------------
  232.   def update
  233.     return unless rotation?
  234.     @rect_y = (@rect_y + @add_value) % ((@words.size - 2) * @target.line_height)
  235.     @duration -= 1
  236.     @rect_y = @rect_y.round.to_f if @duration % @speed == 0
  237.     @src_rect.y = @rect_y.to_i
  238.     draw_reel
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ○ リールの描画
  242.   #--------------------------------------------------------------------------
  243.   def draw_reel
  244.     @target.contents.clear_rect(@dest_rect)
  245.     @target.contents.stretch_blt(@dest_rect, self, @src_rect)
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ○ 回転の開始
  249.   #    dir : 8 で正転、 2 で逆転
  250.   #    loop : true でノンストップ
  251.   #--------------------------------------------------------------------------
  252.   def start(dir, loop = false)
  253.     @duration += @speed
  254.     @duration = -@speed if loop
  255.     @add_value = @add_value.abs * ((dir == 2) ? -1.0 : 1.0)
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ○ 回転の停止
  259.   #--------------------------------------------------------------------------
  260.   def stop
  261.     @duration = @duration % @speed
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ○ 回転中か?
  265.   #--------------------------------------------------------------------------
  266.   def rotation?
  267.     @duration > 0 || @duration < 0
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ○ 現在のインデックス
  271.   #--------------------------------------------------------------------------
  272.   def index
  273.     ((@rect_y.round - 12) / @target.line_height) % @words.size
  274.   end
  275. end


  276. class Window_SuiStringInputBase < Window_Base
  277.   #--------------------------------------------------------------------------
  278.   # ● オブジェクト初期化
  279.   #--------------------------------------------------------------------------
  280.   def initialize(message_window)
  281.     @message_window = message_window
  282.     super(0, 0, 0, 0)
  283.     self.openness = 0
  284.     create_words($game_message.sui_sinput_text)
  285.     additon_words($game_message.sui_sinput_add_text)
  286.     @words.shuffle!.shuffle!.shuffle!
  287.     start
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ○ 文字入力の開始
  291.   #--------------------------------------------------------------------------
  292.   def start
  293.     @index = 0
  294.     @selected = []
  295.     update_placement
  296.     create_contents
  297.     refresh
  298.     open
  299.     activate
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ○ ウィンドウ位置の更新
  303.   #--------------------------------------------------------------------------
  304.   def update_placement
  305.     self.width = size_x * word_width + padding * 4
  306.     self.height = fitting_height(size_y)
  307.     self.x = (Graphics.width - width) / 2
  308.     if @message_window.y >= Graphics.height / 2
  309.       self.y = @message_window.y - height - 32#8  #修改
  310.     else
  311.       self.y = @message_window.y + @message_window.height + 32#8
  312.     end
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ○ 横サイズ
  316.   #--------------------------------------------------------------------------
  317.   def size_x
  318.     @original_size
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ○ 縦サイズ
  322.   #--------------------------------------------------------------------------
  323.   def size_y
  324.     3
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● リフレッシュ
  328.   #--------------------------------------------------------------------------
  329.   def refresh
  330.     contents.clear
  331.     change_color(normal_color)
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ○ 文字の配列を作成
  335.   #--------------------------------------------------------------------------
  336.   def create_words(text)
  337.     @words = []
  338.     cnt = 0
  339.     text = convert_escape_characters(text)
  340.     while cnt < text.length
  341.       @words << text[cnt, 1]
  342.       @words[-1] += text.slice!(/(I\[\d+\])/) if text[cnt, 1] == "\e"
  343.       cnt += 1
  344.     end
  345.     @correct_answer = @words.join
  346.     @original_size = @words.size
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ○ 追加ワードの配列
  350.   #--------------------------------------------------------------------------
  351.   def additon_words(text)
  352.     return if text.empty?
  353.     cnt = 0
  354.     text = convert_escape_characters(text)
  355.     while cnt < text.length
  356.       @words << text[cnt, 1]
  357.       @words[-1] += text.slice!(/(I\[\d+\])/) if text[cnt, 1] == "\e"
  358.       cnt += 1
  359.     end
  360.   end
  361.   #--------------------------------------------------------------------------
  362.   # ○ 1文字の幅
  363.   #--------------------------------------------------------------------------
  364.   def word_width
  365.     30
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ○ 文字の描画
  369.   #--------------------------------------------------------------------------
  370.   def draw_word(c, rect)
  371.     if c =~ /^\eI\[(\d+)\]/
  372.       offset = (word_width - 24) / 2
  373.       draw_icon($1.to_i, rect.x + offset, rect.y)
  374.     else
  375.       draw_text(rect, c, 1)
  376.     end
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ● フレーム更新
  380.   #--------------------------------------------------------------------------
  381.   def update
  382.     super
  383.     return unless active
  384.     process_cursor_move
  385.     return process_ok     if Input.trigger?(:C)
  386.     return process_cancel if Input.trigger?(:B)
  387.     update_cursor
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # ● カーソルの移動処理
  391.   #--------------------------------------------------------------------------
  392.   def process_cursor_move
  393.     last_index = @index
  394.     cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  395.     cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  396.     Sound.play_cursor if @index != last_index
  397.   end
  398.   #--------------------------------------------------------------------------
  399.   # ● カーソルを右に移動
  400.   #     wrap : ラップアラウンド許可
  401.   #--------------------------------------------------------------------------
  402.   def cursor_right(wrap)
  403.     @index = (@index + 1) % size_x if @index < size_x - 1 || wrap
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● カーソルを左に移動
  407.   #     wrap : ラップアラウンド許可
  408.   #--------------------------------------------------------------------------
  409.   def cursor_left(wrap)
  410.     @index = (@index - 1) % size_x if @index > 0 || wrap
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ● 項目を描画する矩形の取得
  414.   #--------------------------------------------------------------------------
  415.   def item_rect(index)
  416.     rect = Rect.new
  417.     rect.x = word_width * index + padding
  418.     rect.width = word_width
  419.     rect.height = line_height + 4
  420.     rect
  421.   end
  422.   #--------------------------------------------------------------------------
  423.   # ○ 入力完了
  424.   #--------------------------------------------------------------------------
  425.   def input_complete
  426.     Sound.play_ok
  427.     flag = @correct_answer == user_answer
  428.     $game_variables[$game_message.sui_sinput_variable_id] = flag ? 1 : 0
  429.     deactivate
  430.     close
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ○ 完成した文字列の取得
  434.   #--------------------------------------------------------------------------
  435.   def user_answer
  436.     @selected.inject("") {|r, i| r += @words[i] }
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● 決定ボタンが押されたときの処理
  440.   #--------------------------------------------------------------------------
  441.   def process_ok
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ● キャンセルボタンが押されたときの処理
  445.   #--------------------------------------------------------------------------
  446.   def process_cancel
  447.     Sound.play_cancel
  448.     $game_variables[$game_message.sui_sinput_variable_id] = -1
  449.     deactivate
  450.     close
  451.   end
  452.   #--------------------------------------------------------------------------
  453.   # ○ すべて入力済みか?
  454.   #--------------------------------------------------------------------------
  455.   def full?
  456.     @selected.size == @original_size
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ● カーソルの更新
  460.   #--------------------------------------------------------------------------
  461.   def update_cursor
  462.     if full?
  463.       cursor_rect.set(0, 0, contents.width, contents.height)
  464.     else
  465.       cursor_rect.set(item_rect(@index))
  466.     end
  467.   end
  468. end


  469. class Window_SuiStringInputChoice < Window_SuiStringInputBase
  470.   #--------------------------------------------------------------------------
  471.   # ○ 入力処理の開始
  472.   #--------------------------------------------------------------------------
  473.   def start
  474.     update_placement
  475.     create_answer_area_rect
  476.     create_word_area_rect
  477.     super
  478.   end
  479.   #--------------------------------------------------------------------------
  480.   # ○ 横サイズ
  481.   #--------------------------------------------------------------------------
  482.   def size_x
  483.     @words.size
  484.   end
  485.   #--------------------------------------------------------------------------
  486.   # ○ 解答エリアの矩形作成
  487.   #--------------------------------------------------------------------------
  488.   def create_answer_area_rect
  489.     @answer_rect = Rect.new
  490.     @answer_rect.y = line_height * 0.4
  491.     @answer_rect.width = @original_size * word_width
  492.     @answer_rect.x = (contents_width - @answer_rect.width) / 2
  493.     @answer_rect.height = line_height
  494.   end
  495.   #--------------------------------------------------------------------------
  496.   # ○ 文字エリアの矩形作成
  497.   #--------------------------------------------------------------------------
  498.   def create_word_area_rect
  499.     @word_rect = Rect.new
  500.     @word_rect.x = padding
  501.     @word_rect.y = line_height * 1.8
  502.     @word_rect.width = @words.size * word_width
  503.     @word_rect.height = line_height
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● リフレッシュ
  507.   #--------------------------------------------------------------------------
  508.   def refresh
  509.     super
  510.     draw_underline
  511.     draw_answer_area
  512.     draw_word_area
  513.   end
  514.   #--------------------------------------------------------------------------
  515.   # ○ 下線の描画
  516.   #--------------------------------------------------------------------------
  517.   def draw_underline
  518.     span = 6
  519.     rect = Rect.new(0, line_height * 1.4, word_width - span, 1)
  520.     @original_size.times do |i|
  521.       rect.x = @answer_rect.x + word_width * i + span / 2
  522.       contents.fill_rect(rect, normal_color)
  523.     end
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ○ 解答エリアの再描画
  527.   #--------------------------------------------------------------------------
  528.   def draw_answer_area
  529.     rect = @answer_rect.clone
  530.     rect.width = word_width
  531.     @selected.each do |i|
  532.       draw_word(@words[i], rect)
  533.       rect.x += word_width
  534.     end
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # ○ 文字エリアの再描画
  538.   #--------------------------------------------------------------------------
  539.   def draw_word_area
  540.     rect = @word_rect.clone
  541.     rect.width = word_width
  542.     @words.each_with_index do |c, i|
  543.       draw_word(c, rect) unless @selected.include?(i)
  544.       rect.x += word_width
  545.     end
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ● 項目を描画する矩形の取得
  549.   #--------------------------------------------------------------------------
  550.   def item_rect(index)
  551.     rect = super
  552.     rect.y = line_height * 1.8 - 2
  553.     rect
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● 決定ボタンが押されたときの処理
  557.   #--------------------------------------------------------------------------
  558.   def process_ok
  559.     return input_complete if full?
  560.     if @selected.include?(@index)
  561.       Sound.play_buzzer
  562.     else
  563.       Sound.play_ok
  564.       @selected << @index
  565.       refresh
  566.     end
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # ● キャンセルボタンが押されたときの処理
  570.   #--------------------------------------------------------------------------
  571.   def process_cancel
  572.     return super if @selected.size == 0
  573.     Sound.play_cancel
  574.     @selected.pop
  575.     refresh
  576.   end
  577. end


  578. class Window_SuiStringInputReel < Window_SuiStringInputBase
  579.   #--------------------------------------------------------------------------
  580.   # ○ 縦サイズ
  581.   #--------------------------------------------------------------------------
  582.   def size_y
  583.     2
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ○ スロットモードか?
  587.   #--------------------------------------------------------------------------
  588.   def slot?
  589.     false
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # ● リフレッシュ
  593.   #--------------------------------------------------------------------------
  594.   def refresh
  595.     super
  596.     @reels.each {|reel| reel.dispose } if @reels
  597.     @reels ||= []
  598.     @reels.clear
  599.     rect = Rect.new(padding, 0, word_width, line_height * 2)
  600.     rect.y = (contents.height - rect.height) / 2
  601.     size_x.times do
  602.       @reels << Sprite_Reel.new(self, @words)
  603.       @reels[-1].dest_rect = rect.clone
  604.       @reels[-1].draw_reel
  605.       @reels[-1].start(SUI::STRINPUT::SLOT_DIRECTION, true) if slot?
  606.       rect.x += word_width
  607.     end
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # ● フレーム更新
  611.   #--------------------------------------------------------------------------
  612.   def update
  613.     super
  614.     return unless active
  615.     @reels.each {|reel| reel.update } if @reels
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ● カーソルの移動処理
  619.   #--------------------------------------------------------------------------
  620.   def process_cursor_move
  621.     super
  622.     last_rotation = @reels[@index].rotation?
  623.     cursor_up if Input.repeat?(:UP)
  624.     cursor_down if Input.repeat?(:DOWN)
  625.     Sound.play_cursor if last_rotation != @reels[@index].rotation?
  626.   end
  627.   #--------------------------------------------------------------------------
  628.   # ● 項目を描画する矩形の取得
  629.   #--------------------------------------------------------------------------
  630.   def item_rect(index)
  631.     rect = super
  632.     rect.y = (contents.height - line_height) / 2 - 2
  633.     rect
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ● カーソルを上に移動
  637.   #--------------------------------------------------------------------------
  638.   def cursor_up
  639.     @reels[@index].start(8) unless @reels[@index].rotation?
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ● カーソルを下に移動
  643.   #--------------------------------------------------------------------------
  644.   def cursor_down
  645.     @reels[@index].start(2) unless @reels[@index].rotation?
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # ● 決定ボタンが押されたときの処理
  649.   #--------------------------------------------------------------------------
  650.   def process_ok
  651.     if @reels.any? {|reel| reel.rotation? }
  652.       Sound.play_buzzer
  653.     else
  654.       @selected = []
  655.       @reels.each {|reel| @selected << reel.index}
  656.       input_complete
  657.     end
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # ● 解放
  661.   #--------------------------------------------------------------------------
  662.   def dispose
  663.     @reels.each {|reel| reel.dispose} if @reels
  664.     super
  665.   end
  666. end


  667. class Window_SuiStringInputSlot < Window_SuiStringInputReel
  668.   #--------------------------------------------------------------------------
  669.   # ● 項目を描画する矩形の取得
  670.   #--------------------------------------------------------------------------
  671.   def item_rect(index)
  672.     rect = super
  673.     rect.x = padding
  674.     rect.width = contents.width - padding * 2
  675.     rect
  676.   end
  677.   #--------------------------------------------------------------------------
  678.   # ○ スロットモードか?
  679.   #--------------------------------------------------------------------------
  680.   def slot?
  681.     true
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # ● カーソルを上に移動
  685.   #--------------------------------------------------------------------------
  686.   def cursor_up
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # ● カーソルを下に移動
  690.   #--------------------------------------------------------------------------
  691.   def cursor_down
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   # ● カーソルを右に移動
  695.   #--------------------------------------------------------------------------
  696.   def cursor_right(wrap)
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # ● カーソルを左に移動
  700.   #--------------------------------------------------------------------------
  701.   def cursor_left(wrap)
  702.   end
  703.   #--------------------------------------------------------------------------
  704.   # ● 決定ボタンが押されたときの処理
  705.   #--------------------------------------------------------------------------
  706.   def process_ok
  707.     if @reels.any? {|reel| reel.rotation? }
  708.       SUI::STRINPUT::SLOT_SE.play
  709.       @reels[@index].stop
  710.       @index += 1 if @index < @reels.size - 1
  711.     else
  712.       @selected = []
  713.       @reels.each {|reel| @selected << reel.index}
  714.       input_complete
  715.     end
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ○ すべて入力済みか?
  719.   #--------------------------------------------------------------------------
  720.   def full?
  721.     !@reels.any? {|reel| reel.rotation? }
  722.   end
  723. end


  724. class Window_Message < Window_Base
  725.   #--------------------------------------------------------------------------
  726.   # ● 全ウィンドウの解放
  727.   #--------------------------------------------------------------------------
  728.   alias sui_sinput_dispose_all_windows dispose_all_windows
  729.   def dispose_all_windows
  730.     sui_sinput_dispose_all_windows
  731.     @sinput_window.dispose if @sinput_window
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # ● 全ウィンドウの更新
  735.   #--------------------------------------------------------------------------
  736.   alias sui_sinput_update_all_windows update_all_windows
  737.   def update_all_windows
  738.     sui_sinput_update_all_windows
  739.     @sinput_window.update if @sinput_window
  740.   end
  741.   #--------------------------------------------------------------------------
  742.   # ● 全ウィンドウが完全に閉じているか判定
  743.   #--------------------------------------------------------------------------
  744.   alias sui_sinput_all_close? all_close?
  745.   def all_close?
  746.     sui_sinput_all_close? && (!@sinput_window || @sinput_window.close?)
  747.   end
  748.   #--------------------------------------------------------------------------
  749.   # ● 入力処理
  750.   #--------------------------------------------------------------------------
  751.   alias sui_sinput_process_input process_input
  752.   def process_input
  753.     if $game_message.sui_sinput?
  754.       input_string_sinput
  755.     else
  756.       sui_sinput_process_input
  757.     end
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # ○ 文字入力の処理
  761.   #--------------------------------------------------------------------------
  762.   def input_string_sinput
  763.     case $game_message.sui_sinput_type
  764.     when "schoice"
  765.       @sinput_window = Window_SuiStringInputChoice.new(self)
  766.     when "sreel"
  767.       @sinput_window = Window_SuiStringInputReel.new(self)
  768.     when "sslot"
  769.       @sinput_window = Window_SuiStringInputSlot.new(self)
  770.     end
  771.     Fiber.yield while @sinput_window.active || !@sinput_window.close?
  772.     @sinput_window.dispose
  773.     @sinput_window = nil
  774.   end
  775. end
复制代码

string_input.zip

2.48 MB, 下载次数: 76

点评

可惜~可惜~  发表于 2020-4-27 17:08
估计是整个站点都关了,当然也没法再访问原服务器了  发表于 2020-4-27 17:05
逛了一会P1发现了这个https://rpg.blue/thread-478163-1-1.html里面有メッセージ履歴画面,你提到的方法<从网页源代码里提取>现在已经因404而无效了吗?  发表于 2020-4-27 15:27
我以前存的,只存了这一个,范例上传了  发表于 2020-4-27 12:46
大佬,睡工房的zip范例和txt脚本全都404不能访问了,你这脚本那里找的?那地方有睡工房的其他脚本么~  发表于 2020-4-27 10:23

评分

参与人数 2赞 +2 收起 理由
MCCF + 1 感觉不应该有这么长吧……
chanszeman1018 + 1 精品文章

查看全部评分

回复 1 0

使用道具 举报

梦石
0
星屑
2299
在线时间
142 小时
注册时间
2016-10-1
回帖
13
 楼主| 发表于 2020-4-29 10:25:15 | 显示全部楼层
百里_飞柳 发表于 2020-4-27 09:55
这个是文字密码类型的扩展,并不是文字输入(x)

大概就是调用事件脚本,然后把结果的字符串传递给一个变 ...

非常感谢,解决了!
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部