public Movie(TagDefineMovie define) { _define = define; _curFrame = null; _isBoundsDirty = true; _tweenMode = kTweenMode.SkipNoLabelFrames; _depthDisplays = new Display[define.maxDepth]; _movieCtrl = new MovieCtrl(this); _caches = new utList <Display>(); if (string.IsNullOrEmpty(define.className)) { this.nameInHierarchy = define.characterId.ToString(); } else { this.nameInHierarchy = define.className; } this.cascadeColorEnabled = true; this.cascadeOpacityEnabled = true; }
//----------init------------ public CCScheduler(){ _timeScale = 1.0f; // used to trigger CCTimer#update updateSelector = "update"; // impMethod = (TICK_IMP) [CCTimerTargetSelector instanceMethodForSelector:updateSelector]; // updates with priority updates0 = new utList<tListEntry>(); updatesNeg = new utList<tListEntry>(); updatesPos = new utList<tListEntry>(); hashForUpdates = new UTHash<int, tHashUpdateEntry>(); // selectors with interval currentTarget = null; currentTargetSalvaged = false; hashForTimers = new UTHash<int, tHashTimerEntry>(); updateHashLocked = false; _paused = false; }
void appendIn(utList<tListEntry> list, System.Object target, bool paused){ tListEntry listEntry = new tListEntry (); listEntry.target = target; listEntry.paused = paused; listEntry.markedForDeletion = false; MethodInfo method = target.GetType ().GetMethod (updateSelector); listEntry.impMethod = (TICK_IMP) Delegate.CreateDelegate(typeof(TICK_IMP), target, method); utNode<tListEntry> listElement = new utNode<tListEntry> (); listElement.next = listElement.prev = null; listElement.obj = listEntry; list.DL_APPEND(listElement); tHashUpdateEntry hashElement = new tHashUpdateEntry (); hashElement.target = target; hashElement.list = list; hashElement.entry = listElement; hashForUpdates.HASH_ADD_INT (target.GetHashCode(), hashElement); }
void priorityIn(utList<tListEntry> list, System.Object target, int priority, bool paused){ tListEntry listEntry = new tListEntry (); listEntry.target = target; listEntry.priority = priority; listEntry.paused = paused; MethodInfo method = target.GetType ().GetMethod (updateSelector); listEntry.impMethod = (TICK_IMP) Delegate.CreateDelegate(typeof(TICK_IMP), target, method); listEntry.markedForDeletion = false; utNode<tListEntry> listElement = new utNode<tListEntry> (); listElement.next = listElement.prev = null; listElement.obj = listEntry; if (list.head == null) { list.DL_APPEND(listElement); } else { bool added = false; for( utNode<tListEntry> elem = list.head; elem != null ; elem = elem.next ) { if(priority < elem.obj.priority){ if( elem == list.head ) list.DL_PREPEND(listElement); else { listElement.next = elem; listElement.prev = elem.prev; elem.prev.next = listElement; elem.prev = listElement; } added = true; break; } } if(!added) list.DL_APPEND(listElement); } tHashUpdateEntry hashElement = new tHashUpdateEntry (); hashElement.target = target; hashElement.list = list; hashElement.entry = listElement; hashForUpdates.HASH_ADD_INT (target.GetHashCode(), hashElement); }
void applyPreKeyTags(int fromFrameIndex, int depth) { utList <FrameObject> preTags = new utList <FrameObject>(); bool removed = false, hasCharacter = false; int i = fromFrameIndex; for (; i >= 0; i--) { Frame frame = _define.frames [i]; for (int k = 0; k < frame.objs.Length; k++) { FrameObject frameObj = frame.objs [k]; ITag iTag = getTag(frameObj); if (iTag is TagRemoveObject) { TagRemoveObject tagRemoveObj = iTag as TagRemoveObject; if (tagRemoveObj.depth == depth) { preTags.DL_APPEND(frameObj); removed = true; break; } } else if (iTag is TagPlaceObject) { TagPlaceObject tagPlaceObj = iTag as TagPlaceObject; if (tagPlaceObj.depth == depth) { preTags.DL_APPEND(frameObj); hasCharacter |= tagPlaceObj.hasCharacter; if (hasCharacter) { break; } } } } if (removed || (hasCharacter)) { break; } } if (preTags.head != null) { for (var ent = preTags.head.prev; ent != preTags.head; ent = ent.prev) { FrameObject frameObj = ent.obj; IDisplayListTag iTag = getTag(frameObj) as IDisplayListTag; iTag.apply(this, frameObj); } { FrameObject frameObj = preTags.head.obj; IDisplayListTag iTag = getTag(frameObj) as IDisplayListTag; iTag.apply(this, frameObj); } } else { Display display = _depthDisplays [depth - 1]; if (display != null) { //cache display.removed = true; display.visible = false; } } }