Project1
标题:
窗口出现这种白色箭头的原因是什么?
[打印本页]
作者:
rt6543ew
时间:
2017-7-15 07:52
标题:
窗口出现这种白色箭头的原因是什么?
无标题.png
(12.42 KB, 下载次数: 30)
下载附件
保存到相册
2017-7-15 07:52 上传
[i
为什么会出现这种箭头?
作者:
张咚咚
时间:
2017-7-15 09:14
@command_window = Window_Command.new(宽度,[])
只有在这里new光标窗口时填宽度,后面改宽度(@command_window.width = XX)的话都会出现箭头
作者:
rt6543ew
时间:
2017-7-15 10:08
class Window_MenuCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize(commands,height)
super(0, 0, 356,height)
@item_max = commands.size
@column_max = 9
@commands = commands
@can_look = [8,0,1]
self.contents = Bitmap.new( @item_max * 90,height - 32)
self.index = 0
end
#---------------------------------------------------------------------------
# ● 删除光标
#---------------------------------------------------------------------------
def update_cursor_rect
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@can_look[0] = self.index
@can_look[0] -= 1
@can_look[0] %= 9
@can_look[1] = self.index
@can_look[2] = self.index
@can_look[2] += 1
@can_look[2] %= 9
for i in 0..@item_max
choose_color = Color.new(100, 0, 0, 255)
draw_item(i, normal_color, choose_color)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color,color_choose)
for c in @can_look
if c == self.index
self.contents.font.color = color_choose
self.contents.font.size = 25
else
self.contents.font.color = color
self.contents.font.size = 15
end
b = @can_look.index(c)
rect = Rect.new(122 * b,4, 80, self.contents.height - 8)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[c],1)
end
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
update_my
# 可以移动光标的情况下
if self.active and @item_max > 0 and @index >= 0
# 方向键右被按下的情况下
if Input.repeat?(Input::RIGHT)
# 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
if @column_max >= 2 and @index < @item_max - 1
# 光标向右移动
$game_system.se_play($data_system.cursor_se)
@index += 1
#===================
elsif @column_max >= 2 and @index + 1 == @item_max
@index = 0
#===================
end
end
# 方向键左被按下的情况下
if Input.repeat?(Input::LEFT)
# 列数为 2 以上并且、光标位置在 0 之后的情况下
if @column_max >= 2 and @index > 0
# 光标向左移动
$game_system.se_play($data_system.cursor_se)
@index -= 1
#===================
elsif @column_max >= 2 and @index + 1 == 1
@index = @item_max - 1
#===================
end
end
end
# 刷新帮助文本 (update_help 定义了继承目标)
if self.active and @help_window != nil
update_help
end
end
end
复制代码
脚本发上来了,请各位轻喷
作者:
RyanBern
时间:
2017-7-15 10:48
原因是 contexts 的宽度超过了(窗口的宽度 - 32)
例如,窗口宽度 192,那么内容(self.contents)的宽度超过 160 就会出现箭头,表示右边还有东西。
作者:
张咚咚
时间:
2017-7-15 11:22
class Window_MenuCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize(commands,height)
super(0, 0, 356,height)
你的宽度已经固定356了,应该是东西存不下
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1