Originally Posted by merlight
Well, they have different row control template, default sort header, vastly different BuildMasterList, I think they deserve being separate classes. You can move a few things to a common base, like FilterScrollList and SortScrollList which are identical, and derive your special classes from that base.
Lua Code:
local StuffListBase = ZO_SortFilterList:Subclass() local CustomerList = StuffListBase:Subclass() local XTradeItemsList = StuffListBase:Subclass() ...
My/TheirTradeItemsList look like they could be merged. Just pass the things that differ as additional arguments to initialize, and store them in the instance.
Lua Code:
function XTradeItemsList:Initialize(control, itemsKey) StuffListBase.Initialize(self, control) self.itemsKey = itemsKey ... end function XTradeItemsList:BuildMasterList() ... for key, itemObject in pairs(selectedTrade[self.itemsKey]) do ... end end TRADESMAN.MyTradeItemsList = XTradeItemsList:New(MyTradeItemsContainer, "MyItems") TRADESMAN.TheirTradeItemsList = XTradeItemsList:New(TheirTradeItemsContainer, "TheirItems")
|
Cool, thank you! Let me look this over and get my head around it... I really appreciate this!