Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # LM² - Forge List
- # Data 29/08/17
- # Criado por LeonMM
- # Necessário para o LM² - Forge
- class Forge_List < Window_Selectable
- include LMM_Forge
- attr_accessor :recipeS
- def initialize
- super(230, 110, 152, 152, 30)
- self.windowskin = RPG::Cache.windowskin('Windowskin03')
- @scrollbar = Scroll_Bar.new(self, 5)
- self.visible = self.active = false
- @recipeS = 0
- end
- def trigger
- super
- self.index = @recipeS
- end
- def recipe
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 0...RECIPES.size
- @data << RECIPES[i]
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * @spacing)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- recipe = @data[index]
- cursor_width = contents.width / @column_max
- x = 15
- y = index / @column_max * @spacing
- rect = Rect.new(26, y+2, 1, 26)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 100))
- if @recipeS == index
- self.contents.font.color = $windows[:forge].check_ing ? PCOLOR : NCOLOR
- else
- self.contents.font.color = normal_color
- end
- case recipe[0][0]
- when 0
- desc = $data_items[recipe[0][1]].name
- recicon = RPG::Cache.icon($data_items[recipe[0][1]].icon_name)
- when 1
- desc = $data_weapons[recipe[0][1]].name
- recicon = RPG::Cache.icon($data_weapons[recipe[0][1]].icon_name)
- when 2
- desc = $data_armors[recipe[0][1]].name
- recicon = RPG::Cache.icon($data_armors[recipe[0][1]].icon_name)
- end
- self.contents.draw_text(30, y, 90, 24, desc, 0)
- self.contents.blt(1,y+2, recicon, Rect.new(0, 0, 24, 24))
- end
- def update
- super
- if self.index >= 0 and recipe
- select_recipe
- end
- end
- def select_recipe
- return unless Input.trigger?(Input::Key['Mouse Left'])
- return unless in_area?(0, 16)
- @recipeS = self.index
- refresh
- $windows[:forge].refresh
- end
- end
Add Comment
Please, Sign In to add comment