#¦£¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡ #¦¢ #¦¢ TRCS.15 #¦¢ "Window_Expand" ver1.01 (2005.11.28 h21) #¦¢ by £Î£Ï #¦¢ http://chobi.net/~no/ #¦¢ #¦¦¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡ #============================================================================== # ¡á Window_Expand #------------------------------------------------------------------------------ # ¡¡ò¦ïÒªÎÓÞª­ªµªÞªÇßï?ªËÓÞª­ª¯ªÊªÃªÆõóúÞª¹ªë«¦«£«ó«É«¦ªÎ«¯«é«¹ªÇª¹¡£ #============================================================================== class Window_Expand < Window_Base #-------------------------------------------------------------------------- # ¡Ü «ª«Ö«¸«§«¯«ÈôøÑ¢ûù # x : «¦«£«ó«É«¦ªÎ X ñ¨øö # y : «¦«£«ó«É«¦ªÎ Y ñ¨øö # width : «¦«£«ó«É«¦ªÎøë # height : «¦«£«ó«É«¦ªÎÍÔªµ # dir1,dir2 : «¦«£«ó«É«¦ªÎ?ÓÞÛ°ú¾(1,2,3,4,6,7,8,9 ªÎ«Æ«ó«­?ªË??) # duration : ?ÓÞèÇÖõªÞªÇªÎãÁÊà(«Õ«ì?«à) #-------------------------------------------------------------------------- def initialize(x, y, width, height, dir1, dir2, duration = 5) @x = x @y = y # ãÁÊબݶªÎãÁ if duration < 0 # @durationªÎö·ªòáóïá @duration = 5 else @duration = duration end # ?ÓÞÛ°ú¾Ì«Ò¡ÛÕÖªªÎôøÑ¢ûù @expensible = [false, false, false, false] # ?ÓÞÛ°ú¾(ß¾éÓù»ñ§)ªòö¢Ôð chk_direction(dir1) chk_direction(dir2) # widthª¬Ûô?ãÒªÎíÞùê if width.is_a?(Range) # ñ§éӪ˪¤ªºªìª«ªË?ÓÞʦÒöªÊíÞùê if @expensible[1] or @expensible[3] # Ûô?ãÒªòÝÂùÜ @first_w = width.first @last_w = width.last else @first_w = @last_w = width.last end else # ËÒã·ªÈðûÖõªÎÓÞª­ªµªòÔÒª¸ªËª¹ªë @first_w = @last_w = width end # heightª¬Ûô?ãÒªÎíÞùê if height.is_a?(Range) # ß¾ù»ª¤ªºªìª«ªË?ÓÞʦÒöªÊíÞùê if @expensible[0] or @expensible[2] # Ûô?ãÒªòÝÂùÜ @first_h = height.first @last_h = height.last else # ËÒã·ªÈðûÖõªÎÓÞª­ªµªòÔÒª¸ªËª¹ªë @first_h = @last_h = height.last end else # ËÒã·ªÈðûÖõªÎÓÞª­ªµªòÔÒª¸ªËª¹ªë @first_h = @last_h = height end # «Õ«ì?«à?ª¿ªêªÎ?ÓÞÕáªòß©õó @expantion_w = (@last_w - @first_w) * 1.0 / @duration @expantion_h = (@last_h - @first_h) * 1.0 / @duration # ñ§Û°ú¾ªË?ÓÞª¹ªëíÞùê if @expensible[3] # éÓÛ°ú¾ªË?ÓÞª¹ªëíÞùê if @expensible[1] # ?ÓÞËÒã·êÈöǪÎß©õó @first_x = @x + (@expantion_w * @duration) / 2 else # ?ÓÞËÒã·êÈöǪÎß©õó @first_x = @x + @expantion_w * @duration end else # ?ÓÞËÒã·êÈöǪÎß©õó @first_x = @x end # ß¾Û°ú¾ªË?ÓÞª¹ªëíÞùê if @expensible[0] # ù»Û°ú¾ªË?ÓÞª¹ªëíÞùê if @expensible[2] # ?ÓÞËÒã·êÈöǪÎß©õó @first_y = @y + (@expantion_h * @duration) / 2 else # ?ÓÞËÒã·êÈöǪÎß©õó @first_y = @y + @expantion_h * @duration end else # ?ÓÞËÒã·êÈöǪÎß©õó @first_y = @y end # ËÒã·êÈöǪ˫¦«£«ó«É«¦ªòíÂà÷ super(@first_x, @first_y, @first_w, @first_h) # xyñ¨øöªÎì¹ÔÑÕáªòß©õó set_moving_xy # ?ÓÞ?×âªòú¼ª¦ expand end #-------------------------------------------------------------------------- # ¡Ü ?ÓÞÛ°ú¾ü¬ìã (Û°ú¾«Ù«¯«È«ëÝÂú°) #-------------------------------------------------------------------------- def chk_direction(direction) # ß¾, éÓ, ù», ñ§ vector = [false, false, false, false] case direction when 1 vector[2] = vector[3] = true when 2 vector[2] = true when 3 vector[1] = vector[2] = true when 4 vector[3] = true when 6 vector[1] = true when 7 vector[0] = vector[3] = true when 8 vector[0] = true when 9 vector[0] = vector[2] = true end for i in 0..3 @expensible[i] |= vector[i] end end #-------------------------------------------------------------------------- # ¡Ü xyñ¨øöªÎì¹ÔÑÕáªòß©õó #-------------------------------------------------------------------------- def set_moving_xy # ñ§Û°ú¾ªË?ÓÞª¹ªëíÞùê if @expensible[3] # éÓÛ°ú¾ªË?ÓÞª¹ªëíÞùê if @expensible[1] # xñ¨øöì¹ÔÑÕáªÎß©õó @moving_x = -(@expantion_w / 2) else # xñ¨øöì¹ÔÑÕáªÎß©õó @moving_x = -(@expantion_w) end else # xñ¨øöì¹ÔÑÕáªÎß©õó @moving_x = 0 end # ß¾Û°ú¾ªË?ÓÞª¹ªëíÞùê if @expensible[0] # ù»Û°ú¾ªË?ÓÞª¹ªëíÞùê if @expensible[2] # yñ¨øöì¹ÔÑÕáªÎß©õó @moving_y = -(@expantion_h / 2) else # yñ¨øöì¹ÔÑÕáªÎß©õó @moving_y = -(@expantion_h) end else # yñ¨øöì¹ÔÑÕáªÎß©õó @moving_y = 0 end end #-------------------------------------------------------------------------- # ¡Ü «¦«£«ó«É«¦?ÓÞ #-------------------------------------------------------------------------- def expand self.x = @first_x self.y = @first_y self.width = @first_w self.width = @first_h d = @duration while d > 1 d -= 1 self.x += @moving_x self.y += @moving_y self.width += @expantion_w self.height += @expantion_h Graphics.update end self.x = @x self.y = @y self.width = @last_w self.height = @last_h end #-------------------------------------------------------------------------- # ¡Ü «¦«£«ó«É«¦õêá³ #-------------------------------------------------------------------------- def reduce d = @duration while d > 1 d -= 1 self.x -= @moving_x self.y -= @moving_y self.width -= @expantion_w self.height -= @expantion_h Graphics.update end end #-------------------------------------------------------------------------- # ¡Ü ú°Û¯ #-------------------------------------------------------------------------- def dispose reduce super end end