Project1

标题: 自制窗口右侧的小箭头怎么去掉? [打印本页]

作者: 幻耶    时间: 2014-8-22 14:35
标题: 自制窗口右侧的小箭头怎么去掉?
改了某个窗口脚本,做一个用来显示图片的窗口,但是右侧一直有一个小三角箭头,希望去除



工程:
Project4.rar (213.76 KB, 下载次数: 38)

RUBY 代码复制
  1. class Window_smap_Command < Window_Selectable
  2.   #--------------------------------------------------------------------------
  3.   # ● 初始化对像
  4.   #     width    : 窗口的宽
  5.   #     commands : 命令字符串序列
  6.   #--------------------------------------------------------------------------
  7.   def initialize(width, commands)
  8.     super(132, 64, width*2, 96)
  9.     @item_max = 10
  10.     @commands = commands
  11.      self.contents = Bitmap.new(width - 32, @item_max * 32)
  12.     $cw_index = 0
  13.     refresh
  14.     self.index = 0
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 刷新
  18.   #--------------------------------------------------------------------------
  19.   def refresh
  20.     self.contents.clear
  21.     for i in 0...@item_max
  22.       draw_item(i, normal_color)
  23.     end
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 描绘项目
  27.   #     index : 项目编号
  28.   #     color : 文字色
  29.   #--------------------------------------------------------------------------
  30.   def draw_item(index, color)
  31.     self.contents.font.color = color
  32.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  33.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  34.     self.contents.draw_text(rect, @commands[index].to_s)
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 项目无效化
  38.   #     index : 项目编号
  39.   #--------------------------------------------------------------------------
  40.   def disable_item(index)
  41.     draw_item(index, disabled_color)
  42.   end
  43.   def able_item(index)
  44.     draw_item(index, normal_color)
  45.   end
  46. end
  47. class Window_Base < Window
  48.   def draw_smap(actor, x, y)
  49.     bitmap=Bitmap.new("Graphics/Pictures/smap4")
  50.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  51.     self.contents.blt(x-192, y+40, bitmap, src_rect)  
  52.     x = 83
  53.     y = 64
  54.   end
  55. end
  56. #==============================================================================
  57. class Window_smap < Window_Base
  58.   #--------------------------------------------------------------------------
  59.   # ● 初始化对像
  60.   #     actor : 角色
  61.   #--------------------------------------------------------------------------
  62.   def initialize(actor)
  63.     super(0, 0, 360, 240)
  64.     self.contents = Bitmap.new(width + 32, height - 32)
  65.     @actor = actor
  66.     refresh
  67.   end  
  68.   #--------------------------------------------------------------------------
  69.   # ● 刷新
  70.   #--------------------------------------------------------------------------
  71.   def refresh
  72.     self.contents.clear   
  73.     draw_smap(@actor, 160, -40)
  74.   end
  75. end
  76. class Scene_smap
  77.   #--------------------------------------------------------------------------
  78.   # ● 初始化对像
  79.   #     actor_index : 角色索引
  80.   #     menu_index : 选项起始位置
  81.   #--------------------------------------------------------------------------
  82.   def initialize(actor_index = 0 , menu_index = 0)
  83.     @actor_index = actor_index
  84.     @menu_index = menu_index
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 主处理
  88.   #--------------------------------------------------------------------------
  89.   def main
  90.     s1 = "地图1"
  91.     s2 = "地图2"
  92.     s3 = "地图3"
  93.     s4 = "地图4"
  94.     s5 = "地图5"
  95.     s6 = "地图6"
  96.     s7 = "地图7"
  97.     s8 = "地图8"
  98.     s9 = "地图9"
  99.     s10 = "退出"
  100.     @command_window = Window_smap_Command.new(180, [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10])
  101.     @command_window.index = @menu_index
  102.     @smap_window = Window_smap.new(@actor)
  103.     #XXOO右窗口的坐标
  104.     @smap_window.x = 132
  105.     @smap_window.y = 180
  106.     @cursor_index = @command_window.index
  107.     # 执行过渡 渐变图形的文件位置 自己设定
  108.     Graphics.transition
  109.     # 主循环
  110.     loop do# 刷新游戏画面      
  111.       Graphics.update     
  112.       Input.update # 刷新输入信息      
  113.       update# 刷新画面   
  114.       if $scene != self # 如果切换画面就中断循环
  115.         break
  116.       end
  117.     end
  118.     # 准备过渡
  119.     Graphics.freeze# 释放窗口   
  120.     @command_window.dispose
  121.     @smap_window.dispose
  122.   end
  123.  
  124.   #--------------------------------------------------------------------------
  125.   # ● 刷新画面
  126.   #--------------------------------------------------------------------------
  127.   def update
  128.     # 刷新窗口
  129.     @command_window.update
  130.     if @cursor_index != @command_window.index
  131.       $cw_index = @command_window.index
  132.       @smap_window.refresh
  133.       @cursor_index = @command_window.index
  134.     end
  135.     # 选项明暗判断
  136.     @smap_window.update
  137.     #=============================================================
  138.     # 按下 B 键的情况下
  139.     #=============================================================
  140.     if Input.trigger?(Input::B)
  141.       # 演奏取消 SE
  142.       $game_system.se_play($data_system.cancel_se)
  143.       @command_window.index = 9
  144.       return
  145.     end
  146.   end
  147. end



作者: 紫英晓狼1130    时间: 2014-8-22 15:18
可以重新添加一个Window_Selectable2
但还是该改windowskin简单些
作者: 芯☆淡茹水    时间: 2014-8-22 15:31
第 64 行:self.contents = Bitmap.new(width + 32, height - 32)
改成:self.contents = Bitmap.new(width - 32, height - 32)




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1