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);
    }
Exemple #3
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);
    }
Exemple #4
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);
    }
    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);
    }
Exemple #6
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);
    }
Exemple #7
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;
    }
Exemple #8
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);
    }
    private void CreateGameMode()
    {
        APFGameMode gamemode_original = Resources.Load <APFGameMode>(PFPrefabPath.GameMode);

        PFGameMode = PFUtil.Instantiate(gamemode_original, PFUIRoot.gameObject);
    }