Пример #1
0
    public void BoxRefresh()
    {
        //ボックス取得
        var cds = DataManager.Instance.box;

        //そーと
        SortedBox = new List <CardParam> ();
        for (int i = 0; i < cds.Count; i++)
        {
            CardParam param = new CardParam();
            param.Set(cds [i]);
            SortedBox.Add(param);
        }
        Sort(SortedBox);

        //絞り込み
        SortedBox = CardRefine(SortedBox, new List <int>(), boxObjs.RoleRefine);

//		//Node破壊
//		foreach ( Transform n in boxObjs.ScrollContent )
//		{
//			GameObject.Destroy(n.gameObject);
//		}
//		//Node生成
//		for (int i = 0; i < SortedBox.Count; i++ ){
//			CardNodeScript node = Instantiate (cardNode);
//			node.name = i + "";
//			node.Delegate = gameObject;
//			node.transform.SetParent (boxObjs.ScrollContent);
//			node.transform.localScale = Vector3.one;
//			node.transform.localPosition = Vector3.zero;
//			CardData cd = new CardData ().Set (SortedBox [i]);
//			//色変更
//			if(DataManager.Deck.ContainCard(useDeck,cd.uid)){
//				node.Refresh (cd, true);
//			} else {
//				node.Refresh (cd,false);
//			}
//
//		}
        //デッキ取得
        SortedDeck = SystemScript.cdTocp(DataManager.Deck.GetDeckData(useDeck));
        //絞り込み
        SortedDeck = CardRefine(SortedDeck, new List <int>(), -1);
        //データ表示 & カードデータ生成
        boxObjs.Info.text = "デッキ枚数 [" +
                            SortedDeck.Count + " / 30]\n■タップで詳細を見る";

        itemCtrls [1].cards    = SortedBox;
        itemCtrls [1].DeckMode = DeckMode;
        infinitys [1].show();
    }
Пример #2
0
    void Refresh()
    {
        //ボックス取得
        var cds = DataManager.Instance.box;

        //cd -> cp
        SortedBox = new List <CardParam> ();
        for (int i = 0; i < cds.Count; i++)
        {
            CardParam param = new CardParam();
            param.Set(cds [i]);
            SortedBox.Add(param);
        }

        //		//idソート
        //		Sort (SortedBox,true);
        int BoxCount = SortedBox.Count;        //カード総数

        //
        //
        //役割、コストソート
        Sort(SortedBox);
        int kindCount = SortedBox.Count;        //種類総数

        //まとめる
//		SortedBox = SystemScript.PackCardParams(SortedBox);

        //絞り込み
        SortedBox = CardRefine(SortedBox, new List <int>(), RoleRefine);


        //デッキ取得
        useDeck    = DataManager.Instance.UseDeck;
        SortedDeck = SystemScript.cdTocp(DataManager.Deck.GetDeckData(useDeck));

        //名前表示
        boxObjs.deckName.text = getDeckNames()[useDeck];

        //ソート
        Sort(SortedDeck);

        //絞り込み
//		SortedDeck = CardRefine(SortedDeck,new List<int>(),-1);



        //ボックス表示
        for (int i = 0; i < boxObjs.BoxCardsImage.Length; i++)
        {
            CardImageScript img = boxObjs.BoxCardsImage [i];
            int             x   = nowPage * 10 + i;
            if (x < SortedBox.Count)
            {
                img.gameObject.SetActive(true);
                img.Set(SortedBox [x]);
                var cp = SortedBox [x];
                SetCardInfo(false, i, GetContainsCards(DataManager.Instance.UseDeck, cp.Atr, cp.ID));
            }
            else
            {
                img.gameObject.SetActive(false);
//				img.RemoveImage ();
            }
        }

        //デッキ表示
        var contents = boxObjs.ScrollContent;

        for (int i = 0; i < contents.childCount; i++)
        {
            Transform t = contents.GetChild(i);
            if (i < SortedDeck.Count)
            {
                t.gameObject.SetActive(true);

                //lv等はボックスを参照
                //				var cp = SortedDeck [i];
                var cp = GetBoxCardParam(SortedDeck [i].ID);

                t.Find("Card").GetComponent <CardImageScript> ().Set(cp);

                cp = new CardParam().Set(DataManager.Instance.box.Find(x => x.ID == cp.ID));

                SetCardInfo(true, i, GetContainsCards(DataManager.Instance.UseDeck, cp.Atr, cp.ID));
            }
            else
            {
                t.gameObject.SetActive(false);
//				t.Find ("Card").GetComponent<CardImageScript> ().RemoveImage ();
            }
        }


        //→表示
        Resources.UnloadUnusedAssets();

        MaxPage = (SortedBox.Count - 1) / 10;

        boxObjs.PageInfo.text = string.Format("CARD BOX {0}/{1}", nowPage + 1, MaxPage + 1);

        int cardCounts = 0;

        for (int i = 0; i < SortedDeck.Count; i++)
        {
            cardCounts += SortedDeck [i].Count;
        }

        //データ表示 & カードデータ生成
        boxObjs.Info.text = string.Format("カード総数 {0}  種類 {1}\nデッキ枚数 [<color=#00ff00>{2} / 30</color>]", BoxCount, kindCount, cardCounts);


        cardDragScroll.transform.GetChild(0).GetChild(0).GetComponent <ContentSizeFitter> ().horizontalFit = ContentSizeFitter.FitMode.Unconstrained;
        cardDragScroll.transform.GetChild(0).GetChild(0).GetComponent <ContentSizeFitter> ().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;


//		Invoke ("UnloadAssets", 0.02f);
    }