本文整理汇总了C#中Cocos2D.CCLabelTTF类的典型用法代码示例。如果您正苦于以下问题:C# CCLabelTTF类的具体用法?C# CCLabelTTF怎么用?C# CCLabelTTF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCLabelTTF类属于Cocos2D命名空间,在下文中一共展示了CCLabelTTF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize s = CCDirector.SharedDirector.WinSize;
CCLabelTTF label = new CCLabelTTF(title(), "arial", 32);
AddChild(label, 1);
label.Position = (new CCPoint(s.Width / 2, s.Height - 50));
string subtitle_ = subtitle();
if (subtitle_.Length > 0)
{
CCLabelTTF l = new CCLabelTTF(subtitle_, "arial", 16);
AddChild(l, 1);
l.Position = (new CCPoint(s.Width / 2, s.Height - 80));
}
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);
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);
}
示例2: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize s = CCDirector.SharedDirector.WinSize;
CCLabelTTF label = new CCLabelTTF(title(), "arial", 28);
AddChild(label, 1);
label.Position = new CCPoint(s.Width / 2, s.Height - 50);
string strSubtitle = subtitle();
if (strSubtitle != null)
{
CCLabelTTF l = new CCLabelTTF(strSubtitle, "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);
AddChild(menu, 1);
}
示例3: OnEnter
public override void OnEnter()
{
base.OnEnter();
m_grossini = new CCSprite(TestResource.s_pPathGrossini);
m_tamara = new CCSprite(TestResource.s_pPathSister1);
m_kathia = new CCSprite(TestResource.s_pPathSister2);
AddChild(m_grossini, 3);
AddChild(m_kathia, 2);
AddChild(m_tamara, 1);
var s = CCDirector.SharedDirector.WinSize;
m_grossini.Position = new CCPoint(60, 50);
m_kathia.Position = new CCPoint(60, 150);
m_tamara.Position = new CCPoint(60, 250);
var label = new CCLabelTTF(title(), "arial", 32);
AddChild(label);
label.Position = new CCPoint(s.Width / 2, s.Height - 50);
var item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback);
var item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback);
var item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback);
var 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);
}
示例4: CreateScaledMenuItemLabel
public static CCMenuItem CreateScaledMenuItemLabel(CCSize buttonSize, int labelPadding, float strokeSize, CCColor3B textColor, CCColor3B strokeColor, CCColor3B backColor, string labelText, Action action)
{
var menuItem = action != null ? new CCMenuItem(o => action()) : new CCMenuItem();
var labelSize = new CCSize(buttonSize.Width - labelPadding, buttonSize.Height - labelPadding);
// Add background
var blockSprite = new CCSprite("images/Block_Back");
blockSprite.ScaleTo(buttonSize);
blockSprite.Color = backColor;
menuItem.AddChild(blockSprite);
menuItem.ContentSize = buttonSize;
// Add label
var labelTtf = new CCLabelTTF(labelText, "arial-24", 10);
labelTtf.Color = textColor;
// Add Stroke to label
// if (strokeSize > 0) labelTtf.AddStroke(strokeSize, strokeColor);
if (labelTtf.ContentSize.Width > labelSize.Width)
{
labelTtf.ScaleTo(labelSize);
}
menuItem.AddChild(labelTtf);
return menuItem;
}
示例5: LabelTTFChinese
public LabelTTFChinese()
{
CCSize size = CCDirector.SharedDirector.WinSize;
CCLabelTTF pLable = new CCLabelTTF("中国", "Marker Felt", 30);
pLable.Position = new CCPoint(size.Width / 2, size.Height / 2);
AddChild(pLable);
}
示例6: Init
public override bool Init()
{
base.Init();
CCSize s = CCDirector.SharedDirector.WinSize;
var label = new CCLabelTTF(title(), "arial", 32);
AddChild(label, 1);
label.Position = (new CCPoint(s.Width / 2, s.Height - 50));
string subtitle_ = subtitle();
if (subtitle_.Length > 0)
{
var l = new CCLabelTTF(subtitle_, "arial", 16);
AddChild(l, 1);
l.Position = (new CCPoint(s.Width / 2, s.Height - 80));
}
var item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback);
var item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback);
var item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback);
var 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);
return true;
}
示例7: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize s = CCDirector.SharedDirector.WinSize;
CCLabelTTF label = new CCLabelTTF(title(), "arial", 28);
AddChild(label, 1);
label.Position = new CCPoint(s.Width / 2, s.Height - 50);
string strSubtitle = subtitle();
if (!string.IsNullOrEmpty(strSubtitle))
{
CCLabelTTF l = new CCLabelTTF(strSubtitle, "arial", 16);
//CCLabelTTF l = CCLabelTTF.labelWithString(strSubtitle, "Thonburi", 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();
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);
}
示例8: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize s = CCDirector.SharedDirector.WinSize;
CCLabelTTF label = new CCLabelTTF(title(), "arial", 24);
AddChild(label);
label.Position = new CCPoint(s.Width / 2, s.Height - 50);
string subTitle = m_pNotificationLayer.subtitle();
if (subTitle != null)
{
CCLabelTTF l = new CCLabelTTF(subTitle, subtitle(), 16);
AddChild(l, 1);
l.Position = new CCPoint(s.Width / 2, s.Height - 80);
}
CCMenuItemImage item1 = new CCMenuItemImage("Images/b1.png", "Images/b2.png", backCallback);
CCMenuItemImage item2 = new CCMenuItemImage("Images/r1.png", "Images/r2.png", restartCallback);
CCMenuItemImage item3 = new CCMenuItemImage("Images/f1.png", "Images/f2.png", 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);
}
示例9: setSceneTitleLabel
public virtual void setSceneTitleLabel(CCLabelTTF var)
{
if (m_pSceneTitleLabel != var)
{
m_pSceneTitleLabel = var;
}
}
示例10: InitWithMaskSprite
/** Initializes a switch with a mask sprite, on/off sprites for on/off states, a thumb sprite and an on/off labels. */
protected virtual bool InitWithMaskSprite(CCSprite maskSprite, CCSprite onSprite, CCSprite offSprite, CCSprite thumbSprite, CCLabelTTF onLabel,
CCLabelTTF offLabel)
{
if (base.Init())
{
Debug.Assert(maskSprite != null, "Mask must not be nil.");
Debug.Assert(onSprite != null, "onSprite must not be nil.");
Debug.Assert(offSprite != null, "offSprite must not be nil.");
Debug.Assert(thumbSprite != null, "thumbSprite must not be nil.");
TouchEnabled = true;
_on = true;
_switchSprite = new CCControlSwitchSprite();
_switchSprite.InitWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite,
onLabel, offLabel);
_switchSprite.Position = new CCPoint(_switchSprite.ContentSize.Width / 2, _switchSprite.ContentSize.Height / 2);
AddChild(_switchSprite);
IgnoreAnchorPointForPosition = false;
AnchorPoint = new CCPoint(0.5f, 0.5f);
ContentSize = _switchSprite.ContentSize;
return true;
}
return false;
}
示例11: 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 = CCDirector.SharedDirector.WinSize;
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));
CCDirector.SharedDirector.ActionManager.AddAction(action, grossini, true);
Schedule(unpause, 3);
}
示例12: GitHubIssue5
public GitHubIssue5()
{
CCSize s = CCDirector.SharedDirector.WinSize;
_TestLabel = new CCLabelTTF("", "Arial", 10);
AddChild(_TestLabel);
_TestLabel.Position = new CCPoint(s.Width / 2, s.Height / 4 * 2);
}
示例13: GameOverLayer
public GameOverLayer(int score, int remoteScore)
{
TouchEnabled = true;
string scoreMessage = String.Format ("Game Over. You collected {0} bananas \r\n Opponent collected {1} bananas!", score, remoteScore);
var scoreLabel = new CCLabelTTF (scoreMessage, "MarkerFelt", 22) {
Position = new CCPoint( CCDirector.SharedDirector.WinSize.Center.X, CCDirector.SharedDirector.WinSize.Center.Y + 50),
Color = new CCColor3B (XNA.Color.Yellow)
};
AddChild (scoreLabel);
var playAgainLabel = new CCLabelTTF ("Tap to Play Again", "MarkerFelt", 22) {
Position = CCDirector.SharedDirector.WinSize.Center,
Color = new CCColor3B (XNA.Color.Green)
};
AddChild (playAgainLabel);
Color = new CCColor3B (XNA.Color.Black);
Opacity = 255;
// Clean up the room from the server
if (Context.isRoomCreator) {
WarpClient.GetInstance ().DeleteRoom (Context.gameRoomId);
}
}
示例14: RenderTextureZbuffer
public RenderTextureZbuffer()
{
//this->setIsTouchEnabled(true);
TouchEnabled = true;
CCSize size = CCDirector.SharedDirector.WinSize;
CCLabelTTF label = new CCLabelTTF("vertexZ = 50", "Marker Felt", 32);
label.Position = new CCPoint(size.Width / 2, size.Height * 0.25f);
AddChild(label);
CCLabelTTF label2 = new CCLabelTTF("vertexZ = 0", "Marker Felt", 32);
label2.Position = new CCPoint(size.Width / 2, size.Height * 0.5f);
AddChild(label2);
CCLabelTTF label3 = new CCLabelTTF("vertexZ = -50", "Marker Felt", 32);
label3.Position = new CCPoint(size.Width / 2, size.Height * 0.75f);
AddChild(label3);
label.VertexZ = 50;
label2.VertexZ = 0;
label3.VertexZ = -50;
CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("Images/bugs/circle.plist");
mgr = new CCSpriteBatchNode("Images/bugs/circle", 9);
AddChild(mgr);
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");
mgr.AddChild(sp1, 9);
mgr.AddChild(sp2, 8);
mgr.AddChild(sp3, 7);
mgr.AddChild(sp4, 6);
mgr.AddChild(sp5, 5);
mgr.AddChild(sp6, 4);
mgr.AddChild(sp7, 3);
mgr.AddChild(sp8, 2);
mgr.AddChild(sp9, 1);
sp1.VertexZ = 400;
sp2.VertexZ = 300;
sp3.VertexZ = 200;
sp4.VertexZ = 100;
sp5.VertexZ = 0;
sp6.VertexZ = -100;
sp7.VertexZ = -200;
sp8.VertexZ = -300;
sp9.VertexZ = -400;
sp9.Scale = 2;
sp9.Color = CCTypes.CCYellow;
}
示例15: TextLayer
public TextLayer()
{
InitWithColor(CCTypes.CreateColor(32, 32, 32, 255));
float x, y;
CCSize size = CCDirector.SharedDirector.WinSize;
x = size.Width;
y = size.Height;
CCNode node = new CCNode ();
CCActionInterval effect = getAction();
node.RunAction(effect);
AddChild(node, 0, EffectTestScene.kTagBackground);
CCSprite bg = new CCSprite(TestResource.s_back3);
node.AddChild(bg, 0);
bg.AnchorPoint = new CCPoint(0.5f, 0.5f);
bg.Position = new CCPoint(size.Width / 2, size.Height / 2);
CCSprite grossini = new CCSprite(TestResource.s_pPathSister2);
node.AddChild(grossini, 1);
grossini.Position = new CCPoint(x / 3, y / 2);
CCActionInterval sc = new CCScaleBy(2, 5);
CCFiniteTimeAction sc_back = sc.Reverse();
grossini.RunAction(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(sc, sc_back))));
//grossini.runAction(effect);
CCSprite tamara = new CCSprite(TestResource.s_pPathSister1);
node.AddChild(tamara, 1);
tamara.Position = new CCPoint(2 * x / 3, y / 2);
CCActionInterval sc2 = new CCScaleBy(2, 5);
CCFiniteTimeAction sc2_back = sc2.Reverse();
tamara.RunAction(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(sc2, sc2_back))));
CCLabelTTF label = new CCLabelTTF(EffectTestScene.effectsList[EffectTestScene.actionIdx], "arial", 32);
label.Position = new CCPoint(x / 2, y - 80);
AddChild(label);
label.Tag = EffectTestScene.kTagLabel;
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(size.Width / 2 - 100, 30);
item2.Position = new CCPoint(size.Width / 2, 30);
item3.Position = new CCPoint(size.Width / 2 + 100, 30);
AddChild(menu, 1);
Schedule(checkAnim);
}