Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #encoding:utf-8
- =begin
- *******************************************************************************************
- * Alternate Choice Window *
- for RGSS3
- Ver 1.1.0 2016.02.17
- Author:魂(Lctseng),Bahamut Forum ID:play123
- Please keep this label reprinted
- Home link:http://home.gamer.com.tw/homeindex.php?owner=play123
- Description:
- Beautifies choice windows and move them to top left screen
- Installation: Paste this script above Main
- Update Log:
- Ver 1.0.0 :
- Date:2014.09.21
- Ver 1.1.0 :
- Date:2016.02.17
- Summary:
- ■、Corrected a bug when cancelling
- ■、Hide arrow of the choice windows
- The following categories can be modiefied or redefined:
- ■ Window_ChoiceList
- This script provided a set of modules
- ■ Lctseng::LargeChoiceWindow
- *******************************************************************************************
- =end
- #encoding:utf-8
- #==============================================================================
- # ■ Lctseng::LargeChoiceWindow
- #------------------------------------------------------------------------------
- # Choice Window Setting Module
- #==============================================================================
- module Lctseng
- module LargeChoiceWindow
- #--------------------------------------------------------------------------
- # ● Whether control character is enabled(ex:\c[n]、\I[n]etc.)
- # Text alignment will not be adjusted (forced left)
- #--------------------------------------------------------------------------
- TEXT_EX_ENABLE = false
- #--------------------------------------------------------------------------
- # ● Text Alignment, used when control characters are not used
- # 0 = left,1 = center,2 = right
- #--------------------------------------------------------------------------
- TEXT_ALIGNMENT = 1
- #--------------------------------------------------------------------------
- # ● Window position/ Size setting
- #--------------------------------------------------------------------------
- # X Coordinate
- WINDOW_X = 0
- # Y Coordinate
- WINDOW_Y = 0
- # Width
- WINDOW_WIDTH = Graphics.width / 2
- # Height
- WINDOW_HEIGHT = Graphics.height - 200
- end
- end
- #*******************************************************************************************
- #
- # DO NOT MODIFY UNLESS YOU KNOW WHAT TO DO !
- #
- #*******************************************************************************************
- #--------------------------------------------------------------------------
- # ★ Script Information Record
- #--------------------------------------------------------------------------
- if !$lctseng_scripts
- $lctseng_scripts = {}
- end
- # Avoid overwriting old date
- @_old_val_script_sym = @_script_sym if !@_script_sym.nil?
- @_script_sym = :large_choice_window
- $lctseng_scripts[@_script_sym] = "1.1.0"
- puts "Load script:Lctseng - Alternate Choice Window:#{$lctseng_scripts[@_script_sym]}"
- # Restore old data
- @_script_sym = @_old_val_script_sym if !@_old_val_script_sym.nil?
- #encoding:utf-8
- #==============================================================================
- # ■ Window_ChoiceList
- #------------------------------------------------------------------------------
- # Window used for "Display Options" function in event
- #==============================================================================
- class Window_ChoiceList < Window_Command
- #--------------------------------------------------------------------------
- # ●Initialization object - 【Change definition】
- #--------------------------------------------------------------------------
- def initialize(message_window)
- @message_window = message_window
- super(0, 0)
- self.openness = 255
- self.opacity = 0
- self.contents_opacity = 0
- self.x = Lctseng::LargeChoiceWindow::WINDOW_X
- self.y = Lctseng::LargeChoiceWindow::WINDOW_Y
- deactivate
- @select = Sprite.new(self.viewport)
- @select.bitmap = Bitmap.new(contents_width - 8,line_height)
- @select.bitmap.fill_rect(@select.bitmap.rect,Color.new(0,0,0,200))
- @select.visible = false
- @select.opacity = 0
- @select_flash_count = 90
- self.arrows_visible = false
- end
- #--------------------------------------------------------------------------
- # ● Update open process
- #--------------------------------------------------------------------------
- def update_open
- self.contents_opacity += 16
- @opening = false if open?
- end
- #--------------------------------------------------------------------------
- # ● Update close process
- #--------------------------------------------------------------------------
- def update_close
- self.contents_opacity -= 16
- @closing = false if close?
- end
- #--------------------------------------------------------------------------
- # ● Open?
- #--------------------------------------------------------------------------
- def open?
- self.contents_opacity >= 255
- end
- #--------------------------------------------------------------------------
- # ● Close?
- #--------------------------------------------------------------------------
- def close?
- self.contents_opacity <= 0
- end
- #--------------------------------------------------------------------------
- # ● Update window location - 【Modify definition】
- #--------------------------------------------------------------------------
- def update_placement
- end
- #--------------------------------------------------------------------------
- # ● Width of window
- #--------------------------------------------------------------------------
- def window_width
- Lctseng::LargeChoiceWindow::WINDOW_WIDTH
- end
- #--------------------------------------------------------------------------
- # ● Height of window
- #--------------------------------------------------------------------------
- def window_height
- Lctseng::LargeChoiceWindow::WINDOW_HEIGHT
- end
- #--------------------------------------------------------------------------
- # ● Calculate width of window
- #--------------------------------------------------------------------------
- def contents_width
- window_width - standard_padding * 2
- end
- #--------------------------------------------------------------------------
- # ● Calculate height of window
- #--------------------------------------------------------------------------
- def contents_height
- window_height - standard_padding * 3
- end
- #--------------------------------------------------------------------------
- # ● Item rectangle
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new
- rect.width = item_width
- rect.height = item_height
- rect.x = index % col_max * (item_width + spacing)
- ## Calculate interval height
- # Assigned height measures
- remain = contents_height - line_height * row_max
- # assigned number & index
- assign = ((remain / row_max)*index).round
- rect.y = (index / col_max * item_height) + assign
- rect
- end
- #--------------------------------------------------------------------------
- # ● Draw item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect_for_text(index)
- contents.fill_rect(rect,back_color)
- if Lctseng::LargeChoiceWindow::TEXT_EX_ENABLE
- draw_text_ex(rect.x, rect.y, command_name(index))
- else
- draw_text(rect, command_name(index) , Lctseng::LargeChoiceWindow::TEXT_ALIGNMENT)
- end
- end
- #--------------------------------------------------------------------------
- # ● Background color
- #--------------------------------------------------------------------------
- def back_color
- Color.new(0, 0, 0, back_opacity)
- end
- #--------------------------------------------------------------------------
- # ● Background opacity
- #--------------------------------------------------------------------------
- def back_opacity
- return 128
- end
- #--------------------------------------------------------------------------
- # ● Dispose
- #--------------------------------------------------------------------------
- def dispose
- super
- @select.dispose
- end
- #--------------------------------------------------------------------------
- # ● Update
- #--------------------------------------------------------------------------
- def update
- super
- @select.visible = self.visible
- @select.opacity = [self.contents_opacity,self.openness].min
- @select.x = self.x + self.cursor_rect.x + 16
- @select.y = self.y + self.cursor_rect.y + 12
- if @select_flash_count < 0
- @select_flash_count = 30
- @select.flash(Color.new(255,255,255,64),60)
- else
- @select_flash_count -= 1
- end
- @select.update
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement