Пример #1
0
    private void CreatePanelPlayers()
    {
        var holder        = _popupPlayers.GetComponentsInChildren <Transform>().SearchChild("PopupPlayers");
        var holderPlayers = holder.gameObject; //найдем панель под иконки игроков

        //----------------------------
        _arrayPlayers = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabIconPlayer, 4);
        var players      = _objectStorage.GetDictionaryCards(SubTypeCard.GameClass);
        var playersCards = new List <ICard>(players.Values);
        var count        = 0;

        foreach (var obj in _arrayPlayers)
        {
            var gameclass = playersCards[count].GetDataCard().GameClass;
            var points    = _dictionaryPoints[gameclass];
            _configurateManager.Configurate(obj, holderPlayers, true,
                                            points[0], points[1], points[2], points[3]);
            var componentObj = obj.GetComponent <ActionsWithCardGameClass>();
            componentObj.СhangeCardType(playersCards[count]);
            var icon = obj.GetComponentsInChildren <Transform>().SearchChild("Icon");
            icon.GetComponent <Image>().sprite = componentObj.CardGame.GetDataCard().Art;
            componentObj.SetDependecies(_publisher);
            if (gameclass == GameClass.Red)
            {
                componentObj.SetSelected();
            }

            var rect = obj.GetComponent <RectTransform>();
            obj.GetComponent <BoxCollider2D>().SetSizeBox2D(rect, 10f, 10f);
            _publisher.AddSubscriber(componentObj);
            _publisher.Publish(null, new CustomEventArgs(GameEventName.SpawnPlayer, obj));
            count++;
        }
    }
Пример #2
0
    private void CreateDependecies()
    {
        var uiButtonsPopup = _btnGameObject.GetComponent <UiButtonsPopups>();

        uiButtonsPopup.SetDependecies(_publisher);
        _audioManager.SetDependecies(_soundGameObject);
        _publisher.Publish(this, new CustomEventArgs(GameEventName.GoStageStartGame));
        _configurateManager.SetDependecies(_poolParent, _defaultCard);
        _objectStorage.CreateAllPools();

        _gameManager.SetUiComponents(_hud, _deckInGame);
        _gameManager.PlaceObjects();
        _deckManager.SetUiComponents(_hud, _pointStopDrag, _pointReturnCard);
        _deckManager.PlaceObjects();
        _enemyManager.SetDependecies(_panelEnemy);
        _alliesManager.SetDependecies(_panelAllies);
        _tokenRewardManager.SetDependecies(_panelPlayers);
        _activateCardManager.SetDependecies(_iconСounterCardPlay);

        uiButtonsPopup = _btnEndTurn.GetComponent <UiButtonsPopups>();
        uiButtonsPopup.SetDependecies(_publisher);
        _publisher.AddSubscriber(uiButtonsPopup);
        uiButtonsPopup = _btnMenu.GetComponent <UiButtonsPopups>();
        uiButtonsPopup.SetDependecies(_publisher);
        _publisher.AddSubscriber(uiButtonsPopup);

        var cardPlaceInSlot = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCard, 1)[0];

        cardPlaceInSlot.transform.SetParent(_popupPlaceInSlot.transform);
        cardPlaceInSlot.SetActive(true);
        cardPlaceInSlot.GetComponent <RectTransform>().SetRect(0.0614f, 0.0575f, 0.412f, 0.9422f);
        cardPlaceInSlot.GetComponent <RectTransform>().SetOffset(0, 0, 0, 0);

        _popupDescriptionCard.AddComponent <ClickHandlerPopupCard>();
        var component = _popupDescriptionCard.GetComponent <ClickHandlerPopupCard>();

        component.SetDependecies(_publisher);

        var rect = _panelAllies.GetComponent <RectTransform>();

        _panelAllies.GetComponent <BoxCollider2D>().SetSizeBox2D(rect, 10f, 10f);

        _targetManager.SetDependecies(_targetPointer, _targetPlayer, _hud);
        _popupManagers.PopupGameMenu.SetDependecies(_popupGameMenu);
        _popupManagers.PopupInventory.SetDependecies(_popupInventory);
        _popupManagers.PopupEvent.SetDependecies(_popupEvent);
        _popupManagers.PopupPlayers.SetDependecies(_popupPlayers);
        _popupManagers.PopupInventory.SearchAndSetHolders(_popupManagers.PopupPlayers.GetArrayPlayers());
        _publisher.Publish(this,
                           new CustomEventArgs(GameEventName.GoCreateBarsPlayers, _popupManagers.PopupPlayers.GetArrayPlayers()));

        _popupManagers.PopupDescriptionCard.SetDependecies(_popupDescriptionCard);
        _popupManagers.PopupPlaceInSlot.SetDependecies(_popupPlaceInSlot, cardPlaceInSlot);
        _popupManagers.PopupRewardEvent.SetDependecies(_popupRewardEvent, _btnContinuePopupReward);
    }
Пример #3
0
 public void PlaceObjects()
 {
     _poolCardsPlayer = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCard, 9);
     foreach (var card in _poolCardsPlayer)
     {
         _configurateManager.Configurate(card, _hud, false, 0.034f, 0.06f, 0.194f, 0.46f);
         card.gameObject.AddComponent <DraggableCard>();
         var component = card.GetComponent <DraggableCard>();
         component.enabled = false;
     }
 }
Пример #4
0
    /*private IEnumerator SpawnCardsInHand()
     * {
     *  var cards = _inventoryManager.GetCardInDeck();
     *  yield return new WaitForSeconds(2f);
     *  var count = 1;
     *  foreach (var card in cards)
     *  {
     *      foreach (var cardPlayer in _poolCardsPlayer)
     *      {
     *          if (cardPlayer.activeSelf) continue;
     *          foreach (Transform child in cardPlayer.transform)
     *              child.gameObject.SetActive( true);
     *          var cardDisplay = cardPlayer.GetComponent<ActionsWithCards>();
     *          var cardByName =  _objectStorage.GetCardByName(card);
     *          cardDisplay.СhangeCardType(cardByName);
     *          cardDisplay.SetIdCard(count);
     *          cardDisplay.CardGame.DisplayCardInGame(cardPlayer);
     *          cardDisplay.SetDependecies(_publisher, _animaManager);
     *          cardDisplay.enabled = false;
     *          cardPlayer.SetActive(true);
     *          _animaManager.SetStateAnimation(cardPlayer, "go_hand",true);
     *          count++;
     *          _coroutiner.StartCoroutine(SwithParentCard(cardPlayer));
     *          yield return new WaitForSeconds(0.2f);
     *          break;
     *      }
     *  }
     * }*/
    /*private IEnumerator SwithParentCard(GameObject card)
     * {
     *  yield return new WaitForSeconds(0.6f);
     *  _objectStorage.ConfigurateByParent(card,_hand);
     *  card.GetComponent<CanvasGroup>().blocksRaycasts = true;
     * }*/
    public void PlaceObjects()
    {
        _poolCardBattleUnit = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCardBattleUnit, 8);
        foreach (var objCard in _poolCardBattleUnit)
        {
            _configurateManager.ConfigurateByParent(objCard, _hud, false);
        }
        _poolCardArea = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCardArea, 3);
        foreach (var objGameArea in _poolCardArea)
        {
            _configurateManager.ConfigurateByParent(objGameArea, _hud, false);
        }
        _poolCardEvent = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCardEvent, 3);
        foreach (var objGameEvent in _poolCardEvent)
        {
            _configurateManager.ConfigurateByParent(objGameEvent, _hud, false);
        }
        _poolCardEnemy = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCardEnemy, 3);
        foreach (var objGameEnemy in _poolCardEnemy)
        {
            _configurateManager.ConfigurateByParent(objGameEnemy, _hud, false);
        }
        _poolGameCard = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCard, 5);
        foreach (var objCard in _poolGameCard)
        {
            _configurateManager.ConfigurateByParent(objCard, _hud, false);
        }

        /*_poolCardsPlayer = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabCard, 9);
         * foreach (var card in _poolCardsPlayer)
         * {
         *  _objectStorage.Configurate(card, _hud, false,0.034f,0.06f,0.194f,0.46f);
         *  card.gameObject.AddComponent<DraggableCard>();
         *  var component = card.GetComponent<DraggableCard>();
         *  component.enabled = false;
         * }*/
        _shirtDeckInGame.transform.SetAsLastSibling();
        _publisher.Publish(null, new CustomEventArgs(GameEventName.GoSetNextStage));
    }
Пример #5
0
    //--------------Метод, создает слоты для панелей инвентаря
    public void CreateSlotsInHolders()
    {
        ActionsWithSlotInventory component;
        //----------------------------
        float xmin = 0.04f, ymin = 0.5907f, xmax = 0.9580f, ymax = 0.9917f, ysize = -0.2f, xsize = 0.314f;

        _arrayInventory = _objectStorage.GetPollObjects(ObjectTypeEnum.SlotCardInInventory, 5);
        foreach (var obj in _arrayInventory)
        {
            _configurateManager.Configurate(obj, _holderCards, true, xmin, xmax, ymin, ymax);
            ymin     += ysize;
            ymax     += ysize;
            component = obj.GetComponent <ActionsWithSlotInventory>();
            obj.transform.GetComponent <Image>().SetAlpha(0f);
            component.SetDependecies(_publisher);
            component.SetVarsSlot(true, false);
        }
        //----------------------------
        _arraySpells = _objectStorage.GetPollObjects(ObjectTypeEnum.SlotCardInInventory, 6);
        xmin         = 0.0644f; ymin = 0.5323f; xmax = 0.3094f; ymax = 0.9348f;
        var count = 0;

        foreach (var obj in _arraySpells)
        {
            _configurateManager.Configurate(obj, _holderInventory, true, xmin, xmax, ymin, ymax);
            component = obj.GetComponent <ActionsWithSlotInventory>();
            component.SetDependecies(_publisher);
            component.SetVarsSlot(true, false);
            xmin += xsize;
            xmax += xsize;
            if (count == 2)
            {
                xmin = 0.0644f; ymin = 0.0756f; xmax = 0.3094f; ymax = 0.475f;
            }
            count++;
        }
        CreateInventory(_player);
    }
Пример #6
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);
        }
    }
Пример #7
0
    public void SetDependecies(GameObject popupEvent)
    {
        _popupEvent = popupEvent;
        var child = _popupEvent.GetComponentsInChildren <Transform>().SearchChild("TitleAdventure");

        _title         = child.GetComponent <TMP_Text>();
        child          = _popupEvent.GetComponentsInChildren <Transform>().SearchChild("Description");
        _description   = child.GetComponent <TMP_Text>();
        _panelButtons1 = _popupEvent.GetComponentsInChildren <Transform>().SearchChild("PanelButtons_1").gameObject;
        _panelButtons2 = _popupEvent.GetComponentsInChildren <Transform>().SearchChild("PanelButtons_2").gameObject;
        child          = _popupEvent.GetComponentsInChildren <Transform>().SearchChild("SpriteArtFirst");
        _firstArt      = child.GetComponent <SpriteRenderer>();
        child          = _popupEvent.GetComponentsInChildren <Transform>().SearchChild("SpriteArtSecond");
        _secondArt     = child.GetComponent <SpriteRenderer>();
        _btnSkip       = _popupEvent.GetComponentsInChildren <Transform>().SearchChild("btnSkip").gameObject;
        _btnSkip.SetActive(false);
        _stopDisplayDescription = false;
        _poolButtons            = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabBtnEvent, 4);
    }
Пример #8
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;
        }
    }