public override void OnTurnBegin()
    {
        base.OnTurnBegin();

        TurnEndBtn.SetActive(true);

        SetCost(PFConst.DefaultPlayerMaxCost);

        RemoveAllCard_InDeckUI();

        //덱카드 갱신
        CardPool[PFCardPool.DeckCard].Clear();

        if (CardPool[PFCardPool.RemainCard].Count < PFConst.InitDeckCardCount)
        {
            CardPool[PFCardPool.RemainCard].AddRange(CardPool[PFCardPool.UsedCard]);

            CardPool[PFCardPool.UsedCard].Clear();
            ShowUsedCardBtn.CardCount_UILabel.text = CardPool[PFCardPool.UsedCard].Count.ToString();
            CardListUI_Used.UpdateUI_CardList(CardPool[PFCardPool.UsedCard]);
        }

        CardPool[PFCardPool.DeckCard] = PFUtil.GetRandomList(CardPool[PFCardPool.RemainCard], PFConst.InitDeckCardCount, true);

        DeckCardList = PFPlayerStuff.Create_DeckCards(DeckCardParent, CardPool[PFCardPool.DeckCard], PFConst.WidthResolution);

        //남은카드 갱신
        PFPlayerStuff.RemoveTargetComponent(CardPool[PFCardPool.RemainCard], CardPool[PFCardPool.DeckCard]);

        CardListUI_Remain.UpdateUI_CardList(CardPool[PFCardPool.RemainCard]);

        ShowRemainCardBtn.CardCount_UILabel.text = CardPool[PFCardPool.RemainCard].Count.ToString();

        Enable_DeckCard_OnClickEvent(true);
    }
    public override void Init(int charTableId, Vector3 vPos)
    {
        base.Init(charTableId, vPos);

        CardListUI_Remain = PFUtil.Instantiate <APFCardListUI>(PFPrefabPath.CardListUI, this.gameObject, Vector3.zero);
        CardListUI_Remain.gameObject.SetActive(false);
        CardListUI_Remain.Title_UILabel.text = PFConst.StrRemainCard;

        CardListUI_Used = PFUtil.Instantiate <APFCardListUI>(PFPrefabPath.CardListUI, this.gameObject, Vector3.zero);
        CardListUI_Used.gameObject.SetActive(false);
        CardListUI_Used.Title_UILabel.text = PFConst.StrUsedCard;

        CardListUI_Destroyed = PFUtil.Instantiate <APFCardListUI>(PFPrefabPath.CardListUI, this.gameObject, Vector3.zero);
        CardListUI_Destroyed.gameObject.SetActive(false);
        CardListUI_Destroyed.Title_UILabel.text = PFConst.StrDestroyedCard;

        PFPlayerCharacter = PFCharacter as APFPlayerCharacter;

        List <int> totalCardList = PFPlayerStuff.GetInitTotalCardList();

        CardPool[PFCardPool.RemainCard] = totalCardList;

        APFGameMode gameMode = APFGameMode.GetInstance();

        gameMode.OnClick_Character_Dele += OnClick_Character;
    }
    protected T CreateCharacter <T>(int charTableId, Vector3 pos) where T : APFCharacter
    {
        CharacterTableId = charTableId;

        string charPrefabPath = PFCharacterTable.GetCharacterPrefabPath(CharacterTableId);

        T character = PFUtil.Instantiate <T>(charPrefabPath, this.gameObject, pos);

        return(character);
    }
示例#4
0
    public static T Instantiate <T>(T originalObj, GameObject parent, Vector3 pos) where T : MonoBehaviour
    {
        T newInstance = PFUtil.Instantiate(originalObj, parent);

        if (newInstance != null)
        {
            newInstance.gameObject.transform.localPosition = pos;
        }

        return(newInstance);
    }
示例#5
0
    APFPlayerController CreatePlayerController()
    {
        APFPlayerController plrController_original = Resources.Load <APFPlayerController>(PFPrefabPath.PlayerController);

        APFPlayerController newPlrController = PFUtil.Instantiate(plrController_original, this.gameObject);

        Vector3 vPos = new Vector3(-480, PFConst.CharacterCreatePosY, 0.0f);

        int charTableId = 10001;

        newPlrController.Init(charTableId, vPos);

        return(newPlrController);
    }
示例#6
0
    public static List <APFCardUI> Create_DeckCards(GameObject cardParent, List <int> deckCardIdList, int bgFrameWidth)
    {
        APFCardUI card_original = Resources.Load <APFCardUI>(PFPrefabPath.Card);

        if (card_original == null)
        {
            StringBuilder sbLog = new StringBuilder("");
            sbLog.AppendFormat("{0} 경로에 카드프리팹이 없습니다.", PFPrefabPath.Card);
            Debug.LogError(sbLog.ToString());
            return(null);
        }

        int cardWidth      = card_original.GetCardWidth();
        int cardCount      = deckCardIdList.Count;
        int cardTotalWidth = cardWidth * cardCount;

        float createPosX = (bgFrameWidth - cardTotalWidth) / 2;

        createPosX += cardWidth / 2;

        List <APFCardUI> newInstanceList = new List <APFCardUI>(cardCount);

        for (int i = 0; i < cardCount; ++i)
        {
            int          cardId    = deckCardIdList[i];
            PFTable.Card cardTable = PFTable.GetCard(cardId);

            if (cardTable != null)
            {
                Vector3 createPos = new Vector3(createPosX, 0.0f, 0.0f);

                APFCardUI newCardInstance = PFUtil.Instantiate(card_original, cardParent, createPos);

                newCardInstance.Init(cardTable);

                newInstanceList.Add(newCardInstance);

                createPosX += cardWidth;
            }
            else
            {
                StringBuilder sbLog = new StringBuilder("");
                sbLog.AppendFormat("카드테이블 id: {0} 카드정보가 없습니다", cardId);
                Debug.LogError(sbLog.ToString());
                return(null);
            }
        }

        return(newInstanceList);
    }
示例#7
0
    public static T Instantiate <T>(string prefabPath, GameObject parent, Vector3 pos) where T : MonoBehaviour
    {
        T original = Resources.Load <T>(prefabPath);

        if (original != null)
        {
            T newInstance = PFUtil.Instantiate(original, parent);

            newInstance.gameObject.transform.localPosition = pos;

            return(newInstance);
        }

        return(null);
    }
示例#8
0
    public static T CreateGameObject <T>(GameObject parentObj) where T : MonoBehaviour
    {
        Type typeOfT = typeof(T);

        //1
        GameObject newGameObj = new GameObject(typeOfT.FullName);

        //2
        PFUtil.SetDefaultAttach(parentObj, newGameObj);

        //3
        T tObj = newGameObj.AddComponent <T>();

        return(tObj);
    }
示例#9
0
    public void UpdateUI_CardList(List <int> cardList)
    {
        PFUtil.DestroyChild(CardListGrid.gameObject, false);

        if (cardList == null)
        {
            return;
        }

        for (int i = 0; i < cardList.Count; ++i)
        {
            APFCardUI pfCard = PFUtil.Instantiate <APFCardUI>(PFPrefabPath.Card, CardListGrid.gameObject, Vector3.zero);
            pfCard.Init(PFTable.GetCard(cardList[i]));
        }

        CardListGrid.repositionNow = true;
    }
示例#10
0
    private APFStatusIconUI AddStatusIcon(PFTable.Card.StatusIcon statusIconType, int statusKeepTurnCount)
    {
        APFStatusIconUI newStatusIcon = PFUtil.Instantiate <APFStatusIconUI>(PFPrefabPath.StatusIcon, StatusIcon_UIGrid.gameObject, Vector3.zero);

        StatusIcon_UIGrid.repositionNow = true; //grid에 새 요소를 추가한후, 위치를 재정비한다.

        string statusIconPath = PFCardTable.GetStatusIconPath(statusIconType);

        UnityEngine.Sprite sprite = Resources.Load <UnityEngine.Sprite>(statusIconPath);

        newStatusIcon.StatusIconType = statusIconType;
        newStatusIcon.SetStatusKeepTurnCount(statusKeepTurnCount);
        newStatusIcon.StatusIconImage.sprite2D = sprite;

        StatusIconList.Add(newStatusIcon);

        return(newStatusIcon);
    }
示例#11
0
    public static T Instantiate <T>(T originalObj, GameObject parent) where T : MonoBehaviour
    {
        if (originalObj != null &&
            parent != null)
        {
            //1
            T newInstance = GameObject.Instantiate <T>(originalObj);

            //2
            Type typeOfT = typeof(T);
            newInstance.name = typeOfT.FullName;

            //3
            PFUtil.SetDefaultAttach(parent, newInstance.gameObject);

            return(newInstance);
        }

        return(null);
    }
示例#12
0
    public static List <APFMonsterController> CreateMonsterControllers(List <List <int> > monsterGroupList, GameObject parent)
    {
        if (monsterGroupList == null)
        {
            return(null);
        }

        List <int> monsterGroup = null;
        {
            int randIndex = UnityEngine.Random.Range(0, monsterGroupList.Count);
            monsterGroup = monsterGroupList[randIndex];
            monsterGroupList.RemoveAt(randIndex);
        }

        float xPos   = 0.0f;
        float yPos   = PFConst.CharacterCreatePosY;
        float xWidth = 300.0f;

        List <APFMonsterController> monsterControllerList = new List <APFMonsterController>();

        for (int i = 0; i < monsterGroup.Count; ++i)
        {
            int charTableId = monsterGroup[i];

            APFMonsterController monsterController = PFUtil.CreateGameObject <APFMonsterController>(parent);

            Vector3 vPos = new Vector3(xPos, yPos, 0.0f);
            monsterController.Init(charTableId, vPos);

            monsterControllerList.Add(monsterController);

            xPos += xWidth;
        }

        return(monsterControllerList);
    }
示例#13
0
    private void CreateGameMode()
    {
        APFGameMode gamemode_original = Resources.Load <APFGameMode>(PFPrefabPath.GameMode);

        PFGameMode = PFUtil.Instantiate(gamemode_original, PFUIRoot.gameObject);
    }
示例#14
0
 private void Destroy_CharCtrlList()
 {
     PFUtil.DestroyGameObject(AliveCharCtrlList);
     PFUtil.DestroyGameObject(DeadCharCtrlList);
 }