Project1

标题: 那个如何在状态界面显示属性雷达图? [打印本页]

作者: 爆焰    时间: 2011-11-28 13:22
标题: 那个如何在状态界面显示属性雷达图?
本帖最后由 爆焰 于 2011-11-28 15:09 编辑

如图。




补充:
愚者已经做到这一步了,但是还是不知道如何显示百分比。%

请高手帮忙dsu_plus_rewardpost_czw
作者: 帕克    时间: 2011-11-28 13:32
http://www.66rpg.com/articles/3326
看看此帖吧,虽然跟你那个不是很像,但是我想目的都一样吧= =

作者: 步兵中尉    时间: 2011-11-28 13:45
用这个抗性雷达吧!但属性至少要8个

  1. # ▼▲▼ XRXS_MP 4. ステータス・属性防御レーダーグラフ ver.1.5 ▼▲▼
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # ■ Window_Base
  5. #==============================================================================
  6. class Window_Base
  7.   def draw_line(start_x, start_y, end_x, end_y, color_1sthalf = normal_color, width = 1, color_2ndhalf = color_1sthalf)
  8.     distance = (start_x - end_x).abs + (start_y - end_y).abs # 大きめに直角時の長さ
  9.     for i in 1..distance
  10.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  11.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  12.       r = color_1sthalf.red   * (distance-i)/distance + color_2ndhalf.red   * i/distance
  13.       g = color_1sthalf.green * (distance-i)/distance + color_2ndhalf.green * i/distance
  14.       b = color_1sthalf.blue  * (distance-i)/distance + color_2ndhalf.blue  * i/distance
  15.       a = color_1sthalf.alpha * (distance-i)/distance + color_2ndhalf.alpha * i/distance
  16.       self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  17.     end
  18.   end
  19. end
  20. #==============================================================================
  21. # ■ Window_Status
  22. #==============================================================================
  23. class Window_Status < Window_Base
  24.   #--------------------------------------------------------------------------
  25.   # ● リフレッシュ
  26.   #--------------------------------------------------------------------------
  27.   alias xrxs_mp4_refresh refresh
  28.   def refresh
  29.     xrxs_mp4_refresh
  30.     # ここで表示位置を調整可能。表示座標 → X    Y
  31.     draw_actor_element_radar_graph(@actor, 390, 60)
  32.     draw_actor_element_radar_graph2(@actor, 390, 250)
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 属性防御レーダーグラフの描写
  36.   #--------------------------------------------------------------------------
  37.   def draw_actor_element_radar_graph(actor, x, y, radius = 56)
  38.     # 各変数の準備(ユーザーが値を任意に変更可能)
  39.     font_size          = 16                            # 属性名のフォントサイズ
  40.     word_element_guard = "属性耐久度"                    # 用語「属性防御」
  41.     element_order      = [0,1,3,8,5,2,4,7,6]           # 属性の順番。最初の0は固定
  42.     graph_line_color1  = Color.new(255, 255, 255, 128) # グラフの目盛線色
  43.     graph_line_color2  = Color.new(  0,   0,   0, 192) # グラフの目盛線色・影
  44.     graph_line_color3  = Color.new(255, 255,  64, 255) # グラフの線色 通常時
  45.     graph_line_color4  = Color.new( 64, 255, 255, 255) # グラフの線色 吸収時
  46.     graph_line_color5  = Color.new(255,  64,  64, 255) # グラフの線色 弱点時
  47.     # 各変数の準備(固定)
  48.     cx                 = x + radius + font_size + 48
  49.     cy                 = y + radius + font_size + 32
  50.     tilt_length        = (radius / 1.41421356).to_i
  51.     # 用語「属性防御」の描写
  52.     self.contents.font.color = system_color
  53. #    self.contents.draw_text(x + 30 , y - 40 , 120, 32, word_element_guard)
  54.     # 各属性名の描写
  55.     self.contents.font.size = font_size
  56.     self.contents.draw_text(cx - font_size/2            , cy - radius - font_size     , font_size, font_size, $data_system.elements[element_order[1]])
  57.     self.contents.draw_text(cx - font_size/2            , cy + radius                 , font_size, font_size,  $data_system.elements[element_order[5]])
  58.     self.contents.draw_text(cx + radius + 0 , cy - font_size / 2          , font_size, font_size,  $data_system.elements[element_order[3]])
  59.     self.contents.draw_text(cx - 2 - radius - font_size , cy - font_size / 2          , font_size, font_size,  $data_system.elements[element_order[7]])
  60.     self.contents.draw_text(cx + tilt_length            , cy - tilt_length - font_size, font_size, font_size,  $data_system.elements[element_order[2]])
  61.     self.contents.draw_text(cx + tilt_length            , cy + tilt_length            , font_size, font_size,  $data_system.elements[element_order[4]])
  62.     self.contents.draw_text(cx - tilt_length - font_size, cy + tilt_length            , font_size, font_size,  $data_system.elements[element_order[6]])
  63.     self.contents.draw_text(cx - tilt_length - font_size, cy - tilt_length - font_size, font_size, font_size,  $data_system.elements[element_order[8]])
  64.    
  65. #    i = @actor.element_rate(element_order[1])
  66. #    text_1 = ((200 - i) / 20).to_s
  67. #    i = @actor.element_rate(element_order[2])
  68. #    text_2 = ((200 - i) / 20).to_s
  69. #    i = @actor.element_rate(element_order[3])
  70. #    text_3 = ((200 - i) / 20).to_s
  71. #    i = @actor.element_rate(element_order[4])
  72. #    text_4 = ((200 - i) / 20).to_s
  73. #    i = @actor.element_rate(element_order[5])
  74. #    text_5 = ((200 - i) / 20).to_s
  75. #    i = @actor.element_rate(element_order[6])
  76. #    text_6 = ((200 - i) / 20).to_s
  77. #    i = @actor.element_rate(element_order[7])
  78. #    text_7 = ((200 - i) / 20).to_s
  79. #    i = @actor.element_rate(element_order[8])
  80. #    text_8 = ((200 - i) / 20).to_s

  81.     # 各属性数値の描写(↑からコピペ(素))
  82. #  self.contents.font.color = Color.new(255, 255, 255, 128)
  83. #   self.contents.draw_text(cx - font_size*1.8            , cy - radius - font_size * 2 , font_size*2, font_size, text_1 , 2)
  84. #   self.contents.draw_text(cx - font_size*2.8            , cy + radius + font_size     , font_size*3, font_size, text_5 , 2)
  85. #  self.contents.draw_text(cx + radius - font_size*1/2 , cy - font_size / 2          , font_size*3, font_size, text_3 , 2)
  86. #   self.contents.draw_text(cx-2 - radius - font_size *4, cy - font_size / 2          , font_size*3, font_size, text_7 , 2)
  87. #   self.contents.draw_text(cx +tilt_length -font_size*3/2, cy -tilt_length -font_size*2, font_size*3, font_size, text_2 , 2)
  88. #   self.contents.draw_text(cx +tilt_length -font_size*3/2, cy +tilt_length +font_size  , font_size*3, font_size, text_4 , 2)
  89.   #  self.contents.draw_text(cx-tilt_length-font_size*7/2, cy +tilt_length +font_size  , font_size*3, font_size, text_6 , 2)
  90. #   self.contents.draw_text(cx-tilt_length-font_size*7/2, cy -tilt_length -font_size*2, font_size*3, font_size, text_8 , 2)
  91.     # グラフ線の描写
  92.     cx += 1
  93.     cy += 1
  94.     draw_line(cx - radius, cy, cx + radius, cy, graph_line_color2)
  95.     draw_line(cx, cy - radius, cx, cy + radius, graph_line_color2)
  96.     draw_line(cx - tilt_length, cy - tilt_length, cx + tilt_length, cy + tilt_length, graph_line_color2, 1)
  97.     draw_line(cx + tilt_length, cy - tilt_length, cx - tilt_length, cy + tilt_length, graph_line_color2, 1)
  98.     # 第一属性から第三属性
  99.     start_x = cx
  100.     start_y = cy - radius
  101.     end_x = cx + (radius / 1.41421356).to_i
  102.     end_y = -1 * end_x + cx + cy
  103.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  104.     # 第三属性から第八属性
  105.     start_x = end_x
  106.     start_y = end_y
  107.     end_x = cx + radius
  108.     end_y = cy
  109.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  110.     # 第八属性から第五属性
  111.     start_x = end_x
  112.     start_y = end_y
  113.     end_x = cx + (radius / 1.41421356).to_i
  114.     end_y = end_x - cx + cy
  115.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  116.     # 第五属性から第二属性
  117.     start_x = end_x
  118.     start_y = end_y
  119.     end_x = cx
  120.     end_y = cy + radius
  121.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  122.     # 第二属性から第四属性
  123.     start_x = end_x
  124.     start_y = end_y
  125.     end_x = cx - (radius / 1.41421356).to_i
  126.     end_y = -1 * end_x + cx + cy
  127.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  128.     # 第四属性から第七属性
  129.     start_x = end_x
  130.     start_y = end_y
  131.     end_x = cx - radius
  132.     end_y = cy
  133.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  134.     # 第七属性から第六属性
  135.     start_x = end_x
  136.     start_y = end_y
  137.     end_x = cx - (radius / 1.41421356).to_i
  138.     end_y = end_x - cx + cy
  139.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  140.     # 第六属性から第一属性
  141.     start_x = end_x
  142.     start_y = end_y
  143.     end_x = cx
  144.     end_y = cy - radius
  145.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  146.     cx -= 1
  147.     cy -= 1
  148.     draw_line(cx - radius, cy, cx + radius, cy, graph_line_color1)
  149.     draw_line(cx, cy - radius, cx, cy + radius, graph_line_color1)
  150.     draw_line(cx - tilt_length, cy - tilt_length, cx + tilt_length, cy + tilt_length, graph_line_color1, 1)
  151.     draw_line(cx + tilt_length, cy - tilt_length, cx - tilt_length, cy + tilt_length, graph_line_color1, 1)
  152.     # 第一属性から第三属性
  153.     start_x = cx
  154.     start_y = cy - radius
  155.     end_x = cx + (radius / 1.41421356).to_i
  156.     end_y = -1 * end_x + cx + cy
  157.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  158.     # 第三属性から第八属性
  159.     start_x = end_x
  160.     start_y = end_y
  161.     end_x = cx + radius
  162.     end_y = cy
  163.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  164.     # 第八属性から第五属性
  165.     start_x = end_x
  166.     start_y = end_y
  167.     end_x = cx + (radius / 1.41421356).to_i
  168.     end_y = end_x - cx + cy
  169.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  170.     # 第五属性から第二属性
  171.     start_x = end_x
  172.     start_y = end_y
  173.     end_x = cx
  174.     end_y = cy + radius
  175.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  176.     # 第二属性から第四属性
  177.     start_x = end_x
  178.     start_y = end_y
  179.     end_x = cx - (radius / 1.41421356).to_i
  180.     end_y = -1 * end_x + cx + cy
  181.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  182.     # 第四属性から第七属性
  183.     start_x = end_x
  184.     start_y = end_y
  185.     end_x = cx - radius
  186.     end_y = cy
  187.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  188.     # 第七属性から第六属性
  189.     start_x = end_x
  190.     start_y = end_y
  191.     end_x = cx - (radius / 1.41421356).to_i
  192.     end_y = end_x - cx + cy
  193.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  194.     # 第六属性から第一属性
  195.     start_x = end_x
  196.     start_y = end_y
  197.     end_x = cx
  198.     end_y = cy - radius
  199.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  200.     # 再び色を変えて描く↓
  201.     # 第一属性から第三属性
  202.     er = (200 - actor.element_rate(element_order[1])) / 2
  203.     color_1sthalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  204.     start_x = cx
  205.     start_y = cy - er.abs * radius / 100
  206.     er = (200 - actor.element_rate(element_order[2])) / 2
  207.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  208.     end_x = cx + (er.abs * radius / 1.41421356 / 100).to_i
  209.     end_y = -1 * end_x + cx + cy
  210.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  211.     # 第三属性から第八属性
  212.     er = (200 - actor.element_rate(element_order[3])) / 2
  213.     color_1sthalf = color_2ndhalf
  214.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  215.     start_x = end_x
  216.     start_y = end_y
  217.     end_x = cx + (er.abs * radius / 100).to_i
  218.     end_y = cy
  219.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  220.     # 第八属性から第五属性
  221.     er = (200 - actor.element_rate(element_order[4])) / 2
  222.     color_1sthalf = color_2ndhalf
  223.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  224.     start_x = end_x
  225.     start_y = end_y
  226.     end_x = cx + (er.abs * radius / 1.41421356 / 100).to_i
  227.     end_y = end_x - cx + cy
  228.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  229.     # 第五属性から第二属性
  230.     er = (200 - actor.element_rate(element_order[5])) / 2
  231.     color_1sthalf = color_2ndhalf
  232.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  233.     start_x = end_x
  234.     start_y = end_y
  235.     end_x = cx
  236.     end_y = cy + (er.abs * radius / 100).to_i
  237.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  238.     # 第二属性から第四属性
  239.     er = (200 - actor.element_rate(element_order[6])) / 2
  240.     color_1sthalf = color_2ndhalf
  241.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  242.     start_x = end_x
  243.     start_y = end_y
  244.     end_x = cx - (er.abs * radius / 1.41421356 / 100).to_i
  245.     end_y = -1 * end_x + cx + cy
  246.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  247.     # 第四属性から第七属性
  248.     er = (200 - actor.element_rate(element_order[7])) / 2
  249.     color_1sthalf = color_2ndhalf
  250.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  251.     start_x = end_x
  252.     start_y = end_y
  253.     end_x = cx - (er.abs * radius / 100).to_i
  254.     end_y = cy
  255.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  256.     # 第七属性から第六属性
  257.     er = (200 - actor.element_rate(element_order[8])) / 2
  258.     color_1sthalf = color_2ndhalf
  259.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  260.     start_x = end_x
  261.     start_y = end_y
  262.     end_x = cx - (er.abs * radius / 1.41421356 / 100).to_i
  263.     end_y = end_x - cx + cy
  264.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  265.     # 第六属性から第一属性
  266.     er = (200 - actor.element_rate(element_order[1])) / 2
  267.     color_1sthalf = color_2ndhalf
  268.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  269.     start_x = end_x
  270.     start_y = end_y
  271.     end_x = cx
  272.     end_y = cy - er.abs * radius / 100
  273.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  274.   end

  275.   #--------------------------------------------------------------------------
  276.   # ● 属性防御レーダーグラフの描写
  277.   #--------------------------------------------------------------------------
  278.   def draw_actor_element_radar_graph2(actor, x, y, radius = 56)
  279.     # 各変数の準備(ユーザーが値を任意に変更可能)
  280.     font_size          = 16                            # 属性名のフォントサイズ
  281.     word_element_guard = "状态抗性"                    # 用語「属性防御」
  282.     element_order      = [0,9,11,16,13,10,12,15,14]           # 属性の順番。最初の0は固定
  283.     graph_line_color1  = Color.new(255, 255, 255, 128) # グラフの目盛線色
  284.     graph_line_color2  = Color.new(  0,   0,   0, 192) # グラフの目盛線色・影
  285.     graph_line_color3  = Color.new(255, 255,  64, 255) # グラフの線色 通常時
  286.     graph_line_color4  = Color.new( 64, 255, 255, 255) # グラフの線色 吸収時
  287.     graph_line_color5  = Color.new(255,  64,  64, 255) # グラフの線色 弱点時
  288.     # 各変数の準備(固定)
  289.     cx                 = x + radius + font_size + 48
  290.     cy                 = y + radius + font_size + 32
  291.     tilt_length        = (radius / 1.41421356).to_i
  292.     # 用語「属性防御」の描写
  293.     self.contents.font.color = system_color
  294. #    self.contents.draw_text(x + 30 , y - 40 , 120, 32, word_element_guard)
  295.     # 各属性名の描写
  296.     self.contents.font.size = font_size
  297.     self.contents.draw_text(cx - 32/2            , cy - radius - 32     , 32,32, $data_system.elements[element_order[1]])
  298.     self.contents.draw_text(cx - 32/2            , cy + radius                 , 32,32,  $data_system.elements[element_order[5]])
  299.     self.contents.draw_text(cx + radius + 0 , cy - 32 / 2          , 32,32,  $data_system.elements[element_order[3]])
  300.     self.contents.draw_text(cx - 2 - radius - 32 , cy - 32 / 2          , 32,32,  $data_system.elements[element_order[7]])
  301.     self.contents.draw_text(cx + tilt_length            , cy - tilt_length - 32, 32,32,  $data_system.elements[element_order[2]])
  302.     self.contents.draw_text(cx + tilt_length            , cy + tilt_length            , 32,32,  $data_system.elements[element_order[4]])
  303.     self.contents.draw_text(cx - tilt_length - 32, cy + tilt_length            , 32,32,  $data_system.elements[element_order[6]])
  304.     self.contents.draw_text(cx - tilt_length - 32, cy - tilt_length - 32, 32,32,  $data_system.elements[element_order[8]])
  305.     cx += 1
  306.     cy += 1
  307.     draw_line(cx - radius, cy, cx + radius, cy, graph_line_color2)
  308.     draw_line(cx, cy - radius, cx, cy + radius, graph_line_color2)
  309.     draw_line(cx - tilt_length, cy - tilt_length, cx + tilt_length, cy + tilt_length, graph_line_color2, 1)
  310.     draw_line(cx + tilt_length, cy - tilt_length, cx - tilt_length, cy + tilt_length, graph_line_color2, 1)
  311.     # 第一属性から第三属性
  312.     start_x = cx
  313.     start_y = cy - radius
  314.     end_x = cx + (radius / 1.41421356).to_i
  315.     end_y = -1 * end_x + cx + cy
  316.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  317.     # 第三属性から第八属性
  318.     start_x = end_x
  319.     start_y = end_y
  320.     end_x = cx + radius
  321.     end_y = cy
  322.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  323.     # 第八属性から第五属性
  324.     start_x = end_x
  325.     start_y = end_y
  326.     end_x = cx + (radius / 1.41421356).to_i
  327.     end_y = end_x - cx + cy
  328.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  329.     # 第五属性から第二属性
  330.     start_x = end_x
  331.     start_y = end_y
  332.     end_x = cx
  333.     end_y = cy + radius
  334.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  335.     # 第二属性から第四属性
  336.     start_x = end_x
  337.     start_y = end_y
  338.     end_x = cx - (radius / 1.41421356).to_i
  339.     end_y = -1 * end_x + cx + cy
  340.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  341.     # 第四属性から第七属性
  342.     start_x = end_x
  343.     start_y = end_y
  344.     end_x = cx - radius
  345.     end_y = cy
  346.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  347.     # 第七属性から第六属性
  348.     start_x = end_x
  349.     start_y = end_y
  350.     end_x = cx - (radius / 1.41421356).to_i
  351.     end_y = end_x - cx + cy
  352.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  353.     # 第六属性から第一属性
  354.     start_x = end_x
  355.     start_y = end_y
  356.     end_x = cx
  357.     end_y = cy - radius
  358.     draw_line(start_x, start_y, end_x, end_y, graph_line_color2)
  359.     cx -= 1
  360.     cy -= 1
  361.     draw_line(cx - radius, cy, cx + radius, cy, graph_line_color1)
  362.     draw_line(cx, cy - radius, cx, cy + radius, graph_line_color1)
  363.     draw_line(cx - tilt_length, cy - tilt_length, cx + tilt_length, cy + tilt_length, graph_line_color1, 1)
  364.     draw_line(cx + tilt_length, cy - tilt_length, cx - tilt_length, cy + tilt_length, graph_line_color1, 1)
  365.     # 第一属性から第三属性
  366.     start_x = cx
  367.     start_y = cy - radius
  368.     end_x = cx + (radius / 1.41421356).to_i
  369.     end_y = -1 * end_x + cx + cy
  370.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  371.     # 第三属性から第八属性
  372.     start_x = end_x
  373.     start_y = end_y
  374.     end_x = cx + radius
  375.     end_y = cy
  376.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  377.     # 第八属性から第五属性
  378.     start_x = end_x
  379.     start_y = end_y
  380.     end_x = cx + (radius / 1.41421356).to_i
  381.     end_y = end_x - cx + cy
  382.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  383.     # 第五属性から第二属性
  384.     start_x = end_x
  385.     start_y = end_y
  386.     end_x = cx
  387.     end_y = cy + radius
  388.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  389.     # 第二属性から第四属性
  390.     start_x = end_x
  391.     start_y = end_y
  392.     end_x = cx - (radius / 1.41421356).to_i
  393.     end_y = -1 * end_x + cx + cy
  394.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  395.     # 第四属性から第七属性
  396.     start_x = end_x
  397.     start_y = end_y
  398.     end_x = cx - radius
  399.     end_y = cy
  400.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  401.     # 第七属性から第六属性
  402.     start_x = end_x
  403.     start_y = end_y
  404.     end_x = cx - (radius / 1.41421356).to_i
  405.     end_y = end_x - cx + cy
  406.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  407.     # 第六属性から第一属性
  408.     start_x = end_x
  409.     start_y = end_y
  410.     end_x = cx
  411.     end_y = cy - radius
  412.     draw_line(start_x, start_y, end_x, end_y, graph_line_color1)
  413.     # 再び色を変えて描く↓
  414.     # 第一属性から第三属性
  415.     er = (200 - actor.element_rate(element_order[1])) / 2
  416.     color_1sthalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  417.     start_x = cx
  418.     start_y = cy - er.abs * radius / 100
  419.     er = (200 - actor.element_rate(element_order[2])) / 2
  420.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  421.     end_x = cx + (er.abs * radius / 1.41421356 / 100).to_i
  422.     end_y = -1 * end_x + cx + cy
  423.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  424.     # 第三属性から第八属性
  425.     er = (200 - actor.element_rate(element_order[3])) / 2
  426.     color_1sthalf = color_2ndhalf
  427.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  428.     start_x = end_x
  429.     start_y = end_y
  430.     end_x = cx + (er.abs * radius / 100).to_i
  431.     end_y = cy
  432.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  433.     # 第八属性から第五属性
  434.     er = (200 - actor.element_rate(element_order[4])) / 2
  435.     color_1sthalf = color_2ndhalf
  436.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  437.     start_x = end_x
  438.     start_y = end_y
  439.     end_x = cx + (er.abs * radius / 1.41421356 / 100).to_i
  440.     end_y = end_x - cx + cy
  441.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  442.     # 第五属性から第二属性
  443.     er = (200 - actor.element_rate(element_order[5])) / 2
  444.     color_1sthalf = color_2ndhalf
  445.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  446.     start_x = end_x
  447.     start_y = end_y
  448.     end_x = cx
  449.     end_y = cy + (er.abs * radius / 100).to_i
  450.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  451.     # 第二属性から第四属性
  452.     er = (200 - actor.element_rate(element_order[6])) / 2
  453.     color_1sthalf = color_2ndhalf
  454.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  455.     start_x = end_x
  456.     start_y = end_y
  457.     end_x = cx - (er.abs * radius / 1.41421356 / 100).to_i
  458.     end_y = -1 * end_x + cx + cy
  459.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  460.     # 第四属性から第七属性
  461.     er = (200 - actor.element_rate(element_order[7])) / 2
  462.     color_1sthalf = color_2ndhalf
  463.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  464.     start_x = end_x
  465.     start_y = end_y
  466.     end_x = cx - (er.abs * radius / 100).to_i
  467.     end_y = cy
  468.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  469.     # 第七属性から第六属性
  470.     er = (200 - actor.element_rate(element_order[8])) / 2
  471.     color_1sthalf = color_2ndhalf
  472.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  473.     start_x = end_x
  474.     start_y = end_y
  475.     end_x = cx - (er.abs * radius / 1.41421356 / 100).to_i
  476.     end_y = end_x - cx + cy
  477.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  478.     # 第六属性から第一属性
  479.     er = (200 - actor.element_rate(element_order[1])) / 2
  480.     color_1sthalf = color_2ndhalf
  481.     color_2ndhalf = er < 0 ? graph_line_color4 : er > 100 ? graph_line_color5 : graph_line_color3
  482.     start_x = end_x
  483.     start_y = end_y
  484.     end_x = cx
  485.     end_y = cy - er.abs * radius / 100
  486.     draw_line(start_x, start_y, end_x, end_y, color_1sthalf, 2, color_2ndhalf)
  487.   end
  488. end
复制代码

作者: 1101    时间: 2011-12-2 13:27
我也需要 感谢上面!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
作者: 恋百里    时间: 2011-12-2 14:25
.楼上上那个脚本思路和我一样。建立一个圆点,然后用三角函数算出各自点在他那个方位最大的距离。然后在用当当前值和最大值 比例 算出实际值。。得出的点连接




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1