本文整理汇总了C#中Cocos2D.CCMenu.AlignItemsHorizontally方法的典型用法代码示例。如果您正苦于以下问题:C# CCMenu.AlignItemsHorizontally方法的具体用法?C# CCMenu.AlignItemsHorizontally怎么用?C# CCMenu.AlignItemsHorizontally使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cocos2D.CCMenu
的用法示例。
在下文中一共展示了CCMenu.AlignItemsHorizontally方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initWithQuantityOfNodes
public virtual void initWithQuantityOfNodes(int nNodes)
{
//srand(time());
CCSize s = CCDirector.SharedDirector.WinSize;
// Title
CCLabelTTF label = new CCLabelTTF(title(), "arial", 32);
AddChild(label, 1);
label.Position = new CCPoint(s.Width / 2, s.Height - 32);
label.Color = new CCColor3B(255, 255, 40);
// Subtitle
string strSubTitle = subtitle();
if (strSubTitle.Length > 0)
{
CCLabelTTF l = new CCLabelTTF(strSubTitle, "arial", 16);
AddChild(l, 1);
l.Position = new CCPoint(s.Width / 2, s.Height - 80);
}
lastRenderedCount = 0;
currentQuantityOfNodes = 0;
quantityOfNodes = nNodes;
CCMenuItemFont.FontSize = 64;
CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);
decrease.Color = new CCColor3B(0, 200, 20);
CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);
increase.Color = new CCColor3B(0, 200, 20);
CCMenu menu = new CCMenu(decrease, increase);
menu.AlignItemsHorizontally();
menu.Position = new CCPoint(s.Width / 2, s.Height / 2 + 15);
AddChild(menu, 1);
CCLabelTTF infoLabel = new CCLabelTTF("0 nodes", "arial", 30);
infoLabel.Color = new CCColor3B(0, 200, 20);
infoLabel.Position = new CCPoint(s.Width / 2, s.Height / 2 - 15);
AddChild(infoLabel, 1, PerformanceNodeChildrenTest.kTagInfoLayer);
NodeChildrenMenuLayer pMenu = new NodeChildrenMenuLayer(true, PerformanceNodeChildrenTest.TEST_COUNT, PerformanceNodeChildrenTest.s_nCurCase);
AddChild(pMenu);
updateQuantityLabel();
updateQuantityOfNodes();
}
示例2: initWithSubTest
public void initWithSubTest(int asubtest, int nNodes)
{
//srandom(0);
subtestNumber = asubtest;
m_pSubTest = new SubTest();
m_pSubTest.initWithSubTest(asubtest, this);
CCSize s = CCDirector.SharedDirector.WinSize;
lastRenderedCount = 0;
quantityNodes = 0;
CCMenuItemFont.FontSize = 64;
CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);
decrease.Color = new CCColor3B(0, 200, 20);
CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);
increase.Color = new CCColor3B(0, 200, 20);
CCMenu menu = new CCMenu(decrease, increase);
menu.AlignItemsHorizontally();
menu.Position = new CCPoint(s.Width / 2, s.Height - 65);
AddChild(menu, 1);
CCLabelTTF infoLabel = new CCLabelTTF("0 nodes", "Marker Felt", 30);
infoLabel.Color = new CCColor3B(0, 200, 20);
infoLabel.Position = new CCPoint(s.Width / 2, s.Height - 90);
AddChild(infoLabel, 1, PerformanceSpriteTest.kTagInfoLayer);
// add menu
SpriteMenuLayer pMenu = new SpriteMenuLayer(true, PerformanceSpriteTest.TEST_COUNT, PerformanceSpriteTest.s_nSpriteCurCase);
AddChild(pMenu, 1, PerformanceSpriteTest.kTagMenuLayer);
// Sub Tests
CCMenuItemFont.FontSize = 32;
CCMenu pSubMenu = new CCMenu(null);
for (int i = 1; i <= 9; ++i)
{
//char str[10] = {0};
var str = string.Format("{0}", i);
CCMenuItemFont itemFont = new CCMenuItemFont(str, testNCallback);
itemFont.Tag = i;
pSubMenu.AddChild(itemFont, 10);
if (i <= 3)
itemFont.Color = new CCColor3B(200, 20, 20);
else if (i <= 6)
itemFont.Color = new CCColor3B(0, 200, 20);
else
itemFont.Color = new CCColor3B(0, 20, 200);
}
pSubMenu.AlignItemsHorizontally();
pSubMenu.Position = new CCPoint(s.Width / 2, 80);
AddChild(pSubMenu, 2);
// add title label
CCLabelTTF label = new CCLabelTTF(title(), "arial", 38);
AddChild(label, 1);
label.Position = new CCPoint(s.Width / 2, s.Height - 32);
label.Color = new CCColor3B(255, 255, 40);
while (quantityNodes < nNodes)
onIncrease(this);
}
示例3: initWithSubTest
public virtual void initWithSubTest(int asubtest, int particles)
{
//srandom(0);
subtestNumber = asubtest;
CCSize s = CCDirector.SharedDirector.WinSize;
lastRenderedCount = 0;
quantityParticles = particles;
CCMenuItemFont.FontSize = 64;
CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);
decrease.Color = new CCColor3B(0, 200, 20);
CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);
increase.Color = new CCColor3B(0, 200, 20);
CCMenu menu = new CCMenu(decrease, increase);
menu.AlignItemsHorizontally();
menu.Position = new CCPoint(s.Width / 2, s.Height / 2 + 15);
AddChild(menu, 1);
CCLabelTTF infoLabel = new CCLabelTTF("0 nodes", "Marker Felt", 30);
infoLabel.Color = new CCColor3B(0, 200, 20);
infoLabel.Position = new CCPoint(s.Width / 2, s.Height - 90);
AddChild(infoLabel, 1, PerformanceParticleTest.kTagInfoLayer);
// particles on stage
CCLabelAtlas labelAtlas = new CCLabelAtlas("0000", "Images/fps_Images", 16, 24, '.');
AddChild(labelAtlas, 0, PerformanceParticleTest.kTagLabelAtlas);
labelAtlas.Position = new CCPoint(s.Width - 66, 50);
// Next Prev Test
ParticleMenuLayer pMenu = new ParticleMenuLayer(true, PerformanceParticleTest.TEST_COUNT, PerformanceParticleTest.s_nParCurIdx);
AddChild(pMenu, 1, PerformanceParticleTest.kTagMenuLayer);
// Sub Tests
CCMenuItemFont.FontSize = 38;
CCMenu pSubMenu = new CCMenu(null);
for (int i = 1; i <= 6; ++i)
{
//char str[10] = {0};
string str;
//sprintf(str, "%d ", i);
str = string.Format("{0:G}", i);
CCMenuItemFont itemFont = new CCMenuItemFont(str, testNCallback);
itemFont.Tag = i;
pSubMenu.AddChild(itemFont, 10);
if (i <= 3)
{
itemFont.Color = new CCColor3B(200, 20, 20);
}
else
{
itemFont.Color = new CCColor3B(0, 200, 20);
}
}
pSubMenu.AlignItemsHorizontally();
pSubMenu.Position = new CCPoint(s.Width / 2, 80);
AddChild(pSubMenu, 2);
CCLabelTTF label = new CCLabelTTF(title(), "arial", 38);
AddChild(label, 1);
label.Position = new CCPoint(s.Width / 2, s.Height - 32);
label.Color = new CCColor3B(255, 255, 40);
updateQuantityLabel();
createParticleSystem();
Schedule(step);
}