#============================================================================== # # ■和風名前入力スクリプト■ # # 名前入力をいろは順にします。 # # 作成日:2015/10/18 # 作成者:かげろう # URL:http://cgpoldpersonteam.blog.fc2.com/ # #============================================================================== class Window_NameInput < Window_Base #-------------------------------------------------------------------------- # ● 文字表 #-------------------------------------------------------------------------- TABLE = [ ' ','ん','ゑ','あ','け','う','つ','わ','ち','い', ' ',' ','ひ','さ','ふ','ゐ','ね','か','り','ろ', ' ',' ','も','き','こ','の','な','よ','ぬ','は', ' ',' ','せ','ゆ','え','お','ら','た','る','に', ' ',' ','す','め','て','く','む','れ','を','ほ', ' ',' ',' ','み',' ','や',' ','そ',' ','へ', ' ',' ',' ','し',' ','ま',' ',' ',' ','と', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', '終',' ',' ',' ',' ',' ',' ',' ',' ',' '] #-------------------------------------------------------------------------- # ● オブジェクト初期化 # mode : 初期入力モード (0 = ひらがな、1 = カタカナ) #-------------------------------------------------------------------------- def initialize(mode = 0) super(88, 148, 368, 248) @mode = mode @index = 9 #初期位置は「い」 refresh update_cursor end #-------------------------------------------------------------------------- # ● 文字の取得 #-------------------------------------------------------------------------- def character if TABLE[@index] != " " #全角スペースは無効 return TABLE[@index] else return "" end end #-------------------------------------------------------------------------- # ● カーソル位置 モード切り替え判定 (かな/カナ) #-------------------------------------------------------------------------- def is_mode_change return false #切替は破棄 end #-------------------------------------------------------------------------- # ● カーソル位置 決定判定 #-------------------------------------------------------------------------- def is_decision return (@index == 80) #決定位置 end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 # index : 項目番号 #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = index % 10 * 32 + index % 10 / 2 * 4 rect.y = index / 10 * WLH rect.width = 32 rect.height = WLH return rect end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0..89 rect = item_rect(i) rect.x += 2 rect.width -= 4 self.contents.draw_text(rect, TABLE[i], 1) end end #-------------------------------------------------------------------------- # ● カーソルを決定へ移動 #-------------------------------------------------------------------------- def cursor_to_decision @index = 80 #決定位置 end #-------------------------------------------------------------------------- # ● 次のページへ移動 #-------------------------------------------------------------------------- def cursor_pagedown #切替は破棄 end #-------------------------------------------------------------------------- # ● 前のページへ移動 #-------------------------------------------------------------------------- def cursor_pageup #切替は破棄 end end