Beispiel #1
0
    public IEnumerator CreateSlots()
    {
        //빈슬롯 생성
        for (int i = 0; i < tr_DeckSlots.Length; i++)
        {
            GameObject         go   = GameUtil.CreateObjectToParent(prefab_UnitInfoSlot, tr_DeckSlots[i]);
            SlotUnitInfoScript slot = go.GetComponent <SlotUnitInfoScript>();
            slot.SetEmptySlot(i);
        }

        //보유카드 리스트 세팅
        List <BattleUnitData> HaveCardList = SaveDataManagerScript.Instance.MyCards.GetHaveCardList();

        foreach (var item in HaveCardList)
        {
            GameObject         go   = GameUtil.CreateObjectToParent(prefab_UnitInfoSlot, gr_Havecards.transform);
            SlotUnitInfoScript slot = go.GetComponent <SlotUnitInfoScript>();
            slot.SetData(item, eUnitSlotType.HaveCard);
            list_HaveCards.Add(slot);
        }

        //장착 모드 슬롯 세팅
        GameObject go_sel = GameUtil.CreateObjectToParent(prefab_UnitInfoSlot, tr_selectmode);

        selectedSlot = go_sel.GetComponent <SlotUnitInfoScript>();
        selectedSlot.SetEmptySlot();
        ChangeShowMode();

        yield return(StartCoroutine(RefreshDeck()));
    }
Beispiel #2
0
    /// <summary>덱 추가</summary>
    /// <param name="_AddData">추가할 유닛 데이터</param>
    public void AddDeck(BattleUnitData _AddData)
    {
        Debug.Log("<color=lime>AddDeck</color>  " + _AddData.Index + " / " + _AddData.UnitID + " / " + _AddData.Name);

        //해당 슬롯에 이미 다른 덱이 있는지 체크(UI)
        //SlotUnitInfoScript _BeforeSlot2 = tr_DeckSlots[_AddData.Index].GetComponent<SlotUnitInfoScript>();
        SlotUnitInfoScript _BeforeSlot = list_CurrentDeckCards.Find(r => r.UnitIndex == _AddData.Index);

        if (_BeforeSlot != null)
        {
            RemoveDeck(_BeforeSlot);
        }
        //else
        //    Debug.LogError("RemoveDeck 없음");

        SlotUnitInfoScript _slot = list_HaveCards.Find(r => r.UnitId == _AddData.UnitID);

        _slot.IsEquipedDeck = true;
        _slot._slotType     = eUnitSlotType.DeckCard;
        _slot.SetSlotIndex(_AddData.Index);
        GameUtil.MoveToParent(_slot.gameObject, tr_DeckSlots[_AddData.Index]);
        _slot.lb_Cost.text = _AddData.Index.ToString();

        //현재 등록덱 리스트에 추가
        list_CurrentDeckCards.Add(_slot);

        SaveDataManagerScript.Instance.MyDecks.AddDeck(CurrentDeckIndex, _AddData);
    }
Beispiel #3
0
 public void ReturnToHaveCardList(SlotUnitInfoScript _slot)
 {
     _slot.IsEquipedDeck = false;
     _slot._slotType     = eUnitSlotType.HaveCard;
     _slot.SetSlotIndex(-1);
     GameUtil.MoveToParent(_slot.gameObject, gr_Havecards.transform);
 }
Beispiel #4
0
 /// <summary>대상 슬롯을 보유 카드 그리드로 이동</summary>
 public void RemoveDeck(SlotUnitInfoScript _slot)
 {
     //Debug.LogError("RemoveDeck : " + _slot.Unitdata.Index);
     ReturnToHaveCardList(_slot);
     SaveDataManagerScript.Instance.MyDecks.RemoveDeck(CurrentDeckIndex, _slot.Unitdata);
 }