标题: [插件] [插件]限时选项的时间槽
Miliardo
幕后黑手
Rank: 4


UID 1
精华 0
积分 379
帖子 339
阅读权限 255
注册 2006-12-3
 
发表于 2007-3-7 21:52  资料  短消息  加为好友 
[插件]限时选项的时间槽

从D大的代码改写的……
希望对大家有帮助……

;TimeBar Plugin
;Version 0.97-beta(2007-03)
;Author:CountD & Miliardo (KCDDP)
;Copyright 2005-2007 [Key Fans Club] the Council of Doujin-game Development and Promotion, All Right Reserved

@if exp="typeof(global.timebar_object) == 'undefined'"
@iscript

class TimeBarPlugin extends KAGPlugin
{

        var fore,bgfore;
        var timer;
        function TimeBarPlugin(seltime)
        {
                bgfore=new Layer(kag, kag.fore.base);
                fore=new Layer(kag, kag.fore.base);
                fore.absolute = 2000000-2;
                bgfore.absolute = 2000000-3;
                timer = new Timer(onTimer, "");
                timer.enabled = false;
                fore.visible = false;
                bgfore.visible = false;
        }

        function createTimeBar()
        {

                bgfore=new Layer(kag, kag.fore.base);
                fore=new Layer(kag, kag.fore.base);
                fore.absolute = 2000000-2;
                bgfore.absolute = 2000000-3;
                fore.visible = false;
                bgfore.visible = false;
        }

        function setOptions(elm)
        {
                createTimeBar();
                if(typeof(elm.bgimage)!='undefined')
                {       
                        bgfore.visible=true;
                        bgfore.loadImages(elm.bgimage);
                        bgfore.setSizeToImageSize();
                        bgfore.setPos(elm.bgx,elm.bgy);
                }
                fore.visible=true;
                fore.loadImages(elm.bar);
                fore.setSizeToImageSize();
                fore.setPos(elm.x,elm.y);
                timer.enabled = true;
                timer.interval = elm.time/(elm.width);
        }

        function finalize()
        {
                invalidate timer;
                invalidate fore;
        }

        function onTimer()
        {
                if (fore.imageWidth > 1) fore.imageWidth -= 1;
                if (fore.imageWidth == 1)
                {
                        timer.enabled = false;
                        fore.visible = false;
                        bgfore.visible = false;
                }
        }

        function delTimeBar()
        {
                timer.enabled = false;
                fore.visible = false;
                bgfore.visible = false;
        }

}


kag.addPlugin(global.timebar_object = new TimeBarPlugin(kag));

@endscript

@macro name="timebar"
@eval exp="timebar_object.setOptions(mp)"
@endmacro


@macro name="deltimebar"
@eval exp="timebar_object.delTimeBar(mp)"
@endmacro

@endif
@return

调用本插件的KAG Tag为timeout。
需要在调用@s之前使用。
参数如下:
bar:时间条的文件名
x、y:时间条显示的位置
time:定时时间
width:时间条的长度
bgimage、bgx、bgy:时间条背景的文件名、位置

调用例子如下:

@timebar bar=bar x=300 y=300 time=5000 width=120 bgimage=barbg bgx=295 bgy=295


顶部
全局变量D
亲友
Rank: 2



UID 14
精华 1
积分 1262
帖子 719
阅读权限 50
注册 2006-12-20
 
发表于 2007-3-7 23:00  资料  短消息  加为好友 
XD
说是改的...我已经不认识了...=v=





顶部
咔莎
会员
Rank: 1
囧—魔兽世界脱宅中—囧



UID 13
精华 0
积分 521
帖子 432
阅读权限 5
注册 2006-12-18
来自 ~Celestial Gem~
 
发表于 2007-3-8 08:59  资料  主页 短消息  加为好友 
总之都谢谢了~可以增加游戏的紧张气氛呀……





You still have lots more to work on.无限怨念积攒中…まだまだだね
顶部
饭团一只
会员
Rank: 1



UID 745
精华 0
积分 42
帖子 13
阅读权限 5
注册 2008-3-8
 
发表于 2008-3-13 12:21  资料  短消息  加为好友 
抱走~~~谢谢
不过还是不太会用,问几个问题可以么?

一。
这个时间槽时间在哪层的?
kag.fore.base。。这个,是建在背景层上的意思么?
那不是不能放其他背景了么?

二。
一直很想问,大家tjs相关的那些都是哪儿查到的?
比如kag.fore.base这个代表的意义之类,kag后面都能点些什么之类,哪里能查到?

[ 本帖最后由 饭团一只 于 2008-3-14 08:52 编辑 ]

顶部
 



清除 Cookies - 联系我们 - [Key Fans Club] the Council of Doujin-game Development and Promotion - Archiver - WAP
Powered by Discuz! 5.5.0 © 2001-2006 Comsenz Inc.
Processed in 0.020744 second(s), 7 queries , Gzip enabled
粤ICP备05060595号
[ 当前模板 - 天高云淡 v 设计制作 - 七星论坛 v 请使用1024*768或以上分辨率浏览本模板 ]
请勿删除或修改此处版权图示