Exemplo n.º 1
0
    public void ReceiveCardFromPlayer(GameObject card)
    {
        usedCardList[usedCardList.Count - 1].transform.position = usedCardPos + new Vector3(0.0f, 0.0f, 1.0f);
        usedCardList.Add(card);
        card.GetComponent <Card>().SetCardOwner(CARD_OWNER.DECK);
        currCardNum             = card.GetComponent <Card>().GetCardNum();
        currType                = card.GetComponent <Card>().GetCardType();
        currCardDam             = card.GetComponent <Card>().GetCardDamage();
        sumCardDam             += currCardDam;
        card.transform.parent   = this.transform;
        card.transform.position = usedCardPos;
        if (currCardNum == 7)
        {
            ui7.gameObject.SetActive(true);
            SetPlayerTurn(14);
            return;
        }

        SetCurrentTypeText();
        SetTotalDamText();

        //Debug.Log(player.playerDeck.Count);
        if (player.playerDeck.Count == 0)
        {
            SetWinner(0);
        }
        if (enemy.enemyDeck.Count == 0)
        {
            SetWinner(1);
        }

        SetPlayerTurn(currCardNum);
    }
Exemplo n.º 2
0
 public void SetSpadeType()
 {
     currType = CARD_TYPE.SPADE;
     ui7.gameObject.SetActive(false);
     SetPlayerTurn(15);
     SetCurrentTypeText();
 }
Exemplo n.º 3
0
    void InitDeck()
    {
        // 첫 장을 뽑아서 usedCardList에 옮긴다
        usedCardList.Add(deck[deck.Count - 1]);
        Debug.Log(deck[deck.Count - 1].gameObject.name);
        deck.RemoveAt(deck.Count - 1);
        usedCardList[0].gameObject.transform.position = usedCardPos;
        usedCardList[0].GetComponent <Card>().SetCardOwner(CARD_OWNER.USED);
        currType    = usedCardList[0].GetComponent <Card>().GetCardType();
        currCardNum = usedCardList[0].GetComponent <Card>().GetCardNum();
        currCardDam = 0;
        SetCurrentTypeText();
        SetTotalDamText();

        for (int i = 0; i < 5; i++)
        {
            if (player)
            {
                player.AddCard(deck[deck.Count - 1]);
                //deck[deck.Count - 1].GetComponent<Card>().SetCardOwner(CARD_OWNER.PLAYER);
                deck[deck.Count - 1].transform.parent = player.gameObject.transform;
                Debug.Log(deck[deck.Count - 1].gameObject.name + " " + deck[deck.Count - 1].GetComponent <Card>().GetCardOwner());
                deck.RemoveAt(deck.Count - 1);
            }
            if (enemy)
            {
                enemy.AddCard(deck[deck.Count - 1]);
                //deck[deck.Count - 1].GetComponent<Card>().SetCardOwner(CARD_OWNER.ENEMY);
                deck[deck.Count - 1].transform.parent = enemy.gameObject.transform;
                Debug.Log(deck[deck.Count - 1].gameObject.name + " " + deck[deck.Count - 1].GetComponent <Card>().GetCardOwner());
                deck.RemoveAt(deck.Count - 1);
            }
        }
        SetCntText();
    }
Exemplo n.º 4
0
 public void SetHeartType()
 {
     currType = CARD_TYPE.HEART;
     ui7.gameObject.SetActive(false);
     SetPlayerTurn(15);
     SetCurrentTypeText();
 }
Exemplo n.º 5
0
    public void NextQuarter()
    {
        // Card Select
        _gameState = GAME_STATE.CARD_SELECT;

        // Next Quarter
        _quarter++;
        _attribute = (CARD_TYPE)Random.Range(0, (int)CARD_TYPE.END);
        _uiRound.SetRound(_quarter, (int)_attribute);

        // Select View
        Initialize_SelectView();

        // 내 카드 강화
        Card myCard = _myDeck.Get_SelectedCard();

        if (null != myCard)
        {
            myCard.Enhance(true);
            myCard.onDeSelected();
        }

        // 적 카드 강화
        Card enemyCard = Singleton.aiManager.Get_CardToEnhance(_enemyDeck.Get_Deck());

        if (null != enemyCard)
        {
            enemyCard.Enhance(true);
        }
    }
Exemplo n.º 6
0
    public void SetCardInfo(Card card)
    {
        gameObject.SetActive(true);

        transform.localPosition = new Vector2(
            Mathf.Clamp(card.transform.localPosition.x, -230f, 230f), 260f);

        CARD_TYPE type = card._cardType;

        _label.text       = Constants.ATTRIBUTE_NAME[(int)type];
        _image.spriteName = SpriteName[(int)type];

        float fDamage = 0f;

        for (int i = 0; i < (int)CARD_TYPE.END; ++i)
        {
            fDamage = BattleManager.Get_Damage
                          (card,
                          Singleton.inGameManager._uiPlayer,
                          (CARD_TYPE)i
                          );

            _damageExpcected[i].text  = fDamage.ToString();
            _damageExpcected[i].color = (fDamage == 0f) ? Color.red : Color.white;

            if (card._cardType == Singleton.inGameManager._attribute && fDamage != 0f)
            {
                _damageExpcected[i].color = Color.green;
            }
        }
    }
Exemplo n.º 7
0
 public void SetDiamondType()
 {
     currType = CARD_TYPE.DIAMOND;
     ui7.gameObject.SetActive(false);
     SetPlayerTurn(15);
     SetCurrentTypeText();
 }
Exemplo n.º 8
0
 public void addCard(CARD_TYPE cType, Card addCard) //타입에 맞게 카드 추가
 {
     if (cType == CARD_TYPE.ROCK)
     {
         if (myCardList[0].Count >= slotCount)
         {
             myCardList[0].RemoveAt(slotCount - 1);                                //슬롯 갯수를 넘어서면 delete
         }
         myCardList[0].Add(addCard);
         BehindCardCount[0] = myCardList[0].Count;
     }
     else if (cType == CARD_TYPE.SCISSORS)
     {
         if (myCardList[1].Count >= slotCount)
         {
             myCardList[1].RemoveAt(slotCount - 1);
         }
         myCardList[1].Add(addCard);
         BehindCardCount[1] = myCardList[1].Count;
     }
     else if (cType == CARD_TYPE.PAPER)
     {
         if (myCardList[2].Count >= slotCount)
         {
             myCardList[2].RemoveAt(slotCount - 1);
         }
         myCardList[2].Add(addCard);
         BehindCardCount[2] = myCardList[2].Count;
     }
 }
Exemplo n.º 9
0
    public static float Get_Damage(Card card, UI_Parent player, CARD_TYPE enemyType)
    {
        float         damage = 0f;
        CARD_TYPE     myType = card._cardType;
        BATTLE_RESULT result = Get_BattleResult(myType, enemyType);

        // Character
        float AD = player._ad;
        float TC = ParserManager.TC[(int)myType][(int)result];
        float TE = (card._bEnhanced) ? ParserManager.TE[(int)myType] : 1f;

        // Item
        float AP = 0f;

        // Stage
        float FC = (Singleton.inGameManager._attribute == myType) ? ParserManager.FC : 1f;
        float QC = ParserManager.QC[Singleton.inGameManager._quarter];

        damage = (AD + AP) * TC * TE * FC * QC;
        damage = Mathf.Round(damage);

        // Log

        LogManager.Log("Type Counter : " + TC + " Type Enhanced : " + TE + " Field Control : " + FC + " Quarter Control : " + QC + " Total Damage : " + damage);

        return(damage);
    }
Exemplo n.º 10
0
    public void SendCardFromDeck(GameObject card)
    {
        if (!isPlayerTurn)
        {
            return;
        }
        int       curNum     = board.GetCurrNum();
        CARD_TYPE curType    = board.GetCurrCardType();
        int       curCardDam = board.GetCurrCardDam();

        int       cardNum  = card.GetComponent <Card>().GetCardNum();
        CARD_TYPE cardType = card.GetComponent <Card>().GetCardType();
        int       cardDam  = card.GetComponent <Card>().GetCardDamage();

        if (curNum == cardNum || curType == cardType || cardType == CARD_TYPE.JOKER || curType == CARD_TYPE.JOKER)
        {
            if (curCardDam <= cardDam)
            {
                playerDeck.Remove(card);
                board.ReceiveCardFromPlayer(card);
                maxListOffset = (playerDeck.Count - 1) / 10;
                if (maxListOffset < currListOffset)
                {
                    currListOffset = maxListOffset;
                }
                SetCardPos();
                SetCntText();
            }
        }
    }
Exemplo n.º 11
0
 // Costruttore per carte di tipo vincita/perdita o di movimento verso una casella
 public Card(CARD_TYPE CardType, string Description, CARD_COLOR CardColor, float Value)
 {
     this.CardType = CardType;
     this.Description = Description;
     this.CardColor = CardColor;
     this.Value = Value;
 }
Exemplo n.º 12
0
        public static int GetChipBasedDataBlockNumber(CARD_TYPE _cardType, int _sectorNumber, int _dataBlockNumberSectorBased)
        {
            int blockCount = 0;
            int dataBlockNumberChipBased = 0;

            switch (_cardType)
            {
            case CARD_TYPE.Mifare1K:
                blockCount = 4;
                break;

            case CARD_TYPE.Mifare2K:

                break;

            case CARD_TYPE.Mifare4K:
                blockCount = (_sectorNumber <= 31 ? 4 : 16);
                break;
            }

            dataBlockNumberChipBased = _sectorNumber <= 31
                                ? (((_sectorNumber + 1) * blockCount) - (blockCount - dataBlockNumberChipBased))
                                : ((128 + (_sectorNumber - 31) * blockCount) - (blockCount - dataBlockNumberChipBased));

            return(dataBlockNumberChipBased + _dataBlockNumberSectorBased);
        }
Exemplo n.º 13
0
    public void Select_Attribute(GameObject obj)
    {
        switch (obj.name)
        {
        case "Attack":
            _cardType = CARD_TYPE.ATTACK;
            break;

        case "Shield":
            _cardType = CARD_TYPE.SHIELD;
            break;

        case "Heal":
            _cardType = CARD_TYPE.HEAL;
            break;

        default:
            _cardType = CARD_TYPE.END;
            break;
        }

        sprAttribute.spriteName = _strAttribute[(int)_cardType];

        Show_Select(false);
    }
Exemplo n.º 14
0
 public void SetCloverType()
 {
     currType = CARD_TYPE.CLOVER;
     ui7.gameObject.SetActive(false);
     SetPlayerTurn(15);
     SetCurrentTypeText();
 }
Exemplo n.º 15
0
    public void SetCard(CARD_TYPE type, CARD_COLOR color, string value)
    {
        this.type     = type;
        this.color    = color;
        this.valueStr = value;
        this.value    = valueMap[this.valueStr];

        switch (this.valueStr)
        {
        case "5":
        {
            this.point = 5;
        }
        break;

        case "10":
        case "K":
        {
            this.point = 10;
        }
        break;

        case "봉":
        {
            this.point = -25;
        }
        break;

        case "용":
        {
            this.point = 25;
        }
        break;

        default:
        {
            this.point = 0;
        }
        break;
        }

        int colorValue = (int)color;

        centerText.text   = valueStr;
        background.sprite = backgroundList[(int)type];

        leftIcon.sprite  = rightIcon.sprite = IconList[colorValue];
        centerText.color = leftText.color = rightText.color = colorList[colorValue];

        leftText.text = rightText.text = valueStr.ToString();

        siblingIdx = transform.GetSiblingIndex();

        if (this.color == CARD_COLOR.NONE)
        {
            leftIcon.enabled  = false;
            rightIcon.enabled = false;
        }
    }
Exemplo n.º 16
0
    public void SetCard(int iNum, CARD_TYPE cardType = CARD_TYPE.END)
    {
        _iNum       = iNum;
        txtNum.text = _iNum.ToString();

        _cardType = cardType;
        sprAttribute.spriteName = _strAttribute[(int)_cardType];
    }
Exemplo n.º 17
0
    // 게임 시작!
    public void GameStart()
    {
        _gameState = GAME_STATE.CARD_SELECT;

        _attribute = (CARD_TYPE)Random.Range(0, (int)CARD_TYPE.END);
        _uiRound.SetRound(_quarter, (int)_attribute);

        _enemyDeck.Set_Deck(Singleton.aiManager.Get_EnemyTypeRandom()); // 적 카드 (PVE)
    }
Exemplo n.º 18
0
    public void Set_BattleInfo(CARD_TYPE myType, int iMyNum, CARD_TYPE yourType, int iYourNum, int RandNum)
    {
        sprMyAttribute.spriteName = _strAttribute[(int)myType];
        txtMyNum.text             = iMyNum.ToString();

        sprYourAttribute.spriteName = _strAttribute[(int)yourType];
        txtYourNum.text             = iYourNum.ToString();

        txtRandNum.text = RandNum.ToString();
    }
Exemplo n.º 19
0
        public CardBase(uint card_id, uint only_id)
        {
            CardID    = card_id;
            CardKeyID = only_id;

            if (card_id == 30 || (card_id >= 21 && card_id <= 26))
            {
                CardType = CARD_TYPE.WEAPON;
            }
        }
Exemplo n.º 20
0
    public CARD_TYPE[] Get_EnemyTypeRandom() // 5개 카드속성 return
    {
        CARD_TYPE[] type = new CARD_TYPE[Constants.DECK_MAX_COUNT];

        for (int i = 0; i < type.Length; ++i)
        {
            type[i] = (CARD_TYPE)(Random.Range(0, (int)CARD_TYPE.END));
        }

        return(type);
    }
Exemplo n.º 21
0
    public static BATTLE_RESULT Get_BattleResult(CARD_TYPE myType, CARD_TYPE enemyType)
    {
        BATTLE_RESULT result = BATTLE_RESULT.END;

        if (myType == CARD_TYPE.ATTACK)
        {
            if (enemyType == CARD_TYPE.ATTACK)
            {
                result = BATTLE_RESULT.DRAW;
            }
            else if (enemyType == CARD_TYPE.DEFEND)
            {
                result = BATTLE_RESULT.LOSE;
            }
            else if (enemyType == CARD_TYPE.HEAL)
            {
                result = BATTLE_RESULT.WIN;
            }
        }
        else if (myType == CARD_TYPE.DEFEND)
        {
            if (enemyType == CARD_TYPE.ATTACK)
            {
                result = BATTLE_RESULT.WIN;
            }
            else if (enemyType == CARD_TYPE.DEFEND)
            {
                result = BATTLE_RESULT.DRAW;
            }
            else if (enemyType == CARD_TYPE.HEAL)
            {
                result = BATTLE_RESULT.LOSE;
            }
        }
        else if (myType == CARD_TYPE.HEAL)
        {
            if (enemyType == CARD_TYPE.ATTACK)
            {
                result = BATTLE_RESULT.LOSE;
            }
            else if (enemyType == CARD_TYPE.DEFEND)
            {
                result = BATTLE_RESULT.WIN;
            }
            else if (enemyType == CARD_TYPE.HEAL)
            {
                result = BATTLE_RESULT.DRAW;
            }
        }

        return(result);
    }
Exemplo n.º 22
0
    // 5개 카드 선택
    public void SetMyCard(Card[] myCard)
    {
        CARD_TYPE[] type = new CARD_TYPE[myCard.Length];

        for (int i = 0; i < myCard.Length; ++i)
        {
            type[i] = myCard[i]._cardType;
        }

        _myDeck.Set_Deck(type);

        (Singleton.popUpManager.Get_PopUp("SystemMessage") as SystemMessage).ShowMessage("Ready", 1f, false);
        (Singleton.popUpManager.Get_PopUp("SystemMessage") as SystemMessage).SetCallBackFunc(gameObject, "GameStart");
    }
Exemplo n.º 23
0
 public void SetType(CARD_TYPE type, bool bEnhance = false)
 {
     for (int i = 0; i < objType.Length; ++i)
     {
         if (i == (int)type)
         {
             _objType[i].SetActive(true);
         }
         else
         {
             _objType[i].SetActive(false);
         }
     }
     enhance.SetActive(bEnhance);
 }
Exemplo n.º 24
0
    void Create_BattleInfo(CARD_TYPE myType, int iMyNum, CARD_TYPE yourType, int iYourNum)
    {
        GameObject obj = GameObject.Instantiate(Resources.Load("Prefab/BattleInfo") as GameObject, Vector3.zero, Quaternion.identity);

        obj.transform.SetParent(_grid.transform);
        obj.transform.localScale = new Vector3(1f, 1f, 1f);
        obj.transform.SetAsFirstSibling();

        _grid.Reposition();
        _scrollview.ResetPosition();

        BattleInfo battleInfo = obj.GetComponent <BattleInfo>();

        battleInfo.Set_BattleInfo(myType, iMyNum, yourType, iYourNum, _randomNumbers[_iBattleRound]);
    }
Exemplo n.º 25
0
    public void Set_CardType(CARD_TYPE type)
    {
        _cardType = type;

        for (int i = 0; i < objType.Length; ++i)
        {
            if (i == (int)type)
            {
                objType[i].SetActive(true);
            }
            else
            {
                objType[i].SetActive(false);
            }
        }
    }
Exemplo n.º 26
0
    void ConvertListSlotsToDict()
    {
        for (int i = 0; i < slotOnTable.Count; i++)
        {
            CARD_TYPE type = slotOnTable[i].type;

            if (_cards.ContainsKey(type))
            {
                AddEmptySlotToExistListInDictionary(slotOnTable[i]);
            }
            else
            {
                AddSlotAsNewKeyInDirection(slotOnTable[i]);
            }
        }
    }
Exemplo n.º 27
0
 public void SetCard(CARD_TYPE type, int number)
 {
     m_Type   = type;
     m_Number = number;
     if (number == 1) // A카드
     {
         m_Damage = 4;
     }
     if (number == 2)
     {
         m_Damage = 2;
     }
     if (type == CARD_TYPE.JOKER)
     {
         m_Damage = 7;
     }
 }
Exemplo n.º 28
0
    /// <summary>
    /// カードのTypeごとに取得したい文字列
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    public string GetCardString(CARD_TYPE type)
    {
        string str = "";

        switch (type)
        {
        case CARD_TYPE.spade: str = "spade"; break;

        case CARD_TYPE.club: str = "club"; break;

        case CARD_TYPE.heart: str = "heart"; break;

        case CARD_TYPE.diamond: str = "diamond"; break;
        }

        return(str);
    }
Exemplo n.º 29
0
    /// <summary>
    /// カードの設定を行う
    /// </summary>
    /// <param name="type"></param>
    /// <param name="id"></param>
    public void SetCard(CARD_TYPE type, int id)
    {
        id = Mathf.Clamp(id, 1, 13);
        if (atlas != null)
        {
            Sprite sp = atlas.GetSprite(
                string.Format(
                    imageName,
                    GetCardString(type),
                    id.ToString("00")
                    )
                );
            card.sprite = sp;
        }
        card_type = type;
        card_id   = id;

        SetWakuActive = false;
    }
Exemplo n.º 30
0
 public List <Card> GetCard(CARD_TYPE cType)
 {
     if (cType == CARD_TYPE.ROCK)
     {
         return(myCardList[0]); //
     }
     else if (cType == CARD_TYPE.SCISSORS)
     {
         return(myCardList[1]);
     }
     else if (cType == CARD_TYPE.PAPER)
     {
         return(myCardList[2]);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 31
0
        private int GetIntFromCardType(CARD_TYPE ct)
        {
            int iRes = -1;

            switch (ct)
            {
            case CARD_TYPE.PRE_PAY:
            {
                iRes = 1;
                break;
            }

            case CARD_TYPE.POST_PAY:
            {
                iRes = 2;
                break;
            }
            }
            return(iRes);
        }
Exemplo n.º 32
0
 // Costruttore per carte di tipo generico
 public Card(CARD_TYPE CardType, string Description, CARD_COLOR CardColor)
 {
     this.CardType = CardType;
     this.Description = Description;
     this.CardColor = CardColor;
 }