Beispiel #1
0
    private void ThemeDefaultHolder(BoxContainer holder)
    {
        holder.Alignment = BoxContainer.AlignMode.Center;
        holder.AddConstantOverride("separation", 20);

        holder.GetNode <TextureRect>("logo").Texture             = GD.Load <Texture>("res://assets/default/icon.png");
        holder.GetNode <TextureRect>("logo").SizeFlagsHorizontal = (int)Control.SizeFlags.ShrinkCenter;

        var title = holder.GetNode <Label>("title");

        title.Align    = Label.AlignEnum.Center;
        title.Text     = ProjectSettings.GetSetting("application/config/name").ToString().Replace("Leacme ", "Leacme\n");
        title.Autowrap = true;
        title.AddFontOverride("font", new DynamicFont()
        {
            FontData = GD.Load <DynamicFontData>("res://assets/default/Tuffy_Bold.ttf"), Size = 70
        });
    }
        public override void _Ready()
        {
            if (!AudioSystem.IsMusicPlaying)
            {
                AudioSystem.PlayMusic(AudioSystem.MusicCollection.TitleScreen);
            }

            _characterScroll = GetNode <ScrollContainer>(
                "MarginContainer/VBoxContainer/CenterContainer/CharactersScroll");
            _characters = _characterScroll.GetNode <BoxContainer>("Characters");
            _selectVBox =
                GetNode <BoxContainer>(
                    "MarginContainer/VBoxContainer/VBoxContainer2/SelectVBox");
            _nameLabel = _selectVBox.GetNode <Label>("VBoxContainer/Label");
            _buttons   = new[]
            {
                GetNode <BaseButton>(
                    "MarginContainer/VBoxContainer/VBoxContainer2/HBoxContainer/ScrollLeft"),
                GetNode <BaseButton>(
                    "MarginContainer/VBoxContainer/VBoxContainer2/HBoxContainer/ScrollRight"),
                GetNode <BaseButton>(
                    "MarginContainer/VBoxContainer/VBoxContainer2/SelectVBox/Select")
            };

            _selectVBox.Visible = false;
            UpdateCharacters();
            foreach (var button in _buttons)
            {
                button.Connect("mouse_entered", this, nameof(OnButton_MouseEntered),
                               new Array {
                    button
                });
                button.Connect("pressed", this, nameof(OnButton_Pressed),
                               new Array {
                    button
                });
            }
        }