Beispiel #1
0
    public override void _Ready()
    {
        GameData.Instance.State = GameData.GameState.Narration;
        if (GameData.Instance.yokai == YokaiId.None)
        {
            Continue();
            return;
        } // Sanity check to avoid the infamous win-crash
        int money = (100 + GameData.Instance.MoneyPercentageBonus) * GameData.Instance.yokai.Data().Reward / 100;

        GameData.Instance.yokai         = YokaiId.None;
        GetNode <Label>(moneyPath).Text = $"+{money}";
        GameData.Instance.Money        += money;

        CardId card = CardData.AllSpecial().Random();

        GetNode <CardVisual>(cardPath).ShowCard(card.Data());
        GetNode <CardVisual>(cardPath).IsDisabled           = true;
        GetNode <RichTextLabel>(descriptionPath).BbcodeText = BB.Format(card.Data().Description);
        GetNode <Button>(addCardbuttonPath).Connect("pressed", this, nameof(AddToDeck), new Godot.Collections.Array()
        {
            card
        });
        GetNode <Button>(continuePath).Connect("pressed", this, nameof(Continue));


        RNG.StartCycle();
        Global.SaveGame();
    }
Beispiel #2
0
    public void SetCard(CardId card, int index)
    {
        CardVisual cardVisual = index switch { 0 => leftCard, 1 => middleCard, 2 => rightCard, _ => null };

        cardsForSale[index] = card;
        if (card == CardId.None)
        {
            cardVisual.Hide();
        }
        else
        {
            cardVisual.ShowCard(card.Data());
            cardVisual.Show();
        }

        cardVisual.GetNode <SmartText>("Text").BbcodeText = $"[center]{card.Data().MonPrice} [img]res://Assets/Sprites/GUI/mon_icon.png[/img][/center]";
    }
Beispiel #3
0
    public async Task AddCard(CardId card)
    {
        CardVisual visualCard;

        lock (handFlowLock) {
            visualCard = CardVisual.Instance();
            visuals.Add(visualCard);
        }
        container.AddChild(visualCard);
        visualCard.Modulate = new Color(1, 1, 1, 0);
        visualCard.ShowCard(card.Data());
        visualCard.MoveFrom(new Vector2(1000, 0));
        await ToSignal(visualCard.MyTween, "tween_completed");

        Refresh();
        visualCard.Connect(nameof(CardVisual.OnClick), this, nameof(SelectCard), visualCard.InArray());
        visualCard.Connect(nameof(CardVisual.FocusEntered), this, nameof(HoverCard));
        visualCard.Connect(nameof(CardVisual.FocusExited), this, nameof(UnHoverCard));
    }