woshiying8 发表于 2014-4-24 14:02
挺好的,系统自带的起名系统只有英文。 - 完整的Window_NameInput:
- #==============================================================================
- # ■ Window_NameInput
- #------------------------------------------------------------------------------
- # 输入名称的画面、文字选择窗口。
- #==============================================================================
- class Window_NameInput < Window_Base
- #--------------------------------------------------------------------------
- # ● 文字码表
- #--------------------------------------------------------------------------
- AG = [ '阿','艾','爱','埃','哀', '安','昂','奥','','',
- '巴','拜','班','邦','保', '鲍','贝','本','比','宾',
- '波','布','别','宝','伯', '','','','','',
- '茨','查','柴','昌','崔', '才','','','','',
- '达','戴','丹','当','德', '登','迪','蒂','丁','丢',
- '顿','道','东','典','多', '朵','大','','','',
- '俄','恩','尔','','', '','','','','',
- '法','凡','芳','费','芬', '佛','福','芙','弗','飞',
- '伽','盖','高','甘','刚', '贡','格','歌','切换','确定']
- GL = [ '葛','哥','根','古','郭', '','','','','',
- '哈','海','豪','汉','洪', '侯','荷','黑','亨','胡',
- '华','霍','惠','怀','赫', '','','','','',
- '吉','嘉','加','焦','杰', '洁','简','金','晶','',
- '卡','凯','开','考','坎', '堪','康','孔','寇','克',
- '科','可','肯','库','夸', '奎','昆','','','',
- '拉','莱','劳','蓝','兰', '朗','龙','隆','乐','勒',
- '雷','蕾','楞','里','理', '力','利','莉','丽','廖',
- '列','留','连','莲','良', '林','灵','铃','切换','确定']
-
- LP = [ '路','露','鲁','卢','罗', '洛','萝','伦','仑','',
- '玛','马','麦','迈','毛', '茅','曼','芒','莫','墨',
- '摩','梅','孟','梦','蒙', '米','密','蜜','妙','谬',
- '敏','明','姆','穆','', '','','','','',
- '那','拿','纳','娜','奈', '乃','南','农','内','尼',
- '涅','牛','纽','宁','奴', '努','诺','','','',
- '欧','','','','', '','','','','',
- '帕','派','潘','庞','破', '泼','坡','培','佩','裴',
- '彭','皮','匹','平','萍', '普','','','切换','确定']
-
- QT = [ '奇','齐','琪','琦','恰', '乔','切','邱','裘','丘',
- '钱','强','秦','钦','琼', '曲','泉','茜','','',
- '让','荣','蓉','柔','热', '日','如','若','瑞','锐',
- '闰','','','','', '','','','','',
- '萨','撒','赛','塞','桑', '宋','松','色','瑟','森',
- '思','斯','丝','苏','梭', '索','孙','沙','闪','尚',
- '商','沈','圣','施','史', '诗','舒','瞬','稣','',
- '塔','泰','桃','谭','坦', '汤','唐','堂','特','腾',
- '提','条','铁','天','汀', '婷','图','托','切换','确定']
-
- TZ = [ '脱','忒','吞','','', '','','','','',
- '乌','瓦','娃','渥','威', '魏','唯','维','薇','韦',
- '卫','万','文','温','雯', '翁','汪','旺','','',
- '西','希','锡','夏','肖', '谢','修','仙','香','向',
- '信','辛','雄','逊','薛', '宣','萱','许','','',
- '易','伊','依','亚','雅', '娅','姚','叶','耶','由',
- '尤','严','杨','扬','洋', '印','因','英','勇','云',
- '月','于','玉','元','', '','','','','',
- '兆','展','章','张','钟', '周','哲','真','切换','确定']
- Z = [ '珍','贞','支','志','治', '智','朱','诸','珠','卓',
- '赞','藏','宗','泽','曾', '兹','佐','尊','扎','翟',
- '庄','','','','', '','','','','',
- '','','','','', '','','','','',
- '一','二','三','四','五', '六','七','八','九','十',
- '〇','零','百','千','万', '世','代','年','月','日',
- '','','','','', '','','','','',
- '','','','','', '','','','','',
- '','','','','', '','','','切换','确定']
-
- 英文 = [ 'A','B','C','D','E', 'a','b','c','d','e',
- 'F','G','H','I','J', 'f','g','h','i','j',
- 'K','L','M','N','O', 'k','l','m','n','o',
- 'P','Q','R','S','T', 'p','q','r','s','t',
- 'U','V','W','X','Y', 'u','v','w','x','y',
- 'Z','','','','', 'z','','','','',
- '1','2','3','4','5', 'Ⅰ','Ⅱ','Ⅲ','Ⅳ','Ⅴ',
- '6','7','8','9','0', 'Ⅵ','Ⅶ','Ⅷ','Ⅸ','Ⅹ',
- '•',' ','-',' ',' ', ' ',' ','☆','切换','确定']
- 特殊符号 = ['!','?','˙','#','&', '*','※','§','○','●',
- '△','▽','▼','▲','■', '□','◇','◆','♀','♂',
- '☆','★','◎','⊙','〤', ',',';',':','『','』',
- '↑','↓','←','→','↖', '↗','↙','↘','「','」',
- '1','2','3','4','5', '6','7','8','9','0',
- '|','…','.','、','-', '(',')','〔','〕',' ',
- '+','-','*','/','\', '',' ',' ',' ',' ',
- ' ',' ',' ',' ',' ', ' ',' ',' ',' ',' ',
- ' ',' ',' ',' ',' ', ' ',' ',' ','切换','确定']
- TABLE = [AG, GL, LP, QT,TZ,Z, 英文, 特殊符号]
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # mode : 默认输入模式
- #--------------------------------------------------------------------------
- def initialize(mode = 0)
- super(88, 148, 368, 248)
- @mode = mode
- [url=home.php?mod=space&uid=370741]@Index[/url] = 0
- refresh
- update_cursor
- end
- #--------------------------------------------------------------------------
- # ● 获取文字
- #--------------------------------------------------------------------------
- def character
- if [url=home.php?mod=space&uid=370741]@Index[/url] < 88
- return TABLE[@mode][@index]
- else
- return ""
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置光标位置:模式替换
- #--------------------------------------------------------------------------
- def is_mode_change
- return (@index == 88)
- end
- #--------------------------------------------------------------------------
- # ● 设置光标位置:确认
- #--------------------------------------------------------------------------
- def is_decision
- return (@index == 89)
- end
- #--------------------------------------------------------------------------
- # ● 获取项目矩型
- # index : 项目索引
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = index % 10 * 32 + index % 10 / 5 * 16
- 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[@mode][i], 1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标
- #--------------------------------------------------------------------------
- def update_cursor
- self.cursor_rect = item_rect(@index)
- end
- #--------------------------------------------------------------------------
- # ● 光标下移
- # wrap : 允许循环
- #--------------------------------------------------------------------------
- def cursor_down(wrap)
- if @index < 80
- @index += 10
- elsif wrap
- @index -= 80
- end
- end
- #--------------------------------------------------------------------------
- # ● 光标上移
- # wrap : 允许循环
- #--------------------------------------------------------------------------
- def cursor_up(wrap)
- if @index >= 10
- @index -= 10
- elsif wrap
- @index += 80
- end
- end
- #--------------------------------------------------------------------------
- # ● 光标右移
- # wrap : 允许循环
- #--------------------------------------------------------------------------
- def cursor_right(wrap)
- if @index % 10 < 9
- @index += 1
- elsif wrap
- @index -= 9
- end
- end
- #--------------------------------------------------------------------------
- # ● 光标左移
- # wrap : 允许循环
- #--------------------------------------------------------------------------
- def cursor_left(wrap)
- if @index % 10 > 0
- @index -= 1
- elsif wrap
- @index += 9
- end
- end
- #--------------------------------------------------------------------------
- # ● 移动光标至「确认」
- #--------------------------------------------------------------------------
- def cursor_to_decision
- @index = 89
- end
- #--------------------------------------------------------------------------
- # ● 下一页
- #--------------------------------------------------------------------------
- def cursor_pagedown
- @mode = (@mode + 1) % TABLE.size
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 上一页
- #--------------------------------------------------------------------------
- def cursor_pageup
- @mode = (@mode + TABLE.size - 1) % TABLE.size
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- last_mode = @mode
- last_index = @index
- if Input.repeat?(Input::DOWN)
- cursor_down(Input.trigger?(Input::DOWN))
- end
- if Input.repeat?(Input::UP)
- cursor_up(Input.trigger?(Input::UP))
- end
- if Input.repeat?(Input::RIGHT)
- cursor_right(Input.trigger?(Input::RIGHT))
- end
- if Input.repeat?(Input::LEFT)
- cursor_left(Input.trigger?(Input::LEFT))
- end
- if Input.trigger?(Input::A)
- cursor_to_decision
- end
- if Input.trigger?(Input::R)
- cursor_pagedown
- end
- if Input.trigger?(Input::L)
- cursor_pageup
- end
- if Input.trigger?(Input::C) and is_mode_change
- cursor_pagedown
- end
- if @index != last_index or @mode != last_mode
- Sound.play_cursor
- end
- update_cursor
- end
- end
复制代码 |