Exemple #1
0
    private void DisplayEvent()
    {
        _firstPause  = 0.04f;
        _secondPause = 0.4f;
        var data = _adventure.GetDataEvent();

        _title.text = data.NameEvent;
        _text       = data.Description;
        _coroutiner.StartCoroutine(DisplayDescription(data.Description, 0.5f));
        _firstArt.sprite = data.Art;
        var events = data.Events;
        var count  = 1;

        foreach (var @event  in events)
        {
            foreach (var btn in _poolButtons)
            {
                if (btn.activeSelf)
                {
                    continue;
                }
                var child   = btn.GetComponentsInChildren <Transform>().SearchChild("Text");
                var btnText = child.GetComponent <TMP_Text>();
                btnText.text = @event.label;
                var button = btn.GetComponent <Button>();
                button.onClick.AddListener(delegate { OnClickButtonEvent(@event); });
                _configurateManager.ConfigurateByParent(btn, count <= 2 ? _panelButtons1 : _panelButtons2, true);
                count++;
                break;
            }
        }
        var component = _btnSkip.GetComponent <Button>();

        component.onClick.AddListener(OnClickButtonSkip);
    }
Exemple #2
0
 private void FinishBattle()
 {
     foreach (var cardPlayer in _poolCardsPlayer)
     {
         var draggable = cardPlayer.GetComponent <DraggableCard>();
         draggable.enabled = false;
         if (!cardPlayer.activeSelf)
         {
             continue;
         }
         var component = cardPlayer.GetComponent <ActionsWithCards>();
         component.Animator.enabled = true;
         _configurateManager.ConfigurateByParent(cardPlayer, _hud, false);
     }
     _currentCardsInHand = 0;
     _discardCards.Clear();
 }
    private void SpawnItemInventory(int index)
    {
        var list      = _inventoryPlayers[_player];
        var component = _arrayInventory[index].GetComponent <ActionsWithSlotInventory>();
        var card      = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCardInInventory, 1)[0];

        _configurateManager.ConfigurateByParent(card, _arrayInventory[index], 0, 0, 1, 1);
        var cardDisplay = card.GetComponent <ActionsWithCards>();
        var name        = list[index];
        var cardData    = _objectStorage.GetCardByName(name);

        cardDisplay.СhangeCardType(cardData);
        cardDisplay.SetIdCard(index);
        cardDisplay.CardGame.DisplayCardInGame(card);
        component.SetVarsSlot(false, false, index, cardData);
        //card.transform.Find("ShirtCard").gameObject.SetActive(false);
        component.SetDependecies(_publisher);
    }
Exemple #4
0
    public void SetDependecies(GameObject popupRewardEvent, GameObject btn)
    {
        _popupReward      = popupRewardEvent;
        _closePanel       = _popupReward.GetComponentsInChildren <Transform>().SearchChild("ClosePanelPlayer").gameObject;
        _btnContinue      = btn;
        _buttonContinue   = _btnContinue.GetComponent <Button>();
        _poolTokensReward = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabToken, 3);
        var art       = _poolTokensReward[0].GetComponentsInChildren <Transform>().SearchChild("SpriteArt");
        var rectToken = art.GetComponent <RectTransform>();

        foreach (var objToken in _poolTokensReward)
        {
            _configurateManager.ConfigurateByParent(objToken, _popupReward, false);
            objToken.GetComponent <RectTransform>().SetOffset(0, 0, 0, 0);
            var artSprite = objToken.GetComponentsInChildren <Transform>().SearchChild("SpriteArt");
            _configurateManager.ConfigurateSprite(artSprite.gameObject, rectToken);
        }
    }
Exemple #5
0
    public void SetDependecies(GameObject panelPlayes)
    {
        _panelPlayers = panelPlayes;
        //----------------------------
        _poolIconToken = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabIconToken, 12);
        var art     = _poolIconToken[0].GetComponent <Transform>();
        var refRect = art.GetComponent <RectTransform>();
        var count   = 0;

        foreach (var icon in _poolIconToken)
        {
            _configurateManager.ConfigurateByParent(icon, _panelPlayers, false);
            var rectIcon = icon.GetComponent <RectTransform>();
            rectIcon.SetOffset(0, 0, 0, 0);
            rectIcon.OffsetAnchorY(-0.0825f * count);
            var artSprite = icon.GetComponent <SpriteRenderer>();
            _configurateManager.ConfigurateSprite(artSprite.gameObject, refRect);
            ++count;
        }
    }
Exemple #6
0
    private IEnumerator SwitchParent(GameObject obj, float pause)
    {
        yield return(new WaitForSeconds(pause));

        _configurateManager.ConfigurateByParent(obj, _panelEnemy, 1, 1, 1, 1);
    }
Exemple #7
0
    public void OnEvent(CustomEventArgs messageData)
    {
        var message = messageData.Message;

        switch (message)
        {
        case GameEventName.GoStageAddCardSpell:
            _coroutiner.StartCoroutine(SpawnCardsByType(CardType.Spell,
                                                        DropChance.ChanceSpell, DropChance.StartСhanceRarity, 3));
            break;

        case GameEventName.GoStageAddCardConsumables:
            _coroutiner.StartCoroutine(SpawnCardsByType(CardType.Consumables,
                                                        DropChance.ChanceConsumables, DropChance.StartСhanceRarity, 3));
            break;

        case GameEventName.GoStageAddCardArea:
            _coroutiner.StartCoroutine(SpawnCardArea());
            break;

        case GameEventName.GoStageAddCardEvent:
            _coroutiner.StartCoroutine(SpawnCardEvent());
            break;

        case GameEventName.GoStageAddCardEnemy:
            _coroutiner.StartCoroutine(SpawnCardEnemy());
            break;

        case GameEventName.GoStageRandomEvent:
            _coroutiner.StartCoroutine(StartRandomEvent());
            break;

        case GameEventName.GoSelectCardEnemy:
        {
            foreach (var card in _poolCardEnemy)
            {
                if (!card.activeSelf)
                {
                    continue;
                }
                var cardDisplay = card.GetComponent <ActionsWithCards>();
                _selectedCardUnit = cardDisplay.CardGame;
                break;
            }
            _coroutiner.StartCoroutine(PreparationStageBattle());
            //_coroutiner.StartCoroutine(SpawnCardsInHand());
            break;
        }

        case GameEventName.GoSummonAllies:
            _selectedCardUnit = messageData.Value as ICard;
            SpawnAllies();
            break;

        case GameEventName.GoStageBattle:
            _publisher.Publish(null, new CustomEventArgs(GameEventName.GoNextTurn));
            break;

        case GameEventName.GoFinishBattle:
            FinishBattle();
            break;

        case GameEventName.GoRewardEvent:
            _coroutiner.StartCoroutine(EndRandomEvent(0.7f));
            break;

        case GameEventName.GoOpenPopupWithDescriptionCard:
        {
            ReturnNoSelectedCard(_poolGameCard);
            var cardGame = messageData.Value;
            _publisher.Publish(_hud, new CustomEventArgs(GameEventName.GoSetNextStage, cardGame));
            break;
        }

        case GameEventName.GoOpenPopupNoDescription:
        {
            ReturnNoSelectedCard(_poolCardArea);
            ReturnNoSelectedCard(_poolCardEvent);
            ReturnNoSelectedCard(_poolCardEnemy);
            var cardGame = messageData.Value;
            _publisher.Publish(_hud, new CustomEventArgs(GameEventName.GoSetNextStage, cardGame));
            break;
        }

        case GameEventName.GoDeadEnemy:
            var objCard = messageData.Value as GameObject;
            _configurateManager.ConfigurateByParent(objCard, _hud, false);
            break;

            /*case GameEventName.GoEndTurnPlayer:
             *  foreach (var card in _poolCardsPlayer)
             *  {
             *      var component = card.GetComponent<DraggableCard>();
             *      component.enabled = false;
             *  }
             *  break;
             * case GameEventName.GoEndTurnEnemy:
             *  foreach (var card in _poolCardsPlayer)
             *  {
             *      var component = card.GetComponent<DraggableCard>();
             *      component.enabled = true;
             *  }
             *  break;*/
        }
    }