Exemple #1
0
    public override void _Ready()
    {
        click = (AudioStreamPlayer)GetTree().GetRoot().GetNode("SceneSwitcher/Click");
        paper = (NinePatchRect)GetNode("ReferenceRect/NinePatchRect");

        holder   = (ReferenceRect)GetNode("ReferenceRect");
        riPrefab = (PackedScene)ResourceLoader.Load("res://Instances/RecipeItem.tscn");

        GetRecipes();
        Vector2 pos = new Vector2(53, 192);

        foreach (Recipe r in recipes)
        {
            RecipeItem recipeItem = (RecipeItem)riPrefab.Instance();
            recipeItem.name        = r.name;
            recipeItem.ingredients = r.ingredients;
            recipeItem.SetPosition(pos);
            GetNode("ReferenceRect").AddChild(recipeItem);
            pos.y += 139;
        }
        Button button = (Button)GetNode("ReferenceRect/Button");

        pos.x  = 29;
        pos.y += 30;
        button.SetPosition(pos);
        NinePatchRect ninePatchRect = (NinePatchRect)GetNode("ReferenceRect/NinePatchRect");

        ninePatchRect.SetSize(new Vector2(ninePatchRect.GetSize().x, pos.y + 102));
    }
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        ImageTexture imageTexture = new ImageTexture();

        imageTexture.CreateFromImage(GD.Load <Texture>("res://background-border.png").GetData());
        NinePatchRect patchRect = new NinePatchRect
        {
            AnchorBottom          = 1,
            AnchorLeft            = 0,
            AnchorTop             = 0,
            AnchorRight           = 1,
            PatchMarginBottom     = 9,
            PatchMarginTop        = 9,
            PatchMarginLeft       = 9,
            PatchMarginRight      = 9,
            MarginBottom          = -20,
            MarginTop             = 20,
            MarginLeft            = 20,
            MarginRight           = -20,
            AxisStretchHorizontal = NinePatchRect.AxisStretchMode.TileFit,
            AxisStretchVertical   = NinePatchRect.AxisStretchMode.TileFit,
            Texture      = imageTexture,
            SelfModulate = Colors.Red
        };

        this.AddChild(patchRect);
    }
Exemple #3
0
    public override void _Ready()
    {
        compoundBars = GetTree().GetNodesInGroup("CompoundBar");

        mouseHoverPanel              = GetNode <PanelContainer>(MouseHoverPanelPath);
        pauseButton                  = GetNode <TextureButton>(PauseButtonPath);
        resumeButton                 = GetNode <TextureButton>(ResumeButtonPath);
        leftPanels                   = GetNode <VBoxContainer>(LeftPanelsPath);
        agentsPanel                  = GetNode <Control>(AgentsPanelPath);
        environmentPanel             = GetNode <NinePatchRect>(EnvironmentPanelPath);
        environmentPanelBarContainer = GetNode <GridContainer>(EnvironmentPanelBarContainerPath);
        glucoseBar                   = GetNode <ProgressBar>(GlucoseBarPath);
        ammoniaBar                   = GetNode <ProgressBar>(AmmoniaBarPath);
        phosphateBar                 = GetNode <ProgressBar>(PhosphateBarPath);
        hydrogenSulfideBar           = GetNode <ProgressBar>(HydrogenSulfideBarPath);
        ironBar                    = GetNode <ProgressBar>(IronBarPath);
        compoundsPanel             = GetNode <NinePatchRect>(CompoundsPanelPath);
        CompoundsPanelBarContainer = GetNode <GridContainer>(CompoundsPanelBarContainerPath);
        oxytoxyBar                 = GetNode <ProgressBar>(OxytoxyBarPath);
        atpBar    = GetNode <TextureProgress>(AtpBarPath);
        healthBar = GetNode <TextureProgress>(HealthBarPath);
        ammoniaReproductionBar   = GetNode <TextureProgress>(AmmoniaReproductionBarPath);
        phosphateReproductionBar = GetNode <TextureProgress>(PhosphateReproductionBarPath);
        atpLabel        = GetNode <Label>(AtpLabelPath);
        hpLabel         = GetNode <Label>(HpLabelPath);
        menu            = GetNode <Control>(MenuPath);
        animationPlayer = GetNode <AnimationPlayer>(AnimationPlayerPath);
        hoveredItems    = GetNode <VBoxContainer>(HoveredItemsContainerPath);
        populationLabel = GetNode <Label>(PopulationLabelPath);
        patchLabel      = GetNode <Label>(PatchLabelPath);
        editorButton    = GetNode <TextureButton>(EditorButtonPath);
        helpScreen      = GetNode <Control>(HelpScreenPath);

        OnEnterStageTransition();
    }
    public override void _Ready()
    {
        click = (AudioStreamPlayer)GetTree().GetRoot().GetNode("SceneSwitcher/Click");
        paper = (NinePatchRect)GetNode("ReferenceRect/NinePatchRect");

        holder           = (ReferenceRect)GetNode("ReferenceRect");
        ingredientPrefab = (PackedScene)ResourceLoader.Load("res://Instances/Ingredient.tscn");

        GetData();
        Vector2 startingPos = new Vector2(53, 192);

        foreach (FoodInfo food in FoodData)
        {
            Ingredient ingredient = (Ingredient)ingredientPrefab.Instance();
            ingredient.name = food.type;
            ingredient.SetPosition(startingPos);
            GetNode("ReferenceRect").AddChild(ingredient);
            startingPos.y += 96;
        }
        Button button = (Button)GetNode("ReferenceRect/Button");

        startingPos.x  = 29;
        startingPos.y += 30;
        button.SetPosition(startingPos);
        NinePatchRect ninePatchRect = (NinePatchRect)GetNode("ReferenceRect/NinePatchRect");

        ninePatchRect.SetSize(new Vector2(ninePatchRect.GetSize().x, startingPos.y + 102));
    }
    public override void _Ready()
    {
        click = (AudioStreamPlayer)GetTree().GetRoot().GetNode("SceneSwitcher/Click");
        paper = (NinePatchRect)GetNode("ReferenceRect/NinePatchRect");

        holder = (ReferenceRect)GetNode("ReferenceRect");
        // Called every time the node is added to the scene.
        // Initialization here
    }
Exemple #6
0
        public override void _Ready()
        {
            border  = GetNode <NinePatchRect>("Border");
            filling = GetNode <NinePatchRect>("Filling");
            label   = GetNode <Label>("Label");

            label.Text = labelText;

            SetEnabled(!enabled);
        }
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        _seconds    = 0;
        _background = GetNode <NinePatchRect>("Background");
        _menuButton = _background.GetNode <TextureButton>("MenuButton");

        _reloadButton = _background.GetNode <TextureButton>("ReloadButton");

        _timeDisplay = _background.GetNode <Label>("TimeDisplay");
        _mineDisplay = _background.GetNode <Label>("NbMineDisplay");

        _background.GetNode <Timer>("Timer").Connect("timeout", this, nameof(OnSecondTimeout));

        _menu = GetNode <Menu>("Menu");
    }
Exemple #8
0
    public override void _Ready()
    {
        compoundBars = GetTree().GetNodesInGroup("CompoundBar");

        winExtinctBoxHolder = GetNode <Control>("WinExtinctBoxHolder");

        panelsTween     = GetNode <Tween>(PanelsTweenPath);
        mouseHoverPanel = GetNode <MarginContainer>(MouseHoverPanelPath);
        pauseButton     = GetNode <TextureButton>(PauseButtonPath);
        resumeButton    = GetNode <TextureButton>(ResumeButtonPath);
        agentsPanel     = GetNode <Control>(AgentsPanelPath);

        environmentPanel             = GetNode <NinePatchRect>(EnvironmentPanelPath);
        environmentPanelBarContainer = GetNode <GridContainer>(EnvironmentPanelBarContainerPath);
        oxygenBar     = GetNode <ProgressBar>(OxygenBarPath);
        co2Bar        = GetNode <ProgressBar>(Co2BarPath);
        nitrogenBar   = GetNode <ProgressBar>(NitrogenBarPath);
        temperature   = GetNode <ProgressBar>(TemperaturePath);
        sunlightLabel = GetNode <ProgressBar>(SunlightPath);
        pressure      = GetNode <ProgressBar>(PressurePath);

        compoundsPanel             = GetNode <NinePatchRect>(CompoundsPanelPath);
        compoundsPanelBarContainer = GetNode <GridContainer>(CompoundsPanelBarContainerPath);
        glucoseBar         = GetNode <ProgressBar>(GlucoseBarPath);
        ammoniaBar         = GetNode <ProgressBar>(AmmoniaBarPath);
        phosphateBar       = GetNode <ProgressBar>(PhosphateBarPath);
        hydrogenSulfideBar = GetNode <ProgressBar>(HydrogenSulfideBarPath);
        ironBar            = GetNode <ProgressBar>(IronBarPath);

        oxytoxyBar               = GetNode <ProgressBar>(OxytoxyBarPath);
        atpBar                   = GetNode <TextureProgress>(AtpBarPath);
        healthBar                = GetNode <TextureProgress>(HealthBarPath);
        ammoniaReproductionBar   = GetNode <TextureProgress>(AmmoniaReproductionBarPath);
        phosphateReproductionBar = GetNode <TextureProgress>(PhosphateReproductionBarPath);

        atpLabel                  = GetNode <Label>(AtpLabelPath);
        hpLabel                   = GetNode <Label>(HpLabelPath);
        menu                      = GetNode <PauseMenu>(MenuPath);
        animationPlayer           = GetNode <AnimationPlayer>(AnimationPlayerPath);
        hoveredCompoundsContainer = GetNode <VBoxContainer>(HoveredCompoundsContainerPath);
        hoveredCellsSeparator     = GetNode <HSeparator>(HoverPanelSeparatorPath);
        hoveredCellsContainer     = GetNode <VBoxContainer>(HoveredCellsContainerPath);
        populationLabel           = GetNode <Label>(PopulationLabelPath);
        patchLabel                = GetNode <Label>(PatchLabelPath);
        editorButton              = GetNode <TextureButton>(EditorButtonPath);
    }
Exemple #9
0
    public void HotbarUpdate()
    {
        for (int Slot = 0; Slot <= 9; Slot++)
        {
            NinePatchRect SlotPatch = GetNode("CLayer/HotBarCenter/HBoxContainer/Vbox").GetChild(Slot) as NinePatchRect;
            if (Game.PossessedPlayer.Inventory[Slot] != null)
            {
                SlotPatch.Texture = Items.Thumbnail(Game.PossessedPlayer.Inventory[Slot].Type);
            }
            SlotPatch.RectMinSize = new Vector2(GetViewport().Size.y / 11, GetViewport().Size.y / 11);

            NinePatchRect ActiveIndicatorPatch = GetNode("CLayer/HotBarCenter/HBoxContainer/Vbox2").GetChild(Slot) as NinePatchRect;
            ActiveIndicatorPatch.RectMinSize = new Vector2(GetViewport().Size.y / 11, GetViewport().Size.y / 11);
            ActiveIndicatorPatch.Texture     = Alpha;
        }

        ((NinePatchRect)(GetNode("CLayer/HotBarCenter/HBoxContainer/Vbox2").GetChild(Game.PossessedPlayer.InventorySlot))).Texture = Triangle;
    }
Exemple #10
0
    public void HotbarUpdate()
    {
        for (int Slot = 0; Slot <= 9; Slot++)
        {
            NinePatchRect SlotPatch = GetNode("CLayer/HotBarCenter/HBoxContainer/Vbox").GetChild(Slot) as NinePatchRect;
            if (Game.PossessedPlayer.Inventory[Slot] != null)
            {
                SlotPatch.Texture = Items.Thumbnails[Game.PossessedPlayer.Inventory[Slot].Id];

                foreach (Node Child in SlotPatch.GetChildren())
                {
                    Child.QueueFree();
                }

                Label CountLabel = ItemCountLabelScene.Instance() as Label;
                CountLabel.Text = Game.PossessedPlayer.Inventory[Slot].Count.ToString();
                SlotPatch.AddChild(CountLabel);
            }
            else
            {
                SlotPatch.Texture = Alpha;

                foreach (Node Child in SlotPatch.GetChildren())
                {
                    Child.QueueFree();
                }
            }

            SlotPatch.RectMinSize = new Vector2(GetViewport().Size.y / 11, GetViewport().Size.y / 11);

            NinePatchRect ActiveIndicatorPatch = GetNode("CLayer/HotBarCenter/HBoxContainer/Vbox2").GetChild(Slot) as NinePatchRect;
            ActiveIndicatorPatch.RectMinSize = new Vector2(GetViewport().Size.y / 11, GetViewport().Size.y / 11);
            ActiveIndicatorPatch.Texture     = Alpha;
        }

        ((NinePatchRect)(GetNode("CLayer/HotBarCenter/HBoxContainer/Vbox2").GetChild(Game.PossessedPlayer.InventorySlot))).Texture = Triangle;
    }
Exemple #11
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     rect = GetNode <NinePatchRect>("ColorRect");
     text = GetNode <Label>("ScoreText");
 }
Exemple #12
0
 public override void _Ready()
 {
     label   = GetNode <Label>("Label");
     content = GetNode <NinePatchRect>("Content/Bar");
     SetHealth(currentHealth, maxHealth);
 }