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

Project1

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

[已经解决] 窗口出现这种白色箭头的原因是什么?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
152
在线时间
78 小时
注册时间
2012-8-16
帖子
44
跳转到指定楼层
1
发表于 2017-7-15 07:52:36 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x


[i


为什么会出现这种箭头?

Lv4.逐梦者

梦石
0
星屑
19334
在线时间
3077 小时
注册时间
2013-1-11
帖子
1288
2
发表于 2017-7-15 09:14:30 | 只看该作者
@command_window = Window_Command.new(宽度,[])
只有在这里new光标窗口时填宽度,后面改宽度(@command_window.width = XX)的话都会出现箭头

点评

我在sence里没有改过宽度。不过我这个窗口是用的一个继承了Window_Selectable的新类,宽度在类初始化的时候已经定义了所以new的参数里没有设置宽度的  发表于 2017-7-15 10:07
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
152
在线时间
78 小时
注册时间
2012-8-16
帖子
44
3
 楼主| 发表于 2017-7-15 10:08:58 | 只看该作者
  1. class Window_MenuCommand < Window_Selectable
  2.   #--------------------------------------------------------------------------
  3.   # ● 初始化对像
  4.   #     width    : 窗口的宽
  5.   #     commands : 命令字符串序列
  6.   #--------------------------------------------------------------------------
  7.   def initialize(commands,height)
  8.     super(0, 0, 356,height)
  9.     @item_max = commands.size
  10.     @column_max = 9
  11.     @commands = commands
  12.     @can_look = [8,0,1]
  13.     self.contents = Bitmap.new( @item_max * 90,height - 32)
  14.     self.index = 0
  15.   end
  16.   #---------------------------------------------------------------------------
  17.   # ● 删除光标
  18.   #---------------------------------------------------------------------------
  19.   def update_cursor_rect
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 刷新
  23.   #--------------------------------------------------------------------------
  24.   def refresh
  25.     self.contents.clear
  26.     @can_look[0] = self.index
  27.     @can_look[0] -= 1
  28.     @can_look[0] %= 9
  29.     @can_look[1] = self.index
  30.     @can_look[2] = self.index
  31.     @can_look[2] += 1
  32.     @can_look[2] %= 9
  33.     for i in 0..@item_max
  34.         choose_color = Color.new(100, 0, 0, 255)
  35.         draw_item(i, normal_color, choose_color)
  36.     end
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 描绘项目
  40.   #     index : 项目编号
  41.   #     color : 文字色
  42.   #--------------------------------------------------------------------------
  43.   def draw_item(index, color,color_choose)
  44.     for c in @can_look
  45.       if c == self.index
  46.         self.contents.font.color = color_choose
  47.         self.contents.font.size = 25
  48.         else
  49.         self.contents.font.color = color
  50.         self.contents.font.size = 15
  51.       end
  52.       b = @can_look.index(c)
  53.       rect = Rect.new(122 * b,4, 80, self.contents.height - 8)
  54.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  55.       self.contents.draw_text(rect, @commands[c],1)
  56.     end
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 项目无效化
  60.   #     index : 项目编号
  61.   #--------------------------------------------------------------------------
  62.   def disable_item(index)
  63.     draw_item(index, disabled_color)
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 刷新画面
  67.   #--------------------------------------------------------------------------
  68.   def update
  69.     update_my
  70.     # 可以移动光标的情况下
  71.     if self.active and @item_max > 0 and @index >= 0
  72.       # 方向键右被按下的情况下
  73.       if Input.repeat?(Input::RIGHT)
  74.         # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  75.         if @column_max >= 2 and @index < @item_max - 1
  76.           # 光标向右移动
  77.           $game_system.se_play($data_system.cursor_se)
  78.           @index += 1
  79.         #===================
  80.         elsif @column_max >= 2 and @index + 1 == @item_max
  81.           @index = 0
  82.         #===================
  83.         end
  84.       end
  85.       # 方向键左被按下的情况下
  86.       if Input.repeat?(Input::LEFT)
  87.         # 列数为 2 以上并且、光标位置在 0 之后的情况下
  88.         if @column_max >= 2 and @index > 0
  89.           # 光标向左移动
  90.           $game_system.se_play($data_system.cursor_se)
  91.           @index -= 1
  92.         #===================
  93.         elsif @column_max >= 2 and @index + 1 == 1
  94.           @index = @item_max - 1
  95.         #===================
  96.         end
  97.       end
  98.     end
  99.     # 刷新帮助文本 (update_help 定义了继承目标)
  100.     if self.active and @help_window != nil
  101.       update_help
  102.     end
  103.   end
  104. end
复制代码


脚本发上来了,请各位轻喷
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

4
发表于 2017-7-15 10:48:12 | 只看该作者
原因是 contexts 的宽度超过了(窗口的宽度 - 32)

例如,窗口宽度 192,那么内容(self.contents)的宽度超过 160 就会出现箭头,表示右边还有东西。

点评

原来范例里的各种height - 32因为这个!感谢  发表于 2017-7-15 12:09

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
19334
在线时间
3077 小时
注册时间
2013-1-11
帖子
1288
5
发表于 2017-7-15 11:22:42 | 只看该作者
class Window_MenuCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     width    : 窗口的宽
  #     commands : 命令字符串序列
  #--------------------------------------------------------------------------
  def initialize(commands,height)
    super(0, 0, 356,height)

你的宽度已经固定356了,应该是东西存不下
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 19:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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