Esempio n. 1
0
    public void AddAssetCard(PlayerCard card, bool bFromHandCard = true)
    {
        if (bFromHandCard)
        {
            RemoveHandCard(card);

            GameLogic.Get().OutputGameLog(string.Format("{0}打出了资产牌<{1}>\n", m_investigatorCard.m_cardName, card.m_cardName));
        }
        else
        {
            // Remove it from location
            if (card.m_currentLocation)
            {
                card.m_currentLocation.m_lstCardsAtHere.Remove(card);
                card.m_currentLocation = null;
                card.gameObject.transform.SetParent(GameLogic.Get().m_mainGameUI.transform.root.parent);
                card.gameObject.SetActive(false);
            }
        }
        m_lstAssetCards.Add(card);

        // Which slot is this asset in?
        if (card.m_slot != AssetSlot.None)
        {
            // TODO: single hand asset and single slot arcane
            PlayerCard oldSlot = m_lstAssetSlots[(int)card.m_slot];
            if (oldSlot != null)
            {
                // Replace this slot asset
                m_lstAssetCards.Remove(oldSlot);
                oldSlot.Discard();

                GameLogic.Get().OutputGameLog(string.Format("{0}被替换下场\n", card.m_cardName));
            }
            m_lstAssetSlots[(int)card.m_slot] = card;
        }

        if (card.GetComponent <PlayerCardLogic>())
        {
            card.GetComponent <PlayerCardLogic>().OnReveal(card);
        }

        var          ui   = GameLogic.Get().m_mainGameUI;
        ListViewItem item = new ListViewItem();

        item.card = card;
        ui.m_assetListView.AddItemsAt(ui.m_assetListView.GetItemsCount(), item);
    }
Esempio n. 2
0
    void MIXCARDSELECT()
    {
        arrEachCard          = new List <GameObject> ();
        arrCardMixItemSelect = new List <GameObject> ();
        TopCardCardPosInit();
        GameObject BottomCardLine, KickerCard, GkCard;

        KickerCard     = (GameObject)Resources.Load("prefab_General/KickerCard");
        GkCard         = (GameObject)Resources.Load("prefab_General/Gk_Card");
        BottomCardLine = mRscrcMan.FindChild(dicMenuList["Ui_team"], "LPanel_cardmix/card_character/grid", true).gameObject;
        for (int i = 0; i < arrAllCard.Count; i++)
        {
            DestroyObject(arrAllCard [i]);
        }
        arrAllCard.Clear();
        for (int i = 0; i < Ag.mySelf.arrCard.Count; i++)
        {
            if (Ag.mySelf.arrCard [i].WAS.kickOrder > -1)
            {
                continue;
            }
            //-----------------------------------------------------------------
            GameObject PlayerCard;
            if (Ag.mySelf.arrCard [i].WAS.isKicker)
            {
                PlayerCard = Instantiate(KickerCard) as GameObject;
            }
            else
            {
                PlayerCard = Instantiate(GkCard) as GameObject;
            }
            Debug.Log(Ag.mySelf.arrCard [i].mID + "id");
            PlayerCard.GetComponent <PlayerCardInfo> ().mwas  = Ag.mySelf.arrCard [i].WAS;
            PlayerCard.GetComponent <PlayerCardInfo> ().mCard = Ag.mySelf.arrCard [i];
            //Debug.Log ("PlayerCardINfo" + PlayerCard.GetComponent<PlayerCardInfo> ().mCard.WAS.kickOrder + "WAS" + PlayerCard.GetComponent<PlayerCardInfo> ().mwas.kickOrder);
            PlayerCard.transform.parent        = BottomCardLine.transform;
            PlayerCard.transform.localScale    = new Vector3(1, 1, 1);
            PlayerCard.transform.localPosition = new Vector3(0, 0, -25f);
            PlayerCard.name = "BottomCard" + PlayerCard.GetComponent <PlayerCardInfo> ().mwas.ID;
            BottomCardLine.GetComponent <UIGrid> ().Reposition();
            PlayerCard.AddComponent <UIButtonMessage> ().functionName = "SendMixCardInfo";
            PlayerCard.GetComponent <UIButtonMessage> ().target       = PlayerCard;
            mRscrcMan.AddComponentUISendMessage(mRscrcMan.FindChild(PlayerCard, "btn_playerinfo", true), PlayerCard, "PlayerDetail");

            PlayerCard.GetComponent <PlayerCardInfo> ().CardInit();
        }
        arrSelected = new List <GameObject> ();
        foreach (Transform child in BottomCardLine.transform)
        {
            arrAllCard.Add(child.gameObject);
        }


        StartCoroutine(RepositionCardMix());
    }
Esempio n. 3
0
    public bool CanPlayHandCard(PlayerCard card)
    {
        bool bAsset = card.m_lstKeywords.Contains(Card.Keyword.Asset) && m_resources >= card.m_cost;

        bool bCanPlayEvent = true;

        if (card.GetComponent <PlayerCardLogic>())
        {
            bCanPlayEvent = card.GetComponent <PlayerCardLogic>().CanTrigger();
        }

        bool bEvent = card.m_lstKeywords.Contains(Card.Keyword.Event) &&
                      card.m_eventTiming == EventTiming.InvestigatePhase &&
                      m_resources >= card.m_cost &&
                      bCanPlayEvent;

        if (bAsset || bEvent)
        {
            return(true);
        }

        return(false);
    }
Esempio n. 4
0
    public void AddHandCard(GameObject go)
    {
        if (go != null)
        {
            PlayerCard pc = go.GetComponent <PlayerCard>();
            pc.m_currentLocation = null;

            if (pc.GetComponent <PlayerCardLogic>().OnGainCard())
            {
                m_lstPlayerCards.Add(pc);
                go.SetActive(true);

                var          ui   = GameLogic.Get().m_mainGameUI;
                ListViewItem item = new ListViewItem();
                item.card = pc;
                ui.m_handCardListView.AddItemsAt(ui.m_handCardListView.GetItemsCount(), item);
            }
        }
    }
    void AllCardSelect()
    {
        TopCardPosInit();
        arrEachCard = new List <GameObject> ();
        GameObject KickerCard, GkCard;

        KickerCard = (GameObject)Resources.Load("prefab_General/KickerCard");
        GkCard     = (GameObject)Resources.Load("prefab_General/Gk_Card");

        for (int i = 0; i < arrAllCard.Count; i++)
        {
            DestroyObject(arrAllCard [i]);
        }
        arrAllCard.Clear();
        for (int i = 0; i < Ag.mySelf.arrCard.Count; i++)
        {
            //Deleate

            /*
             * if (i < 6)
             *  Ag.mySelf.arrCard [i].WAS.kickOrder = i;
             */
            //-----------------------------------------------------------------
            GameObject PlayerCard;
            if (Ag.mySelf.arrCard [i].WAS.isKicker)
            {
                PlayerCard = Instantiate(KickerCard) as GameObject;
            }
            else
            {
                PlayerCard = Instantiate(GkCard) as GameObject;
            }
            //Debug.Log (Ag.mySelf.arrCard [i].mID + "id");
            PlayerCard.GetComponent <PlayerCardInfo> ().mwas  = Ag.mySelf.arrCard [i].WAS;
            PlayerCard.GetComponent <PlayerCardInfo> ().mCard = Ag.mySelf.arrCard [i];
            if (PlayerCard.GetComponent <PlayerCardInfo> ().mCard.WAS.kickOrder > -1)
            {
                PlayerCard.transform.parent        = dicMenuList ["TopCardLine"].transform;
                PlayerCard.transform.localScale    = new Vector3(1, 1, 1);
                PlayerCard.transform.localPosition = arrTopCardVector [PlayerCard.GetComponent <PlayerCardInfo> ().mCard.WAS.kickOrder];
                PlayerCard.name = "TopCard" + PlayerCard.GetComponent <PlayerCardInfo> ().mCard.WAS.kickOrder;
            }
            else
            {
                PlayerCard.transform.parent        = dicMenuList ["BottomCardLine"].transform;
                PlayerCard.transform.localScale    = new Vector3(1, 1, 1);
                PlayerCard.transform.localPosition = new Vector3(0, 0, -25f);
                PlayerCard.name = "BottomCard" + PlayerCard.GetComponent <PlayerCardInfo> ().mCard.WAS.ID;
                //mRscrcMan.FindGameObject ("Ui_camera/Camera/Ui_team/LPanel_lineup/card_character/grid", true).GetComponent<UIGrid> ().Reposition ();
                //PlayerCard.transform.localPosition = arrTopCardVector [PlayerCard.GetComponent<PlayerCardInfo> ().mwas.kickOrder];
            }
            PlayerCard.AddComponent <UIButtonMessage> ().functionName = "SendCardInfo";
            PlayerCard.GetComponent <UIButtonMessage> ().target       = PlayerCard;

            mRscrcMan.AddComponentUISendMessage(mRscrcMan.FindChild(PlayerCard, "btn_playerinfo", true), PlayerCard, "PlayerDetail");
            PlayerCard.GetComponent <PlayerCardInfo> ().CardInit();
            arrAllCard.Add(PlayerCard);

            mRscrcMan.FindChild(arrAllCard [i], "btn_playerinfo", true);
            mRscrcMan.FindChild(arrAllCard [i], "cardselect", false);
        }
        StartCoroutine(CardRepositionNow(0.2f));
    }