本文整理汇总了C#中Cocos2D.CCMenu.AlignItemsVerticallyWithPadding方法的典型用法代码示例。如果您正苦于以下问题:C# CCMenu.AlignItemsVerticallyWithPadding方法的具体用法?C# CCMenu.AlignItemsVerticallyWithPadding怎么用?C# CCMenu.AlignItemsVerticallyWithPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cocos2D.CCMenu
的用法示例。
在下文中一共展示了CCMenu.AlignItemsVerticallyWithPadding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HighScoreLayer
public HighScoreLayer (int score): base()
{
currentScore = score;
var batchnode = GetChildByTag ((int)Tags.SpriteManager) as CCSpriteBatchNode;
var title = CCSprite.Create(batchnode.Texture,new CCRect(608,192,225,57));
title.Position=new CCPoint(160,240);
batchnode.AddChild (title);
var button1 = new CCMenuItemImage("Images/playAgainButton", "Images/playAgainButton",
new SEL_MenuHandler((sender)=>{
CCDirector.SharedDirector.ReplaceScene(CCTransitionFade.Create(.5f, GameLayer.Scene, new CCColor3B(255,255,255)));
}));
var button2 = new CCMenuItemImage("Images/changePlayerButton", "Images/changePlayerButton", new SEL_MenuHandler((sender)=>{
// do nothing
}));
var menu = new CCMenu(button1,button2);
menu.Position=new CCPoint(160,58);
menu.AlignItemsVerticallyWithPadding(9);
AddChild (menu);
}
示例2: MenuLayerPriorityTest
public MenuLayerPriorityTest()
{
// Testing empty menu
m_pMenu1 = new CCMenu();
m_pMenu2 = new CCMenu();
// Menu 1
CCMenuItemFont item1 = new CCMenuItemFont("Return to Main Menu", menuCallback);
CCMenuItemFont item2 = new CCMenuItemFont("Disable menu for 5 seconds", disableMenuCallback);
m_pMenu1.AddChild(item1);
m_pMenu1.AddChild(item2);
m_pMenu1.AlignItemsVerticallyWithPadding(2);
AddChild(m_pMenu1);
// Menu 2
m_bPriority = true;
//CCMenuItemFont.setFontSize(48);
item1 = new CCMenuItemFont("Toggle priority", togglePriorityCallback);
item1.Scale = 1.5f;
item1.Color = new CCColor3B(0, 0, 255);
m_pMenu2.AddChild(item1);
AddChild(m_pMenu2);
}
示例3: Init
public override bool Init()
{
if (base.Init())
{
// ask director the the window size
CCSize size = CCDirector.SharedDirector.WinSize;
QuestionContainerSprite question = new QuestionContainerSprite();
QuestionContainerSprite question2 = new QuestionContainerSprite();
question.Init();
question2.Init();
// [question setContentSize:CGSizeMake(50,50)];
// [question2 setContentSize:CGSizeMake(50,50)];
CCMenuItemSprite sprite = new CCMenuItemSprite(question2, question, this, selectAnswer);
CCLayerColor layer = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 100, 100);
CCLayerColor layer2 = new CCLayerColor(new CCColor4B(255, 0, 0, 255), 100, 100);
CCMenuItemSprite sprite2 = new CCMenuItemSprite(layer, layer2, this, selectAnswer);
CCMenu menu = new CCMenu(sprite, sprite2, null);
menu.AlignItemsVerticallyWithPadding(100);
menu.Position = new CCPoint(size.Width / 2, size.Height / 2);
// add the label as a child to this Layer
AddChild(menu);
return true;
}
return false;
}
示例4: LabelTTFTest
public LabelTTFTest()
{
var blockSize = new CCSize(200, 160);
CCSize s = CCDirector.SharedDirector.WinSize;
CCLayerColor colorLayer = new CCLayerColor(new CCColor4B(100, 100, 100, 255), blockSize.Width, blockSize.Height);
colorLayer.AnchorPoint = new CCPoint(0, 0);
colorLayer.Position = new CCPoint((s.Width - blockSize.Width) / 2, (s.Height - blockSize.Height) / 2);
AddChild(colorLayer);
CCMenuItemFont.FontSize = 30;
CCMenu menu = new CCMenu(
new CCMenuItemFont("Left", setAlignmentLeft),
new CCMenuItemFont("Center", setAlignmentCenter),
new CCMenuItemFont("Right", setAlignmentRight)
);
menu.AlignItemsVerticallyWithPadding(4);
menu.Position = new CCPoint(50, s.Height / 2 - 20);
AddChild(menu);
menu = new CCMenu(
new CCMenuItemFont("Top", setAlignmentTop),
new CCMenuItemFont("Middle", setAlignmentMiddle),
new CCMenuItemFont("Bottom", setAlignmentBottom)
);
menu.AlignItemsVerticallyWithPadding(4);
menu.Position = new CCPoint(s.Width - 50, s.Height / 2 - 20);
AddChild(menu);
m_plabel = null;
m_eHorizAlign = CCTextAlignment.CCTextAlignmentLeft;
m_eVertAlign = CCVerticalTextAlignment.CCVerticalTextAlignmentTop;
updateAlignment();
}