Пример #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
 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;
     }
 }
Пример #3
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);
    }