Project1
标题:
@cursor.visible = true 这样一句 到底错在什么地方
[打印本页]
作者:
z2z4
时间:
2013-8-30 08:18
标题:
@cursor.visible = true 这样一句 到底错在什么地方
本帖最后由 z2z4 于 2013-8-30 08:32 编辑
@cursor.visible = true if @cursor.visible == false
我找不到 这句 错在什么地方
@cursor 没找到他的实例 不知道 是不是这句引起的
#==============================================================================
# ■ Command_Base
#------------------------------------------------------------------------------
# 一般的なコマンド選択を行うウィンドウです。
#==============================================================================
class Command_MenuBase < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@non_close = false
self.index = 0
self.opacity = 0
@move_time = 4
@cx = [104,119,127,130,126,116,99]
@adjust_y = 90
[url=home.php?mod=space&uid=257928]@open[/url] = true
@cursor.opacity = 0
end
#--------------------------------------------------------------------------
# ● コマンドオープン
#--------------------------------------------------------------------------
def open_command
open
@cursor.opacity = 255 if @move_time == 0
@open = false if @move_time == 0
@move_time -= 1
end
#--------------------------------------------------------------------------
# ● コマンドクローズ
#--------------------------------------------------------------------------
def close_command
return if @open
loop do
update_basic
close
break if @move_time == 0
@move_time -= 1
end
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
open_command if @open
end
#--------------------------------------------------------------------------
# ● コマンド画像作成1
#--------------------------------------------------------------------------
def make_command1
@c_index = 0
@command00 = Sprite.new
@command01 = Sprite.new
@command02 = Sprite.new if @item_max > 1
@command03 = Sprite.new if @item_max > 2
@command04 = Sprite.new if @item_max > 3
@command05 = Sprite.new if @item_max > 4
@command06 = Sprite.new if @item_max > 5
@command07 = Sprite.new if @item_max > 6
@command99 = Sprite.new
end
#--------------------------------------------------------------------------
# ● コマンド画像作成2
#--------------------------------------------------------------------------
def create_command(command, file, cz)
command.bitmap = Cache.skin(file)
command.src_rect.set(0, @c_index * 30, 114, 30)
command.x = x + @cx[@c_index]
command.y = y + @adjust_y + @c_index * 30
command.z = cz
@c_index += 1
end
#--------------------------------------------------------------------------
# ● スキン作成
#--------------------------------------------------------------------------
def create_skin(command, file, cz)
command.bitmap = Cache.skin(file)
command.x = x
command.y = y
command.z = cz
end
#--------------------------------------------------------------------------
# ● オープン
#--------------------------------------------------------------------------
def open
@command99.x -= 26
refresh if @move_time == 0
end
#--------------------------------------------------------------------------
# ● クローズ
#--------------------------------------------------------------------------
def close
@command99.x += 50
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@command01.x = x + @cx[0] if @command01 != nil
@command02.x = x + @cx[1] if @command02 != nil
@command03.x = x + @cx[2] if @command03 != nil
@command04.x = x + @cx[3] if @command04 != nil
@command05.x = x + @cx[4] if @command05 != nil
@command06.x = x + @cx[5] if @command06 != nil
@command07.x = x + @cx[6] if @command07 != nil
case index
when 0 ; @command01.x -= 10 if @command01 != nil
when 1 ; @command02.x -= 10 if @command02 != nil
when 2 ; @command03.x -= 10 if @command03 != nil
when 3 ; @command04.x -= 10 if @command04 != nil
when 4 ; @command05.x -= 10 if @command05 != nil
when 5 ; @command06.x -= 10 if @command06 != nil
when 6 ; @command07.x -= 10 if @command07 != nil
end
end
#--------------------------------------------------------------------------
# ● 基本更新処理
#--------------------------------------------------------------------------
def update_basic
Graphics.update # ゲーム画面を更新
Input.update # 入力情報を更新
$game_system.update # タイマーを更新
end
#--------------------------------------------------------------------------
# ● 光标移动修改
#--------------------------------------------------------------------------
def update_cursor
if [url=home.php?mod=space&uid=370741]@Index[/url] < 0 # カーソル位置が 0 未満の場合
@cursor.visible = false if @cursor != nil
else # カーソル位置が 0 以上の場合
@cursor.visible = true if @cursor.visible == false
@cursor_flame = 0 if @cursor_flame == 40
@cursor.src_rect.set(0, 0, 28, 22) if @cursor_flame == 0
@cursor.src_rect.set(0, 22, 28, 22) if @cursor_flame == 10
@cursor.src_rect.set(0, 44, 28, 22) if @cursor_flame == 20
@cursor.src_rect.set(0, 22, 28, 22) if @cursor_flame == 30
@cursor_flame += 1
@cursor.x = self.x + @cx[index] - 18 if @cx != nil
@cursor.y = self.y + @adjust_y + index * 30
end
end
#--------------------------------------------------------------------------
# ● カーソル消去
#--------------------------------------------------------------------------
def cursor_off
@cursor.visible = false
end
#--------------------------------------------------------------------------
# ● カーソル表示
#--------------------------------------------------------------------------
def cursor_on
@cursor.visible = true
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
super
@move_time = 2
close_command
Graphics.freeze
@command00.dispose if @command00 != nil
@command01.dispose if @command01 != nil
@command02.dispose if @command02 != nil
@command03.dispose if @command03 != nil
@command04.dispose if @command04 != nil
@command05.dispose if @command05 != nil
@command06.dispose if @command06 != nil
@command07.dispose if @command07 != nil
@command99.dispose if @command99 != nil
$game_temp.long_fade = 3
end
end
复制代码
作者:
945127391
时间:
2013-8-30 08:25
单给出脚本里的一句话是很难看出问题的,请附上完整脚本
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1