Project1
标题:
超级雷人死板起名系统
[打印本页]
作者:
EngShun
时间:
2010-12-31 14:33
标题:
超级雷人死板起名系统
本帖最后由 EngShun 于 2010-12-31 15:03 编辑
简介:雷人,为什么雷人,看脚本就懂了,死板,应为界面有些死板
使用方法:在main之前插入
功能:
可以设置许多页,但一定要照着顺序
比如说第一页为Character[0]第二也就必须Character[1]...以此类推
每一页的最后四个一定要是"上页","下页","退格","确定"这四个(意思一样也可以)
这是脚本:
module NameInput
Character = []
Character[0] = ["赵","钱","孙","李","周","吴","郑","王","冯","陈",
"褚","卫","蒋","沈","韩","杨","朱","秦","尤","许",
"何","吕","施","张","孔","曹","严","华","金","魏",
"陶","姜","戚","谢","邹","喻","柏","水","窦","章",
"云","苏","潘","葛","奚","范","彭","郎","鲁","韦",
"昌","马","苗","凤","花","方","俞","任","袁","柳",
"酆","鲍","史","唐","费","廉","岑","薛","雷","贺",
"倪","汤","滕","殷","罗","毕","上页","下页","退格","确认"]
Character[1] = ["郝","邬","安","常","乐","于","时","傅","皮","卞",
"齐","康","伍","余","元","卜","顾","孟","平","黄",
"和","穆","萧","尹","姚","邵","堪","汪","祁","毛",
"禹","狄","米","贝","明","臧","计","伏","成","戴",
"谈","宋","茅","庞","熊","纪","舒","屈","项","祝",
"董","粱","杜","阮","蓝","闵","席","季","麻","强",
"贾","路","娄","危","江","童","颜","郭","梅","盛",
"林","刁","钟","徐","邱","骆","上页","下页","退格","确认"]
Character[2] = ["高","夏","蔡","田","樊","胡","凌","霍","虞","万",
"支","柯","咎","管","卢","莫","经","房","裘","缪",
"干","解","应","宗","宣","丁","贲","邓","郁","单",
"杭","洪","包","诸","左","石","崔","吉","钮","龚",
"程","嵇","邢","滑","裴","陆","荣","翁","荀","羊",
"於","惠","甄","魏","加","封","芮","羿","储","靳",
"汲","邴","糜","松","井","段","富","巫","乌","焦",
"巴","弓","牧","隗","山","谷","上页","下页","退格","确认"]
Character[3] = ["车","侯","宓","蓬","全","郗","班","仰","秋","仲",
"伊","宫","宁","仇","栾","暴","甘","钭","厉","戎",
"祖","武","符","刘","姜","詹","束","龙","叶","幸",
"司","韶","郜","黎","蓟","薄","印","宿","白","怀",
"蒲","台","从","鄂","索","咸","籍","赖","卓","蔺",
"屠","蒙","池","乔","阴","郁","胥","能","苍","双",
"闻","莘","党","翟","谭","贡","劳","逄","姬","申",
"扶","堵","冉","宰","郦","雍","上页","下页","退格","确认"]
Character[4] = ["郤","璩","桑","桂","濮","牛","寿","通","边","扈",
"燕","冀","郏","浦","尚","农","温","别","庄","晏",
"柴","瞿","阎","充","慕","连","茹","习","宦","艾",
"鱼","容","向","古","易","慎","戈","廖","庚","终",
"暨","居","衡","步","都","耿","满","弘","匡","国",
"文","寇","广","禄","阙","东","殴","殳","沃","利",
"蔚","越","夔","隆","师","巩","厍","聂","晁","勾",
"敖","融","冷","訾","辛","阚","上页","下页","退格","确认"]
Character[5] = ["那","简","饶","空","曾","毋","沙","乜","养","鞠",
"须","丰","巢","关","蒯","相","查","后","荆","红",
"游","竺","权","逯","盖","益","桓","公","万","俟",
"司","马","上","官","欧","阳","夏","侯","诸","葛",
"闻","人","东","方","赫","连","皇","甫","尉","迟",
"公","羊","澹","台","公","冶","宗","政","濮","阳",
"淳","于","仲","孙","太","叔","申","屠","公","孙",
"乐","正","轩","辕","令","狐","上页","下页","退格","确认"]
Character[6] = ["钟","离","闾","丘","长","孙","慕","容","鲜","于",
"宇","文","司","徒","司","空","亓","官","司","寇",
"仉","督","子","车","颛","孙","端","木","巫","马",
"公","西","漆","雕","乐","正","壤","驷","公","良",
"拓","拔","夹","谷","宰","父","谷","粱","晋","楚",
"闫","法","汝","鄢","涂","段","干","百","里","东",
"郭","南","门","呼","延","妫","海","羊","舌","微",
"生","岳","帅","缑","亢","况","上页","下页","退格","确认"]
Character[7] = ["後","有","琴","梁","丘","左","丘","东","门","西",
"门","商","牟","佘","佴","伯","赏","南","宫","墨",
"哈","谯","笪","年","爱","阳","佟","第","五","言",
"福","百","家","姓","续","林","狗","猫","蛇","鼠",
"大","小","上","下","英","有","去","无","回","雷",
"人","俊","豪","杰","顺","利","上页","下页","退格","确认"]
Character[8] = ["A","B","C","D","E","F","G","H","I","J",
"K","L","M","N","O","P","Q","R","S","T",
"U","V","W","X","Y","Z","a","b","c","d",
"e","f","g","h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x",
"y","z","0","1","2","3","4","5","6","7",
"8","9",",",".","/",";","'","[","]","`",
"-","=","<",">","?",":","上页","下页","退格","确认"]
Character[9] = ["{","}","!","@","$","%","^","&","*","(",
")","_","+","|","☆","★","○","●","◎","◇",
"◆","□","■","△","▲","※","→","←","↑","↓",
"〓","上页","下页","退格","确认"]
Character[10] = ["あ","い","う","え","お","か","き","く","け","こ",
"さ","し","す","せ","そ","た","ち","つ","て","と",
"な","に","ぬ","ね","の","は","ひ","ふ","へ","ほ",
"ま","み","む","め","も","や", "ゆ","よ","ら","り",
"る","れ","ろ","わ", "を","ん","が","ぎ","ぐ","げ",
"ご","ざ","じ","ず","ぜ","ぞ","だ","ぢ","づ","で",
"ど","ば","び","ぶ","べ","ぼ","ぱ","ぴ","ぷ","ぺ",
"ぽ","ゃ","上页","下页","退格","确认"]
end
class Window_Name_Input < Window_Selectable
def initialize(command=[])
super(144,160, 352, 288)
@item_max = command.size
@column_max = 10
@commands = command
self.contents = Bitmap.new(320, 256)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(cmd=@commands)
@commands = cmd
@item_max = @commands.size
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
# 计算得出当前index所对应的内容所在的行
row_index = index / @column_max
# 根据余数得出所在的列
for i in 0...@column_max
if index % @column_max == i
rect = Rect.new(i * 32 + 2, 32 * row_index, 28,32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index].to_s,1)
break
end
end
end
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽度
cursor_width = (self.width - 32) / @column_max
# 计算光标坐标
x = @index % @column_max * (cursor_width)
y = @index / @column_max * 32 - self.oy
# 更新光标矩形
self.cursor_rect.set(x, y, cursor_width, 32)
end
end
class Scene_Name
include NameInput
def main
@spriteset = Spriteset_Map.new
@actor = $game_actors[$game_temp.name_actor_id]
@name = $game_actors[$game_temp.name_actor_id].name
@defult_name = $game_actors[$game_temp.name_actor_id].name
@max = $game_temp.name_max_char
@pages = 0
@character = Character[@pages]
@edit_window = Window_Name_Input.new(@character)
@name_window = Window_Base.new(144,64,352,96)
@name_window.contents = Bitmap.new(320,64)
refresh
Graphics.transition
loop do
Input.update
Graphics.update
update
break if $scene != self
end
Graphics.freeze
@spriteset.dispose
@edit_window.dispose
@name_window.dispose
end
def update
@edit_window.update
if Input.trigger?(Input::L)
if Character.size != 1
@pages -= 1
@pages = Character.size - 1 if @pages < 0
@character = Character[@pages]
@edit_window.index = @character.size - 1 if @edit_window.index >= @character.size
@edit_window.refresh(@character)
end
elsif Input.trigger?(Input::R)
if Character.size != 1
@pages += 1
@pages = 0 if @pages >= Character.size
@character = Character[@pages]
@edit_window.index = @character.size - 1 if @edit_window.index >= @character.size
@edit_window.refresh(@character)
end
elsif Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @name != ""
@scan = @name.scan(/./)
@scan[@scan.size - 1] = nil
@name = ""
for i in
[email protected]
@name += @scan[i] if @scan[i] != nil
end
refresh
end
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @edit_window.index
when @character.size - 1
@name = @defult_name if @name == ""
$game_actors[$game_temp.name_actor_id].name = @name
$scene = Scene_Map.new
return
when @character.size - 2
if @name != ""
@scan = @name.scan(/./)
@scan[@scan.size - 1] = nil
@name = ""
for i in
[email protected]
@name += @scan[i]
end
end
when @character.size - 3
if Character.size != 1
@pages += 1
@pages = 0 if @pages >= Character.size
@character = Character[@pages]
@edit_window.index = @character.size - 1 if @edit_window.index >= @character.size
@edit_window.refresh(@character)
end
when @character.size - 4
if Character.size != 1
@pages -= 1
@pages = Character.size - 1 if @pages < 0
@character = Character[@pages]
@edit_window.index = @character.size - 1 if @edit_window.index >= @character.size
@edit_window.refresh(@character)
end
else
if @name.scan(/./).size < @max
@name += @character[@edit_window.index]
end
end
refresh
end
end
def refresh
@name_window.contents.clear
@name_window.draw_actor_graphic(@actor, 32, 64)
text = ""
for i in 0...@max
if @name.scan(/./)[i] != nil
text += @name.scan(/./)[i]
else
text += ".."
end
end
@name_window.contents.draw_text(0,0,320,64,text,1)
end
end
复制代码
------------------------------------------补充------------------------------------------
每页选项最多八十个,超出就不好看了
作者:
stevenrock
时间:
2010-12-31 22:09
制作的非常精美啊~很好用!
作者:
enghao_lim
时间:
2010-12-31 22:31
这下可好了……撞帖了……不过是n年前的事……
苹果梨也写过一个……不过他是活用 Character =
{}
作者:
zhixin1997
时间:
2011-1-10 21:32
非常麻烦啊- -
有没有个范例教程?
作者:
aya163
时间:
2011-1-18 16:22
不错支持一下。
作者:
姬文翔
时间:
2011-1-21 02:39
啊……这……还不如用那个拼音输入的好。至少在扩展性方面差太多了
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1