示例#1
0
        /// <summary>
        /// 手札エリアのカードを手に持つ
        /// </summary>
        /// <param name=""></param>
        public void catchHandAreaCard(int hand_area_touch_index)
        {
            BattleCard battle_card = m_HandArea.getCard(hand_area_touch_index);

            if (battle_card != null)
            {
                if (m_InHandArea.getCardCount() > 0)
                {
                    BattleCard in_hand_card = m_InHandArea.getCard(0);
                    if (battle_card.getElementType() != in_hand_card.getElementType())
                    {
                        battle_card = null;
                    }
                    else
                    {
                        int step = (hand_area_touch_index > in_hand_card.m_HandCardIndex) ? 1 : -1;
                        for (int idx = in_hand_card.m_HandCardIndex; idx != hand_area_touch_index; idx += step)
                        {
                            BattleCard temp_battle_card = m_HandArea.getCard(idx + step);
                            if (temp_battle_card != null && temp_battle_card.getElementType() != in_hand_card.getElementType())
                            {
                                battle_card = null;
                                break;
                            }
                        }
                    }
                }

                if (battle_card != null)
                {
                    setCardToInHand(battle_card);
                }
            }
        }
示例#2
0
        public bool removeCard(BattleCard battle_card, bool is_unuse_card)
        {
            for (int idx = 0; idx < m_BattleCards.Length; idx++)
            {
                if (m_BattleCards[idx] == battle_card)
                {
                    m_CardCount--;
                    for (; idx < m_CardCount; idx++)
                    {
                        m_BattleCards[idx] = m_BattleCards[idx + 1];
                        m_BattleCards[idx].setPhase(BattleCard.Phase.FIELD_AREA);   // 描画位置を更新
                    }
                    m_BattleCards[idx] = null;

                    if (is_unuse_card)
                    {
                        battle_card.setPhase(BattleCard.Phase.UNUSED);
                        battle_card.m_ViewControl.gameObject.SetActive(false);
                    }
                    return(true);
                }
            }

            return(false);
        }
示例#3
0
        /// <summary>
        /// 手札エリアに新しいカードを配る
        /// </summary>
        /// <param name="hand_area_index"></param>
        /// <param name="element_type"></param>
        public void addNewCardInHandArea(int hand_area_index, MasterDataDefineLabel.ElementType element_type)
        {
            BattleCard battle_card = getUnusedCard();

            if (battle_card != null)
            {
                MasterDataDefineLabel.ElementType wrk_element_type = element_type;
#if BUILD_TYPE_DEBUG
                if (m_DebugNextCardFix[hand_area_index] != MasterDataDefineLabel.ElementType.NONE)
                {
                    wrk_element_type = m_DebugNextCardFix[hand_area_index];
                }
#endif //BUILD_TYPE_DEBUG

                battle_card.setElementType(wrk_element_type, BattleCard.ChangeCause.NEW_CARD);

                if (m_NextArea != null)
                {
                    BattleCard next_card = m_NextArea.getCard(hand_area_index);
                    if (next_card != null)
                    {
                        setCardToHandArea(hand_area_index, next_card);
                    }

                    setCardToNextArea(hand_area_index, battle_card);
                }
                else
                {
                    setCardToHandArea(hand_area_index, battle_card);
                }
            }
        }
示例#4
0
 public void setCardToNextArea(int index, BattleCard battle_card)
 {
     if (m_NextArea != null)
     {
         removeCard(battle_card, false);
         m_NextArea.setCard(index, battle_card);
         battle_card.setPhase(BattleCard.Phase.NEXT_AREA);
     }
 }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        if (m_HandArea != null)
        {
            for (int idx = 0; idx < m_HandArea.getCardMaxCount(); idx++)
            {
                BattleScene.BattleCard battle_card = m_HandArea.getCard(idx);
                if (battle_card != null)
                {
                    if (battle_card.getChangeCause() == BattleScene.BattleCard.ChangeCause.NEW_CARD)
                    {
                        battle_card.resetChageCause();
                        battle_card.setPhase(BattleScene.BattleCard.Phase.HAND_AREA);
                        battle_card.m_ViewControl.transform.SetParent(getBattleCardTransform(idx, TransformType.NEXT_AREA), false);
                        battle_card.m_ViewControl.transform.localPosition = Vector3.zero;
                        battle_card.m_ViewControl.transform.localRotation = Quaternion.identity;
                        battle_card.m_ViewControl.transform.localScale    = Vector3.one;
                    }

                    if (battle_card.isChangePhase())
                    {
                        float hold_time = battle_card.m_HoldMoveTime;
                        battle_card.resetChangePhase();
                        battle_card.m_ViewControl.gameObject.SetActive(true);
                        battle_card.m_ViewControl.setSnapToParent(getBattleCardTransform(idx, TransformType.HAND_AREA), 0.1f, hold_time);
                    }
                }
            }
        }

        if (m_NextArea != null)
        {
            for (int idx = 0; idx < m_NextArea.getCardMaxCount(); idx++)
            {
                BattleScene.BattleCard battle_card = m_NextArea.getCard(idx);
                if (battle_card != null)
                {
                    if (battle_card.getChangeCause() == BattleScene.BattleCard.ChangeCause.NEW_CARD)
                    {
                        battle_card.resetChageCause();
                        battle_card.setPhase(BattleScene.BattleCard.Phase.NEXT_AREA);
                        battle_card.m_ViewControl.transform.SetParent(getBattleCardTransform(idx, TransformType.APPEAR_AREA), false);
                        battle_card.m_ViewControl.transform.localPosition = Vector3.zero;
                        battle_card.m_ViewControl.transform.localRotation = Quaternion.identity;
                        battle_card.m_ViewControl.transform.localScale    = Vector3.one;
                    }

                    if (battle_card.isChangePhase())
                    {
                        battle_card.resetChangePhase();
                        battle_card.m_ViewControl.gameObject.SetActive(true);
                        battle_card.m_ViewControl.setSnapToParent(getBattleCardTransform(idx, TransformType.NEXT_AREA), 0.1f);
                    }
                }
            }
        }
    }
示例#6
0
 public void addCard(BattleCard battle_card)
 {
     if (m_CardCount < m_BattleCards.Length)
     {
         battle_card.setPhase(BattleCard.Phase.IN_HAND);
         m_BattleCards[m_CardCount] = battle_card;
         m_CardCount++;
     }
 }
示例#7
0
 /// <summary>
 /// 手持ちカードをどこかに置く(どこに置いたかで挙動が変わる)
 /// </summary>
 /// <param name="hand_area_touch_index"></param>
 /// <param name="field_area_touch_index"></param>
 public void putInHandCard(int hand_area_touch_index, int field_area_touch_index)
 {
     if (m_InHandArea.getCardCount() > 0)
     {
         if (hand_area_touch_index >= 0)
         {
             // 手札エリアに置いた
             for (int idx = 0; idx < m_InHandArea.getCardCount(); idx++)
             {
                 BattleCard battle_card = m_InHandArea.getCard(idx);
                 if (battle_card != null)
                 {
                     setCardToHandArea(hand_area_touch_index, battle_card);
                     idx--;
                 }
             }
         }
         else if (field_area_touch_index >= 0)
         {
             // 場札エリアに置いた
             for (int idx = 0; idx < m_InHandArea.getCardCount(); idx++)
             {
                 BattleCard battle_card = m_InHandArea.getCard(idx);
                 if (battle_card != null)
                 {
                     bool is_success = setCardToFieldArea(field_area_touch_index, battle_card);
                     if (is_success)
                     {
                         // 新しいカードを手札エリアに
                         m_IsStartCountDown = true;
                     }
                     else
                     {
                         // 場札エリアに置けなかったので手札エリアへ戻す
                         setCardToHandArea(battle_card.m_HandCardIndex, battle_card);
                     }
                     idx--;
                 }
             }
         }
         else
         {
             // 手札エリアでも場札エリアでもないところに置いた
             for (int idx = 0; idx < m_InHandArea.getCardCount(); idx++)
             {
                 BattleCard battle_card = m_InHandArea.getCard(idx);
                 if (battle_card != null)
                 {
                     setCardToHandArea(battle_card.m_HandCardIndex, battle_card);
                     idx--;
                 }
             }
         }
     }
 }
示例#8
0
 public void removeCard(BattleCard battle_card, bool is_unuse_card)
 {
     for (int idx = 0; idx < m_FieldAreas.Length; idx++)
     {
         bool is_delete = m_FieldAreas[idx].removeCard(battle_card, is_unuse_card);
         if (is_delete)
         {
             break;
         }
     }
 }
示例#9
0
        public bool addCard(BattleCard battle_card)
        {
            if (isFull() == false)
            {
                battle_card.setPhase(BattleCard.Phase.FIELD_AREA);
                m_BattleCards[m_CardCount] = battle_card;
                m_CardCount++;
                return(true);
            }

            return(false);
        }
示例#10
0
    //----------------------------------------------------------------------------

    /*!
     *  @brief		手札変換:パネル指定
     */
    //----------------------------------------------------------------------------
    public void ChangeHandPanel(BattleSkillActivity activity)
    {
        //------------------------------
        //	エラーチェック
        //------------------------------
        if (activity == null ||
            BattleParam.isActiveBattle() == false)
        {
            return;
        }

        // バトルマネージャ取得
        BattleSceneManager battleMgr = BattleSceneManager.Instance;


        // 汎用パラメータから設定
        MasterDataDefineLabel.ElementType[] elemArray = activity.Get_BOOSTSKILL_HAND_CNG_PANEL();

        for (int i = 0; i < elemArray.Length; ++i)
        {
            BattleScene.BattleCard battle_card = battleMgr.PRIVATE_FIELD.m_BattleCardManager.m_HandArea.getCard(i);

            if (battle_card == null ||
                elemArray[i] == MasterDataDefineLabel.ElementType.MAX)
            {
                continue;
            }

            // 変換先が設定されている場合
            if (elemArray[i] != MasterDataDefineLabel.ElementType.NONE)
            {
                // 属性変更
                battle_card.setElementType(elemArray[i], BattleScene.BattleCard.ChangeCause.SKILL);

                //	手札変化エフェクト
                BattleSceneManager.Instance.PRIVATE_FIELD.m_BattleCardManager.addEffectInfo(BattleScene._BattleCardManager.EffectInfo.EffectPosition.HAND_CARD_AREA, i, BattleScene._BattleCardManager.EffectInfo.EffectType.CARD_CHANGE);
                // 設定されていない場合は、ランダム変換
            }
            else
            {
                // ランダム属性を取得
                MasterDataDefineLabel.ElementType randElement = (MasterDataDefineLabel.ElementType)RandManager.GetRand((int)MasterDataDefineLabel.ElementType.NAUGHT,
                                                                                                                       (int)MasterDataDefineLabel.ElementType.MAX);

                // 属性変更
                battle_card.setElementType(randElement, BattleScene.BattleCard.ChangeCause.SKILL);

                //	手札変化エフェクト
                BattleSceneManager.Instance.PRIVATE_FIELD.m_BattleCardManager.addEffectInfo(BattleScene._BattleCardManager.EffectInfo.EffectPosition.HAND_CARD_AREA, i, BattleScene._BattleCardManager.EffectInfo.EffectType.CARD_CHANGE);
            }
        }
    }
示例#11
0
 // 属性別のカード枚数を取得
 public int[] getCostPerElenet()
 {
     for (int idx = 0; idx < m_CostPerElement.Length; idx++)
     {
         m_CostPerElement[idx] = 0;
     }
     for (int idx = 0; idx < m_CardCount; idx++)
     {
         BattleCard battle_card = m_BattleCards[idx];
         m_CostPerElement[(int)battle_card.getElementType()]++;
     }
     return(m_CostPerElement);
 }
示例#12
0
 /// <summary>
 /// 時間切れで手に持っているカードを手札位置に戻す
 /// </summary>
 public void putInHandCardByTimeOver()
 {
     for (int idx = 0; idx < m_InHandArea.getCardCount(); idx++)
     {
         BattleCard battle_card = m_InHandArea.getCard(idx);
         if (battle_card != null)
         {
             setCardToHandArea(battle_card.m_HandCardIndex, battle_card);
             battle_card.m_HoldMoveTime = 0.5f;  // すぐに戻さないでしばらくその場にとどめる。
             idx--;
         }
     }
 }
示例#13
0
        /// <summary>
        /// プールの中から未使用カードを取得
        /// </summary>
        /// <returns></returns>
        public BattleCard getUnusedCard()
        {
            for (int idx = 0; idx < m_BattleCards.Length; idx++)
            {
                BattleCard battle_card = m_BattleCards[idx];
                if (battle_card.getPhase() == BattleCard.Phase.UNUSED)
                {
                    return(battle_card);
                }
            }

            return(null);
        }
示例#14
0
 public void removeCard(BattleCard battle_card, bool is_unuse_card)
 {
     for (int idx = 0; idx < m_BattleCards.Length; idx++)
     {
         if (m_BattleCards[idx] == battle_card)
         {
             m_BattleCards[idx] = null;
             if (is_unuse_card)
             {
                 battle_card.setPhase(BattleCard.Phase.UNUSED);
                 battle_card.m_ViewControl.gameObject.SetActive(false);
             }
             break;
         }
     }
 }
示例#15
0
        public _BattleCardManager()
        {
            m_NextArea = new HandArea(5);
            m_HandArea = new HandArea(5);
#if BUILD_TYPE_DEBUG
            m_DebugNextCardFix = new MasterDataDefineLabel.ElementType[5];
#endif //BUILD_TYPE_DEBUG
            m_FieldAreas  = new FieldAreas(5, 5);
            m_InHandArea  = new InHandArea(m_HandArea.getCardMaxCount());
            m_BattleCards = new BattleCard[
                ((m_NextArea != null) ? m_NextArea.getCardMaxCount() : 0)
                + m_HandArea.getCardMaxCount()
                + m_FieldAreas.getFieldAreaCountMax() * m_FieldAreas.getFieldArea(0).getCardMaxCount()];

            for (int idx = 0; idx < m_BattleCards.Length; idx++)
            {
                m_BattleCards[idx] = new BattleCard(this);
            }
        }
示例#16
0
        /// <summary>
        /// 場などからカードを取り省く
        /// </summary>
        /// <param name="battle_card"></param>
        /// <param name="is_unuse_card"></param>
        public void removeCard(BattleCard battle_card, bool is_unuse_card)
        {
            switch (battle_card.getPhase())
            {
            case BattleCard.Phase.NEXT_AREA:
                m_NextArea.removeCard(battle_card, is_unuse_card);
                break;

            case BattleCard.Phase.HAND_AREA:
                m_HandArea.removeCard(battle_card, is_unuse_card);
                break;

            case BattleCard.Phase.IN_HAND:
                m_InHandArea.removeCard(battle_card, is_unuse_card);
                break;

            case BattleCard.Phase.FIELD_AREA:
                m_FieldAreas.removeCard(battle_card, is_unuse_card);
                break;
            }
        }
示例#17
0
    // Update is called once per frame
    void Update()
    {
        if (m_InHandArea != null)
        {
            float   hand_z = BattleTouchInput.Instance.getScreenPosition(transform.position).z;
            Vector3 hand_world_position = BattleTouchInput.Instance.getWorldPosition(hand_z);
            m_InHandObject.transform.position = hand_world_position;

            for (int card_idx = 0; card_idx < m_InHandArea.getCardCount(); card_idx++)
            {
                BattleScene.BattleCard battle_card = m_InHandArea.getCard(card_idx);
                if (battle_card != null)
                {
                    if (battle_card.isChangePhase())
                    {
                        battle_card.resetChangePhase();
                        battle_card.m_ViewControl.gameObject.SetActive(true);
                        battle_card.m_ViewControl.setSnapToParent(getBattleCardTransform(card_idx), 0.0f);
                    }
                }
            }
        }
    }
示例#18
0
        public void setCard(int index, BattleCard battle_card)
        {
            if (m_BattleCards[index] != null)
            {
                int free_index = -1;
                int dist_min   = m_BattleCards.Length;
                for (int idx = 0; idx < m_BattleCards.Length; idx++)
                {
                    if (m_BattleCards[idx] == null)
                    {
                        int dist = Mathf.Abs(idx - index);
                        if (dist < dist_min)
                        {
                            dist_min   = dist;
                            free_index = idx;
                        }
                    }
                }

                if (free_index >= 0)
                {
                    int step = (index > free_index) ? 1 : -1;
                    for (int idx = free_index; idx != index; idx += step)
                    {
                        m_BattleCards[idx] = m_BattleCards[idx + step];
                        m_BattleCards[idx].m_HandCardIndex = idx;
                        m_BattleCards[idx].setPhase(BattleCard.Phase.HAND_AREA);
                    }
                    m_BattleCards[index] = null;
                }
            }

            battle_card.setPhase(BattleCard.Phase.HAND_AREA);
            battle_card.m_HandCardIndex = index;
            m_BattleCards[index]        = battle_card;
        }
示例#19
0
    // Update is called once per frame
    void Update()
    {
        if (m_FieldAreas != null)
        {
            bool is_update_field_view = false;

            // 復活可能かどうか更新
            if (m_FieldAreas.m_IsResurrectMode != m_IsResurrectMode)
            {
                m_IsResurrectMode    = m_FieldAreas.m_IsResurrectMode;
                is_update_field_view = false;
            }

            // 定期的更新の確認
            m_BasePanelUpdateCounter--;
            if (m_BasePanelUpdateCounter <= 0)
            {
                is_update_field_view = true;
            }

            // BOOST・FULLが更新されたかを更新
            if (is_update_field_view == false)
            {
                for (int field_idx = 0; field_idx < m_FieldAreas.getFieldAreaCountMax(); field_idx++)
                {
                    FieldArea field_area = m_FieldAreas.getFieldArea(field_idx);
                    if (field_area != null)
                    {
                        if (m_ViewObjects[field_idx].m_Boost.IsActive() != field_area.m_IsBoost ||
                            m_ViewObjects[field_idx].m_Full.IsActive() != field_area.isFull()
                            )
                        {
                            is_update_field_view = true;
                            break;
                        }
                    }
                }
            }

            if (is_update_field_view)
            {
                m_BasePanelUpdateCounter = 30;
            }

            for (int field_idx = 0; field_idx < m_FieldAreas.getFieldAreaCountMax(); field_idx++)
            {
                FieldArea field_area = m_FieldAreas.getFieldArea(field_idx);
                if (field_area != null)
                {
                    // カード表示を更新
                    for (int card_idx = 0; card_idx < field_area.getCardCount(); card_idx++)
                    {
                        BattleScene.BattleCard battle_card = field_area.getCard(card_idx);
                        if (battle_card != null)
                        {
                            if (battle_card.isChangePhase())
                            {
                                battle_card.resetChangePhase();
                                float duration = 0.05f;
                                if (battle_card.m_ViewControl.gameObject.IsActive() == false)
                                {
                                    battle_card.m_ViewControl.gameObject.SetActive(true);
                                    duration = 0.0f;
                                }
                                battle_card.m_ViewControl.setSnapToParent(getBattleCardTransform(field_idx, card_idx), duration);
                            }
                        }
                    }

                    // 下地パネル・BOOST・FULL表示を更新
                    if (is_update_field_view)
                    {
                        if (m_SelectedField != field_idx)
                        {
                            if (m_IsResurrectMode &&
                                field_area.m_IsBoost
                                )
                            {
                                m_ViewObjects[field_idx].m_PanelBase.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelSelect.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelRBase.SetActive(true);
                                m_ViewObjects[field_idx].m_PanelRSelect.SetActive(false);
                            }
                            else
                            {
                                m_ViewObjects[field_idx].m_PanelBase.SetActive(true);
                                m_ViewObjects[field_idx].m_PanelSelect.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelRBase.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelRSelect.SetActive(false);
                            }
                        }
                        else
                        {
                            if (m_IsResurrectMode &&
                                field_area.m_IsBoost
                                )
                            {
                                m_ViewObjects[field_idx].m_PanelBase.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelSelect.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelRBase.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelRSelect.SetActive(true);
                            }
                            else
                            {
                                m_ViewObjects[field_idx].m_PanelBase.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelSelect.SetActive(true);
                                m_ViewObjects[field_idx].m_PanelRBase.SetActive(false);
                                m_ViewObjects[field_idx].m_PanelRSelect.SetActive(false);
                            }
                        }

                        m_ViewObjects[field_idx].m_Boost.SetActive(field_area.m_IsBoost);
                        m_ViewObjects[field_idx].m_Full.SetActive(field_area.isFull());
                    }
                }
            }
        }
    }
示例#20
0
 public void init(BattleScene.BattleCard battle_card)
 {
     battle_card.m_ViewControl = this;
     m_BattleCard = battle_card;
 }
示例#21
0
 /// <summary>
 /// 場エリアにカードをセット(同時に手持ちエリアから取り省かれる)
 /// </summary>
 /// <param name="index"></param>
 /// <param name="battle_card"></param>
 /// <returns></returns>
 public bool setCardToFieldArea(int index, BattleCard battle_card)
 {
     removeCard(battle_card, false);
     return(m_FieldAreas.addCard(index, battle_card));
 }
示例#22
0
 /// <summary>
 /// 手持ちエリアにカードをセット(同時に手札エリアから取り省かれる)
 /// </summary>
 /// <param name="battle_card"></param>
 public void setCardToInHand(BattleCard battle_card)
 {
     removeCard(battle_card, false);
     m_InHandArea.addCard(battle_card);
 }
示例#23
0
 /// <summary>
 /// 手札エリアにカードをセット
 /// </summary>
 /// <param name="index"></param>
 /// <param name="battle_card"></param>
 public void setCardToHandArea(int index, BattleCard battle_card)
 {
     removeCard(battle_card, false);
     m_HandArea.setCard(index, battle_card);
 }
示例#24
0
 public bool addCard(int index, BattleCard battle_card)
 {
     return(m_FieldAreas[index].addCard(battle_card));
 }