Beispiel #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));
    }
    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));
    }
Beispiel #3
0
 /// <summary>
 /// Creates a controller and initializes the patch fields.
 /// </summary>
 public void InitializeEditor(ProcessingData data, bool isEditable)
 {
     _renderViewportReferenceRect = GetNode <ReferenceRect>("RenderViewportReferenceRect");
     Sfc2dEditorControl           = new Sfc2dEditorControl(_renderViewportReferenceRect, data, isEditable);
     Connect("resized", this, nameof(MarkForResizeOffsetRestore));
     _currentScale = new Vector2(1f, 1f);
 }
    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
    }
Beispiel #5
0
    public override void _Ready()
    {
        File file = new File();

        shiftEnd = (AudioStreamPlayer)GetNode("ShiftEnd");
        click    = (AudioStreamPlayer)GetTree().GetRoot().GetNode("SceneSwitcher/Click");
        pause    = (AudioStreamPlayer)GetNode("Pause");
        if (!file.FileExists("res://Data/MoneyRecord"))
        {
            file.Open("res://Data/MoneyRecord", 2);
            file.StoreDouble((float)0);
            file.Close();
        }
        if (!file.FileExists("res://Data/TimeRecord"))
        {
            file.Open("res://Data/TimeRecord", 2);
            file.StoreDouble((float)0);
            file.Close();
        }

        Global global = (Global)GetTree().GetRoot().GetNode("global");

        gameMode = global.gameMode;

        timeElapsed = (Label)GetNode("TimeElapsed");
        timeLeft    = (ProgressBar)GetNode("ProgressBar");
        time        = endTime;
        pauseMenu   = (ReferenceRect)GetNode("PauseMenu");
        endMenu     = (ReferenceRect)GetNode("EndMenu");
        Money       = 100;
        switch (gameMode)
        {
        case 0:
            timeLeft.Show();
            break;

        case 1:
            timeElapsed.Show();
            break;
        }
        SetProcess(true);
        // Called every time the node is added to the scene.
        // Initialization here
    }
Beispiel #6
0
 public Sfc2dEditorControl(ReferenceRect referenceRect, ProcessingData data, bool isEditable)
 {
     ReferenceRect = referenceRect;
     Data          = data;
     _isEditable   = isEditable;
 }