# ----------------------------------------------------------------------------- # 值槽脚本随机生成系统(SLOTCR) By.Clov # 通用版本:RMXP(RGSS1) RMVX(RGSS2) RMVX ACE(RGSS3) # 使用方法:在全部窗口类插入即可 例:draw_cr(0,0,变量1,变量2,'开心值',100,10) # 参数说明:x x坐标,y y坐标,current 当前值,max 最大值,txt 显示的文字 # width 值槽的宽,height 值槽的高 # 背景与边框没有随机的必要,请自行到脚本里设置 # ----------------------------------------------------------------------------- class Window_Base def draw_crhp(x,y,current,max,txt='',width=60,height=10) #颜色1、颜色2 c1=[230, 7, 17];c2=[13, 2, 158] #背景颜色 bk_color = Color.new(0,0,0,255) back_color = Color.new(0,0,0,80) #数值是否显示 num = true #显示数值的对齐方式 0:向左对齐 1:向中间对齐 2:向右边对齐 num_align = 1 #计算比率 bl = current.to_f / max #计算实际宽 w = (width*bl).round #描绘值槽 contents.fill_rect(x, y, width, height, back_color) r = c1[0];g = c1[1];b = c1[2] plus_r = (c2[0]-c1[0])/(height-1).to_f plus_g = (c2[1]-c1[1])/(height-1).to_f plus_b = (c2[2]-c1[2])/(height-1).to_f height.times {|i| contents.fill_rect(x, y+i, w, 1, Color.new(r,g,b,255)) r+=plus_r;g+=plus_g;b+=plus_b} contents.fill_rect(x-1, y-1, width+2, 1, bk_color) contents.fill_rect(x-1, y+height, width+2, 1, bk_color) contents.fill_rect(x-1, y, 1, height, bk_color) contents.fill_rect(x+width, y, 1, height, bk_color) #描绘文字 txt_w = contents.text_size(txt).width + 2 contents.draw_text(x-txt_w,y+height/2-12, width, 24, txt) contents.draw_text(x,y+height/2-12, width, 24, current.to_s,num_align) if num end end
QQ截图20141024195213.png (17.92 KB, 下载次数: 17)
QQ截图20141024195213413.png (10.63 KB, 下载次数: 17)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |