本文整理汇总了C#中CocosSharp.CCMenu.AlignItemsVertically方法的典型用法代码示例。如果您正苦于以下问题:C# CCMenu.AlignItemsVertically方法的具体用法?C# CCMenu.AlignItemsVertically怎么用?C# CCMenu.AlignItemsVertically使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CocosSharp.CCMenu
的用法示例。
在下文中一共展示了CCMenu.AlignItemsVertically方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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.AlignItemsVertically(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);
}
示例2: OnEnter
public override void OnEnter()
{
base.OnEnter();
// Testing empty menu
menu1 = new CCMenu();
menu2 = new CCMenu();
// Menu 1
var item1 = new CCMenuItemFont("Return to Main Menu", menuCallback);
var item2 = new CCMenuItemFont("Disable menu for 5 seconds", disableMenuCallback);
menu1.AddChild(item1);
menu1.AddChild(item2);
menu1.AlignItemsVertically(2);
AddChild(menu1);
// Menu 2
priority = true;
//CCMenuItemFont.setFontSize(48);
item1 = new CCMenuItemFont("Toggle priority", togglePriorityCallback);
item1.Scale = 1.5f;
item1.Color = new CCColor3B(0, 0, 255);
menu2.AddChild(item1);
AddChild(menu2);
}
示例3: OnEnter
public override void OnEnter()
{
base.OnEnter();
var s = Layer.VisibleBoundsWorldspace.Size;
var sprite = new CCSprite("Images/grossinis_sister1.png");
sprite.Position = VisibleBoundsWorldspace.Center;
AddChild(sprite);
sprite.RepeatForever(rotateBy);
// Add a menu item to resume the Scheduled actions.
CCMenuItemFont.FontSize = 32;
CCMenuItemFont.FontName = "MarkerFelt";
var menu = new CCMenu(
new CCMenuItemFont("Resume", resume)
);
menu.AlignItemsVertically(4);
menu.Position = new CCPoint(s.Width / 2, s.Height / 4);
AddChild(menu);
Schedule ();
Schedule (tick1, 0.5f);
Schedule (tick2, 1.0f);
Schedule (pause, 3.0f, 0, 0);
}
示例4: HighScoreLayer
public HighScoreLayer (int score): base()
{
currentScore = score;
var batchnode = GetChildByTag ((int)Tags.SpriteManager) as CCSpriteBatchNode;
var title = new CCSprite(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 Action<object>(delegate(object o) {
Director.ReplaceScene(new CCTransitionFade(.5f, GameLayer.Scene, new CCColor3B(255,255,255)));
}));
var button2 = new CCMenuItemImage("Images/changePlayerButton", "Images/changePlayerButton", new Action<object>(delegate (object sender) {
// do nothing
}));
var menu = new CCMenu(button1,button2);
menu.Position=new CCPoint(160,58);
menu.AlignItemsVertically(9);
AddChild (menu);
}
示例5: LabelTTFTest
public LabelTTFTest()
{
CCMenuItemFont.FontSize = 32;
CCMenuItemFont.FontName = "MarkerFelt";
menuLeft = new CCMenu(
new CCMenuItemFont("Left", setAlignmentLeft),
new CCMenuItemFont("Center", setAlignmentCenter),
new CCMenuItemFont("Right", setAlignmentRight)
);
menuLeft.AlignItemsVertically(4);
AddChild(menuLeft);
menuRight = new CCMenu(
new CCMenuItemFont("Top", setAlignmentTop),
new CCMenuItemFont("Middle", setAlignmentMiddle),
new CCMenuItemFont("Bottom", setAlignmentBottom)
);
menuRight.AlignItemsVertically(4);
AddChild(menuRight);
}
示例6: NodeToWorld3D
public NodeToWorld3D()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
parent = new CCNode();
parent.AnchorPoint = new CCPoint(0.5f, 0.5f);
AddChild(parent);
back = new CCSprite(TestResource.s_back3);
parent.AddChild(back, -10);
back.AnchorPoint = CCPoint.Zero;
var item = new CCMenuItemImage(TestResource.s_PlayNormal, TestResource.s_PlaySelect);
menu = new CCMenu(item);
menu.AlignItemsVertically();
back.AddChild(menu);
item.RepeatForever(CocosNodeTestStaticLibrary.nodeRotate);
back.RepeatForever(CocosNodeTestStaticLibrary.nodeMove, CocosNodeTestStaticLibrary.nodeMove.Reverse());
parent.RunAction (CocosNodeTestStaticLibrary.nodeOrbit);
}
示例7: reset
public void reset()
{
int localtag = 0;
localtag++;
// TO TRIGGER THE BUG:
// remove the itself from parent from an action
// The menu will be removed, but the instance will be alive
// and then a new node will be allocated occupying the memory.
// => CRASH BOOM BANG
CCNode node = GetChildByTag(localtag - 1);
CCLog.Log("Menu: %p", node);
RemoveChild(node, false);
// [self removeChildByTag:localtag-1 cleanup:NO];
CCMenuItem item1 = new CCMenuItemFont("One", menuCallback);
CCLog.Log("MenuItemFont: %p", item1);
CCMenuItem item2 = new CCMenuItemFont("Two", menuCallback);
CCMenu menu = new CCMenu(item1, item2);
menu.AlignItemsVertically();
float x = CCRandom.Next() * 50;
float y = CCRandom.Next() * 50;
menu.Position = menu.Position + new CCPoint(x, y);
AddChild(menu, 0, localtag);
//[self check:self];
}
示例8: MainMenuLayer
/// <summary>
///
/// </summary>
public MainMenuLayer()
{
Color = CCColor3B.White;
Opacity = 127;
Menu = new CCMenu
(
new CCMenuItemLabel(new Label("Retour", CCColor3B.Black), ComeBackToGame),
new CCMenuItemLabel(new Label("Quitter", CCColor3B.Black), LeaveGame)
);
Menu.AlignItemsVertically(MENU_ALIGN_PADDING);
}
示例9: SceneTestLayer1
public SceneTestLayer1()
{
CCMenuItemFont item1 = new CCMenuItemFont("(1) Test PushScene", onPushScene);
CCMenuItemFont item2 = new CCMenuItemFont("(1) Test PushScene w/Transition", onPushSceneTran);
CCMenuItemFont item3 = new CCMenuItemFont("(1) Quit", onQuit);
popMenuItem = new CCMenuItemFont("(1) Test PopScene w/Transition", onPopSceneTran);
theMenu = new CCMenu(item1, item2, item3, popMenuItem);
theMenu.AlignItemsVertically();
AddChild(theMenu);
CCSprite sprite = new CCSprite(SceneTestScene.grossini) { Tag = SceneTestScene.GROSSINI_TAG };
AddChild(sprite);
}
示例10: SceneTestLayer3
public SceneTestLayer3() : base(new CCColor4B(0, 0, 255, 255))
{
var item0 = new CCMenuItemFont("(3) Touch to pushScene (self)", item0Clicked);
var item1 = new CCMenuItemFont("(3) Touch to popScene", item1Clicked);
var item2 = new CCMenuItemFont("(3) Touch to popToRootScene", item2Clicked);
var item3 = new CCMenuItemFont("(3) Touch to popToSceneStackLevel(2)", item3Clicked);
CCMenu menu = new CCMenu(item0, item1, item2, item3);
menu.AlignItemsVertically();
AddChild(menu);
CCSprite sprite = new CCSprite(SceneTestScene.grossini) { Tag = SceneTestScene.GROSSINI_TAG};
AddChild(sprite);
}
示例11: SceneTestLayer2
public SceneTestLayer2()
{
m_timeCounter = 0;
CCMenuItemFont item1 = new CCMenuItemFont("(2) replaceScene", onReplaceScene);
CCMenuItemFont item2 = new CCMenuItemFont("(2) replaceScene w/transition", onReplaceSceneTran);
CCMenuItemFont item3 = new CCMenuItemFont("(2) Go Back", onGoBack);
popMenuItem = new CCMenuItemFont("(2) Test popScene w/transition", onPopSceneTran);
theMenu = new CCMenu(item1, item2, item3, popMenuItem);
theMenu.AlignItemsVertically();
AddChild(theMenu);
CCSprite sprite = new CCSprite(SceneTestScene.grossini) { Tag = SceneTestScene.GROSSINI_TAG };
AddChild(sprite);
}
示例12: AddedToScene
protected override void AddedToScene() {
base.AddedToScene();
var _menuPos = new CCPoint(Settings.ScreenSize.Center);
CCLabelTtf labelStartGame = GetMenuLabel("Start Game");
CCMenuItem itemStart = new CCMenuItemLabelTTF(labelStartGame, StartGame);
CCLabelTtf labelExit = GetMenuLabel("Exit Game");
CCMenuItem itemExit = new CCMenuItemLabelTTF(labelExit, ExitGame);
MainMenu = new CCMenu(itemStart, itemExit) {Position = _menuPos};
MainMenu.AlignItemsVertically(15);
AddChild(MainMenu);
}
示例13: AddedToScene
protected override void AddedToScene()
{
base.AddedToScene();
Scene.SceneResolutionPolicy = CCSceneResolutionPolicy.ShowAll;
var winSize = Window.WindowSizeInPixels;
var backgroundImage = new CCSprite("WoodRetroApple_iPad_HomeScreen.jpg");
backgroundImage.Position = new CCPoint(winSize.Width / 2, winSize.Height / 2);
_appScale = winSize.Height / backgroundImage.ContentSize.Height;
backgroundImage.ScaleX = _appScale;
backgroundImage.ScaleY = _appScale;
AddChild(backgroundImage, -2);
var monsters = new CCSprite("backgroundMonsters2.png");
monsters.Position = new CCPoint(winSize.Width / 2, winSize.Height / 2);
monsters.ScaleX = _appScale;
monsters.ScaleY = _appScale;
AddChild(monsters, -1);
var logo = new CCSprite("MonsterSmashing.png");
logo.Position = new CCPoint(winSize.Width/2, winSize.Height * 0.7f);
logo.Scale = _appScale;
AddChild(logo);
var startGameButtonImage = new CCMenuItemImage("play.png", "playSelected.png", obj =>
{
var transition = new CCTransitionFlipAngular(0.5f, MonsterRun.GameScene(Window), CCTransitionOrientation.DownOver);
Window.DefaultDirector.ReplaceScene(transition);
});
startGameButtonImage.Scale = _appScale;
_soundOn = new CCMenuItemImage("soundOn.png", "soundOnSelected.png");
_soundOff = new CCMenuItemImage("soundOff.png", "soundOffSelected.png");
var toggleItem = new CCMenuItemToggle(obj => {}, _soundOn, _soundOff);
toggleItem.Scale = _appScale;
var menu = new CCMenu(startGameButtonImage, toggleItem);
menu.Position = new CCPoint(winSize.Width * 0.5f, winSize.Height * 0.4f);
menu.AlignItemsVertically(15);
AddChild(menu);
}
示例14: Bug914Layer
public Bug914Layer()
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
// Register Touch Event
var touchListener = new CCEventListenerTouchAllAtOnce();
touchListener.OnTouchesBegan = onTouchesBegan;
touchListener.OnTouchesMoved = onTouchesMoved;
AddEventListener(touchListener);
// ask director the the window size
CCSize size = Layer.VisibleBoundsWorldspace.Size;
CCLayerColor layer;
for (int i = 0; i < 5; i++)
{
layer = new CCLayerColor(new CCColor4B((byte)(i*20), (byte)(i*20), (byte)(i*20),255));
layer.ContentSize = new CCSize(i * 100, i * 100);
layer.Position = new CCPoint(size.Width / 2, size.Height / 2);
layer.AnchorPoint = new CCPoint(0.5f, 0.5f);
layer.IgnoreAnchorPointForPosition = true;
AddChild(layer, -1 - i);
}
// create and initialize a Label
var label = new CCLabel("Hello World", "Marker Felt", 64, CCLabelFormat.SpriteFont);
CCMenuItem item1 = new CCMenuItemFont("restart", restart);
CCMenu menu = new CCMenu(item1);
menu.AlignItemsVertically();
menu.Position = new CCPoint(size.Width / 2, 100);
AddChild(menu);
// position the label on the center of the screen
label.Position = new CCPoint(size.Width / 2, size.Height / 2);
// add the label as a child to this Layer
AddChild(label);
}
示例15: LabelTTFTest
public LabelTTFTest()
{
var blockSize = new CCSize(200, 160);
var s = Layer.VisibleBoundsWorldspace.Size;
var colorLayer = new CCLayerColor(new CCColor4B(100, 100, 100, 255));
colorLayer.AnchorPoint = CCPoint.Zero;
colorLayer.Position = new CCPoint((s.Width - blockSize.Width) / 2, (s.Height - blockSize.Height) / 2);
AddChild(colorLayer);
CCMenuItemFont.FontSize = 32;
CCMenuItemFont.FontName = "MarkerFelt";
var menu = new CCMenu(
new CCMenuItemFont("Left", setAlignmentLeft),
new CCMenuItemFont("Center", setAlignmentCenter),
new CCMenuItemFont("Right", setAlignmentRight)
);
menu.AlignItemsVertically(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.AlignItemsVertically(4);
menu.Position = new CCPoint(s.Width - 50, s.Height / 2 - 20);
AddChild(menu);
m_plabel = null;
m_eHorizAlign = CCTextAlignment.Left;
m_eVertAlign = CCVerticalTextAlignment.Top;
updateAlignment();
}