Project1

标题: 名称输入处理 窗口,上面的名称文字不想显示光标,能做到 [打印本页]

作者: 惊天动地    时间: 2012-8-24 10:23
标题: 名称输入处理 窗口,上面的名称文字不想显示光标,能做到
本帖最后由 惊天动地 于 2012-8-24 11:06 编辑

大侠们好

             我的是xp的游戏, 弄了个名称输入处理,我想在上面不显示矩形光标,看不见光标图案,能做到吗?帮帮我。谢谢了
  
就是这个方形图标,想去掉 不显示,谢谢帮助dsu_plus_rewardpost_czw
作者: 失落的乐章    时间: 2012-8-24 12:00
用这段脚本替换掉Window_NameEdit的内容。
  1. #==============================================================================
  2. # ■ Window_NameEdit
  3. #------------------------------------------------------------------------------
  4. #  名称输入画面、编辑名称的窗口。
  5. #==============================================================================

  6. class Window_NameEdit < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 定义实例变量
  9.   #--------------------------------------------------------------------------
  10.   attr_reader   :name                     # 名称
  11.   attr_reader   :index                    # 光标位置
  12.   #--------------------------------------------------------------------------
  13.   # ● 初始化对像
  14.   #     actor    : 角色
  15.   #     max_char : 最大字数
  16.   #--------------------------------------------------------------------------
  17.   def initialize(actor, max_char)
  18.     super(0, 0, 640, 128)
  19.     self.contents = Bitmap.new(width - 32, height - 32)
  20.     @actor = actor
  21.     @name = actor.name
  22.     @max_char = max_char
  23.     # 控制名字在最大字数以内
  24.     name_array = @name.split(//)[0...@max_char]
  25.     @name = ""
  26.     for i in 0...name_array.size
  27.       @name += name_array[i]
  28.     end
  29.     @default_name = @name
  30.     @index = name_array.size
  31.     refresh
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 还原为默认的名称
  35.   #--------------------------------------------------------------------------
  36.   def restore_default
  37.     @name = @default_name
  38.     @index = @name.split(//).size
  39.     refresh
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 添加文字
  43.   #     character : 要添加的文字
  44.   #--------------------------------------------------------------------------
  45.   def add(character)
  46.     if @index < @max_char and character != ""
  47.       @name += character
  48.       @index += 1
  49.       refresh
  50.     end
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 删除文字
  54.   #--------------------------------------------------------------------------
  55.   def back
  56.     if @index > 0
  57.       # 删除一个字
  58.       name_array = @name.split(//)
  59.       @name = ""
  60.       for i in 0...name_array.size-1
  61.         @name += name_array[i]
  62.       end
  63.       @index -= 1
  64.       refresh
  65.     end
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● 刷新
  69.   #--------------------------------------------------------------------------
  70.   def refresh
  71.     self.contents.clear
  72.     # 描绘名称
  73.     name_array = @name.split(//)
  74.     for i in 0...@max_char
  75.       c = name_array[i]
  76.       if c == nil
  77.         c = "_"
  78.       end
  79.       x = 320 - @max_char * 14 + i * 28
  80.       self.contents.draw_text(x, 32, 28, 32, c, 1)
  81.     end
  82.     # 描绘图形
  83.     draw_actor_graphic(@actor, 320 - @max_char * 14 - 40, 80)
  84.   end
  85.   def update
  86.     super
  87.   end
  88. end
复制代码





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