• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CocosSharp.CCLabelTtf类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



CCLabelTtf类属于CocosSharp命名空间,在下文中一共展示了CCLabelTtf类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetMenuLabel

        private CCLabelTtf GetMenuLabel(string text) {
            var label = new CCLabelTtf(text, "kongtext", 18) {
                Color = new CCColor3B(180, 180, 250)
            };

            return label;
        }
开发者ID:Insality,项目名称:essence-of-shadows,代码行数:7,代码来源:MenuLayer.cs


示例2: OnEnter

        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf label = new CCLabelTtf(title(), "arial", 32);
            AddChild(label);
            label.Position = (new CCPoint(s.Width / 2, s.Height - 50));

            string subTitle = subtitle();
            if (!string.IsNullOrEmpty(subTitle))
            {
                CCLabelTtf l = new CCLabelTtf(subTitle, "arial", 16);
                AddChild(l, 1);
                l.Position = new CCPoint(s.Width / 2, s.Height - 80);
            }

            CCMenuItemImage item1 = new CCMenuItemImage("Images/b1", "Images/b2", backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage("Images/f1", "Images/f2", nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);
            menu.Position = new CCPoint(0, 0);
            item1.Position = new CCPoint(s.Width / 2 - 100, 30);
            item2.Position = new CCPoint(s.Width / 2, 30);
            item3.Position = new CCPoint(s.Width / 2 + 100, 30);

            AddChild(menu, 1);
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:30,代码来源:SchedulerTestLayer.cs


示例3: OnEnter

        public override void OnEnter()
        {
            //
            // This test MUST be done in 'onEnter' and not on 'init'
            // otherwise the paused action will be resumed at 'onEnter' time
            //
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf l = new CCLabelTtf("After 5 seconds grossini should move", "arial", 16);
            AddChild(l);
            l.Position = (new CCPoint(s.Width / 2, 245));


            //
            // Also, this test MUST be done, after [super onEnter]
            //
            CCSprite grossini = new CCSprite(s_pPathGrossini);
            AddChild(grossini, 0, kTagGrossini);
            grossini.Position = (new CCPoint(200, 200));

            CCAction action = new CCMoveBy (1, new CCPoint(150, 0));

            grossini.AddAction(action, true);

            Schedule(unpause, 3);
        }
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:28,代码来源:PauseTest.cs


示例4: LabelSFOldNew

        public LabelSFOldNew()
        {
            // CCLabel SpriteFont
            label1 = new CCLabel("SpriteFont Label Test", "arial", 48, CCLabelFormat.SpriteFont);

            AddChild(label1);

            label2 = new CCLabelTtf("SpriteFont Label Test", "arial", 48);
            label2.Color = CCColor3B.Red;
            label2.AnchorPoint = CCPoint.AnchorMiddle;

            AddChild(label2);

            drawNode = new CCDrawNode();
            AddChild(drawNode);

            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = (touches, touchEvent) =>
            {
                var location = touches[0].Location;

                if (label1.BoundingBoxTransformedToWorld.ContainsPoint(location))
                    CCLog.Log("Hit");
            };
            AddEventListener(touchListener);

        }
开发者ID:KevinHeyer,项目名称:CocosSharp,代码行数:27,代码来源:LabelSFOldNew.cs


示例5: OnEnter

        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf label = new CCLabelTtf(title(), "arial", 40);
            label.AnchorPoint = new CCPoint (0.5f, 0.5f);
            AddChild(label, 1);
            label.Position = (new CCPoint(s.Width / 2, s.Height - 50));

            CCMenuItemImage item1 = new CCMenuItemImage(s_pPathB1, s_pPathB2, backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage(s_pPathR1, s_pPathR2, restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage(s_pPathF1, s_pPathF2, nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);

            float padding = 10.0f;
            float halfRestartWidth = item2.ContentSize.Width / 2.0f;

            menu.Position = (new CCPoint(0, 0));

            // Anchor point of menu items is 0.5, 0.5 by default
            item1.Position = (new CCPoint(s.Width / 2 - item1.ContentSize.Width / 2.0f - halfRestartWidth - padding, item2.ContentSize.Height + padding));
            item2.Position = (new CCPoint(s.Width / 2, item2.ContentSize.Height + padding));
            item3.Position = (new CCPoint(s.Width / 2 + item3.ContentSize.Width / 2.0f + halfRestartWidth + padding, item2.ContentSize.Height + padding));

            AddChild(menu, TestScene.MENU_LEVEL);
        }
开发者ID:netonjm,项目名称:CocosSharp,代码行数:29,代码来源:ActionManagerTest.cs


示例6: RenderTextureZbuffer

        public RenderTextureZbuffer()
        {
            label = new CCLabelTtf("vertexZ = 50", "Marker Felt", 32);
            AddChild(label);

            label2 = new CCLabelTtf("vertexZ = 0", "Marker Felt", 32);
            AddChild(label2);

            label3 = new CCLabelTtf("vertexZ = -50", "Marker Felt", 32);
            AddChild(label3);

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("Images/bugs/circle.plist");

            sp1 = new CCSprite("Images/bugs/circle");
            sp2 = new CCSprite("Images/bugs/circle");
            sp3 = new CCSprite("Images/bugs/circle");
            sp4 = new CCSprite("Images/bugs/circle");
            sp5 = new CCSprite("Images/bugs/circle");
            sp6 = new CCSprite("Images/bugs/circle");
            sp7 = new CCSprite("Images/bugs/circle");
            sp8 = new CCSprite("Images/bugs/circle");
            sp9 = new CCSprite("Images/bugs/circle");

            AddChild(sp1, 9);
            AddChild(sp2, 8);
            AddChild(sp3, 7);
            AddChild(sp4, 6);
            AddChild(sp5, 5);
            AddChild(sp6, 4);
            AddChild(sp7, 3);
            AddChild(sp8, 2);
            AddChild(sp9, 1);

            sp9.Color = CCColor3B.Yellow;
        }
开发者ID:KevinHeyer,项目名称:CocosSharp,代码行数:35,代码来源:RenderTextureZbuffer.cs


示例7: InitOrientationTest

        private bool InitOrientationTest ()
        {
            bool bRet = false;
            do
            {

                CCSize s = Layer.VisibleBoundsWorldspace.Size;

                CCLabelTtf label = new CCLabelTtf(title(), "Arial", 26);
                AddChild(label, 1);
                label.Position = new CCPoint(s.Width / 2, s.Height - 50);

                string sSubtitle = subtitle();
                if (sSubtitle.Length > 0)
                {
                    CCLabelTtf l = new CCLabelTtf(sSubtitle, "Arial", 16);
                    AddChild(l, 1);
                    l.Position = new CCPoint(s.Width / 2, s.Height - 80);
                }

                CCMenuItemImage item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2,  BackCallback);
                CCMenuItemImage item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2,  RestartCallback);
                CCMenuItemImage item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2,  NextCallback);

                CCMenu menu = new CCMenu(item1, item2, item3);
                menu.Position = new CCPoint();
                item1.Position = new CCPoint(s.Width / 2 - 100, 30);
                item2.Position = new CCPoint(s.Width / 2, 30);
                item3.Position = new CCPoint(s.Width / 2 + 100, 30);

                bRet = true;
            } while (false);

            return bRet;
        }
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:35,代码来源:OrientationTest.cs


示例8: PCLLabel

		public static CCLabelTtf PCLLabel(string message)
		{
			var label = new CCLabelTtf(message, "MarkerFelt", 22);
			label.Color = CCColor3B.White;
			label.Position = CCDrawManager.VisibleSize.Center;
			return label;
		}
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:7,代码来源:TestClass.cs


示例9: GameScene

        public GameScene(CCWindow mainWindow)
            : base(mainWindow)
        {
            mainLayer = new CCLayer ();
            AddChild (mainLayer);

            paddleSprite = new CCSprite ("paddle");
            paddleSprite.PositionX = 100;
            paddleSprite.PositionY = 100;
            mainLayer.AddChild (paddleSprite);

            ballSprite = new CCSprite ("ball");
            ballSprite.PositionX = 320;
            ballSprite.PositionY = 600;
            mainLayer.AddChild (ballSprite);

            scoreLabel = new CCLabelTtf ("Score: 0", "arial", 22);
            scoreLabel.PositionX = mainLayer.VisibleBoundsWorldspace.MinX + 20;
            scoreLabel.PositionY = mainLayer.VisibleBoundsWorldspace.MaxY - 20;
            scoreLabel.AnchorPoint = CCPoint.AnchorUpperLeft;

            mainLayer.AddChild (scoreLabel);

            Schedule (RunGameLogic);

            // New code:
            touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesMoved = HandleTouchesMoved;
            AddEventListener (touchListener, this);
        }
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:30,代码来源:GameScene.cs


示例10: setSceneTitleLabel

		public virtual void setSceneTitleLabel(CCLabelTtf var)   
		{ 
			if (m_pSceneTitleLabel != var) 
			{ 
				m_pSceneTitleLabel = var; 
			} 
		}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:7,代码来源:CCControlScene.cs


示例11: AddedToScene

        protected override void AddedToScene ()
        {
            base.AddedToScene ();

            Scene.SceneResolutionPolicy = CCSceneResolutionPolicy.ShowAll;

            var scoreLabel = new CCLabelTtf (scoreMessage, "arial", 22) {
                Position = new CCPoint (VisibleBoundsWorldspace.Size.Center.X, VisibleBoundsWorldspace.Size.Center.Y + 50),
                Color = new CCColor3B (CCColor4B.Yellow),
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment = CCVerticalTextAlignment.Center,
                AnchorPoint = CCPoint.AnchorMiddle,
                Dimensions = ContentSize
            };

            AddChild (scoreLabel);

            var playAgainLabel = new CCLabelTtf ("Tap to Play Again", "arial", 22) {
                Position = VisibleBoundsWorldspace.Size.Center,
                Color = new CCColor3B (CCColor4B.Green),
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment = CCVerticalTextAlignment.Center,
                AnchorPoint = CCPoint.AnchorMiddle,
                Dimensions = ContentSize
            };

            AddChild (playAgainLabel);

            AddMonkey ();
        }
开发者ID:Adameg,项目名称:mobile-samples,代码行数:30,代码来源:GameOverLayer.cs


示例12: OnEnter

        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf label = new CCLabelTtf(title(), "arial", 26);
            AddChild(label, 1);
            label.Position = (new CCPoint(s.Width / 2, s.Height - 50));

            string strSubTitle = subtitle();
            if (strSubTitle.Length > 0)
            {
                CCLabelTtf l = new CCLabelTtf(strSubTitle, "Thonburi", 16);
                AddChild(l, 1);
                l.Position = (new CCPoint(s.Width / 2, s.Height - 80));
            }

            CCMenuItemImage item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);

            menu.Position = (new CCPoint(0, 0));
            item1.Position = (new CCPoint(s.Width / 2 - 100, 30));
            item2.Position = (new CCPoint(s.Width / 2, 30));
            item3.Position = (new CCPoint(s.Width / 2 + 100, 30));
            AddChild(menu, 1);
        }
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:30,代码来源:ZwoptexTest.cs


示例13: OnEnter

        public override void OnEnter ()
        {
            base.OnEnter ();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            Box2DView view = Box2DView.viewWithEntryID(m_entryID);
            AddChild(view, 0, kTagBox2DNode);
            view.Scale = 8;
            view.AnchorPoint = new CCPoint(0, 0);
            view.Position = new CCPoint(s.Width / 2, s.Height / 4);

            //#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
            //    CCLabelBMFont* label = new CCLabelBMFont(view.title().c_str(),  "fonts/arial16.fnt");
            //#else    
            CCLabelTtf label = new CCLabelTtf(view.title(), "arial", 18);
            //#endif
            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 30);

            CCMenuItemImage item1 = new CCMenuItemImage("Images/b1", "Images/b2", backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage("Images/f1", "Images/f2", nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);

            menu.Position = CCPoint.Zero;
            item1.Position = new CCPoint(s.Width / 2 - 100, 30);
            item2.Position = new CCPoint(s.Width / 2, 30);
            item3.Position = new CCPoint(s.Width / 2 + 100, 30);

            AddChild(menu, 1);
        }
开发者ID:songfulin,项目名称:CocosSharp,代码行数:33,代码来源:MenuLayer.cs


示例14: GameOverLayer

		public GameOverLayer (int score)
		{

			var touchListener = new CCEventListenerTouchAllAtOnce();
			touchListener.OnTouchesEnded = (touches, ccevent) => CCDirector.SharedDirector.ReplaceScene (GameLayer.Scene);

			EventDispatcher.AddEventListener(touchListener, this);

			string scoreMessage = String.Format ("Game Over. You collected {0} bananas!", score);
       
            var scoreLabel = new CCLabelTtf (scoreMessage, "MarkerFelt", 22) {
				Position = new CCPoint( CCDirector.SharedDirector.WinSize.Center.X,  CCDirector.SharedDirector.WinSize.Center.Y + 50),
                Color = new CCColor3B (CCColor4B.Yellow),
				HorizontalAlignment = CCTextAlignment.Center,
				VerticalAlignment = CCVerticalTextAlignment.Center,
				Dimensions = ContentSize
			};

			AddChild (scoreLabel);

            var playAgainLabel = new CCLabelTtf ("Tap to Play Again", "MarkerFelt", 22) {
				Position = CCDirector.SharedDirector.WinSize.Center,
                Color = new CCColor3B (CCColor4B.Green),
				HorizontalAlignment = CCTextAlignment.Center,
				VerticalAlignment = CCVerticalTextAlignment.Center,
				Dimensions = ContentSize
			};

			AddChild (playAgainLabel);

            Color = new CCColor3B (CCColor4B.Black);
			Opacity = 255;

		}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:34,代码来源:GameOverLayer.cs


示例15: AddHpLabel

 private void AddHpLabel() {
     _hpLabel = new CCLabelTtf("HP", "kongtext", 8) {
         Color = CCColor3B.White,
         AnchorPoint = CCPoint.AnchorMiddleBottom,
         Position = new CCPoint(Settings.ScreenWidth/2, BarHeight*0.25f)
     };
     AddChild(_hpLabel);
 }
开发者ID:Insality,项目名称:essence-of-shadows,代码行数:8,代码来源:HudLayer.cs


示例16: TTFFontInit

 public TTFFontInit()
 {
     font = new CCLabelTtf();
     font.FontName = "MarkerFelt";
     font.FontSize = 38;
     font.Text = ("It is working!");
     AddChild(font);
 }
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:8,代码来源:TTFFontInit.cs


示例17: AddGoldLabel

        private void AddGoldLabel() {
            _goldLabel = new CCLabelTtf("Gold:", "kongtext", 10) {
                Color = CCColor3B.White,
                AnchorPoint = CCPoint.AnchorLowerLeft,
                Position = new CCPoint(Settings.ScreenWidth/2 + BarWidth/5, BarHeight)
            };

            AddChild(_goldLabel);
        }
开发者ID:Insality,项目名称:essence-of-shadows,代码行数:9,代码来源:HudLayer.cs


示例18: AddLevelLabel

        private void AddLevelLabel() {
            _levelLabel = new CCLabelTtf("LVL", "kongtext", 12) {
                Color = CCColor3B.White,
                AnchorPoint = CCPoint.AnchorMiddleBottom,
                Position = new CCPoint(Settings.ScreenWidth/2, BarHeight)
            };

            AddChild(_levelLabel);
        }
开发者ID:Insality,项目名称:essence-of-shadows,代码行数:9,代码来源:HudLayer.cs


示例19: OnEnter

 public override void OnEnter()
 {
     base.OnEnter();
     CCSize size = Layer.VisibleBoundsWorldspace.Size;
     CCLabelTtf label = new CCLabelTtf("cocos2d", "arial", 64);
     label.Position = size.Center;
     label.AnchorPoint = CCPoint.AnchorMiddle;
     AddChild(label);
 }
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:9,代码来源:TestLayer.cs


示例20: Bug624Layer2

        public Bug624Layer2()
        {
            CCSize size = Layer.VisibleBoundsWorldspace.Size;
            CCLabelTtf label = new CCLabelTtf("Layer2", "MarkerFelt", 36);

            label.Position = new CCPoint(size.Width / 2, size.Height / 2);
            AddChild(label);
            Schedule(switchLayer, 5.0f);

        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:10,代码来源:Bug624Layer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CocosSharp.CCMenu类代码示例发布时间:2022-05-24
下一篇:
C# CocosSharp.CCLabel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap