本文整理汇总了C#中cocos2d.CCLabelTTF类的典型用法代码示例。如果您正苦于以下问题:C# CCLabelTTF类的具体用法?C# CCLabelTTF怎么用?C# CCLabelTTF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCLabelTTF类属于cocos2d命名空间,在下文中一共展示了CCLabelTTF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/** Creates a switch with a mask sprite, on/off sprites for on/off states, a thumb sprite and an on/off labels. */
public static CCControlSwitch Create(CCSprite maskSprite, CCSprite onSprite, CCSprite offSprite, CCSprite thumbSprite, CCLabelTTF onLabel,
CCLabelTTF offLabel)
{
var pRet = new CCControlSwitch();
pRet.InitWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel);
return pRet;
}
示例2: setDisplayValueLabel
public virtual void setDisplayValueLabel(CCLabelTTF var)
{
if (m_pDisplayValueLabel != var)
{
m_pDisplayValueLabel = var;
}
}
示例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 = 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);
}
示例4: 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);
}
示例5: TileDemo
public TileDemo()
{
base.isTouchEnabled = true;
CCSize s = CCDirector.sharedDirector().getWinSize();
m_label = CCLabelTTF.labelWithString("not", "Arial", 28);
addChild(m_label, 1);
m_label.position = new CCPoint(s.width / 2, s.height - 50);
string strSubtitle = subtitle();
if (strSubtitle == null)
{
CCLabelTTF l = CCLabelTTF.labelWithString(strSubtitle, "Arial", 16);
addChild(l, 1);
l.position = new CCPoint(s.width / 2, s.height - 80);
m_subtitle = l;
}
CCMenuItemImage item1 = CCMenuItemImage.itemFromNormalImage(s_pPathB1, s_pPathB2, this, backCallback);
CCMenuItemImage item2 = CCMenuItemImage.itemFromNormalImage(s_pPathR1, s_pPathR2, this, restartCallback);
CCMenuItemImage item3 = CCMenuItemImage.itemFromNormalImage(s_pPathF1, s_pPathF2, this, nextCallback);
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);
CCMenu menu = CCMenu.menuWithItems(item1, item2, item3);
menu.position = new CCPoint(0, 0);
addChild(menu, 1);
}
示例6: 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 = CCMenu.Create(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);
}
示例7: GameOverScene
public GameOverScene(bool isWin)
{
CCLayerColor colorLayer = CCLayerColor.layerWithColor(new ccColor4B(255, 255, 255, 255));
this.addChild(colorLayer);
CCSize winSize = CCDirector.sharedDirector().getWinSize();
string msg;
if (isWin)
msg = "YOU WIN";
else
msg = "YOU LOSE";
label = CCLabelTTF.labelWithString(msg, "Arial", 32);
label.Color = new ccColor3B(0, 0, 0);
label.position = new CCPoint(winSize.width / 2, winSize.height / 2 + 100);
this.addChild(label);
//this.runAction(CCSequence.actions(CCDelayTime.actionWithDuration(3), CCCallFunc.actionWithTarget(this, gameOverDone)));
var itemReplay = CCMenuItemImage.itemFromNormalImage(@"images/reload", @"images/reload", this, replay);
var itemMainMenu = CCMenuItemImage.itemFromNormalImage(@"images/mainmenu", @"images/mainmenu", this, mainmenu);
var itemNextLevel = CCMenuItemImage.itemFromNormalImage(@"images/nextlevel", @"images/nextlevel", this, nextlevel);
if (!isWin)
itemNextLevel.visible = false;
var menu = CCMenu.menuWithItems(itemReplay, itemMainMenu, itemNextLevel);
menu.alignItemsHorizontally();
menu.position = new CCPoint(winSize.width / 2, winSize.height / 2 - 100);
this.addChild(menu);
}
示例8: 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);
}
示例9: 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 strSubtitle = subtitle();
if (!string.IsNullOrEmpty(strSubtitle))
{
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 = CCMenu.Create(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);
}
示例10: 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);
}
示例11: TableCellAtIndex
public virtual CCTableViewCell TableCellAtIndex(CCTableView table, int idx)
{
string str = idx.ToString();
var cell = table.DequeueCell();
if (cell == null) {
cell = new CustomTableViewCell();
var sprite = new CCSprite("Images/Icon");
sprite.AnchorPoint = CCPoint.Zero;
sprite.Position = new CCPoint(0, 0);
cell.AddChild(sprite);
var label = new CCLabelTTF(str, "Helvetica", 20.0f);
label.Position = CCPoint.Zero;
label.AnchorPoint = CCPoint.Zero;
label.Tag = 123;
cell.AddChild(label);
}
else
{
var label = (CCLabelTTF)cell.GetChildByTag(123);
label.Label = (str);
}
return cell;
}
示例12: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize s = CCDirector.SharedDirector.WinSize;
CCLabelTTF label = new CCLabelTTF(title(), "arial", 18);
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", 22);
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);
CCLayerColor background = new CCLayerColor(new CCColor4B(255,0,0,255));
AddChild(background, -10);
}
示例13: Box2DTestLayer
public Box2DTestLayer()
{
TouchEnabled = true;
AccelerometerEnabled = true;
CCSize s = CCDirector.SharedDirector.WinSize;
// init physics
initPhysics();
// create reset button
createResetButton();
//Set up sprite
// Use batch node. Faster
_batch = CCSpriteBatchNode.Create("Images/blocks", 100);
m_pSpriteTexture = _batch.Texture;
AddChild(_batch, 0, kTagParentNode);
addNewSpriteAtPosition(new CCPoint(s.Width / 2, s.Height / 2));
CCLabelTTF label = new CCLabelTTF("Tap screen", "Marker Felt", 32);
AddChild(label, 0);
label.Color = new CCColor3B(0, 0, 255);
label.Position = new CCPoint(s.Width / 2, s.Height - 50);
ScheduleUpdate();
}
示例14: 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);
}
示例15: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCApplication.SharedApplication.GamePadButtonUpdate += _GamePadButtonDelegate;
CCApplication.SharedApplication.GamePadDPadUpdate += _GamePadDPadDelegate;
CCApplication.SharedApplication.GamePadStickUpdate += _GamePadStickDelegate;
CCApplication.SharedApplication.GamePadTriggerUpdate += _GamePadTriggerDelegate;
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);
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);
}