This commit is contained in:
세젤귀 고양이들 2021-12-24 20:54:44 +09:00
parent 584937b05d
commit ea9b17a2c4
2 changed files with 19 additions and 14 deletions

View file

@ -23,6 +23,19 @@ function module.init(shared)
local advancedTween = shared.advancedTween; ---@module src.libs.AdvancedTween local advancedTween = shared.advancedTween; ---@module src.libs.AdvancedTween
local round = shared.round; ---@module src.libs.round local round = shared.round; ---@module src.libs.round
local function setProperty(item,index,value,ClassName)
ClassName = ClassName or item.ClassName;
local isImage = (ClassName == "ImageLabel" or ClassName == "ImageButton");
if index == "roundSize" and isImage then
if not round then
warn "module 'round' needs to be loaded for set images round size but it is not found on 'src.libs'. you should adding that to src.libs directory"
end
round.setRound(item,value);
else
item[index] = value; -- set property
end
end
-- make object that from instance, class and more -- make object that from instance, class and more
function new.make(ClassName,...) -- render object function new.make(ClassName,...) -- render object
-- make thing -- make thing
@ -85,11 +98,11 @@ function module.init(shared)
if with then if with then
set = with(set); set = with(set);
end end
item[index] = set; setProperty(item,index,set,ClassName);
else else
local dset = value.dvalue; local dset = value.dvalue;
if dset then if dset then
item[index] = dset; setProperty(item,index,dset,ClassName);
end end
end end
local tween = value.tvalue; local tween = value.tvalue;
@ -109,7 +122,7 @@ function module.init(shared)
end end
advancedTween.RunTween(item,tween,{[index] = newValue}); advancedTween.RunTween(item,tween,{[index] = newValue});
else else
item[index] = newValue; setProperty(item,index,newValue,ClassName);
end end
end end
value:register(regFn); value:register(regFn);
@ -122,15 +135,7 @@ function module.init(shared)
-- event binding -- event binding
elseif indexType == "string" then elseif indexType == "string" then
-- prop set -- prop set
local isImage = (ClassName == "ImageLabel" or ClassName == "ImageButton"); setProperty(item,index,value,ClassName);
if index == "roundSize" and isImage then
if not round then
warn "module 'round' needs to be loaded for set images round size but it is not found on 'src.libs'. you should adding that to src.libs directory"
end
round.setRound(item,value);
else
item[index] = value; -- set property
end
elseif indexType == "number" then -- object elseif indexType == "number" then -- object
-- child object -- child object
mount(item,((iprop == 1) and value or value:Clone()),holder); mount(item,((iprop == 1) and value or value:Clone()),holder);

View file

@ -10,14 +10,14 @@ local roundScaleType = Enum.ScaleType.Slice;
local roundSliceCenter = Rect.new(Vector2.new(516,516),Vector2.new(516,516)); local roundSliceCenter = Rect.new(Vector2.new(516,516),Vector2.new(516,516));
local roundSliceScale = 0.0019166666666667; local roundSliceScale = 0.0019166666666667;
function round:setRound(ImageFrame,RoundSize) function round.setRound(ImageFrame,RoundSize)
ImageFrame.Image = roundImage; ImageFrame.Image = roundImage;
ImageFrame.ScaleType = roundScaleType; ImageFrame.ScaleType = roundScaleType;
ImageFrame.SliceCenter = roundSliceCenter; ImageFrame.SliceCenter = roundSliceCenter;
ImageFrame.SliceScale = roundSliceScale * RoundSize; ImageFrame.SliceScale = roundSliceScale * RoundSize;
return ImageFrame; return ImageFrame;
end end
function round:setOutline(ImageFrame,RoundSize) function round.setOutline(ImageFrame,RoundSize)
ImageFrame.Image = outlineImage ImageFrame.Image = outlineImage
ImageFrame.ScaleType = outlineScaleType; ImageFrame.ScaleType = outlineScaleType;
ImageFrame.SliceCenter = outlineSliceCenter; ImageFrame.SliceCenter = outlineSliceCenter;