本文整理汇总了C#中Cocos2D.CCMenu类的典型用法代码示例。如果您正苦于以下问题:C# CCMenu类的具体用法?C# CCMenu怎么用?C# CCMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCMenu类属于Cocos2D命名空间,在下文中一共展示了CCMenu类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.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);
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:28,代码来源:MenuLayerPriorityTest.cs
示例2: 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);
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:33,代码来源:EaseActionsTest.cs
示例3: 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);
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:31,代码来源:Layertest.cs
示例4: 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];
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:29,代码来源:Bug422Layer.cs
示例5: OnEnter
public override void OnEnter()
{
base.OnEnter();
var s = CCDirector.SharedDirector.WinSize;
CCMenuItemFont.FontName = "arial";
CCMenuItemFont.FontSize = 24;
var pMainItem = new CCMenuItemFont("Back", toMainLayer);
pMainItem.Position = new CCPoint(s.Width - 50, 25);
var pMenu = new CCMenu(pMainItem);
pMenu.Position = new CCPoint(0, 0);
if (m_bControlMenuVisible)
{
var item1 = new CCMenuItemImage("Images/b1", "Images/b2", backCallback);
var item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback);
var item3 = new CCMenuItemImage("Images/f1", "Images/f2", 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);
pMenu.AddChild(item1, PerformanceTestScene.kItemTagBasic);
pMenu.AddChild(item2, PerformanceTestScene.kItemTagBasic);
pMenu.AddChild(item3, PerformanceTestScene.kItemTagBasic);
}
AddChild(pMenu);
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:28,代码来源:PerformBasicLayer.cs
示例6: Init
public override bool Init()
{
InitWithColor(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);
CCSize s = CCDirector.SharedDirector.WinSize;
CCSprite sprite = new CCSprite(s_pPathGrossini);
AddChild(sprite);
sprite.Position = new CCPoint(s.Width /2, 40);
CCActionInterval rotate = new CCRotateBy (2, 360);
CCAction repeat = new CCRepeatForever (rotate);
sprite.RunAction(repeat);
Schedule(testDealloc);
return true;
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:27,代码来源:SceneTestLayer3.cs
示例7: Init
public override bool Init()
{
if (!base.Init())
return false;
var winSize = CCDirector.SharedDirector.WinSize;
var tableView = new CCTableView(this, new CCSize(250, 60));
tableView.Direction = CCScrollViewDirection.Horizontal;
tableView.Position = new CCPoint(20,winSize.Height/2-30);
tableView.Delegate = this;
this.AddChild(tableView);
tableView.ReloadData();
tableView = new CCTableView(this, new CCSize(60, 280));
tableView.Direction = CCScrollViewDirection.Vertical;
tableView.Position = new CCPoint(winSize.Width - 150, winSize.Height/2 - 120);
tableView.Delegate = this;
tableView.VerticalFillOrder = CCTableViewVerticalFillOrder.FillTopDown;
this.AddChild(tableView);
tableView.ReloadData();
// Back Menu
var itemBack = new CCMenuItemFont("Back", toExtensionsMainLayer);
itemBack.Position = new CCPoint(winSize.Width - 50, 25);
var menuBack = new CCMenu(itemBack);
menuBack.Position = CCPoint.Zero;
AddChild(menuBack);
return true;
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:31,代码来源:TableViewTestScene.cs
示例8: 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);
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:27,代码来源:HighScoreLayer.cs
示例9: NodeToWorld
public NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite back = new CCSprite(TestResource.s_back3);
AddChild(back, -10);
back.AnchorPoint = (new CCPoint(0, 0));
CCSize backSize = back.ContentSize;
CCMenuItem item = new CCMenuItemImage(TestResource.s_PlayNormal, TestResource.s_PlaySelect);
CCMenu menu = new CCMenu(item);
menu.AlignItemsVertically();
menu.Position = (new CCPoint(backSize.Width / 2, backSize.Height / 2));
back.AddChild(menu);
CCActionInterval rot = new CCRotateBy (5, 360);
CCAction fe = new CCRepeatForever (rot);
item.RunAction(fe);
CCActionInterval move = new CCMoveBy (3, new CCPoint(200, 0));
var move_back = (CCActionInterval) move.Reverse();
CCFiniteTimeAction seq = new CCSequence(move, move_back);
CCAction fe2 = new CCRepeatForever ((CCActionInterval) seq);
back.RunAction(fe2);
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:28,代码来源:NodeToWorld.cs
示例10: 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;
}
开发者ID:pekayatt,项目名称:cocos2d-xna,代码行数:33,代码来源:DrawPrimitivesTest.cs
示例11: 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);
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:32,代码来源:SpriteTestDemo.cs
示例12: 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);
}
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:30,代码来源:TextInputTest.cs
示例13: Init
public override bool Init()
{
if (base.Init())
{
CCSize s = CCDirector.SharedDirector.WinSize;
CCLayerColor background = new CCLayerColor(new CCColor4B(255, 0, 255, 255));
AddChild(background);
CCLayerColor sprite_a = new CCLayerColor(new CCColor4B(255, 0, 0, 255), 700, 700);
sprite_a.AnchorPoint = new CCPoint(0.5f, 0.5f);
sprite_a.IgnoreAnchorPointForPosition = true;
sprite_a.Position = new CCPoint(0.0f, s.Height / 2);
AddChild(sprite_a);
sprite_a.RunAction(new CCRepeatForever ((CCActionInterval)new CCSequence(
new CCMoveTo (1.0f, new CCPoint(1024.0f, 384.0f)),
new CCMoveTo (1.0f, new CCPoint(0.0f, 384.0f)))));
CCLayerColor sprite_b = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 400, 400);
sprite_b.AnchorPoint = new CCPoint(0.5f, 0.5f);
sprite_b.IgnoreAnchorPointForPosition = true;
sprite_b.Position = new CCPoint(s.Width / 2, s.Height / 2);
AddChild(sprite_b);
CCMenuItemLabel label = new CCMenuItemLabel(new CCLabelTTF("Flip Me", "Helvetica", 24), callBack);
CCMenu menu = new CCMenu(label);
menu.Position = new CCPoint(s.Width - 200.0f, 50.0f);
AddChild(menu);
return true;
}
return false;
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:35,代码来源:Bug1159Layer.cs
示例14: 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;
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:32,代码来源:Bug-458.cs
示例15: 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);
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:32,代码来源:LabelTest.cs
示例16: IntervalLayer
public IntervalLayer()
{
m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f;
CCSize s = CCDirector.SharedDirector.WinSize;
// sun
CCParticleSystem sun = new CCParticleSun();
sun.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
sun.Position = (new CCPoint(s.Width - 32, s.Height - 32));
sun.TotalParticles = 130;
sun.Life = (0.6f);
AddChild(sun);
// timers
m_label0 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
m_label1 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
m_label2 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
m_label3 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
m_label4 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
ScheduleUpdate();
Schedule(step1);
Schedule(step2, 0);
Schedule(step3, 1.0f);
Schedule(step4, 2.0f);
m_label0.Position = new CCPoint(s.Width * 1 / 6, s.Height / 2);
m_label1.Position = new CCPoint(s.Width * 2 / 6, s.Height / 2);
m_label2.Position = new CCPoint(s.Width * 3 / 6, s.Height / 2);
m_label3.Position = new CCPoint(s.Width * 4 / 6, s.Height / 2);
m_label4.Position = new CCPoint(s.Width * 5 / 6, s.Height / 2);
AddChild(m_label0);
AddChild(m_label1);
AddChild(m_label2);
AddChild(m_label3);
AddChild(m_label4);
// Sprite
CCSprite sprite = new CCSprite(s_pPathGrossini);
sprite.Position = new CCPoint(40, 50);
CCJumpBy jump = new CCJumpBy (3, new CCPoint(s.Width - 80, 0), 50, 4);
AddChild(sprite);
sprite.RunAction(new CCRepeatForever (
(CCActionInterval) (new CCSequence(jump, jump.Reverse())))
);
// pause button
CCMenuItem item1 = new CCMenuItemFont("Pause", onPause);
CCMenu menu = new CCMenu(item1);
menu.Position = new CCPoint(s.Width / 2, s.Height - 50);
AddChild(menu);
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:59,代码来源:IntervalLayer.cs
示例17: 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);
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:57,代码来源:TextLayer.cs
示例18: OnEnter
public override void OnEnter()
{
base.OnEnter();
float x, y;
CCSize size = CCDirector.SharedDirector.WinSize;
x = size.Width;
y = size.Height;
CCSprite bg = new CCSprite("Images/background3");
AddChild(bg, 0, EffectAdvanceScene.kTagBackground);
bg.Position = new CCPoint(x / 2, y / 2);
grossini = new CCSprite("Images/grossinis_sister2");
bg.AddChild(grossini, 1, EffectAdvanceScene.kTagSprite1);
grossini.Position = new CCPoint(x / 3.0f, 200);
CCActionInterval sc = new CCScaleBy(2, 5);
CCFiniteTimeAction sc_back = sc.Reverse();
grossini.RunAction(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(sc, sc_back))));
tamara = new CCSprite("Images/grossinis_sister1");
bg.AddChild(tamara, 1, EffectAdvanceScene.kTagSprite2);
tamara.Position = new CCPoint(2 * x / 3.0f, 200);
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(title(), "arial", 28);
label.Position = new CCPoint(x / 2, y - 80);
AddChild(label);
label.Tag = EffectAdvanceScene.kTagLabel;
string strSubtitle = subtitle();
if (strSubtitle != null)
{
CCLabelTTF l = new CCLabelTTF(strSubtitle, "arial", 16);
AddChild(l, 101);
l.Position = new CCPoint(size.Width / 2, size.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(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);
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:55,代码来源:EffectAdvanceTextLayer.cs
示例19: Init
public override bool Init()
{
if (base.Init())
{
// Get the sceensize
CCSize screensize = CCDirector.SharedDirector.WinSize;
var pBackItem = new CCMenuItemFont("Back", toExtensionsMainLayer);
pBackItem.Position = new CCPoint(screensize.Width - 50, 25);
var pBackMenu = new CCMenu(pBackItem);
pBackMenu.Position = CCPoint.Zero;
AddChild(pBackMenu, 10);
// Add the generated background
var background = new CCSprite("extensions/background");
background.Position = new CCPoint(screensize.Width / 2, screensize.Height / 2);
AddChild(background);
// Add the ribbon
var ribbon = new CCScale9SpriteFile("extensions/ribbon", new CCRect(1, 1, 48, 55));
ribbon.ContentSize = new CCSize(screensize.Width, 57);
ribbon.Position = new CCPoint(screensize.Width / 2.0f, screensize.Height - ribbon.ContentSize.Height / 2.0f);
AddChild(ribbon);
// Add the title
setSceneTitleLabel(new CCLabelTTF(" ", "Arial", 12));
m_pSceneTitleLabel.Position = new CCPoint(screensize.Width / 2, screensize.Height - m_pSceneTitleLabel.ContentSize.Height / 2 - 5);
AddChild(m_pSceneTitleLabel, 1);
// Add the subtitle
setSceneSubtitleLabel(new CCLabelTTF(" ", "Arial", 12));
m_pSceneSubtitleLabel.Position = new CCPoint(screensize.Width / 2,
screensize.Height - m_pSceneTitleLabel.ContentSize.Height -
m_pSceneSubtitleLabel.ContentSize.Height / 2 - 10);
AddChild(m_pSceneSubtitleLabel, 1);
// Add the menu
var item1 = new CCMenuItemImage("Images/b1", "Images/b2", previousCallback);
var item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback);
var item3 = new CCMenuItemImage("Images/f1", "Images/f2", nextCallback);
var menu = new CCMenu(item1, item3, item2);
menu.Position = CCPoint.Zero;
item1.Position = new CCPoint(screensize.Width / 2 - 100, 37);
item2.Position = new CCPoint(screensize.Width / 2, 35);
item3.Position = new CCPoint(screensize.Width / 2 + 100, 37);
AddChild(menu, 1);
return true;
}
return false;
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:54,代码来源:CCControlScene.cs
示例20: TextLayer
public TextLayer()
{
InitWithColor(CCTypes.CreateColor(32, 32, 32, 255));
var node = new CCNode();
CCActionInterval effect = getAction();
node.RunAction(effect);
AddChild(node, 0, EffectTestScene.kTagBackground);
var bg = new CCSprite(TestResource.s_back3);
node.AddChild(bg, 0);
bg.AnchorPoint = new CCPoint(0.5f, 0.5f);
bg.Position = CCVisibleRect.Center;
var grossini = new CCSprite(TestResource.s_pPathSister2);
node.AddChild(grossini, 1);
grossini.Position = new CCPoint(CCVisibleRect.Left.X + CCVisibleRect.VisibleRect.Size.Width / 3,
CCVisibleRect.Center.Y);
CCActionInterval sc = new CCScaleBy(2, 5);
CCFiniteTimeAction sc_back = sc.Reverse();
grossini.RunAction(new CCRepeatForever((new CCSequence(sc, sc_back))));
var tamara = new CCSprite(TestResource.s_pPathSister1);
node.AddChild(tamara, 1);
tamara.Position = new CCPoint(CCVisibleRect.Left.X + 2 * CCVisibleRect.VisibleRect.Size.Width / 3,
CCVisibleRect.Center.Y);
CCActionInterval sc2 = new CCScaleBy(2, 5);
CCFiniteTimeAction sc2_back = sc2.Reverse();
tamara.RunAction(new CCRepeatForever((new CCSequence(sc2, sc2_back))));
var label = new CCLabelTTF(EffectTestScene.effectsList[EffectTestScene.actionIdx], "arial", 32);
label.Position = new CCPoint(CCVisibleRect.Center.X, CCVisibleRect.Top.Y - 80);
AddChild(label);
label.Tag = EffectTestScene.kTagLabel;
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(CCVisibleRect.Center.X - item2.ContentSize.Width * 2,
CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2);
item2.Position = new CCPoint(CCVisibleRect.Center.X, CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2);
item3.Position = new CCPoint(CCVisibleRect.Center.X + item2.ContentSize.Width * 2,
CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2);
AddChild(menu, 1);
Schedule(checkAnim);
}
开发者ID:womandroid,项目名称:cocos2d-xna,代码行数:53,代码来源:TextLayer.cs
注:本文中的Cocos2D.CCMenu类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论