Esempio n. 1
0
        public void disableMenuCallback(object pSender)
        {
            m_pMenu1.Enabled = false;
            CCDelayTime wait = new CCDelayTime (5);
            CCCallFunc enable = new CCCallFunc(enableMenuCallback);

            CCFiniteTimeAction seq = new CCSequence(wait, enable);
            m_pMenu1.RunAction(seq);
        }
        public void disableMenuCallback(object pSender)
        {
            menu1.Enabled = false;
            var wait = new CCDelayTime (5);
            var enable = new CCCallFunc(enableMenuCallback);

            var seq = new CCSequence(wait, enable);
            menu1.RunAction(seq);
        }
Esempio n. 3
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCMoveBy pMove = new CCMoveBy (2, new CCPoint(200, 0));
            CCCallFunc pCallback = new CCCallFunc(stopAction);
            CCFiniteTimeAction pSequence = (CCFiniteTimeAction)new CCSequence(pMove, pCallback);
            pSequence.Tag = (int)KTag.kTagSequence;

            CCSprite pChild = new CCSprite(s_pPathGrossini);
            pChild.Position = (new CCPoint(200, 200));

            AddChild(pChild, 1, kTagGrossini);
            pChild.RunAction(pSequence);
        }
Esempio n. 4
0
 public CCCallFuncState (CCCallFunc action, CCNode target)
     : base(action, target)
 {   
     CallFunction = action.CallFunction;
     ScriptFuncName = action.ScriptFuncName;
 }
Esempio n. 5
0
        public override void OnEnter()
        {

            base.OnEnter();

            CenterSprites(0);

            var spr = new CCSprite("Images/grossini");
            spr.Position = new CCPoint(200, 200);
            AddChild(spr);

            var act1 = new CCMoveBy (2, new CCPoint(0, 100));

            var act2 = new CCCallFunc(Log1);
            var act3 = new CCMoveBy (2, new CCPoint(0, -100));
            var act4 = new CCCallFunc(Log2);
            var act5 = new CCMoveBy (2, new CCPoint(100, -100));
            var act6 = new CCCallFunc(Log3);
            var act7 = new CCMoveBy (2, new CCPoint(-100, 0));
            var act8 = new CCCallFunc(Log4);

            var actF = new CCSequence(act1, act2, act3, act4, act5, act6, act7, act8);

            spr.RunAction(actF);
        }
        public Object ActionForCallbackChannel(CCBSequenceProperty channel)
        {
            float lastKeyframeTime = 0;

            var actions      = new List <CCFiniteTimeAction>();
            var keyframes    = channel.Keyframes;
            int numKeyframes = keyframes.Count;

            for (int i = 0; i < numKeyframes; ++i)
            {
                CCBKeyframe keyframe = keyframes[i];
                float       timeSinceLastKeyframe = keyframe.Time - lastKeyframeTime;
                lastKeyframeTime = keyframe.Time;
                if (timeSinceLastKeyframe > 0)
                {
                    actions.Add(new CCDelayTime(timeSinceLastKeyframe));
                }

                var           keyVal         = (List <CCBValue>)keyframe.Value;
                string        selectorName   = keyVal[0].GetStringValue();
                CCBTargetType selectorTarget =
                    (CCBTargetType)int.Parse(keyVal[1].GetStringValue());

                if (JSControlled)
                {
                    string     callbackName = string.Format("{0}:{1}", selectorTarget, selectorName);
                    CCCallFunc callback     = (CCCallFunc)_keyframeCallFuncs[callbackName];

                    if (callback != null)
                    {
                        actions.Add(callback);
                    }
                }
                else
                {
                    Object target = null;

                    if (selectorTarget == CCBTargetType.DocumentRoot)
                    {
                        target = _rootNode;
                    }
                    else if (selectorTarget == CCBTargetType.Owner)
                    {
                        target = Owner;
                    }

                    if (target != null)
                    {
                        if (selectorName.Length > 0)
                        {
                            Action <CCNode> selCallFunc = null;

                            ICCBSelectorResolver targetAsCCBSelectorResolver = target as ICCBSelectorResolver;

                            if (targetAsCCBSelectorResolver != null)
                            {
                                selCallFunc = targetAsCCBSelectorResolver.OnResolveCCBCCCallFuncSelector(target,
                                                                                                         selectorName);
                            }

                            if (selCallFunc == null)
                            {
                                CCLog.Log("Skipping selector {0} since no CCBSelectorResolver is present.",
                                          selectorName);
                            }
                            else
                            {
                                CCCallFuncN callback = new CCCallFuncN(selCallFunc);
                                actions.Add(callback);
                            }
                        }
                        else
                        {
                            CCLog.Log("Unexpected empty selector.");
                        }
                    }
                }
            }
            if (actions.Capacity < 1)
            {
                return(null);
            }

            return(new CCSequence(actions.ToArray()));
        }
Esempio n. 7
0
 public CCCallFuncState(CCCallFunc action, CCNode target)
     : base(action, target)
 {
     CallFunction   = action.CallFunction;
     ScriptFuncName = action.ScriptFuncName;
 }