Advertisement
FlipelyFlip

Erfolgssystem

Oct 1st, 2013
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.38 KB | None | 0 0
  1. module Flip
  2.   Erfolge = [
  3.   # [Text, Wert, Maximalwert, Trophäenbild]
  4.   # Wert, Maximalwert und Trophäenbild entsprechen der Variable.
  5.   ["Getötete Gegner", 1, 2, 3], # der Beistrich ist hier ganz wichtig, ebenso alles
  6.   # in eckigen Klammern halten.
  7.   ["Erhaltenes Geld", 4],
  8.   ] # <-- NICHT ENTFERNEN!!
  9.  
  10.   Trophaen_ID = [ # Hier kannst du die Icon-ID für die Trophäen angeben.
  11.   0, # keine Trophäe
  12.   1, # Trophäe 1
  13.   2, # Trophäe 2
  14.   3, # Trophäe 3
  15.   4, # Trophäe 4
  16.   ] # <-- NICHT ENTFERNEN!!
  17. end
  18.  
  19. class Window_MenuCommand < Window_Command
  20.   #--------------------------------------------------------------------------
  21.   # * Add Exit Game to Command List
  22.   #--------------------------------------------------------------------------
  23.   def add_game_end_command
  24.     add_command("Erfolge", :erfolge)
  25.     add_command(Vocab::game_end, :game_end)
  26.   end
  27. end
  28.  
  29. class Scene_Menu < Scene_MenuBase
  30.   #--------------------------------------------------------------------------
  31.   # * Create Command Window
  32.   #--------------------------------------------------------------------------
  33.   def create_command_window
  34.     @command_window = Window_MenuCommand.new
  35.     @command_window.set_handler(:item,      method(:command_item))
  36.     @command_window.set_handler(:skill,     method(:command_personal))
  37.     @command_window.set_handler(:equip,     method(:command_personal))
  38.     @command_window.set_handler(:status,    method(:command_personal))
  39.     @command_window.set_handler(:formation, method(:command_formation))
  40.     @command_window.set_handler(:save,      method(:command_save))
  41.     @command_window.set_handler(:erfolge,   method(:command_erfolge))
  42.     @command_window.set_handler(:game_end,  method(:command_game_end))
  43.     @command_window.set_handler(:cancel,    method(:return_scene))
  44.   end
  45.  
  46.   def command_erfolge
  47.     SceneManager.call(Scene_Erfolge)
  48.   end
  49. end
  50.  
  51. class Scene_Erfolge < Scene_Base
  52.   #--------------------------------------------------------------------------
  53.   # * Start Processing
  54.   #--------------------------------------------------------------------------
  55.   def start
  56.     super
  57.     @erfolgs_window = Window_Erfolge.new
  58.     @erfolgs_window.set_handler(:cancel,   method(:return_scene))
  59.   end
  60. end
  61.  
  62. class Window_Erfolge < Window_Selectable
  63.   #--------------------------------------------------------------------------
  64.   # * Object Initialization
  65.   #--------------------------------------------------------------------------
  66.   def initialize
  67.     super(0, 0, Graphics.width, Graphics.height)
  68.     refresh
  69.     activate
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # * Refresh
  73.   #--------------------------------------------------------------------------
  74.   def refresh
  75.     contents.clear
  76.     for i in 0...Flip::Erfolge.size
  77.       if Flip::Erfolge[i].size > 2
  78.         draw_line_with_slash(i)
  79.       else
  80.         draw_line_without_slash(i)
  81.       end
  82.     end
  83.   end
  84.   def draw_line_with_slash(i)
  85.     text = sprintf("%s: %s / %s",Flip::Erfolge[i][0],$game_variables[Flip::Erfolge[i][1]],$game_variables[Flip::Erfolge[i][2]])
  86.     y = 24 * i
  87.     draw_text_ex(34, y, text)
  88.     draw_icon(Flip::Trophaen_ID[$game_variables[Flip::Erfolge[i][3]]], 10, y)
  89.   end
  90.   def draw_line_without_slash(i)
  91.     text = sprintf("%s: %s",Flip::Erfolge[i][0], $game_variables[Flip::Erfolge[i][1]])
  92.     draw_text_ex(34, 24 * i, text)
  93.   end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement