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

Project1

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

[已经解决] 如何通过脚本实现队列行进功能的开关?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
47
在线时间
58 小时
注册时间
2010-10-6
帖子
54
跳转到指定楼层
1
发表于 2014-7-30 16:57:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 VIPArcher 于 2014-7-30 17:27 编辑

找了一个设置的脚本。
然后我想在上面增加开关队列行进的功能,
请教一下怎么才能通过脚本实现队列行进功能的开关?
 $savec.set(id, data)——保存「true/false」
 $savec.check(id)——读取「true/false」
 $savec.set_num(id, data)——保存数值
 $savec.get_num(id)——读取数值0

上面的是说明,和脚本无关
……
RUBY 代码复制
  1. module SUI
  2. module OPTION
  3.   # ボイス再生ボリューム変更時のサンプルボイス
  4.   # 指定したボイスからランダムで1つ、新しいボリュームで再生されます。
  5.   # サンプルボイスがいらない場合は空にしてください。
  6.   SAMPLE = [
  7.   #ファイル名
  8. #  "sample_voice01",
  9. #  "sample_voice02",
  10.    "Cat",
  11.    "Crow",
  12.    "Dog",
  13.   ]
  14.  
  15.   # ボイスファイルの保存場所
  16.   #VOICE_DIR = "Audio/SE/Voice/"
  17.   VOICE_DIR = "Audio/SE/"
  18. end
  19. end
  20. #==============================================================================
  21. # 設定完了
  22. #==============================================================================
  23.  
  24.  
  25.  
  26. class Window_Option < Window_Base
  27.   #--------------------------------------------------------------------------
  28.   # ● オブジェクト初期化
  29.   #--------------------------------------------------------------------------
  30.   def initialize
  31.     super(0, 0, 430, 330)
  32.     self.openness = 0
  33.     self.x = Graphics.width / 2 - self.width / 2
  34.     self.y = Graphics.height / 2 - self.height / 2 + line_height / 2 + padding
  35.     self.z = 160
  36.     [url=home.php?mod=space&uid=401263]@line[/url] = 0
  37.     set_index
  38.     refresh
  39.     update_cursor
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● リフレッシュ
  43.   #--------------------------------------------------------------------------
  44.   def refresh
  45.     self.contents.clear
  46.     contents.font.color = normal_color
  47.     contents.draw_text(0, 0 * rows_height, contents.width, line_height, "背景音量")
  48.     contents.draw_text(0, 1 * rows_height, contents.width, line_height, "语音音量")
  49.     contents.draw_text(0, 2 * rows_height, contents.width, line_height, "角色语音开关")
  50.     contents.draw_text(0, 3 * rows_height, contents.width, line_height, "文字表示速度")
  51.     contents.draw_text(0, 4 * rows_height, contents.width, line_height, "队列行进开关")
  52.     draw_command_10(0)
  53.     draw_command_10(1)
  54.     draw_command_2(2)
  55.     draw_command_3(3)
  56.     draw_command_2(4)
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 行の高さ(2行分)
  60.   #--------------------------------------------------------------------------
  61.   def rows_height
  62.     60
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 文字の描画
  66.   #--------------------------------------------------------------------------
  67.   def draw_text2(x, y, w, text, blue = false)
  68.     contents.font.color = blue ? system_color : normal_color
  69.     contents.font.color.alpha = blue ? 255 : 128
  70.     draw_text(x, y, w, line_height, text)
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 10コマンドの描画
  74.   #--------------------------------------------------------------------------
  75.   def draw_command_10(row)
  76.     y = rows_height * row + line_height
  77.     10.times do |i|
  78.       x = 30 + 36 * i - ((i == 9) ? 2 : 0)
  79.       draw_text2(x, y, 30, ((i + 1) * 10).to_s, (i == @index[row]))
  80.     end
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 10コマンドの矩形を取得
  84.   #--------------------------------------------------------------------------
  85.   def item_rect_10
  86.     rect = Rect.new
  87.     rect.x = 30 - 9 + 36 * @index[@line]
  88.     rect.y = rows_height * [url=home.php?mod=space&uid=401263]@line[/url] + line_height
  89.     rect.width = 30 + 8
  90.     rect.height = line_height
  91.     rect
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 2コマンドの描画
  95.   #--------------------------------------------------------------------------
  96.   def draw_command_2(row)
  97.     y = rows_height * row + line_height
  98.     list = ["开启", "关闭"]
  99.     2.times do |i|
  100.       x = 30 + 100 * i
  101.       draw_text2(x, y, 40, list[i], (i == @index[row]))
  102.     end
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● 2コマンドの矩形を取得
  106.   #--------------------------------------------------------------------------
  107.   def item_rect_2
  108.     rect = Rect.new
  109.     rect.x = 30 - 11+ 100 * @index[@line]
  110.     rect.y = rows_height * [url=home.php?mod=space&uid=401263]@line[/url] + line_height
  111.     rect.width = 50 + 8
  112.     rect.height = line_height
  113.     rect
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 3コマンドの描画
  117.   #--------------------------------------------------------------------------
  118.   def draw_command_3(row)
  119.     y = rows_height * row + line_height
  120.     list = ["缓慢", "普通", "快速"]
  121.     3.times do |i|
  122.       x = 30 + 80 * i
  123.       draw_text2(x, y, 40, list[i], (i == @index[row]))
  124.     end
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● 3コマンドの矩形を取得
  128.   #--------------------------------------------------------------------------
  129.   def item_rect_3
  130.     rect = Rect.new
  131.     rect.x = 30 - 11 + 80 * @index[@line]
  132.     rect.y = rows_height * @line + line_height
  133.     rect.width = 50 + 8
  134.     rect.height = line_height
  135.     rect
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● カーソルの更新
  139.   #--------------------------------------------------------------------------
  140.   def update_cursor
  141.     case @line
  142.       when 0, 1
  143.         cursor_rect.set(item_rect_10)
  144.       when 2, 4
  145.         cursor_rect.set(item_rect_2)
  146.       when 3
  147.         cursor_rect.set(item_rect_3)
  148.       end
  149.       Sound.play_cursor
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 行の設定
  153.   #--------------------------------------------------------------------------
  154.   def line=(row)
  155.     old = @line
  156.     @line = [[@line + row, 0].max, 4].min
  157.     update_cursor if old != @line
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● 行の設定
  161.   #--------------------------------------------------------------------------
  162.   def index=(i)
  163.     max = 10 if( @line == 0 || @line == 1)
  164.     max = 1 if( @line == 2|| @line == 4)
  165.     max = 2 if( @line == 3)
  166.     old = @index[@line]
  167.     @index[@line] = [[@index[@line] + i, 0].max, max].min
  168.     update_cursor if old != @index[@line]
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● フレーム更新
  172.   #--------------------------------------------------------------------------
  173.   def update
  174.     super
  175.     return unless self.openness == 255
  176.     self.line = +1 if Input.repeat?(:DOWN)
  177.     self.line = -1 if Input.repeat?(:UP)
  178.     self.index = +1 if Input.repeat?(:RIGHT)
  179.     self.index = -1 if Input.repeat?(:LEFT)
  180.     if Input.trigger?(:C)
  181.       Sound.play_use_item
  182.       case @line
  183.         when 0
  184.           $savec.set_num("bgm_vol", (@index[@line] + 0) * 10)
  185.           refresh
  186.           RPG::BGM::last.play
  187.         when 1
  188.           $savec.set_num("voice_vol", (@index[@line] + 0) * 10)
  189.           refresh
  190.           Audio.se_stop
  191.           vol = SUI::OPTION.voice_volume
  192.           return if SUI::OPTION::SAMPLE.length == 0
  193.           r = SUI::OPTION::SAMPLE[rand(SUI::OPTION::SAMPLE.length)]
  194.           Audio.se_play("#{SUI::OPTION::VOICE_DIR}#{r}", 100 * vol)
  195.         when 2
  196.           $savec.set("voice", @index[@line] == 1)
  197.           refresh
  198.         when 3
  199.           $savec.set_num("speed", @index[@line])
  200.           refresh
  201.         when 4
  202.           $savec.set("followers_move", @index[@line] == 1)
  203.           refresh
  204.         end
  205.     end
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● アクティブ設定
  209.   #--------------------------------------------------------------------------
  210.   def set_index
  211.     @index = []
  212.  
  213.     res = $savec.get_num("bgm_vol")
  214.     res = 70 if res < 10
  215.     @index[0] = (res / 10) - 1
  216.  
  217.     res = $savec.get_num("voice_vol")
  218.     res = 70 if res < 10
  219.     @index[1] = (res / 10) - 1
  220.  
  221.     @index[2] = $savec.check("voice") ? 1 : 0
  222.  
  223.     @index[3] = $savec.get_num("speed")
  224.     @index[3] = 1 if @index[3] == -1
  225.  
  226.     @index[4] = $savec.check("followers_move") ? 1 : 0
  227.   end
  228. end

……
   

点评

你就不能用一次代码框吗? 就是发帖的时候工具栏上的这个<>  发表于 2014-7-30 17:26
[

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21020
在线时间
9338 小时
注册时间
2012-6-19
帖子
7107

开拓者短篇九导演组冠军

2
发表于 2014-7-30 17:25:25 | 只看该作者
本帖最后由 喵呜喵5 于 2014-7-30 17:26 编辑
  1. $game_player.followers.visible = $data_system.opt_followers = true #false 关闭队列行进
  2. $game_player.refresh
复制代码

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
47
在线时间
58 小时
注册时间
2010-10-6
帖子
54
3
 楼主| 发表于 2014-7-31 00:53:44 | 只看该作者
喵呜喵5 发表于 2014-7-30 17:25

受帮助了
[
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-11 18:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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