Exemplo n.º 1
0
        public void RunAnimations(int nSeqId, float fTweenDuration)
        {
            Debug.Assert(nSeqId != -1, "Sequence id couldn't be found");

            mRootNode.StopAllActions();

            foreach (var pElement in mNodeSequences)
            {
                CCNode node = pElement.Key;
                node.StopAllActions();

                // Refer to CCBReader::readKeyframe() for the real type of value
                Dictionary <int, Dictionary <string, CCBSequenceProperty> > seqs = pElement.Value;

                var seqNodePropNames = new List <string>();

                Dictionary <string, CCBSequenceProperty> seqNodeProps;
                if (seqs.TryGetValue(nSeqId, out seqNodeProps))
                {
                    // Reset nodes that have sequence node properties, and run actions on them
                    foreach (var pElement1 in seqNodeProps)
                    {
                        string propName             = pElement1.Key;
                        CCBSequenceProperty seqProp = pElement1.Value;
                        seqNodePropNames.Add(propName);

                        SetFirstFrame(node, seqProp, fTweenDuration);
                        RunAction(node, seqProp, fTweenDuration);
                    }
                }

                // Reset the nodes that may have been changed by other timelines
                Dictionary <string, object> nodeBaseValues;
                if (mBaseValues.TryGetValue(node, out nodeBaseValues))
                {
                    foreach (var pElement2 in nodeBaseValues)
                    {
                        if (!seqNodePropNames.Contains(pElement2.Key))
                        {
                            object value = pElement2.Value;

                            if (value != null)
                            {
                                SetAnimatedProperty(pElement2.Key, node, value, fTweenDuration);
                            }
                        }
                    }
                }
            }

            // Make callback at end of sequence
            CCBSequence seq            = GetSequence(nSeqId);
            CCAction    completeAction = new CCSequence(
                new CCDelayTime(seq.Duration + fTweenDuration),
                new CCCallFunc(SequenceCompleted)
                );

            mRootNode.RunAction(completeAction);

            // Set the running scene
            mRunningSequence = GetSequence(nSeqId);
        }
Exemplo n.º 2
0
 public void bugMe(CCNode node)
 {
     node.StopAllActions(); //After this stop next action not working, if remove this stop everything is working
     node.RunAction(new CCScaleTo(2, 2));
 }