设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 81|回复: 0

[转载] opening window animation?

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4446

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22899
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28239

    灌水之王

    发表于 7 天前 | 显示全部楼层 |阅读模式
    (sorry if this is the wrong board, wasn't sure if this should go here or learning rgss. or something.)

    howdy! i'm trying to setup a simple popup window- currently for tutorials, but the script will probably have other applications elsewhere- and i'm struggling to get the nice little window opening animation that's used for the messages and most other built-in game windows to appear on mine.

    i currently have this (ft. placeholder text for testing):
                    Ruby:        
    #------------------------------------------------------------------------------ # WINDOWPOP #------------------------------------------------------------------------------ # manages popup boxes in the upper left corner # # called with #             AO_Windowpop.new(#,:{text source}) #   with the # being the style id for the type of window, #   and the :{text_source} being the symbol key for the text. #------------------------------------------------------------------------------ class AO_Windowpop #------------------------------------------------------------------------------      def initialize(style,ref)     reset_all     source(ref)     draw_dummy_window     get_window_dimensions(style)     end # init     def reset_all   # resets all class and global variables     $winpop_dummy_width = 0     @src = nil     @ref = nil   end # reset_all     def source(ref)   # defines text source     loc = AO::SAMPLETEXT         @src = loc[ref]     @ref = ref   end # source       def draw_dummy_window   # makes an invisible window to determine how wide the real one has to be     width = Windowpop_dummy.new     width.get(@ref)   end     def get_window_dimensions(style)   #defines the style of the window (may break into multiple blocks l8r)     tally = 0     case style       when 1         # unlock window; 1 line, appears for 2 sec & vanishes         x = $winpop_dummy_width + 36         y = 48         input = false         center = true       when 2         # tutorial window; multiple lines, stays open until a button is pressed         @src.each {|k,v|         x = $winpop_dummy_width + 24         tally += 1         y = (24*tally)+(tally*8)         input = true         center = false}       end # case     call_window(x,y,input,center)   end # get_window_dimensions       def call_window(x,y,input,center)   # makes window         window = AO_Windowpop_Window.new(100,60,x,y)     window.direct(input,center,@ref)     end # call_window     #------------------------------------------------------------------------------ end #Windowpop #------------------------------------------------------------------------------ class AO_Windowpop_Window < Window_Base #------------------------------------------------------------------------------      def initialize(x,y,width,height)         super(x,y,width,height)         self.back_opacity = 255     reset_all     end # init     def reset_all   #resets all class variables     @src = nil   end # reset_all     def direct(input,center,ref)     # calls building processes w/ their requisite arguments     update_open     source_text(ref)         tp_draw_text(center)         input == true ? input_pause : hold_two_seconds     update_close         dispose     end # direct      def source_text(ref)   # sets the text source         loc = AO::SAMPLETEXT         @src = loc[ref]     end # source_text       def tp_draw_text(center)   # draws the text         @src.each {|k,v|             txt = v             center == true ? x = contents_width/2-text_size(txt).width/2 : x = 0             y = line_height*k             draw_text_ex(x,y,txt)}     end # tp_draw_text      def input_pause   # pauses until a button is pressed         self.pause = true         wait(10)         Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C)         Input.update         self.pause = false     end # input_update      def wait(duration)   # defines what a pause is         duration.times { Fiber.yield }     end # wait     def hold_two_seconds   # pauses for 2 seconds     wait(120)   end  #------------------------------------------------------------------------------ end #Windowpop_window #------------------------------------------------------------------------------ class Windowpop_dummy < Window_Base #------------------------------------------------------------------------------      def initialize         super(0,0,0,0)         hide     end # init      def get(ref)   # compares the size of each line & sets the variable to the largest one         src = AO::SAMPLETEXT[ref]         max = 0         src.each{|k,v|         current = text_size(v).width         max = current if current > max}         $winpop_dummy_width = max     end # get   #------------------------------------------------------------------------------ end # Windowpop_dummy #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ module AO #------------------------------------------------------------------------------   SAMPLETEXT = {   :unlock => {0 => "Unlocked Something!"},   :tutorial => {0=> "SOMETHING:",1 => "- How to do it",2 => "- When to do it"},   } # sampletext #------------------------------------------------------------------------------ end # AO #------------------------------------------------------------------------------


    (definitely not as neat as it could be, but it works fine for what i'm using it for)

    and the windows just kind of pop in and out of existence. i was under the impression update_open and update_close were what performed that, which is why i specifically called them while building the window, but either i completely misunderstood, or i just did it wrong.

    any assistance would be greatly appreciated!


    本贴来自国际rpgmaker官方论坛作者:voidsumbrella处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/opening-window-animation.181218/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 14:26 , Processed in 0.064352 second(s), 51 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表