예제 #1
0
    public TeamPanel(Team team)
    {
        this.team = team;

        team.SignalTeamChange += HandleSignalPlayerChange;

        fullWidth = GameConfig.WINNING_SCORE * WIDTH_PER_NIB;

        bg = new FSliceSprite("PointBarBG", fullWidth+6.0f, 30.0f, 0, 10, 0, 10);
        AddChild(bg);
        bg.color = team.color;

        goldBG = new FSliceSprite("PointBarBGGold", fullWidth+6.0f, 30.0f, 0, 10, 0, 10);
        AddChild(goldBG);
        goldBG.alpha = 0.66f;
        goldBG.isVisible = false;

        for(int p = 0; p<GameConfig.WINNING_SCORE; p++)
        {
            FContainer nib = new FContainer();

            nib.x = -fullWidth*0.5f + 15.0f + p * WIDTH_PER_NIB;
            nib.y = 0;

            FSprite bgSprite = new FSprite("PointBarNibBG");
            bgSprite.color = team.color;
            nib.AddChild(bgSprite);

            AddChild(nib);
            nibs.Add(nib);
        }

        ListenForUpdate(HandleUpdate);
    }
예제 #2
0
    public SimpleButton(string title, float width, float height, SimpleButtonColor color, bool isPressTap, string fontName)
    {
        _isPressTap        = isPressTap;
        this.effectManager = Core.topEffectManager;

        _color          = color;
        AddChild(button = new FSliceButton(width, height, _color.path, _color.path));

        //button.SetPosition(0.25f,0.33f);//pixel perfect?

        AddChild(mainLabel = new DualLabel(fontName, title, Color.white, TOColors.TEXT_SHADOW));
        mainLabel.y        = 2.5f;

        if (_isPressTap)
        {
            button.SignalPress += (b) => DoTap();
        }
        else
        {
            button.SignalRelease += (b) => DoTap();
        }

        _overHighlight       = new FSliceSprite("UI/ButtonHighlight", width, height, 12, 12, 12, 12);
        _overHighlight.alpha = 0.45f;


        ListenForUpdate(HandleUpdate);

        UpdateEnabled();
    }
    public ImSliceSpriteComponent(string name, string imageName, float width, float height, float insetTop, float insetRight, float insetBottom, float insetLeft)
        : base(name)
    {
        componentType_ = ComponentType.SliceSprite;

        sprite_ = new FSliceSprite(imageName, width, height, insetTop, insetRight, insetBottom, insetLeft);
    }
예제 #4
0
    public PlayerSelectPanel(Player player)
    {
        this.player = player;

        if(GameManager.instance.shouldUseTeams)
        {
            FSliceSprite teamBG = new FSliceSprite("Selection_BG", 528, 208, 16, 16, 16, 16);
            AddChild(teamBG);
            teamBG.alpha = 0.9f;
            teamBG.color = player.team.color;
        }

        AddChild(background = new FSliceSprite("Popup_BG",520,200,16,16,16,16));
        background.color = player.color;
        background.alpha = 0.4f;

        AddChild(nameLabel = new FLabel("CubanoBig", player.name));
        nameLabel.scale = 1.0f;
        nameLabel.y = 30.0f;

        AddChild(readyLabel = new FLabel("CubanoBig", ""));
        readyLabel.y = -30.0f;
        readyLabel.scale = 0.75f;

        AddChild(button = new FButton("Popup_BG"));
        button.sprite.width = 520;
        button.sprite.height = 200;
        button.alpha = 0.0f; //hidden button
        button.SignalPress += HandleSignalPress;

        ListenForUpdate(HandleUpdate);

        UpdateState();
    }
예제 #5
0
        public FNode ShowButtonHighlight(FNode node, Vector2 offset, float width, float height, Color color, bool shouldPlaySound)
        {
            if (shouldPlaySound) {
                FXPlayer.NormalButtonTap ();
            }

            FSliceSprite highlight = new FSliceSprite ("UI/ButtonHighlight", width, height, 8, 8, 8, 8);
            AddChild (highlight);

            highlight.SetPosition (this.OtherToLocal (node, offset));

            highlight.shader = FShader.Additive;

            highlight.scale = 1.0f;
            highlight.alpha = 0.35f;
            highlight.color = color + new Color (0.5f, 0.5f, 0.5f);//brighten the color

            //uniform scaling
            float growSize = 8.0f;
            float growScaleX = (width + growSize) / width;
            float growScaleY = (height + growSize) / height;

            Go.to (highlight, 0.15f, new GoTweenConfig ().floatProp ("scaleX", growScaleX).floatProp ("scaleY", growScaleY).floatProp ("alpha", 0.0f).setEaseType (GoEaseType.Linear).removeWhenComplete ());

            return highlight;
        }
예제 #6
0
    public FNode ShowButtonHighlight(FNode node, Vector2 offset, float width, float height, Color color, bool shouldPlaySound)
    {
        if (shouldPlaySound)
        {
            FXPlayer.NormalButtonTap();
        }

        FSliceSprite highlight = new FSliceSprite("UI/ButtonHighlight", width, height, 8, 8, 8, 8);

        AddChild(highlight);

        highlight.SetPosition(this.OtherToLocal(node, offset));

        highlight.shader = FShader.Additive;

        highlight.scale = 1.0f;
        highlight.alpha = 0.35f;
        highlight.color = color + new Color(0.5f, 0.5f, 0.5f);      //brighten the color

        //uniform scaling
        float growSize   = 8.0f;
        float growScaleX = (width + growSize) / width;
        float growScaleY = (height + growSize) / height;

        Go.to(highlight, 0.15f, new TweenConfig().floatProp("scaleX", growScaleX).floatProp("scaleY", growScaleY).floatProp("alpha", 0.0f).setEaseType(EaseType.Linear).removeWhenComplete());

        return(highlight);
    }
예제 #7
0
    public SimpleButton(string title, float width, float height, SimpleButtonColor color, bool isPressTap,string fontName)
    {
        _isPressTap = isPressTap;
        this.effectManager = Core.topEffectManager;

        _color = color;
        AddChild(button = new FSliceButton(width,height,_color.path,_color.path));

        //button.SetPosition(0.25f,0.33f);//pixel perfect?

        AddChild(mainLabel = new DualLabel(fontName,title,Color.white,TOColors.TEXT_SHADOW));
        mainLabel.y = 2.5f;

        if(_isPressTap)
        {
            button.SignalPress += (b) => DoTap();
        }
        else
        {
            button.SignalRelease += (b) => DoTap();
        }

        _overHighlight = new FSliceSprite("UI/ButtonHighlight",width,height,12,12,12,12);
        _overHighlight.alpha = 0.45f;

        ListenForUpdate(HandleUpdate);

        UpdateEnabled();
    }
예제 #8
0
    public FSprite CreateDebugSprite(TORect rect, Color rectColor)
    {
        FSliceSprite debugSprite = new FSliceSprite("Debug/Square", rect.width, rect.height, 4, 4, 4, 4);

        debugSprite.color = rectColor;
        debugSprite.alpha = 0.7f;
        debugSprite.SetAnchor(0, 0);
        debugSprite.SetPosition(rect.x, rect.y);
        frontContainer.AddChild(debugSprite);
        return(debugSprite);
    }
예제 #9
0
    public bool ContainsTouch(FTouch touch)
    {
        FSliceSprite sprite   = SliceSpriteComponents()[0].sprite;
        Vector2      localPos = GlobalToLocal(touch.position);

        if (sprite.localRect.Contains(localPos))
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
예제 #10
0
    public FSliceButton(float width, float height, string upElementName, string downElementName, Color upColor, Color downColor, string soundName)
    {
        _upElement   = Futile.atlasManager.GetElementWithName(upElementName);
        _downElement = Futile.atlasManager.GetElementWithName(downElementName);
        _upColor     = upColor;
        _downColor   = downColor;

        _soundName = soundName;

        _bg         = new FSliceSprite(_upElement.name, width, height, 12, 12, 12, 12);
        _bg.anchorX = _anchorX;
        _bg.anchorY = _anchorY;
        _bg.color   = _upColor;
        AddChild(_bg);
    }
예제 #11
0
    public FSliceButton(float width, float height, string upElementName, string downElementName, Color upColor, Color downColor, string soundName)
    {
        _upElement = Futile.atlasManager.GetElementWithName(upElementName);
        _downElement = Futile.atlasManager.GetElementWithName(downElementName);
        _upColor = upColor;
        _downColor = downColor;

        _soundName = soundName;

        _bg = new FSliceSprite(_upElement.name, width, height, 16, 16, 16, 16);
        _bg.anchorX = _anchorX;
        _bg.anchorY = _anchorY;
        _bg.color = _upColor;
        AddChild(_bg);
    }
예제 #12
0
    public VolumeBox()
    {
        base.Init(Player.NullPlayer);

        contentContainer.AddChild(mainSprite = new FSprite("Icons/Volume_Main"));
        contentSprites.Add(mainSprite);
        mainSprite.color = Color.black;

        contentContainer.AddChild(barASprite = new FSliceSprite("Icons/Volume_Bar", 6, 20, 8, 0, 8, 0));
        contentSprites.Add(barASprite);
        barASprite.color = Color.black;

        contentContainer.AddChild(barBSprite = new FSliceSprite("Icons/Volume_Bar", 6, 20, 8, 0, 8, 0));
        contentSprites.Add(barBSprite);
        barBSprite.color = Color.black;

        FSoundManager.Init();
        _isMuted = FSoundManager.isMuted;

        //1.0f = muted (X), 0.0f = unmuted (||)
        muteTweenable = new RXTweenable(_isMuted ? 1.0f : 0.0f);
        muteTweenable.SignalChange += HandleMuteChange;
        HandleMuteChange();
    }
예제 #13
0
    public override void Start()
    {
        FSoundManager.StopMusic();

        FSprite logo = new FSprite("TetherLogo");
        logo.y = 270.0f;
        AddChild(logo);

        //		FLabel titleLabel = new FLabel("CubanoBig", "TETHER");
        //		AddChild(titleLabel);
        //		titleLabel.y = 300;

        allReadyLabel = new FLabel("CubanoBig", "");
        AddChild(allReadyLabel);
        allReadyLabel.y = 190;
        allReadyLabel.scale = 0.75f;

        if(GameManager.instance.shouldUseTeams)
        {
            FLabel teamLabel = new FLabel("Franchise", "TEAM MODE");
            AddChild(teamLabel);
            teamLabel.y = -332;
            teamLabel.scale = 0.5f;
            teamLabel.alpha = 0.0f;

            Go.to(teamLabel, 0.5f, new TweenConfig().floatProp("alpha", 0.7f).setDelay(0.7f));
        }

        //		infoLabel = new FLabel("Franchise", "CLICK THE BOXES OR PRESS BACK/SELECT TO TOGGLE PLAYERS");
        //		AddChild(infoLabel);
        //		infoLabel.y = -332;
        //		infoLabel.scale = 0.5f;
        //		infoLabel.alpha = 0.0f;
        //
        //		Go.to(infoLabel, 0.5f, new TweenConfig().floatProp("alpha", 0.7f).setDelay(0.7f));

        FLabel smallLabel;
        //
        smallLabel = new FLabel("Franchise", "F: FULLSCREEN");
        AddChild(smallLabel);
        smallLabel.x = -634;
        smallLabel.y = 336.0f;
        smallLabel.alignment = FLabelAlignment.Left;
        smallLabel.scale = 0.4f;
        smallLabel.alpha = 0.7f;

        smallLabel = new FLabel("Franchise", "T: TOGGLE TEAMS");
        AddChild(smallLabel);
        smallLabel.x = -634;
        smallLabel.y = 336.0f - 28.0f * 1;
        smallLabel.alignment = FLabelAlignment.Left;
        smallLabel.scale = 0.4f;
        smallLabel.alpha = 0.7f;
        //
        smallLabel = new FLabel("Franchise", "M: MUTE");
        AddChild(smallLabel);
        smallLabel.x = -634;
        smallLabel.y = 336.0f - 28.0f * 2;
        smallLabel.alignment = FLabelAlignment.Left;
        smallLabel.scale = 0.4f;
        smallLabel.alpha = 0.7f;

        //		smallLabel = new FLabel("Franchise", "R: RESET");
        //		AddChild(smallLabel);
        //		smallLabel.x = -634;
        //		smallLabel.y = 336.0f - 28.0f * 3;
        //		smallLabel.alignment = FLabelAlignment.Left;
        //		smallLabel.scale = 0.4f;
        //		smallLabel.alpha = 0.7f;

        FSliceButton teamButton = new FSliceButton(140, 36, "Popup_BG", "Popup_BG", Color.white, Color.white, "click1");
        AddChild(teamButton);
        teamButton.x = -Futile.screen.width/2 + 70;
        teamButton.y = Futile.screen.height/2 - 56;
        teamButton.sprite.alpha = 0.0f;
        //teamButton.AddLabelA("CubanoBig", "START!", 0.75f, 2f, Color.white);
        teamButton.SignalRelease += (b) =>
        {
            TMain.instance.SwapTeams();
        };

        FSliceButton fullButton = new FSliceButton(140, 36, "Popup_BG", "Popup_BG", Color.white, Color.white, "click1");
        AddChild(fullButton);
        fullButton.x = -Futile.screen.width/2 + 70;
        fullButton.y = Futile.screen.height/2 - 56 + 28.0f;
        fullButton.sprite.alpha = 0.0f;
        //teamButton.AddLabelA("CubanoBig", "START!", 0.75f, 2f, Color.white);
        fullButton.SignalRelease += (b) =>
        {
            TMain.instance.SwapFullScreen();
        };

        startButton = new FSliceButton(220, 80, "Popup_BG", "Popup_BG", Color.blue, Color.white, "click1");
        AddChild(startButton);
        startButton.x = 425.0f;
        startButton.y = 270;
        startButton.sprite.alpha = 0.3f;
        startButton.AddLabelA("CubanoBig", "START!", 0.75f, 2f, Color.white);
        startButton.SignalRelease += HandleStartButtonClick;

        startButton.alpha = 0.0f;

        float spreadX = 275;
        float spreadY = 115;

        AddChild(panelHolder = new FContainer());
        panelHolder.y = -80.0f;

        List<Player> players = GameManager.instance.players;

        for(int p = 0; p<players.Count; p++)
        {
            Player player = players[p];

            if(player.controller != GameManager.instance.unusedPlayerController && player.controller.CanBeUsed())
            {
                AIPlayerController aiController = player.controller as AIPlayerController;

                if(aiController != null)
                {
                    player.controller.SetPlayer(null);
                    player.controller = aiController.symbolic;
                }
            }
        }

        selectedPanelBorder = new FContainer();

        FSliceSprite selectBG = new FSliceSprite("Selection_BG", 540, 220, 16, 16, 16, 16);

        selectedPanelBorder.AddChild(selectBG);
        selectBG.alpha = 0.9f;
        selectBG.color = RXColor.GetColorFromHex(0xFF9966);

        AddChild(selectedPanelBorder);

        CreatePlayerPanel(0, -spreadX, spreadY);
        CreatePlayerPanel(1, spreadX, spreadY);
        CreatePlayerPanel(2, -spreadX, -spreadY);
        CreatePlayerPanel(3, spreadX, -spreadY);

        HandlePanelStateChange();

        UpdateSelectedPanel();

        ListenForUpdate (HandleUpdate);
    }
예제 #14
0
    private void showGrid(float width, float height)
    {
        TweenChain chainY = new TweenChain();
        TweenChain chainX = new TweenChain();

        for(float y = height/2;y >= -height/2;y-=64) {
            FSliceSprite ss = new FSliceSprite(Futile.whiteElement, width, 1, 0, 0, 0, 0);
            ss.y = y;
            ss.x = -width;
            AddChild(ss);
            Tween t = new Tween(ss, 3 / (height / 64), new TweenConfig().floatProp("x", 0), null);
            chainY.append(t);
        }
        for(float x = -width/2;x<= width/2;x+=64) {
            FSliceSprite ss = new FSliceSprite(Futile.whiteElement, 1, height, 0, 0, 0, 0);
            ss.x = x;
            ss.y = height;
            AddChild(ss);
            Tween t = new Tween(ss, 3 / (width / 64), new TweenConfig().floatProp("y", 0), null);
            chainX.append(t);
        }
        chainY.play();
        chainX.play();
    }
예제 #15
0
        public RoundedRect(MenuFlow menu, bool solid = false) : base(menu)
        {
            _sliceSprite = new FSliceSprite(solid ? "solidroundedrect" : "roundedrect", 16, 16, 8, 8, 8, 8);

            AddElement(_sliceSprite);
        }
예제 #16
0
 public FSprite CreateDebugSprite(TORect rect, Color rectColor)
 {
     FSliceSprite debugSprite = new FSliceSprite("Debug/Square",rect.width,rect.height,4,4,4,4);
     debugSprite.color = rectColor;
     debugSprite.alpha = 0.7f;
     debugSprite.SetAnchor(0,0);
     debugSprite.SetPosition(rect.x,rect.y);
     frontContainer.AddChild(debugSprite);
     return debugSprite;
 }
예제 #17
0
    public VolumeBox()
    {
        base.Init(Player.NullPlayer);

        contentContainer.AddChild(mainSprite = new FSprite("Icons/Volume_Main"));
        contentSprites.Add(mainSprite);
        mainSprite.color = Color.black;

        contentContainer.AddChild(barASprite = new FSliceSprite("Icons/Volume_Bar",6,20,8,0,8,0));
        contentSprites.Add(barASprite);
        barASprite.color = Color.black;

        contentContainer.AddChild(barBSprite = new FSliceSprite("Icons/Volume_Bar",6,20,8,0,8,0));
        contentSprites.Add(barBSprite);
        barBSprite.color = Color.black;

        FSoundManager.Init();
        _isMuted = FSoundManager.isMuted;

        //1.0f = muted (X), 0.0f = unmuted (||)
        muteTweenable = new RXTweenable(_isMuted ? 1.0f : 0.0f);
        muteTweenable.SignalChange += HandleMuteChange;
        HandleMuteChange();
    }
    public ImSliceSpriteComponent(string name, string imageName, float width, float height, float insetTop, float insetRight, float insetBottom, float insetLeft) : base(name)
    {
        componentType_ = ComponentType.SliceSprite;

        sprite_ = new FSliceSprite(imageName, width, height, insetTop, insetRight, insetBottom, insetLeft);
    }