Project1

标题: 名称输入加强脚本 [打印本页]

作者: xcr530551426    时间: 2009-1-13 00:32
标题: 名称输入加强脚本
#==============================================================================
# 请先删除Window_NameInput脚本,然后在Main前面添加下面脚本,
#
# 或者把Window_NameInput替换成本脚本的内容。
#------------------------------------------------------------------------------
#  名称输入加强脚本
#==============================================================================
  1. #==============================================================================
  2. # 请先删除Window_NameInput脚本,然后在Main前面添加下面脚本,
  3. #
  4. # 或者把Window_NameInput替换成本脚本的内容。
  5. #------------------------------------------------------------------------------
  6. #  名称输入加强脚本
  7. #==============================================================================
  8. # ————————————————————————————————————
  9. # 本脚本来自www.66rpg.com,转载请保留此信息
  10. # ————————————————————————————————————
  11. class Window_NameInput < Window_Base
  12.   CHARACTER_TABLE =
  13.   [
  14.     "A","B","C","D","E",
  15.     "F","G","H","I","J",
  16.     "K","L","M","N","O",
  17.     "P","Q","R","S","T",
  18.     "U","V","W","X","Y",
  19.     "Z","","","","",
  20.     "","","","","",
  21.     "", "" ,"", "" ,"",
  22.     "","","","","",
  23.     "", "" ,"", "" ,"",
  24.     "1","2","3","4","5",
  25.     "6","7","8","9","0",
  26.     "","","","","",
  27.     "","","","","",
  28.     "","","","","",
  29.     "","","","","",
  30.     "","","","","",
  31.     "","", "" , "" , "" ,
  32.     "a","b","c","d","e",
  33.     "f","g","h","i","j",
  34.     "k","l","m","n","o",
  35.     "p","q","r","s","t",
  36.     "u","v","w","x","y",
  37.     "z","","","","",
  38.     "","","","","",
  39.     "", "" ,"", "" ,"",
  40.     "","","","","",
  41.     "", "" ,"", "" ,"",
  42.     "","","","","",
  43.     "","","","","",
  44.     "","","","","",
  45.     "","","","","",
  46.     "","","","","",
  47.     "","","","","",
  48.     "","","","","",
  49.     "","", "" , "" , "" ,
  50.   ]
  51.   #--------------------------------------------------------------------------
  52.   # ● 初始化对像
  53.   #--------------------------------------------------------------------------
  54.   def initialize
  55.     super(0, 128, 640, 352)
  56.     self.contents = Bitmap.new(width - 32, height - 32)
  57.     @index = 0
  58.     refresh
  59.     update_cursor_rect
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 获取文字
  63.   #--------------------------------------------------------------------------
  64.   def character
  65.     return CHARACTER_TABLE[@index]
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● 刷新
  69.   #--------------------------------------------------------------------------
  70.   def refresh
  71.     self.contents.clear
  72.     for i in 0..179
  73.       x = 4 + i / 5 / 9 * 152 + i % 5 * 28
  74.       y = i / 5 % 9 * 32
  75.       self.contents.draw_text(x, y, 28, 32, CHARACTER_TABLE[i], 1)
  76.     end
  77.     self.contents.draw_text(544, 9 * 32, 64, 32, "Confirm", 1)
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 刷新光标矩形
  81.   #--------------------------------------------------------------------------
  82.   def update_cursor_rect
  83.     # 光标位置在 [确定] 的情况下
  84.     if @index >= 180
  85.       self.cursor_rect.set(544, 9 * 32, 64, 32)
  86.     # 光标位置在 [确定] 以外的情况下
  87.     else
  88.       x = 4 + @index / 5 / 9 * 152 + @index % 5 * 28
  89.       y = @index / 5 % 9 * 32
  90.       self.cursor_rect.set(x, y, 28, 32)
  91.     end
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 刷新画面
  95.   #--------------------------------------------------------------------------
  96.   def update
  97.     super
  98.      # 光标位置在 [确定] 的情况下
  99.     if @index >= 180
  100.       # カーソル下
  101.       if Input.trigger?(Input::DOWN)
  102.         $game_system.se_play($data_system.cursor_se)
  103.         @index -= 180
  104.       end
  105.       # カーソル上
  106.       if Input.repeat?(Input::UP)
  107.         $game_system.se_play($data_system.cursor_se)
  108.         @index -= 180 - 40
  109.       end
  110.     # 光标位置在 [确定] 以外的情况下
  111.     else
  112.       # 按下方向键右的情况下
  113.       if Input.repeat?(Input::RIGHT)
  114.         # 按下状态不是重复的情况下
  115.         # 光标位置不在右端的情况下
  116.         if Input.trigger?(Input::RIGHT) or
  117.            @index / 45 < 3 or @index % 5 < 4
  118.           # 光标向右移动
  119.           $game_system.se_play($data_system.cursor_se)
  120.           if @index % 5 < 4
  121.             @index += 1
  122.           else
  123.             @index += 45 - 4
  124.           end
  125.           if @index >= 180
  126.             @index -= 180
  127.           end
  128.         end
  129.       end
  130.       # 按下方向键左的情况下
  131.       if Input.repeat?(Input::LEFT)
  132.         # 按下状态不是重复的情况下、
  133.         # 光标位置不在左端的情况下
  134.         if Input.trigger?(Input::LEFT) or
  135.            @index / 45 > 0 or @index % 5 > 0
  136.          # 光标向右移动
  137.           $game_system.se_play($data_system.cursor_se)
  138.           if @index % 5 > 0
  139.             @index -= 1
  140.           else
  141.             @index -= 45 - 4
  142.           end
  143.           if @index < 0
  144.             @index += 180
  145.           end
  146.         end
  147.       end
  148.       # 按下方向键下的情况下
  149.       if Input.repeat?(Input::DOWN)
  150.         # 光标向下移动
  151.         $game_system.se_play($data_system.cursor_se)
  152.         if @index % 45 < 40
  153.           @index += 5
  154.         else
  155.           @index += 180 - 40
  156.         end
  157.       end
  158.       # 按下方向键上的情况下
  159.       if Input.repeat?(Input::UP)
  160.         # 按下状态不是重复的情况下、
  161.         # 光标位置不在上端的情况下
  162.         if Input.trigger?(Input::UP) or @index % 45 >= 5
  163.           # カーソルを上に移動
  164.           $game_system.se_play($data_system.cursor_se)
  165.           if @index % 45 >= 5
  166.             @index -= 5
  167.           else
  168.             @index += 180
  169.           end
  170.         end
  171.       end
  172.       # L 键与 R 键被按下的情况下
  173.       if Input.repeat?(Input::L) or Input.repeat?(Input::R)
  174.         # ひらがな / カタカナ 移動
  175.         $game_system.se_play($data_system.cursor_se)
  176.         if @index / 45 < 2
  177.           @index += 90
  178.         else
  179.           @index -= 90
  180.         end
  181.       end
  182.     end
  183.     update_cursor_rect
  184.   end
  185. end
复制代码

作者: 八云紫    时间: 2009-1-13 00:43
那个,请问,加强了什么呢?
作者: tigerzhz    时间: 2009-1-15 01:41
哈哈!这个系统比我的【是中国人怎能用日文文字表?v1.0(正式版发布!) 】
好多了!!!!不过名字没我多,也不丰富:
http://rpg.blue/viewthread.php?tid=114526




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