feat: reformat error messages, update atween
This commit is contained in:
parent
3318270c3d
commit
458477d7c8
6 changed files with 143 additions and 113 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "Plugin",
|
||||
"name": "Quad",
|
||||
"tree": {
|
||||
"$properties": {
|
||||
"Name": "Quad"
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ function module.init(shared)
|
|||
local isImage = (ClassName == "ImageLabel" or ClassName == "ImageButton");
|
||||
if (index == "RoundSize" or index == "roundSize") and isImage then
|
||||
if not round then
|
||||
error("module 'round' needs to be loaded for set image round size but it is not found on 'src.libs'. you should adding that to src.libs directory");
|
||||
error("[QUAD] module 'round' needs to be loaded for set image round size but it is not found on 'src.libs'. you should adding that to src.libs directory");
|
||||
end
|
||||
round.setRound(item,value);
|
||||
elseif index == "UiRoundSize" or index == "uiRoundSize" or index == "UIRoundSize" then
|
||||
|
|
@ -135,7 +135,7 @@ function module.init(shared)
|
|||
end
|
||||
if not item then -- if cannot make new object, ignore this call
|
||||
local str = tostring(ClassName);
|
||||
print(("fail to make item '%s', did you forget to checking the class '%s' is exist?"):format(str,str));
|
||||
warn(("[Quad] fail to make item '%s', did you forget to checking the class '%s' is exist?"):format(str,str));
|
||||
end
|
||||
|
||||
-- set property and adding child and binding functions
|
||||
|
|
@ -190,7 +190,7 @@ function module.init(shared)
|
|||
end
|
||||
if tween then
|
||||
if not advancedTween then
|
||||
return warn "module 'AdvancedTween' needs to be loaded for tween properties but it is not found on 'src.libs'. you should adding that to src.libs directory";
|
||||
return warn "[QUAD] module 'AdvancedTween' needs to be loaded for tween properties but it is not found on 'src.libs'. you should adding that to src.libs directory";
|
||||
end
|
||||
local ended, onStepped;
|
||||
if tween.Ended then
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ module.LerpProperties = LerpProperties
|
|||
--Data.Properties.Position = UDim2.new(1,0,1,0) 처럼 하면 Position 속성의 목표를 1,0,1,0 으로 지정
|
||||
function module.RunTween(Item,Data,Properties,Ended,OnStepped,Setter,Getter,_)
|
||||
-- remove self
|
||||
if Item == module then Item = Data; Data = Properties; Properties = Ended; Ended = OnStepped; OnStepped = Setter; Setter = Getter; Getter = _; end
|
||||
if Item == module then warn "AdvancedTween:RunTween() is deprecated, You can use AdvancedTween.RunTween() instead"; Item = Data; Data = Properties; Properties = Ended; Ended = OnStepped; OnStepped = Setter; Setter = Getter; Getter = _; end
|
||||
|
||||
-- 시간 저장
|
||||
local Time = Data.Time or 1
|
||||
|
|
@ -291,26 +291,50 @@ function module.RunTween(Item,Data,Properties,Ended,OnStepped,Setter,Getter,_)
|
|||
-- 스캐줄에 등록
|
||||
insert(BindedFunctions,Step)
|
||||
FunctionTargetItem[Step] = Item
|
||||
|
||||
return Step
|
||||
end
|
||||
|
||||
-- 여러개의 개체를 트윈시킴
|
||||
function module.RunTweens(Items,Data,Properties,Ended,OnStepped,Setter,Getter,_)
|
||||
-- remove self
|
||||
if Items == module then Items = Data; Data = Properties; Properties = Ended; Ended = OnStepped; OnStepped = Setter; Setter = Getter; Getter = _; end
|
||||
if Items == module then warn "AdvancedTween:RunTweens() is deprecated, You can use AdvancedTween.RunTweens() instead"; Items = Data; Data = Properties; Properties = Ended; Ended = OnStepped; OnStepped = Setter; Setter = Getter; Getter = _; end
|
||||
for _,Item in pairs(Items) do
|
||||
module.RunTween(Item,Data,Properties,Ended,OnStepped,Setter,Getter)
|
||||
end
|
||||
end
|
||||
|
||||
-- 트윈 멈추기
|
||||
function module.StopTween(Item,_)
|
||||
if Item == module then Item = _ end
|
||||
module.PlayIndex[Item] = nil
|
||||
function module.StopTween(ItemOrStep,_)
|
||||
if ItemOrStep == module then warn "AdvancedTween:StopTween() is deprecated, You can use AdvancedTween.StopTween() instead"; ItemOrStep = _ end
|
||||
if type(ItemOrStep) == "function" then
|
||||
local pos = find(BindedFunctions,ItemOrStep)
|
||||
if not pos then
|
||||
warn(("tween %s was not found from AdvancedTween BindedFunctions. ignored call StopTween"):format(tostring(ItemOrStep)))
|
||||
return
|
||||
end
|
||||
remove(BindedFunctions,pos)
|
||||
return
|
||||
end
|
||||
module.PlayIndex[ItemOrStep] = nil
|
||||
end
|
||||
|
||||
function module.StopPropertyTween(Item,PropertyName,_)
|
||||
if Item == module then warn "AdvancedTween:StopTween() is deprecated, You can use AdvancedTween.StopTween() instead"; Item = _ end
|
||||
local ItemPlayIndex = module.PlayIndex[Item]
|
||||
if not ItemPlayIndex then return end
|
||||
if type(PropertyName) == "table" then
|
||||
for _,name in pairs(PropertyName) do
|
||||
ItemPlayIndex[name] = (ItemPlayIndex[name] or 0) + 1
|
||||
end
|
||||
else
|
||||
ItemPlayIndex[PropertyName] = (ItemPlayIndex[PropertyName] or 0) + 1
|
||||
end
|
||||
end
|
||||
|
||||
-- 해당 개체가 트윈중인지 반환
|
||||
function module.IsTweening(Item,_)
|
||||
if Item == module then Item = _ end
|
||||
if Item == module then warn "AdvancedTween:IsTweening() is deprecated, You can use AdvancedTween.IsTweening() instead"; Item = _ end
|
||||
|
||||
if module.PlayIndex[Item] == nil then
|
||||
return false
|
||||
|
|
@ -326,7 +350,7 @@ end
|
|||
|
||||
-- 해당 개체의 해당 프로퍼티가 트윈중인지 반환
|
||||
function module.IsPropertyTweening(Item,PropertyName,_)
|
||||
if Item == module then Item = _ end
|
||||
if Item == module then warn "AdvancedTween:IsPropertyTweening() is deprecated, You can use AdvancedTween.IsPropertyTweening() instead"; Item = _ end
|
||||
|
||||
if module.PlayIndex[Item] == nil then
|
||||
return false
|
||||
|
|
@ -359,4 +383,8 @@ script.Destroying:Connect(function()
|
|||
Stepped.UnbindAll()
|
||||
end)
|
||||
|
||||
function module.Destroy()
|
||||
Stepped.UnbindAll()
|
||||
end
|
||||
|
||||
return module
|
||||
|
|
|
|||
|
|
@ -107,7 +107,9 @@ function module.init(shared)
|
|||
tween = function (s,value)
|
||||
return setmetatable({tvalue = value},{__index = s});
|
||||
end;
|
||||
---@deprecated
|
||||
from = function (s,value)
|
||||
warn "[QUAD] register:from() is deprecated. You can use register:add(t:table|function) instead"
|
||||
return setmetatable({fvalue = value},{__index = s});
|
||||
end;
|
||||
add = function (s,value)
|
||||
|
|
|
|||
Loading…
Reference in a new issue