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


C# FButton.SetPosition方法代码示例

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


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

示例1: Start

    public override void Start()
    {
        background_ = new FSprite("level select screen final");
        AddChild(background_);

        string highest_level = PlayerPrefs.GetString("highest_level");
        if(highest_level.Equals("stomach"))
        {
            setBrain(ButtonType.locked);
            setLungs(ButtonType.locked);
        } else if(highest_level.Equals("lung")) {
            setBrain(ButtonType.locked);
            setLungs(ButtonType.normal);
        } else {
            setBrain(ButtonType.normal);
            setLungs(ButtonType.normal);
        }

        stomach = new FButton("Stomach", "StomachPressed");
        stomach.SignalRelease += HandleStomachButton;
        AddChild(stomach);
        stomach.SetPosition(STOMACH_POSITION);

        background_.scale = 1f;

        Go.to(background_, 0.5f, new TweenConfig().setDelay(0.1f).floatProp("scale", 1.0f).setEaseType(EaseType.BackOut));
    }
开发者ID:rhololkeolke,项目名称:Game-Design-Class,代码行数:27,代码来源:LevelSelectPage.cs

示例2: Start

    public override void Start()
    {
        // once play navigates away from home screen, don't play the intro when they return
        Main.instance.playIntro = false;

        FSprite background = new FSprite("viewport");
        background.SetAnchor(0.0f, 0.0f);
        AddChild(background);

        string backButtonText = "Back";
        string titleText = "About The Game";
        if (Main.instance.gameFinished){
            // Display end game messages
            titleText = "The Ship Went Nuclear!";

            _scoreLabel = new FLabel("Emulogic", "You Saved " + Main.instance.crewSaved + " Crew Members");
            _scoreLabel.color = Color.black; // new Color(0.173f, 0.722f, 0.976f, 1.0f);
            _scoreLabel.scale = 0.25f;
            _scoreLabel.SetPosition(Futile.screen.halfWidth, Futile.screen.halfHeight + Futile.screen.halfHeight / 2);

            AddChild(_scoreLabel);

            _againButton = new FButton("buttonWide");
            _againButton.AddLabel("Emulogic","Play Again",Color.black);  //new Color(0.45f,0.25f,0.0f,1.0f)
            _againButton.label.scale = 0.25f;
            _againButton.SetPosition(Futile.screen.halfWidth, Futile.screen.halfHeight + 80);
            AddChild(_againButton);

            _againButton.SignalRelease += HandleAgainButtonRelease;

            backButtonText = "Home";
        } else {
            // diplay generic message
        }

        _textLabel = new FLabel("Emulogic", titleText);
        _textLabel.color = Color.black;
        _textLabel.scale = 0.5f;
        _textLabel.SetPosition(Futile.screen.halfWidth, Futile.screen.halfHeight + Futile.screen.halfHeight * 2 / 3);

        AddChild(_textLabel);

        _quitButton = new FButton("buttonWide");
        _quitButton.AddLabel("Emulogic",backButtonText,Color.black);  //new Color(0.45f,0.25f,0.0f,1.0f)
        _quitButton.label.scale = 0.25f;
        _quitButton.SetPosition(Futile.screen.halfWidth, Futile.screen.halfHeight);
        AddChild(_quitButton);

        _quitButton.SignalRelease += HandleQuitButtonRelease;

        string about = "Game Designed and created by Jason Rendel,\nfor Ludum Dare 27. My first game jam ever!\nCreated for the 48 hour competition.\n\n ---- Tools ----\n Unity 3d - Futile - Gimp \nTexture Packer - Glyph Designer - CFXR\n\nFollow me @jasonrendel\nCheck out what else I'm up to at www.jasonrendel.com";

        _scoreLabel = new FLabel("Emulogic", about);
        _scoreLabel.color = Color.black;
        _scoreLabel.scale = 0.20f;
        _scoreLabel.SetPosition(Futile.screen.halfWidth, 200);

        AddChild(_scoreLabel);
    }
开发者ID:jrendel,项目名称:LD27,代码行数:59,代码来源:ScoreScreen.cs

示例3: setBrain

    private void setBrain(ButtonType type)
    {
        if(brain != null){
            RemoveChild(brain);
        }

        switch(type){
        case ButtonType.normal:
            brain = new FButton("Brain", "BrainPressed");
            brain.SignalRelease += HandleBrainButton;
            break;
        case ButtonType.locked:
            brain = new FButton("BrainLocked");
            break;
        }

        AddChild(brain);
        brain.SetPosition(BRAIN_POSITION);
    }
开发者ID:rhololkeolke,项目名称:Game-Design-Class,代码行数:19,代码来源:LevelSelectPage.cs

示例4: setLungs

    private void setLungs(ButtonType type)
    {
        if(lungs != null){
                RemoveChild(lungs);
            }

            switch(type){
            case ButtonType.normal:
                lungs = new FButton("Lungs", "LungsPressed");
                lungs.SignalRelease += HandleLungsButton;
                break;
            case ButtonType.locked:
                lungs = new FButton("LungsLocked");
                break;
            }

            AddChild(lungs);
            lungs.SetPosition(LUNGS_POSITION);
    }
开发者ID:rhololkeolke,项目名称:Game-Design-Class,代码行数:19,代码来源:LevelSelectPage.cs

示例5: HandleUpdate

    protected void HandleUpdate()
    {
        level.Update();
        if(player_won_)
        {
            if(ImmunityCombatManager.instance.stage_name.Equals("stomach"))
            {
                if(!PlayerPrefs.GetString("highest_level").Equals("brain"))
                    PlayerPrefs.SetString("highest_level", "lung");
            }
            else if(ImmunityCombatManager.instance.stage_name.Equals("lung"))
                PlayerPrefs.SetString("highest_level", "brain");

            player_.play("idle");
            if(enemy_.FinishedCount >= 1)
            {
                if(displayEndScreen){
                    victory = new FSprite("victory screen final");
                    nextLevelButton = new FButton("NextLevel", "NextLevelPressed");

                    levelSelectButton = new FButton("LevelSelect","LevelSelectPressed");

                    AddChild(victory);
                    AddChild(nextLevelButton);
                    AddChild(levelSelectButton);

                    nextLevelButton.SignalRelease += HandleNextLevelButton;
                    levelSelectButton.SignalRelease += HandleLevelSelectButton;

                    nextLevelButton.SetPosition(new Vector2(200, -210));
                    levelSelectButton.SetPosition(new Vector2(-200,-300));
                    displayEndScreen = false;

                    if(ImmunityCombatManager.instance.stage_name.Equals("brain"))
                    {
                        nextLevelButton.isVisible = false;
                    }

                    AddChild(player_);
                    player_.x = -Futile.screen.halfWidth*.6f;
                    player_.y = -Futile.screen.halfHeight*.05f;
                    player_.scale = 1.4f;
                    player_.play("idle");
                }

            }
            return;
        }

        if(player_lost_)
        {
            enemy_.play("idle");
            if(player_.FinishedCount >= 1)
            {
                if(displayEndScreen){
                    defeat = new FSprite("try again screen final");
                    yesButton = new FButton("Yes", "YesPressed");
                    noButton = new FButton("No","NoPressed");

                    AddChild(defeat);
                    AddChild(yesButton);
                    AddChild(noButton);

                    yesButton.SignalRelease += HandleYesButton;
                    noButton.SignalRelease += HandleNoButton;

                    yesButton.SetPosition(new Vector2(-120, -100));
                    noButton.SetPosition(new Vector2(150,-100));
                    displayEndScreen = false;

                    AddChild(player_);
                    player_.x = -Futile.screen.halfWidth*.6f;
                    player_.y = -Futile.screen.halfHeight*.12f;
                    player_.scale = 1.4f;
                    player_.play("idle");
                }
            }

            return;
        }

        switch(enemy_.curr_behavior_)
        {
        case EnemyCharacter.BehaviorType.MOVE_TOWARDS_PLAYER:
            MoveTowardsPlayerBehavior();
            break;
        case EnemyCharacter.BehaviorType.MOVE_AWAY_FROM_PLAYER:
            MoveAwayFromPlayerBehavior();
            break;
        case EnemyCharacter.BehaviorType.PUNCH:
            PunchBehavior();
            break;
        case EnemyCharacter.BehaviorType.SPAWN_SWARM:
            SpawnSwarmBehavior();
            break;
        case EnemyCharacter.BehaviorType.HIT:
            PunchyHitBehavior();
            break;
        case EnemyCharacter.BehaviorType.BLOCK:
            PunchyBlockBehavior();
//.........这里部分代码省略.........
开发者ID:remy22,项目名称:Game-Design-Class,代码行数:101,代码来源:CombatPage.cs

示例6: InitArrows

    // this creates all the arrows around the board and sets them up to be able to send their data when pressed and released
    private void InitArrows()
    {
        for (int i = 0; i < tileMapWidth; i++) {
            FButton arrowButtonUp = new FButton("arrow", "arrow", "click");
            arrowButtonUp.SetPosition((i + 0.5f) * tileSize, (tileMapHeight + 0.5f) * tileSize);
            arrowButtonUp.SetColors(Color.white, Color.red);
            arrowButtonUp.data = new ArrowData(Direction.Up, i);
            arrowButtonUp.SignalRelease += ArrowButtonReleased;
            boardContainer.AddChild(arrowButtonUp);

            FButton arrowButtonDown = new FButton("arrow", "arrow", "click");
            arrowButtonDown.SetPosition((i + 0.5f) * tileSize, -0.5f * tileSize);
            arrowButtonDown.SetColors(Color.white, Color.red);
            arrowButtonDown.data = new ArrowData(Direction.Down, i);
            arrowButtonDown.SignalRelease += ArrowButtonReleased;
            arrowButtonDown.rotation = 180;
            boardContainer.AddChild(arrowButtonDown);
        }

        for (int j = 0; j < tileMapHeight; j++) {
            FButton arrowButtonRight = new FButton("arrow", "arrow", "click");
            arrowButtonRight.SetPosition((tileMapWidth + 0.5f) * tileSize, (j + 0.5f) * tileSize);
            arrowButtonRight.SetColors(Color.white, Color.red);
            arrowButtonRight.data = new ArrowData(Direction.Right, j);
            arrowButtonRight.SignalRelease += ArrowButtonReleased;
            arrowButtonRight.rotation = 90;
            boardContainer.AddChild(arrowButtonRight);

            FButton arrowButtonLeft = new FButton("arrow", "arrow", "click");
            arrowButtonLeft.SetPosition(-0.5f * tileSize, (j + 0.5f) * tileSize);
            arrowButtonLeft.SetColors(Color.white, Color.red);
            arrowButtonLeft.data = new ArrowData(Direction.Left, j);
            arrowButtonLeft.SignalRelease += ArrowButtonReleased;
            arrowButtonLeft.rotation = 270;
            boardContainer.AddChild(arrowButtonLeft);
        }
    }
开发者ID:soshimozi,项目名称:Match-Puzzle-Shapes-Using-Bitmasks,代码行数:38,代码来源:BitmaskPuzzleGame.cs

示例7: Start

    public override void Start()
    {
        Main.instance.crewSaved = 0;
        Main.instance.gameFinished = false;

        FSprite background = new FSprite("viewport");
        background.SetAnchor(0.0f, 0.0f);
        AddChild(background);

        _introLabel = new FLabel("Emulogic", "");
        _introLabel.color = Color.black; //Color.green; // new Color(0.173f, 0.722f, 0.976f, 1.0f);
        _introLabel.scale = 0.2f;
        _introLabel.SetAnchor(0.0f, 1.0f);
        _introLabel.SetPosition(60, Futile.screen.height - 14);

        AddChild(_introLabel);

        _titleLabel = new FLabel("Emulogic", "");
        _titleLabel.color = Color.black;
        _titleLabel.scale = 1.0f;
        _titleLabel.SetAnchor(0.0f, 1.0f);
        _titleLabel.SetPosition(200, 550);

        AddChild(_titleLabel);

        _finalLabel = new FLabel("Emulogic", "");
        _finalLabel.color = Color.black; //Color.green;
        _finalLabel.scale = 0.2f;
        _finalLabel.SetAnchor(0.0f, 1.0f);
        _finalLabel.SetPosition(575, 400);

        AddChild(_finalLabel);

        if (!Main.instance.playIntro){
            _introLabel.text = _introText;
            _titleLabel.text = _titleText;
            _finalLabel.text = _finalText;
        }

        _startButton = new FButton("buttonWide");
        _startButton.AddLabel("Emulogic","Play!",Color.black);  //new Color(0.45f,0.25f,0.0f,1.0f)
        _startButton.label.scale = 0.25f;
        _startButton.SetPosition(Futile.screen.width - 225, 155);
        AddChild(_startButton);

        _startButton.SignalRelease += HandleStartButtonRelease;

        _creditsButton = new FButton("buttonWide");
        _creditsButton.AddLabel("Emulogic","About",Color.black);  //new Color(0.45f,0.25f,0.0f,1.0f)
        _creditsButton.label.scale = 0.25f;
        _creditsButton.SetPosition(Futile.screen.width - 225, 75);
        AddChild(_creditsButton);

        _creditsButton.SignalRelease += HandleCreditsButtonRelease;

        _lastTextUpdate = Main.GameTime;

        FSprite escapePod = new FSprite("escapePod");
        FSprite doors = new FSprite("doorsIcon");
        FSprite crew = new FSprite("floatingCharacter");
        FSprite clock = new FSprite("moveTileIcon");
        //FSprite clock = new FSprite("clock4");

        escapePod.scale = 0.5f;
        doors.scale = 0.5f;

        escapePod.SetPosition(140, 305);
        doors.SetPosition(140, 230);
        crew.SetPosition(140, 155);
        clock.SetPosition(140, 80);

        AddChild(escapePod);
        AddChild(doors);
        AddChild(crew);
        AddChild(clock);

        FLabel escapePodLabel = new FLabel("Emulogic", "Get the crew to \nthe escape pods!");
        escapePodLabel.color = Color.black; //Color.green;
        escapePodLabel.scale = 0.15f;
        escapePodLabel.SetAnchor(0.0f, 0.5f);
        escapePodLabel.SetPosition(200, 305);
        AddChild(escapePodLabel);

        FLabel doorsLabel = new FLabel("Emulogic", "Touch doors to \nopen and close them.");
        doorsLabel.color = Color.black; //Color.green;
        doorsLabel.scale = 0.15f;
        doorsLabel.SetAnchor(0.0f, 0.5f);
        doorsLabel.SetPosition(200, 230);
        AddChild(doorsLabel);

        FLabel crewLabel = new FLabel("Emulogic", "The Crew. They will walk \nthrough open doors, \nbut don't expect much else.");
        crewLabel.color = Color.black; //Color.green;
        crewLabel.scale = 0.15f;
        crewLabel.SetAnchor(0.0f, 0.5f);
        crewLabel.SetPosition(200, 155);
        AddChild(crewLabel);

        FLabel clockLabel = new FLabel("Emulogic", "Place movement tiles \nto redirect the crew.");
        //FLabel clockLabel = new FLabel("Emulogic", "10 Seconds.");
        clockLabel.color = Color.black; //Color.green;
//.........这里部分代码省略.........
开发者ID:jrendel,项目名称:LD27,代码行数:101,代码来源:TitlePage.cs


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