Ejemplo n.º 1
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);
    }