EffectSelected.lua
1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
local EffectSelected = class("EffectSelected",function (rect,type)
local selected_box;
if type == EnumNodeType.POKER or type == EnumNodeType.DDZ_POKER then
selected_box = ccui.Scale9Sprite:create("res/common/selected_box_common.png");
-- selected_box:setCapInsets(cc.rect(30,30,48,17));
-- selected_box:setContentSize(cc.size(rect.width+30,rect.height+30));
elseif type == EnumNodeType.MAIL then
selected_box = ccui.Scale9Sprite:create("res/common/selected_box_mail.png");
-- selected_box:setCapInsets(cc.rect(25,25,1122,52));
-- selected_box:setContentSize(cc.size(rect.width+20,rect.height+20));
else
selected_box = ccui.Scale9Sprite:create("res/common/selected_box_common.png");
-- selected_box:setCapInsets(cc.rect(30,30,48,17));
-- selected_box:setContentSize(cc.size(rect.width+35,rect.height+35));
end
return selected_box;
end)
function EffectSelected:ctor(rect,type)
self:init(rect,type);
self:resize(rect,type);
end
function EffectSelected:init(rect,type)
local fadeIn = cc.FadeIn:create(0.7);
local fadeOut = cc.FadeOut:create(0.7);
local repeatAction = cc.RepeatForever:create(cc.Sequence:create(fadeIn,fadeOut));
self:runAction(repeatAction);
end
function EffectSelected:resize(rect,type)
if type == EnumNodeType.POKER or type == EnumNodeType.DDZ_POKER then
self:setCapInsets(cc.rect(30,30,48,17));
self:setContentSize(cc.size(rect.width+30,rect.height+30));
elseif type == EnumNodeType.MAIL then
self:setCapInsets(cc.rect(25,25,1122,52));
self:setContentSize(cc.size(rect.width+20,rect.height+20));
else
self:setCapInsets(cc.rect(58,58,6,6));
self:setContentSize(cc.size(rect.width+48,rect.height+48));
end
end
return EffectSelected