当前位置: 首页>>代码示例>>C#>>正文


C# CCLabelTTF.RunAction方法代码示例

本文整理汇总了C#中cocos2d.CCLabelTTF.RunAction方法的典型用法代码示例。如果您正苦于以下问题:C# CCLabelTTF.RunAction方法的具体用法?C# CCLabelTTF.RunAction怎么用?C# CCLabelTTF.RunAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cocos2d.CCLabelTTF的用法示例。


在下文中一共展示了CCLabelTTF.RunAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LabelTTFA8Test

        public LabelTTFA8Test()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayerColor layer = CCLayerColor.Create(new CCColor4B(128, 128, 128, 255));
            AddChild(layer, -10);

            // CCLabelBMFont
            CCLabelTTF label1 = new CCLabelTTF("Testing A8 Format", "Marker Felt", 38);
            AddChild(label1);
            label1.Color = CCTypes.CCRed;
            label1.Position = new CCPoint(s.Width / 2, s.Height / 2);

            CCFadeOut fadeOut = new CCFadeOut  (2);
            CCFadeIn fadeIn = new CCFadeIn  (2);
            CCFiniteTimeAction seq = CCSequence.FromActions(fadeOut, fadeIn);
            CCRepeatForever forever = new CCRepeatForever ((CCActionInterval) seq);
            label1.RunAction(forever);
        }
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:19,代码来源:LabelTTFA8Test.cs

示例2: onTextFieldInsertText

        public virtual bool onTextFieldInsertText(CCTextFieldTTF pSender, string text, int nLen)
        {
            // if insert enter, treat as default to detach with ime
            if ("\n" == text)
            {
                return false;
            }

            // if the textfield's char count more than m_nCharLimit, doesn't insert text anymore.
            if (pSender.CharCount >= m_nCharLimit)
            {
                return true;
            }

            // create a insert text sprite and do some action
            CCLabelTTF label = new CCLabelTTF(text, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE);
            this.AddChild(label);
            CCColor3B color = new CCColor3B { R = 226, G = 121, B = 7 };
            label.Color = color;

            // move the sprite from top to position
            CCPoint endPos = pSender.Position;
            if (pSender.CharCount > 0)
            {
                endPos.X += pSender.ContentSize.Width / 2;
            }
            CCSize inputTextSize = label.ContentSize;
            CCPoint beginPos = new CCPoint(endPos.X, CCDirector.SharedDirector.WinSize.Height - inputTextSize.Height * 2);

            float duration = 0.5f;
            label.Position = beginPos;
            label.Scale = 8;

            CCAction seq = CCSequence.FromActions(
                CCSpawn.FromActions(
                    new CCMoveTo (duration, endPos),
                    new CCScaleTo(duration, 1),
                    new CCFadeOut  (duration)),
                new CCCallFuncN(callbackRemoveNodeWhenDidAction));
            label.RunAction(seq);
            return false;
        }
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:42,代码来源:TextInputTest.cs

示例3: onTextFieldDeleteBackward

        public virtual bool onTextFieldDeleteBackward(CCTextFieldTTF pSender, string delText, int nLen)
        {
            // create a delete text sprite and do some action
            CCLabelTTF label = new CCLabelTTF(delText, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE);
            this.AddChild(label);

            // move the sprite to fly out
            CCPoint beginPos = pSender.Position;
            CCSize textfieldSize = pSender.ContentSize;
            CCSize labelSize = label.ContentSize;
            beginPos.X += (textfieldSize.Width - labelSize.Width) / 2.0f;

            int RAND_MAX = 32767;
            Random rand = new Random();

            CCSize winSize = CCDirector.SharedDirector.WinSize;
            CCPoint endPos = new CCPoint(-winSize.Width / 4.0f, winSize.Height * (0.5f + (float)Random.Next() / (2.0f * RAND_MAX)));
            float duration = 1;
            float rotateDuration = 0.2f;
            int repeatTime = 5;
            label.Position = beginPos;

            CCAction seq = CCSequence.FromActions(
                CCSpawn.FromActions(
                    new CCMoveTo (duration, endPos),
                    new CCRepeat (
                        new CCRotateBy (rotateDuration, (Random.Next() % 2 > 0) ? 360 : -360),
                        (uint)repeatTime),
                    new CCFadeOut  (duration)),
                new CCCallFuncN(callbackRemoveNodeWhenDidAction));
            label.RunAction(seq);
            return false;
        }
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:33,代码来源:TextInputTest.cs

示例4: ShowBoardMessage

        internal void ShowBoardMessage(string theMessage)
        {
            CCLabelTTF boardMessage = new CCLabelTTF(theMessage, "MarkerFelt", 22);
            AddChild(boardMessage, Constants.DepthPointScore);
            boardMessage.Color = new CCColor3B(255,255,255);
            boardMessage.PositionX = screenWidth /2;
            boardMessage.PositionY = screenHeight * .7f;

            CCSequence seq = CCSequence.FromActions(
                               new CCScaleTo(2.0f, 2.0f),
                               new CCFadeTo(1.0f, 0),
                               new CCCallFuncN(RemoveBoardMessage)  //NOTE: CCCallFuncN  works, CCCallFunc does not.
                );

            boardMessage.RunAction(seq);
        }
开发者ID:CasperWollesen,项目名称:AngryNinjas,代码行数:16,代码来源:TheLevel.cs

示例5: ShowPointsWithFontLabelForValue

        void ShowPointsWithFontLabelForValue(int pointValue, CCPoint positionToShowScore)
        {
            CCLabelTTF scoreLabel = new CCLabelTTF(string.Format("{0}", pointValue), "MarkerFelt", 22);
            AddChild(scoreLabel, Constants.DepthPointScore);
            scoreLabel.Color = new CCColor3B(255,255,255);
            scoreLabel.Position = positionToShowScore;

            CCMoveTo moveAction = new CCMoveTo(1.0f, new CCPoint ( scoreLabel.Position.X  , scoreLabel.Position.Y + 25 ));

            scoreLabel.RunAction(moveAction);

            CCSequence seq = CCSequence.FromActions(
                new CCFadeTo(1.5f, 20),
                new CCCallFuncN(RemoveThisLabel));

            scoreLabel.RunAction(seq);
        }
开发者ID:CasperWollesen,项目名称:AngryNinjas,代码行数:17,代码来源:TheLevel.cs


注:本文中的cocos2d.CCLabelTTF.RunAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。