QQ截图20130417072425.png (79.92 KB, 下载次数: 29)
#============================================================================== # ■ Window_MASS #------------------------------------------------------------------------------ # 角色深造窗口 #============================================================================== class Window_MASS < Window_Status #-------------------------------------------------------------------------- # ● 绘制能力值 #-------------------------------------------------------------------------- def draw_parameters(x, y) x = x + 15 # 图形的X坐标 y = y # 图形的Y坐标 long = 65 # 每边边长 draw_param_shape2(x, y,long) end #-------------------------------------------------------------------------- # ● 多边形描绘角色属性 #-------------------------------------------------------------------------- def draw_param_shape2(x,y,long = 50,n = 7,color = Color.new(255,255,255),actor = @actor) if n >= 3 x1 = [] y1 = [] mx = [] my = [] px = [] py = [] an = jiaodu(n).to_f# * 2.0 an2 = 180 - an x1[0], y1[0] = x,y for i in 0...n an -= an2 if i > 0 an = 180 if i == n - 1 x1[i+1] = Math.cos(an/180.0*Math::PI) * long.to_f + x1[i] y1[i+1] = Math.sin(an/180.0*Math::PI) * long.to_f + y1[i] # 计算一边中点 mx[i] = Math.cos(an/180.0*Math::PI) * long.to_f / 2 + x1[i] my[i] = Math.sin(an/180.0*Math::PI) * long.to_f / 2 + y1[i] contents.draw_line(x1[i].to_i, y1[i].to_i, x1[i+1].to_i, y1[i+1].to_i, color) if i < n - 1 contents.draw_line(x1[i].to_i+1, y1[i].to_i+1, x1[i+1].to_i+1, y1[i+1].to_i+1, color) if i < n - 1 end contents.draw_line(x1[n-1].to_i, y1[n-1].to_i, x1[0].to_i, y1[0].to_i, color) contents.draw_line(x1[n-1].to_i+1, y1[n-1].to_i+1, x1[0].to_i+1, y1[0].to_i+1, color) s0 = jiaodu(n) / 2.0 s1 = Math.tan(s0/180.0*Math::PI) * (long / 2.0) # a 长度 s2 = jiaodu(n) - 90 # s3,s4 重心坐标 s3 = Math.cos(s2/180.0*Math::PI) * s1 + mx[0] s4 = Math.sin(s2/180.0*Math::PI) * s1 + my[0] # 连接重心 for i in 0...x1.size an2 = 0 s5 = x1[i].to_i s6 = y1[i].to_i s7 = Math.sqrt((long / 2.0)**2+s1**2) if (s3 < s5) an2 = Math.asin((s6-s4)/s7) * 180 / Math::PI else an2 = 180 - Math.asin((s6-s4)/s7) * 180 / Math::PI end link_mid_and_point_together(s5,s6,s3.to_i,s4.to_i) if i < x1.size-1 num = actor.param(i) px[i],py[i] = draw_add_param2(s5,s6,s7,[s3.to_i,s4.to_i],an2,i,num ) if i < n end for i in 0...px.size i < (n-1) ? contents.draw_line(px[i],py[i],px[i+1],py[i+1],Color.new(0,255,0)) : contents.draw_line(px[i],py[i],px[0],py[0],Color.new(0,255,0)) i += 1 end return x1,y1 end return nil,nil end #-------------------------------------------------------------------------- # ● 绘制值 #-------------------------------------------------------------------------- def draw_add_param2(x,y,len,mid,an,param_id,num,color = Color.new(255,255,0)) s1 = num.to_f / 999.0 # 最大值 s2 = len * s1 param_point_x = Math.cos(an/180.0*Math::PI) * s2 + mid[0] param_point_y = Math.sin(an/180.0*Math::PI) * s2 + mid[1] s3 = Vocab::param(param_id) + " " + num.to_s contents.font.size = 13 contents.font.shadow = true change_color(color) contents.font.out_color = Color.new(255,5,255,120) draw_text(x,y,70,line_height,s3) contents.font.out_color = Color.new(0,0,0,128) change_color(Color.new(255,255,255)) contents.font.size = 24 contents.font.shadow = false return param_point_x.to_i,param_point_y.to_i end end
804173948 发表于 2013-4-17 13:03
#==============================================================================
# ■ Window_MASS
# ...
804173948 发表于 2013-4-17 20:01
...把开头的 “class Window_MASS < Window_Status “ 改为" class Window_Status" 应该可以
然后在第16 ...
QQ截图20130417213606.png (46.13 KB, 下载次数: 27)
QQ截图20130417213636.png (21.45 KB, 下载次数: 32)
804173948 发表于 2013-4-18 13:22
。。。
搜索"def draw_param_shape2(x,y,long = 50,n =7,color = Color.new(255,255,255),actor = @acto ...
QQ截图20130418133352.png (245.68 KB, 下载次数: 33)
QQ截图20130418210046.png (44.4 KB, 下载次数: 31)
QQ截图20130418210100.png (9.01 KB, 下载次数: 33)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |