当前位置: 首页>>代码示例>>C#>>正文


C# Button.addEventListener方法代码示例

本文整理汇总了C#中Button.addEventListener方法的典型用法代码示例。如果您正苦于以下问题:C# Button.addEventListener方法的具体用法?C# Button.addEventListener怎么用?C# Button.addEventListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Button的用法示例。


在下文中一共展示了Button.addEventListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Scene

    public Scene()
    {
        // the main menu listens for TRIGGERED events, so we just need to add the button.
        // (the event will bubble up when it's dispatched.)

        var mBackButton = new Button( new Image(Game.assets.getTexture("button_back")), "Back", null, Game.textFormat);
        mBackButton.x = 320 - mBackButton.width / 2;
        mBackButton.y = 960 - mBackButton.height + 1;
        mBackButton.name = "backButton";
        mBackButton.addEventListener(Button.BUTTON_CLICKED, onButtonTriggered);
        addChild(mBackButton);
    }
开发者ID:crl,项目名称:UniStarling,代码行数:12,代码来源:Scene.cs

示例2: MainMenu

    //private TextField txt;
    public MainMenu()
    {
        logo = new Image( Game.assets.getTexture("logo") );
        addChild(logo);

        var scenesToCreate = new List<String>{
            "Textures",
            "Multitouch",
            "TextFields",
            "Animations",
            //"Custom hit-test",
            "Movie Clip",
            //"Filters",
            "Blend Modes",
            //"Render Texture",
            "Clipping",
            "Benchmark"
        };

        var buttonTexture = Game.assets.getTexture("button_medium");
        var count = 0;

        foreach (var sceneToCreate in scenesToCreate)
        {
            var sceneTitle = sceneToCreate;

            var button = new Button( new Image(buttonTexture), sceneTitle, null, Game.textFormat);
            button.x = count % 2 == 0 ? 56 : 334;
            button.y = 310 + (count / 2) * 92;
            button.name = sceneTitle;
            button.addEventListener(Button.BUTTON_CLICKED, onButtonTriggered);
            addChild(button);

            if (scenesToCreate.Count % 2 != 0 && count % 2 == 1)
                button.y += 48;

            ++count;
        }

        BitmapTextField bmpTxt = new BitmapTextField( );
        bmpTxt.width = 500;
        bmpTxt.height = 200;
        bmpTxt.textFormat = Game.textFormat;
        bmpTxt.text = "uniStarling Demo App";
        bmpTxt.y = 900;
        bmpTxt.x = 56;
        addChild( bmpTxt );
    }
开发者ID:crl,项目名称:UniStarling,代码行数:49,代码来源:MainMenu.cs

示例3: BenchmarkScene

    public BenchmarkScene()
    {
        // the container will hold all test objects
        mContainer = new Sprite();
        mContainer.mouseEnabled = false;
        mContainer.mouseChildrenEnabled = false;
        //mContainer.touchable = false; // we do not need touch events on the test objects --
                                      // thus, it is more efficient to disable them.
        addChildAt(mContainer, 0);

        mStartButton = new Button(new Image(Game.assets.getTexture("button_normal")), "Start benchmark", null, Game.textFormat);
        mStartButton.addEventListener(Button.BUTTON_CLICKED, onStartButtonTriggered);
        mStartButton.x = 320f - mStartButton.width / 2f;
        mStartButton.y = 40f;
        addChild(mStartButton);

        mStarted = false;
        mElapsed = 0.0f;

        addEventListener(CEvent.ENTER_FRAME, onEnterFrame);
    }
开发者ID:crl,项目名称:UniStarling,代码行数:21,代码来源:BenchmarkScene.cs

示例4: AnimationScene

    public AnimationScene()
        : base()
    {
        mTransitions = new List<String>();
        mTransitions.Add(Transitions.LINEAR);
        mTransitions.Add(Transitions.EASE_IN_OUT);
        mTransitions.Add(Transitions.EASE_OUT_BACK);
        mTransitions.Add(Transitions.EASE_OUT_BOUNCE);
        mTransitions.Add(Transitions.EASE_OUT_ELASTIC);

        var buttonTexture = Game.assets.getTexture("button_normal");

        // create a button that starts the tween
        mStartButton = new Button(new Image(buttonTexture), "Start animation", null, Game.textFormat);
        mStartButton.addEventListener(Button.BUTTON_CLICKED, onStartButtonTriggered);
        mStartButton.x = 320f - mStartButton.width / 2f;
        mStartButton.y = 40f;
        addChild(mStartButton);

        // this button will show you how to call a method with a delay
        mDelayButton = new Button(new Image(buttonTexture), "Delayed call", null, Game.textFormat);
        mDelayButton.addEventListener(Button.BUTTON_CLICKED, onDelayButtonTriggered);
        mDelayButton.x = mStartButton.x;
        mDelayButton.y = mStartButton.y + 80f;
        addChild(mDelayButton);

        // the Starling will be tweened
        mEgg = new Image(Game.assets.getTexture("starling_front"));
        addChild(mEgg);
        resetEgg();

        mTransitionLabel = new BitmapTextField();
        mTransitionLabel.width = 640f;
        mTransitionLabel.height = 30f;
        mTransitionLabel.textFormat = Game.textFormat;
        mTransitionLabel.y = mDelayButton.y + 80f;
        mTransitionLabel.alpha = 0.0f; // invisible, will be shown later
        addChild(mTransitionLabel);
    }
开发者ID:crl,项目名称:UniStarling,代码行数:39,代码来源:AnimationScene.cs


注:本文中的Button.addEventListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。