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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
end
-- detect any instances of ZO_MUST_IMPLEMENT that are not implemented.
local NO_STACK_TRACE = 0
end
end
if currentClass . __parentClasses then
end
end
end
end
if SHOULD_VERIFY_CLASSES then
local g_concreteClassSet = { }
end
g_concreteClassSet [ concreteClass ] = nil
end
g_concreteClassSet [ concreteClass ] = nil
end
end
end )
else
-- do nothing instead of tracking and automatically verifying classes
end
end
end
end
ZO_Object = { }
return newObject
end
---
-- Call ZO_Object:Subclass() to create a new class that inherits from this one.
--
newClass . __isAbstractClass = false
local PARENT_STACK = 2
end
return newClass
end
---
-- Call ZO_Object:MultiSubclass() to create a new class that
-- inherits from multiple parent classes. In situations where the same method is
-- defined on multiple classes, the leftmost class in the argument list takes
-- priority. It is recommended that you override to avoid this!
--
end
end
end
} )
newClass . __parentClasses = parentClasses
newClass . __isAbstractClass = false
if parentClass . __isAbstractClass then
local PARENT_STACK = 2
break
end
end
return newClass
end
--- Use MUST_IMPLEMENT to create a field that must be implemented by
-- subclasses. If a concrete class does not implement a field that contains a
-- MUST_IMPLEMENT, it will cause an error after the entire addon has been loaded.
-- Example A: ZO_MyAbstractClass.MyAbstractFunction = ZO_MyAbstractClass:MUST_IMPLEMENT()
-- Example B: ZO_MyAbstractClass:MUST_IMPLEMENT("MyAbstractFunction")
if fieldName then
end
end
--- Use IGNORE_UNIMPLEMENTED_FUNCTIONS to mark a class as abstract. Typically used to denote an abstract derived class that
-- does not have any of its own MUST_IMPLEMENT fields, but inherits from another abstract class that does.
-- Example: ZO_MyAbstractDerivedClass:IGNORE_UNIMPLEMENTED()
end
--- Use STUB to create a field that doesn't have to be implemented by subclasses, but will error if called.
-- Example A: ZO_MyParentClass.MyStubbedFunction = ZO_MyAbstractClass:STUB()
-- Example B: ZO_MyParentClass:STUB("MyStubbedFunction")
end
if fieldName then
end
end
if currentClass == checkClass then
return true
end
if currentClass . __parentClasses then
return true
end
end
end
return false
end
end
--[[
Here is a simple multiple inheritence example:
local A = ZO_Object:Subclass()
function A:InitializeA()
self.name = "A"
end
local B = ZO_Object:Subclass()
function B:InitializeB()
self.text = "B"
end
C = ZO_Object.MultiSubclass(A, B)
function C:New()
local obj = ZO_Object.New(self)
obj:Initialize()
return obj
end
function C:Initialize()
self:InitializeA()
self:InitializeB()
end
]] --
return function ( tbl , key )
if dataSource then
end
end
end
end
ZO_DataSourceObject = { }
return newObject
end
end
end
newTemplate . instanceMetaTable = { __index = ZO_GenerateDataSourceMetaTableIndexFunction ( newTemplate ) }
newTemplate . __isAbstractClass = false
return newTemplate
end
---
-- ZO_InitializingObject is a new Object definition that more directly encodes
-- the practices most current ZO_Objects are actually using. in most cases, you
-- can directly replace a ZO_Object with a ZO_InitializingObject, and delete the
-- redundant :New() definition that most ZO_Object classes create.
--
ZO_InitializingObject = { }
---
-- This is the external constructor for each object. should be called like so:
-- myObject = MyClass:New([arguments])
--
return newObject
end
---
-- Override this initialization function to define how your object should be constructed. example:
-- function MyClass:Initialize(argument1, argument2)
-- self.myField = argument1
-- end
-- You can still create an InitializingObject that doesn't have an Initialize
-- definition, it will just call this empty method instead.
-- To be overridden
end
--
-- ZO_DeferredInitializingObject is a ZO_InitializingObject wrapper that standardizes the logic around deferring some of the initialization until later.
-- Use of this abstract class requires passing in a fragment and implementing OnDeferredInitialize
-- OnDeferredInitialize will be called when the fragment is showing before calling self:OnShowing()
ZO_DeferredInitializingObject = { }
---
-- Override this initialization function to define how your object should be constructed.
-- You must create a fragment, scene, or scene group and call this base Initialize function, passing the fragment, scene, or scene group. example:
-- function MyClass:Initialize(control, argument1, argument2)
-- ZO_DeferredInitializingObject.Initialize(self, ZO_FadeSceneFragment:New(control))
-- self.myField = argument1
-- end
end
end
end
end
if newState == ZO_STATE . SHOWING then
elseif newState == ZO_STATE . SHOWN then
elseif newState == ZO_STATE . HIDING then
elseif newState == ZO_STATE . HIDDEN then
end
end
-- To be overridden
end
-- To be overridden
end
-- To be overridden
end
-- To be overridden
end
end
end
end
end
|