本文整理汇总了C#中CocosSharp.CCMenu.RunAction方法的典型用法代码示例。如果您正苦于以下问题:C# CCMenu.RunAction方法的具体用法?C# CCMenu.RunAction怎么用?C# CCMenu.RunAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CocosSharp.CCMenu
的用法示例。
在下文中一共展示了CCMenu.RunAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuLayer1
public MenuLayer1()
{
// Register Touch Event
touchListener = new CCEventListenerTouchOneByOne();
touchListener.IsSwallowTouches = true;
touchListener.OnTouchBegan = onTouchBegan;
touchListener.OnTouchMoved = onTouchMoved;
touchListener.OnTouchEnded = onTouchEnded;
touchListener.OnTouchCancelled = onTouchCancelled;
AddEventListener(touchListener, 1);
// We do not have an HD version of the menuitemsprite so internally CocosSharp tries to convert our
// rectangle coordinates passed to work with HD images so the coordinates are off. We will just
// modify this here to make sure we have the correct sizes when they are passed.
CCSprite spriteNormal = new CCSprite(s_MenuItem, new CCRect(0, 23 * 2, 115, 23));
CCSprite spriteSelected = new CCSprite(s_MenuItem, new CCRect(0, 23 * 1, 115, 23));
CCSprite spriteDisabled = new CCSprite(s_MenuItem, new CCRect(0, 23 * 0, 115, 23));
var item1 = new CCMenuItemImage(spriteNormal, spriteSelected, spriteDisabled, this.menuCallback);
// Image Item
var item2 = new CCMenuItemImage(s_SendScore, s_PressSendScore, this.menuCallback2);
// Label Item (LabelAtlas)
var labelAtlas = new CCLabelAtlas("0123456789", "Images/fps_Images.png", 12, 32, '.');
var item3 = new CCMenuItemLabelAtlas(labelAtlas, this.menuCallbackDisabled);
item3.DisabledColor = new CCColor3B(32, 32, 64);
item3.Color = new CCColor3B(200, 200, 255);
// Font Item
CCMenuItemFont item4 = new CCMenuItemFont("I toggle enable items", (sender) =>
{
disabledItem.Enabled = !disabledItem.Enabled;
});
// Label Item (CCLabelBMFont)
CCLabelBMFont label = new CCLabelBMFont("configuration", "fonts/bitmapFontTest3.fnt");
CCMenuItemLabelBMFont item5 = new CCMenuItemLabelBMFont(label, this.menuCallbackConfig);
// Testing issue #500
item5.Scale = 0.8f;
CCMenuItemFont.FontSize = 30;
// Events
CCMenuItemFont item6 = new CCMenuItemFont("Priority Test", menuCallbackPriorityTest);
// Font Item
CCMenuItemFont item7 = new CCMenuItemFont("Quit", this.onQuit);
item7.RepeatForever(color_action, color_action.Reverse());
menu = new CCMenu(item1, item2, item3, item4, item5, item6, item7);
menu.AlignItemsVertically();
disabledItem = item3;
disabledItem.Enabled = false;
AddChild(menu);
menu.Scale = 0;
menu.RunAction(new CCScaleTo(1, 1));
}
示例2: AddedToScene
protected override void AddedToScene()
{
base.AddedToScene();
// We do not have an HD version of the menuitemsprite so internally CocosSharp tries to convert our
// rectangle coordinates passed to work with HD images so the coordinates are off. We will just
// modify this here to make sure we have the correct sizes when they are passed.
var spriteNormal = new CCSprite(s_MenuItem, new CCRect(0, 23 * 2, 115, 23));
var spriteSelected = new CCSprite(s_MenuItem, new CCRect(0, 23 * 1, 115, 23));
var spriteDisabled = new CCSprite(s_MenuItem, new CCRect(0, 23 * 0, 115, 23));
var item1 = new CCMenuItemImage(spriteNormal, spriteSelected, spriteDisabled, this.menuCallback);
// Image Item
var item2 = new CCMenuItemImage(s_SendScore, s_PressSendScore, this.menuCallback2);
// Label Item (LabelAtlas)
var labelAtlas = new CCLabelAtlas("0123456789", "Images/fps_Images.png", 12, 32, '.');
var item3 = new CCMenuItemLabelAtlas(labelAtlas, this.menuCallbackDisabled);
item3.DisabledColor = new CCColor3B(32, 32, 64);
item3.Color = new CCColor3B(200, 200, 255);
// Font Item
var item4 = new CCMenuItemFont("I toggle enable items", (sender) =>
{
disabledItem.Enabled = !disabledItem.Enabled;
});
// Label Item (CCLabelBMFont)
var label = new CCLabel("configuration", "fonts/bitmapFontTest3.fnt");
var item5 = new CCMenuItemLabel(label, this.menuCallbackConfig);
// Testing issue #500
item5.Scale = 0.8f;
CCMenuItemFont.FontSize = 30;
// Events
var item6 = new CCMenuItemFont("Priority Test", menuCallbackPriorityTest);
// Font Item
var item7 = new CCMenuItemFont("Quit", this.onQuit);
item7.RepeatForever(color_action, color_action.Reverse());
menu = new CCMenu(item1, item2, item3, item4, item5, item6, item7);
menu.AlignItemsVertically();
disabledItem = item3;
disabledItem.Enabled = false;
AddChild(menu);
menu.Scale = 0;
menu.RunAction(new CCScaleTo(1, 1));
// elastic effect
var s = Layer.VisibleBoundsWorldspace.Size;
int i = 0;
CCNode child;
var pArray = menu.Children;
object pObject = null;
if (pArray.Count > 0)
{
for (int j = 0; j < pArray.Count; j++)
{
pObject = pArray[j];
if (pObject == null)
break;
child = (CCNode) pObject;
CCPoint dstPoint = child.Position;
int offset = (int) (s.Width / 2 + 50);
if (i % 2 == 0)
offset = -offset;
child.Position = new CCPoint(dstPoint.X + offset, dstPoint.Y);
child.RunAction(new CCEaseElasticOut(new CCMoveBy(2, new CCPoint(dstPoint.X - offset, 0)), 0.35f));
i++;
}
}
}