commit
4824bab145
4 changed files with 69 additions and 19 deletions
|
|
@ -5,3 +5,9 @@ types 모듈이 삭제되며 init.lua 에 통합됨
|
||||||
이제 extend 에 대해서 Init(self) self 안에 props 기능이 내장되어있음
|
이제 extend 에 대해서 Init(self) self 안에 props 기능이 내장되어있음
|
||||||
|
|
||||||
TODO: slot 기능 구현
|
TODO: slot 기능 구현
|
||||||
|
|
||||||
|
TODO: spring 구현
|
||||||
|
|
||||||
|
TODO: !ChildRemoved 구현
|
||||||
|
|
||||||
|
TODO: AdvancedTween 을 submodule 로 변경
|
||||||
|
|
|
||||||
22
mock/Slot.txt
Normal file
22
mock/Slot.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
Window {
|
||||||
|
Class.Slot "Content" {
|
||||||
|
Text {
|
||||||
|
Text = "wow";
|
||||||
|
};
|
||||||
|
Text {
|
||||||
|
Text = "wow";
|
||||||
|
};
|
||||||
|
Text {
|
||||||
|
Text = "wow";
|
||||||
|
};
|
||||||
|
Text {
|
||||||
|
Text = "wow";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
TopbarButton {
|
||||||
|
[Class.Slot] = "Topbar";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
다수가 있을경우
|
||||||
|
이런식으로 묶을 수 있다고 하자
|
||||||
|
|
@ -110,8 +110,13 @@ function module.init(shared)
|
||||||
new.SetProperty = SetProperty
|
new.SetProperty = SetProperty
|
||||||
|
|
||||||
local function Link(linker,item,index,indexType)
|
local function Link(linker,item,index,indexType)
|
||||||
local target = linker.target
|
-- error("Not implemented")
|
||||||
local name = linker.name
|
|
||||||
|
local target = linker.lvalue
|
||||||
|
local name = linker.key
|
||||||
|
|
||||||
|
-- local target = linker.target
|
||||||
|
-- local name = linker.name
|
||||||
if indexType == "number" then
|
if indexType == "number" then
|
||||||
-- set
|
-- set
|
||||||
-- if rawget(target,name) ~= nil then
|
-- if rawget(target,name) ~= nil then
|
||||||
|
|
@ -140,7 +145,7 @@ function module.init(shared)
|
||||||
local indexType = typeof(index)
|
local indexType = typeof(index)
|
||||||
local quadType = valueType == "table" and PcallGetProperty(value,"__type")
|
local quadType = valueType == "table" and PcallGetProperty(value,"__type")
|
||||||
|
|
||||||
if quadType == "quad_linker" then
|
if indexType == "number" and quadType == "quad_register" then
|
||||||
-- linking
|
-- linking
|
||||||
Link(value,item,index,indexType)
|
Link(value,item,index,indexType)
|
||||||
elseif indexType == "string" and quadType == "quad_register" then
|
elseif indexType == "string" and quadType == "quad_register" then
|
||||||
|
|
@ -162,7 +167,8 @@ function module.init(shared)
|
||||||
local setValue,tween = value:CalcWithNewValue(item,newValue,key)
|
local setValue,tween = value:CalcWithNewValue(item,newValue,key)
|
||||||
if tween then
|
if tween then
|
||||||
if not advancedTween then
|
if not advancedTween then
|
||||||
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"
|
warn "[QUAD] Failed to execute register handler function. (Real Instance was not updated)"
|
||||||
|
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.\nPossible reason : Cloned repository without recursive option. => 'git submodule init ; git submodule update' to get submodules"
|
||||||
end
|
end
|
||||||
-- local ended, onStepped
|
-- local ended, onStepped
|
||||||
-- if tween.Ended then
|
-- if tween.Ended then
|
||||||
|
|
@ -349,13 +355,13 @@ function module.init(shared)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local function Linker(target,name)
|
-- local function Linker(target,name)
|
||||||
return {
|
-- return {
|
||||||
__type = "quad_linker";
|
-- __type = "quad_linker";
|
||||||
target = target;
|
-- target = target;
|
||||||
name = name;
|
-- name = name;
|
||||||
}
|
-- }
|
||||||
end
|
-- end
|
||||||
|
|
||||||
-- make class
|
-- make class
|
||||||
function new.Extend()
|
function new.Extend()
|
||||||
|
|
@ -400,8 +406,12 @@ function module.init(shared)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:Default(...)
|
-- default function from props
|
||||||
return this.__prop:Default(...)
|
function this:Default(key,value)
|
||||||
|
if self == this then
|
||||||
|
error("prop handler not found (this method cannot be used on class)")
|
||||||
|
end
|
||||||
|
self.__prop:Default(key,value)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:GetPropertyChangedSignal(propertyName)
|
function this:GetPropertyChangedSignal(propertyName)
|
||||||
|
|
@ -436,11 +446,18 @@ function module.init(shared)
|
||||||
thisSignal:Fire(value)
|
thisSignal:Fire(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:GetChildren()
|
function this:GetChildren(slotName)
|
||||||
local children = rawget(self,"__child")
|
if slotName then
|
||||||
if not children then
|
local slot = rawget(slotName,"__slot")
|
||||||
return {}
|
if not slot then return {} end
|
||||||
|
local newSlot = {}
|
||||||
|
for _,v in pairs(slot) do
|
||||||
|
insert(newSlot,v)
|
||||||
|
end
|
||||||
|
return slot
|
||||||
end
|
end
|
||||||
|
local children = rawget(self,"__child")
|
||||||
|
if not children then return {} end
|
||||||
local newChildren = {}
|
local newChildren = {}
|
||||||
for _,v in pairs(children) do
|
for _,v in pairs(children) do
|
||||||
insert(newChildren,v)
|
insert(newChildren,v)
|
||||||
|
|
@ -504,7 +521,6 @@ function module.init(shared)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- link to new
|
--- link to new
|
||||||
|
|
@ -517,7 +533,10 @@ function module.init(shared)
|
||||||
if type(name) ~= "string" then
|
if type(name) ~= "string" then
|
||||||
error(("Name must be string, but got %s"):format(type(name)))
|
error(("Name must be string, but got %s"):format(type(name)))
|
||||||
end
|
end
|
||||||
return Linker(self,name)
|
-- return Linker(self,name)
|
||||||
|
local register = self.__props(name)
|
||||||
|
register:Link(self)
|
||||||
|
return register
|
||||||
end
|
end
|
||||||
|
|
||||||
-- indexer (getter)
|
-- indexer (getter)
|
||||||
|
|
|
||||||
|
|
@ -283,6 +283,9 @@ function module.init(shared)
|
||||||
-- return s
|
-- return s
|
||||||
return setmetatable({avalue = avalue},{__index = s})
|
return setmetatable({avalue = avalue},{__index = s})
|
||||||
end;
|
end;
|
||||||
|
Link = function(s,lvalue)
|
||||||
|
return setmetatable({avalue = lvalue},{__index = s})
|
||||||
|
end;
|
||||||
-- return init data
|
-- return init data
|
||||||
CalcWithDefault = function (s,withItem)
|
CalcWithDefault = function (s,withItem)
|
||||||
local with = s.wfunc
|
local with = s.wfunc
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue