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


C# CCLabel.RunActionsAsync方法代码示例

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


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

示例1: OnDeleteBackward

        void OnDeleteBackward (object sender, CCIMEKeybardEventArgs e)
        {
            var focusedTextField = sender as CCTextField;

            if (focusedTextField == null || string.IsNullOrEmpty(focusedTextField.Text))
            {
                e.Cancel = true;
                return;
            }

            // Just cancel this if we would backspace over the PlaceHolderText as it would just be
            // replaced anyway and the Action below should not be executed.
            var delText = focusedTextField.Text;
            if (delText == focusedTextField.PlaceHolderText)
            {
                e.Cancel = true;
                return;
            }

            delText = delText.Substring(delText.Length - 1);

            // create a delete text sprite and do some action
            var label = new CCLabel(delText, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE + 3, CCLabelFormat.SpriteFont);
            this.AddChild(label);

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

            var nextRandom = (float)CCRandom.Next(RANDOM_MAX);

            CCSize winSize = VisibleBoundsWorldspace.Size;
            CCPoint endPos = new CCPoint(-winSize.Width / 4.0f, winSize.Height * (0.5f + nextRandom / (2.0f * RANDOM_MAX)));

            float duration = 1;
            float rotateDuration = 0.2f;
            int repeatTime = 5;
            label.Position = beginPos;

            var delAction = new CCSpawn(new CCMoveTo(duration, endPos),
                new CCRepeat(
                        new CCRotateBy(rotateDuration, (CCRandom.Next() % 2 > 0) ? 360 : -360),
                        (uint)repeatTime),
                        new CCFadeOut(duration)
                );

            label.RunActionsAsync(delAction, new CCRemoveSelf(true));

        }
开发者ID:haithemaraissia,项目名称:CocosSharp,代码行数:51,代码来源:TextInputTest.cs


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