本文整理汇总了C#中CocosSharp.CCLabelTtf类的典型用法代码示例。如果您正苦于以下问题:C# CCLabelTtf类的具体用法?C# CCLabelTtf怎么用?C# CCLabelTtf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCLabelTtf类属于CocosSharp命名空间,在下文中一共展示了CCLabelTtf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMenuLabel
private CCLabelTtf GetMenuLabel(string text) {
var label = new CCLabelTtf(text, "kongtext", 18) {
Color = new CCColor3B(180, 180, 250)
};
return label;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例10: setSceneTitleLabel
public virtual void setSceneTitleLabel(CCLabelTtf var)
{
if (m_pSceneTitleLabel != var)
{
m_pSceneTitleLabel = var;
}
}
示例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 ();
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}