Advertisement
biward

Spy

Apr 24th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.11 KB | None | 0 0
  1. ################################################################################
  2. ##### ** ItemsColor
  3. # Par Biward le 24/04/2014 ~ 00:21
  4. # Fonctionne sur : VXAce et VX
  5. #
  6. # Permet de choisir une couleur d'affichage pour chaque objet dans le menu
  7. # équipement de base.
  8. #
  9. # Comment fonctionne-t-il ?
  10. # Il vous suffit de mettre <ItemColor = R, G, B> dans la note de l'objet en
  11. # question.
  12. # R est le taux de rouge  (0~255)
  13. # G est le taux de vert   (0~255)
  14. # B est le taux de bleu   (0~255)
  15. #
  16. ################################################################################
  17. ##### ** Début du script
  18. ########################
  19. class Window_Base
  20.   #########################################
  21.   ##### ** Change Color
  22.   # Alias + ajout de conditions
  23.   # Permet de modifier la couleur de l'item
  24.   #########################################
  25.   alias dicolorbi change_color if RUBY_VERSION == "1.9.2"
  26.   def change_color(color, enabled = true, item = nil)
  27.     if RUBY_VERSION == "1.9.2"
  28.       dicolorbi(color, enabled)
  29.     elsif RUBY_VERSION == "1.8.1"
  30.       contents.font.color = normal_color
  31.     end
  32.     if item
  33.       # On vérifie si l'objet a une couleur spéciale
  34.       item.note =~ /<ItemColor = (.*)>/
  35.       if $1
  36.         e = $1.split(",")
  37.         c = Color.new(e[0].to_i, e[1].to_i, e[2].to_i, 255)
  38.       end
  39.       # On vérifie si l'objet a une couleur de palette
  40.       item.note =~ /<ItemPalet = (.*)>/
  41.       c = text_color($1.to_i) if $1
  42.       if c
  43.         contents.font.color.set(c) if RUBY_VERSION == "1.9.2"
  44.         contents.font.color = c if RUBY_VERSION == "1.8.1"
  45.         contents.font.color.alpha = translucent_alpha unless enabled
  46.       end
  47.     end
  48.   end
  49.  
  50.   #########################################
  51.   ##### ** Line Height | Draw Text
  52.   # Ajout de deux nouvelles méthodes de VXAce à VX
  53.   #########################################
  54.   if RUBY_VERSION == "1.8.1"
  55.     def line_height ; WLH ; end
  56.     def draw_text(*args) ; contents.draw_text(*args) ; end
  57.   end
  58. end
  59. #######################
  60. ##### ** Fin du script
  61. ################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement