Exemplo n.º 1
0
    public override void _Ready()
    {
        normalStylebox  = ResourceLoader.Load("res://knytt/ui/touch/NormalStyleBox.tres") as StyleBox;
        pressedStylebox = ResourceLoader.Load("res://knytt/ui/touch/PressedStyleBox.tres") as StyleBox;

        leftUpPanel   = GetNode <Control>("ArrowsPanel/LeftUpPanel");
        rightUpPanel  = GetNode <Control>("ArrowsPanel/RightUpPanel");
        leftPanel     = GetNode <Control>("ArrowsPanel/LeftPanel");
        rightPanel    = GetNode <Control>("ArrowsPanel/RightPanel");
        downPanel     = GetNode <Control>("ArrowsPanel/DownPanel");
        infoPanel     = GetNode <Control>("JumpPanel/InfoPanel");
        resetPanel    = GetNode <Control>("JumpPanel/ResetPanel");
        pausePanel    = GetNode <Control>("JumpPanel/PausePanel");
        umbrellaPanel = GetNode <Control>("JumpPanel/UmbrellaPanel");
        walkPanel     = GetNode <Control>("JumpPanel/WalkPanel");
        jumpPanel     = GetNode <Control>("JumpPanel/JumpPanel");
        down2Panel    = GetNode <Control>("JumpPanel/DownPanel");

        jumpPanels = new Control[] {
            infoPanel, resetPanel, pausePanel, umbrellaPanel, walkPanel, jumpPanel, down2Panel
        };
        jumpActionNames = actionNames.Skip(4).ToArray();

        Modulate = MODULATE_COLOR;
        GetTree().Root.Connect("size_changed", this, nameof(_on_viewport_size_changed));
        Configure();
    }
Exemplo n.º 2
0
        private void _drawItem(
            DrawingHandleScreen handle, ref float vOffset, float hOffset, Item item,
            Font font, StyleBox itemSelected)
        {
            var itemHeight = font.GetHeight(UIScale) + itemSelected.MinimumSize.Y;
            var selected   = item.Index == _selectedIndex;

            if (selected)
            {
                itemSelected.Draw(handle, UIBox2.FromDimensions(hOffset, vOffset, PixelWidth - hOffset, itemHeight));
            }

            if (!string.IsNullOrWhiteSpace(item.Text))
            {
                var offset   = itemSelected.GetContentOffset(Vector2.Zero);
                var baseLine = offset + (hOffset, vOffset + font.GetAscent(UIScale));
                foreach (var chr in item.Text)
                {
                    baseLine += (font.DrawChar(handle, chr, baseLine, UIScale, Color.White), 0);
                }
            }

            vOffset += itemHeight;
            hOffset += 5;
            foreach (var child in item.Children)
            {
                _drawItem(handle, ref vOffset, hOffset, child, font, itemSelected);
            }
        }
Exemplo n.º 3
0
 public override void _Ready()
 {
     itemScene     = ResourceLoader.Load <PackedScene>("res://knytt/ui/stats/StatItem.tscn");
     labelScene    = ResourceLoader.Load <PackedScene>("res://knytt/ui/stats/StatLabel.tscn");
     achievedStyle = ResourceLoader.Load <StyleBox>("res://knytt/ui/styles/AchievedItem.tres");
     container     = GetNode <Control>("ScrollContainer/VBoxContainer");
 }
Exemplo n.º 4
0
    public static TextEdit BackgroundBox()
    {
        TextEdit ret = TextBox("");
        StyleBox box = ColorStyleBox(BoxColor("background"));

        ret.AddStyleboxOverride("normal", box);
        ret.AddStyleboxOverride("focus", box);
        ret.AddStyleboxOverride("panel", box);
        ret.AddStyleboxOverride("read_only", box);
        return(ret);
    }
Exemplo n.º 5
0
    public PlayerTabEntry(string username, string character, string antagonist, StyleBox styleBox, bool connected)
    {
        RobustXamlLoader.Load(this);

        UsernameLabel.Text = username;
        if (!connected)
        {
            UsernameLabel.StyleClasses.Add("Disabled");
        }
        CharacterLabel.Text  = character;
        AntagonistLabel.Text = antagonist;
        BackgroundColorPanel.PanelOverride = styleBox;
    }
    public override void _Ready()
    {
        // load the red style so we can switch it based on this component's alliance
        redStyle = (StyleBox)ResourceLoader.Load("res://themes/red_box_round.stylebox");


        stage1Label = GetNode <Label>("HBoxContainer/Stage1/Label");
        stage2Label = GetNode <Label>("HBoxContainer/Stage2/Label");
        stage3Label = GetNode <Label>("HBoxContainer/Stage3/Label");

        stage1Lock = GetNode <Sprite>("HBoxContainer/Stage1/Lock");
        stage2Lock = GetNode <Sprite>("HBoxContainer/Stage2/Lock");
        stage3Lock = GetNode <Sprite>("HBoxContainer/Stage3/Lock");

        stage1Complete = GetNode <Sprite>("HBoxContainer/Stage1/Complete");
        stage2Complete = GetNode <Sprite>("HBoxContainer/Stage2/Complete");
        stage3Complete = GetNode <Sprite>("HBoxContainer/Stage3/Complete");

        stage1SpinColorWheel     = GetNode <Sprite>("HBoxContainer/Stage1/RotateColorWheel");
        stage2SpinColorWheel     = GetNode <Sprite>("HBoxContainer/Stage2/RotateColorWheel");
        stage3PositionColorWheel = GetNode <Sprite>("HBoxContainer/Stage3/RotateColorWheel");

        // start with all stages locked
        stage1Lock.Visible = true;
        stage2Lock.Visible = true;
        stage3Lock.Visible = true;

        stage1Complete.Visible = false;
        stage2Complete.Visible = false;
        stage3Complete.Visible = false;

        stage1SpinColorWheel.Visible     = false;
        stage2SpinColorWheel.Visible     = false;
        stage3PositionColorWheel.Visible = false;

        if (Alliance == Alliance.Red)
        {
            // turn our various panels red
            GetNode("Level").Set("custom_styles/panel", redStyle);
            GetNode("HBoxContainer/Stage1").Set("custom_styles/panel", redStyle);
            GetNode("HBoxContainer/Stage2").Set("custom_styles/panel", redStyle);
            GetNode("HBoxContainer/Stage3").Set("custom_styles/panel", redStyle);
        }
        Signals.StageChangedEvent += OnStageChanged;
    }
Exemplo n.º 7
0
        public UIThemeDefault()
        {
            var res     = IoCManager.Resolve <IResourceCache>();
            var calibri = res.GetResource <FontResource>("/Fonts/CALIBRI.TTF");

            DefaultFont = LabelFont = new VectorFont(calibri, 16);

            PanelPanel = new StyleBoxFlat {
                BackgroundColor = new Color(37, 37, 45)
            };

            ButtonStyle = new StyleBoxFlat {
                BackgroundColor = Color.Gray
            };
            ButtonStyle.SetContentMarginOverride(StyleBox.Margin.All, 5);
            LineEditBox = new StyleBoxFlat {
                BackgroundColor = Color.Blue
            };
            LineEditBox.SetContentMarginOverride(StyleBox.Margin.All, 5);
        }
Exemplo n.º 8
0
    public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected)
    {
        RobustXamlLoader.Load(this);

        UsernameLabel.Text = username;
        if (!connected)
        {
            UsernameLabel.StyleClasses.Add("Disabled");
        }
        JobLabel.Text       = job;
        CharacterLabel.Text = character;
        if (identity != character)
        {
            CharacterLabel.Text += $" [{identity}]";
        }
        AntagonistLabel.Text = antagonist;
        BackgroundColorPanel.PanelOverride = styleBox;
    }