GA好望角|魔力宝贝私服|魔力私服|魔力私服|GA反外挂

 找回密码
 立即注册
凤凰(QQ:715837)
售前咨询
GA白皮书(客户端)
GA白皮书(服务端)
cgdev.me开发者论坛
放映地(炫斗魔力公益PK服)
新服发布站
欢迎来到GA好望角~
价格公示表
回首页
查看: 2272|回复: 0

教程2 官方内置控件测试

[复制链接]

131

主题

137

帖子

137

积分

管理员

Rank: 9Rank: 9Rank: 9

金钱
2118
号角币
466
发表于 2021-11-21 10:36:18 | 显示全部楼层 |阅读模式
      

--本代码支持二建端直接执行看效果
--以下代码可以实时在浏览器中编辑修改 并执行查看效果

TESTLoader = new.www('http://bbs.ml30.com/gacenter/Iselect/')
-- 创建一个窗口
cc.view = 
{   
    title = 'Itest1';--窗口名
    xpos = 120; ypos = 200; --初始坐标
    sizex = 504; sizey = 327; pxpos = 504; pypos = 50;--窗口大小/可拖动区域坐标X(0~504) Y(0~50)

    on_init  = function(view)    --当窗口初始化

    end;
    on_load  = function(view)    --当窗口开始创建

    end;
};

-- 放一个bmp的背景板
cc.bmpbutton = 
{
        args = { TESTLoader.Uget('bg2.bmp') };         --控件的图档
        title = 'bg';                --控件名
        xpos = 0; ypos = 0;          --注意:这里的坐标是相对坐标 以view的坐标为基准 即屏幕坐标=view坐标+本控件坐标
        on_load = function(object)           

        end; 
        on_event = function(object)
            object.id = TESTLoader.Uwait('bg2.bmp')
        end;
};

-- 放一个关闭按钮 这是一个封装好的按钮 
cc.closebutton =
{
        title = 'Iclose';
        xpos = 461; ypos = 9;
        event = function ( object )  --当玩家点击关闭按钮时会触发event事件 返回1允许关闭 返回0不允许
                Audio.Bell(54,320)
                return 1;
        end
};

for i=1,3 do
cc.textbox =
{
	title = 'textbox1'..i;
	xpos = 50;
	ypos = 50+i*20;
	color = 6+i;
	fontsize = 1;
	text = "哈哈哈 "..i;
	
}
end

cc.anime =
{
	title = 'anime1';
	xpos = 120;
	ypos = 50;
	animeID = 100086;
	dir = 4;
	action = 0;

	
}

cc.listbox =
{
	title = 'listbox1';
	args = {10};
	xpos = 100;
	ypos = 50;
	data =  {
	"昆虫系",
	"昆虫系",
	" ",
	" ",
	" ",
	" ",
	" ",
	" ",
	" ",
	"植物系"
	};
	

	
}

cc.comlistbox =
{
	title = 'comlistbox1';
	args = {10};
	xpos = 320;
	ypos = 50;
	data =  {
	"昆虫系",
	"昆虫系",
	" ",
	" ",
	" ",
	" ",
	" ",
	" ",
	" ",
	"植物系"
	};
	

	
}


cc.inputbox =
{
	title = 'inputbox1';
	xpos = 180;
	ypos = -10;
	sizex = 120;
	sizey = 20;
	event = function(object,event)
       this.spComBox(object.mainview.xpos + object.xpos,object.mainview.ypos + object.ypos,object.mainview.xpos + object.xpos + object.sizex,object.mainview.ypos + object.ypos + object.sizey,10,0)
       if event == Cevent.click then

       end
       if object.isfirstfocus() then
           object.settext(object.text)
       end
       if object.isfocus() then
           object.settext(object.text)
       end
       if not object.isfocus() then
          this.spText(object.mainview.xpos + object.xpos,object.mainview.ypos + object.ypos,object.fontsize,object.text)
       end 
	end

	
}


<?
function gacenter.finish(player)
        NLG.SystemMessage(player,"[提示] 测试脚本执行完成.")       

        Client.RunABundle(player,'__WEBFILE__')      
        Client.Show(player,'Itest1')
        
end
?>








回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|GA好望角

GMT+8, 2024-4-25 16:50 , Processed in 0.052628 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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