Advertisement
AlliedG

System Options Add-on

Jan 20th, 2015
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. class Window_SystemOptions < Window_Command
  2. #--------------------------------------------------------------------------
  3. # * Move Cursor Down
  4. #--------------------------------------------------------------------------
  5. def cursor_down(wrap = false)
  6. if index < item_max - col_max || (wrap && col_max == 1)
  7. select((index + col_max) % item_max)
  8. cursor_down(wrap) if current_symbol == :blank
  9. end
  10. end
  11. #--------------------------------------------------------------------------
  12. # * Move Cursor Up
  13. #--------------------------------------------------------------------------
  14. def cursor_up(wrap = false)
  15. if index >= col_max || (wrap && col_max == 1)
  16. select((index - col_max + item_max) % item_max)
  17. cursor_up(wrap) if current_symbol == :blank
  18. end
  19. end
  20. #--------------------------------------------------------------------------
  21. # * Get Rectangle for Drawing Items
  22. #--------------------------------------------------------------------------
  23. def item_rect(index)
  24. lines = YEA::SYSTEM::COMMANDS.size
  25. h = (height - lines * line_height - line_height) / 2
  26. rect = Rect.new
  27. rect.width = item_width
  28. rect.height = item_height
  29. rect.x = index % col_max * (item_width + spacing)
  30. rect.y = index / col_max * item_height + h
  31. rect
  32. end
  33. #--------------------------------------------------------------------------
  34. # * Draw Horizontal Line
  35. #--------------------------------------------------------------------------
  36. def draw_horz_line(y)
  37. line_y = y + line_height / 2 - 1
  38. contents.fill_rect(0, line_y, contents_width, 2, line_color)
  39. end
  40. #--------------------------------------------------------------------------
  41. # * Get Color of Horizontal Line
  42. #--------------------------------------------------------------------------
  43. def line_color
  44. color = normal_color
  45. color.alpha = 48
  46. color
  47. end
  48. #--------------------------------------------------------------------------
  49. # draw_item
  50. #--------------------------------------------------------------------------
  51. def draw_item(index)
  52. reset_font_settings
  53. rect = item_rect(index)
  54. contents.clear_rect(rect)
  55. case @list[index][:symbol]
  56. when :blank
  57. draw_horz_line(rect.y)
  58. when :window_red, :window_grn, :window_blu
  59. draw_window_tone(rect, index, @list[index][:symbol])
  60. when :volume_bgm, :volume_bgs, :volume_sfx
  61. draw_volume(rect, index, @list[index][:symbol])
  62. when :autodash, :instantmsg, :animations
  63. draw_toggle(rect, index, @list[index][:symbol])
  64. when :to_title, :shutdown
  65. draw_text(item_rect_for_text(index), command_name(index), 1)
  66. when :custom_switch
  67. draw_custom_switch(rect, index, @list[index][:ext])
  68. when :custom_variable
  69. draw_custom_variable(rect, index, @list[index][:ext])
  70. end
  71. end
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement