示例#1
0
    public void OnLvup(int cid, int lv, string errmsg)
    {
        alert.OpenClose(false);
        alert = null;
        //エラー表示
        if (errmsg != "")
        {
            alert = AlertView.Make(-1, "エラー", errmsg, new string[] { "確認" }, gameObject, 1);
            return;
        }

        //レベルアップ処理
        DataManager.Box.LevelUp(cid);

        //ボックスデータ更新
        Refresh();

        //再タップ処理
        OnCardTap(SelectingData[0], SelectingData[1]);

        //再取得
        CardParam cp = GetBoxCardParam(SelectingCard.ID);

        //アラート表示
        AlertView.Make(1, "強化成功", string.Format(cp.Name + ":LV.{0}\nパワー+1", cp.LV), new string[] { "OK" }, gameObject, 1);
        DataManager.Instance.SEPlay(10);
    }
示例#2
0
    /// <summary>
    /// _Role -1=ALL 0=Charger 1=Attacker 2=Defender
    /// </summary>
    List <CardParam> CardRefine(List <CardParam> _Cards, List <int> _Attribute, int _Role)
    {
        List <CardParam> Result = new List <CardParam> ();

        for (int i = 0; i < _Cards.Count; i++)
        {
            CardParam cd = _Cards [i];

            if (_Attribute.Count != 0)
            {
                if (!_Attribute.Contains(cd.Atr))
                {
                    continue;
                }
            }

            if (_Role != -1)
            {
                if (_Role != cd.Role)
                {
                    continue;
                }
            }
            Result.Add(cd);
        }
        return(Result);
    }
示例#3
0
//	public void UnloadAssets () {
//		Resources.UnloadUnusedAssets ();
//	}

    public void ShowDetail()
    {
//		int id = SelectingCard.ID;
//		CardData cd = DataManager.Instance.box.Find (x => x.ID == id);
        CardParam cp = GetBoxCardParam(SelectingCard.ID);

        detailScript.Show(cp);
        if (cp.Count >= SystemScript.needPoint(cp))
        {
            //強化可能
            boxObjs.LevelUpText.text = "<color=#00ff00>レベルアップ</color>";
        }
        else
        {
            //強化不可
            boxObjs.LevelUpText.text = "<color=#cccccc>レベルアップ</color>";
        }
        boxObjs.LevelUpText.text += string.Format("\n<size=18>{0}/{1}</size>", cp.Count, SystemScript.needPoint(cp));

        //無効化
        if (!DataManager.Instance.LVSystem)
        {
            boxObjs.LevelUpText.text = "";
        }
    }
示例#4
0
    /// <summary>
    /// _type 0=ノードタップ -1=詳細表示
    /// </summary>
    /// <param name="_num">Number.</param>
    /// <param name="_tag">Tag.</param>
    public void OnRecieve(int _num, int _type)
    {
        if (_type == 0)
        {
            DataManager.Instance.SEPlay(0);
        }
        else if (_type == -1)
        {
            DataManager.Instance.SEPlay(7);
        }
        Debug.Log(_num);
        if (DeckMode)
        {
            //デッキモード
            SelectingCard = SortedDeck [_num];

            if (_type == 0)
            {
                //取り除く
                DataManager.Deck.SetCard(useDeck, SelectingCard.Atr, SelectingCard.ID, false);
            }
            else
            {
                //詳細表示
                DetailShow(SortedDeck [_num]);
            }
        }
        else
        {
            //ボックスモード
            SelectingCard = SortedBox[_num];
            if (_type == 0)
            {
                //デッキにカードが含まれているか
                if (DataManager.Deck.ContainCard(useDeck, SelectingCard.Atr, SelectingCard.ID))
                {
                    //取り除く
                    DataManager.Deck.SetCard(useDeck, SelectingCard.Atr, SelectingCard.ID, false);
                }
                else
                {
                    //デッキに追加
                    DataManager.Deck.SetCard(useDeck, SelectingCard.Atr, SelectingCard.ID, true);
                }
            }
            else
            {
                //詳細表示
                DetailShow(SortedBox [_num]);
            }
        }
        Refresh();
    }
示例#5
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();
    }
示例#6
0
    public void Show(CardParam cp)
    {
        NameAndGroup.text = cp.Name + string.Format(":LV.{0}", cp.LV);
        if (cp.Groups.Count > 0)
        {
            NameAndGroup.text += "\n<size=18>" + SystemScript.GetGroup(cp.Groups) + "</size>";
        }
        Param.text = System.String.Format
                         ("{0}\n役割:{1}\nコスト:{2}\nパワー:{3}"
                         , new string[] { SystemScript.GetReality(cp.Rea, true), SystemScript.GetRole(cp.Role), cp.Cost.ToString(), cp.Power.ToString() });

        SkillText.text = SystemScript.GetSkillsText(cp, SystemScript.ShowType.DETAIL, true);
        CardImg.gameObject.SetActive(true);
        CardImg.Set(cp);
    }
示例#7
0
    public void LvUpNotify()
    {
        //無効化
        if (!DataManager.Instance.LVSystem)
        {
            return;
        }

        CardParam cp = GetBoxCardParam(SelectingCard.ID);

        if (cp.Count >= SystemScript.needPoint(cp))
        {
            AlertView.Make(0, "強化", string.Format(cp.Name + "\nLV.{0} → LV.{1}", cp.LV, cp.LV + 1), new string[] { "OK", "Camcel" }, gameObject, 1);
        }
//		AlertView.Make (0,"強化","カードを強化しますか",new string[]{"OK"}, gameObject,2);
    }
示例#8
0
    public void OnRecieve(int _num, int _tag)
    {
        if (_num == -1)
        {
            return;
        }
        if (_tag == 0)
        {
            if (_num == 0)
            {
                //レベルアップ処理
                CardParam cp = GetBoxCardParam(SelectingCard.ID);
                TestScript.Instance.Delegate = gameObject;
                TestScript.Instance.Lvup(cp.ID, cp.LV + 1);

                alert = AlertView.Make(0, "通信中...", "しばらくお待ちください", new string[] {}, gameObject, 1, true);

//				//レベルアップ処理
//				DataManager.Box.LevelUp(cp.ID);
//
//				Refresh();
//				//再タップ処理
//				OnCardTap(SelectingData[0],SelectingData[1]);
//
//				AlertView.Make (1, "強化成功", string.Format (cp.Name +":LV.{0}\nパワー+1", cp.LV+1), new string[]{ "OK" }, gameObject, 1);
//				DataManager.Instance.SEPlay (10);
            }
        }
        else if (_tag == 1)
        {
            //強化完了
        }
        else if (_tag == 2)
        {
            //デッキ変更
            DataManager.Instance.UseDeck = _num;
            Refresh();
        }
        else if (_tag == 3)
        {
            //絞り込み
            RefineIndex = _num;
            BoxRoleRefine(0);
        }
    }
示例#9
0
    public void Refresh(CardParam _param, bool _DeckMode)
    {
//		DeckInCount = DataManager.Deck.GetCard(DataManager.Instance.UseDeck,_param.Atr,_param.ID).Count;
//		BoxCount = DataManager.Box.GetCard(_param.Atr,_param.ID).Count;

        //名前+種族
        string Title = System.String.Format
                           ("LV.{0} {1} ", new string[] { _param.LV.ToString(), _param.Name.ToString() });

        if (_param.Groups.Count > 0)
        {
            Title += "\n<size=25>" + SystemScript.GetGroup(_param.Groups) + "</size>";
        }
        Name.text = Title;

        //パラメータ

        Param.text = System.String.Format
                         ("{0}\n役割:{1}\nコスト:{2}\nパワー:{3}"
                         , new string[] { SystemScript.GetReality(_param.Rea, true), SystemScript.GetRole(_param.Role), _param.Cost.ToString(), _param.Power.ToString() });
        //
        Skill.text = SystemScript.GetSkillsText(_param, SystemScript.ShowType.DETAIL, true);

        //LVUP関連
//		LvUpText.text = System.String.Format ("LV.{0}→LV.{1}\n{2} / {3}枚",new string[]{_param.LV.ToString(),(_param.LV+1).ToString(),BoxCount.ToString(),999.ToString()});
        LvUpText.text = "強化";
        //イメージ変更
        CardImage.Set(_param);
        CardBigImage.Set(_param);

        //ボタン変更
        for (int i = 0; i < Buttons.Length; i++)
        {
            GameObject btn = Buttons [i];
            if (i == DeckInCount)
            {
                btn.GetComponent <ShadowMove> ().Move(true, false);
            }
            else
            {
                btn.GetComponent <ShadowMove> ().Move(false, false);
            }
        }
//		Param.text = _param.
    }
示例#10
0
文件: ShopScript.cs 项目: ngokakr/tcg
    void Show()
    {
        cardPacks = new List <CardPackStruct> ();
        List <XLS_CardPack.Sheet> sheets = DataManager.Instance.xls_CardPack.sheets;

        for (int i = 0; i < sheets.Count; i++)
        {
            XLS_CardPack.Sheet sheet   = sheets [i];
            CardPackStruct     cardStr = new CardPackStruct();
            cardStr.BronzeCards = new List <CardData> ();
            cardStr.SilverCards = new List <CardData> ();
            cardStr.GoldCards   = new List <CardData> ();
            cardStr.LegendCards = new List <CardData> ();
            cardStr.PackName    = sheet.name;

            for (int i2 = 0; i2 < sheet.list.Count; i2++)
            {
                XLS_CardPack.Param param = sheet.list [i2];
                CardData           cd    = new CardData().Set(param.cardAtr, param.cardID, param.cardLV, 1);
                CardParam          cp    = new CardParam().Set(cd);
                switch (cp.Rea)
                {
                case 0:
                    cardStr.BronzeCards.Add(cd);
                    break;

                case 1:
                    cardStr.SilverCards.Add(cd);
                    break;

                case 2:
                    cardStr.GoldCards.Add(cd);
                    break;

                case 3:
                    cardStr.LegendCards.Add(cd);
                    break;
                }
            }

            cardPacks.Add(cardStr);
        }
    }
示例#11
0
    public void Set(CardParam _cp, bool _CanSummon = true)
    {
        if (!(_cp.Atr == Atr && _cp.ID == ID && _cp.Role == role))
        {
            Atr              = _cp.Atr;
            ID               = _cp.ID;
            role             = _cp.Role;
            CardImage.sprite = SystemScript.GetCardSprite(_cp);
            CardImage.SetNativeSize();
            float width      = CardImage.sprite.rect.width;
            float height     = CardImage.sprite.rect.height;
            float widthRate  = width / MaxWidth;
            float HeightRate = height / MaxHeight;
//			Debug.Log (width + ":"+height + ":"+MaxWidth + ":"+MaxHeight + ":"+ widthRate + " : " + HeightRate);
            if (widthRate > HeightRate)
            {
                CardImage.transform.localScale = new Vector3(1 / widthRate, 1 / widthRate);
            }
            else
            {
                CardImage.transform.localScale = new Vector3(1 / HeightRate, 1 / HeightRate);
            }

//			GetComponent<RectTransform> ().sizeDelta = size;

            if (Attribute != null)
            {
                DataManager.CardImageParts parts = DataManager.Instance.cardParts;

                BG.sprite        = parts.BG [_cp.Role * 4 + _cp.Rea];
                Frame.sprite     = parts.Frame [_cp.Role];
                Reality.sprite   = parts.Reality [_cp.Rea];
                Power.sprite     = parts.Power [_cp.Role];
                Role.sprite      = parts.Role [_cp.Role];
                Attribute.sprite = parts.Attribute [_cp.Atr];
            }
            else
            {
//				Color[] top = new Color[3];
//				Color[] btm = new Color[3];
//				top [0] = new Color (118f / 255f, 0f, 240f / 255f);
//				btm [0] = new Color (33f / 255f, 0f, 51f / 255f);
//				top [1] = new Color (0f / 255f,  190f/255f, 240f / 255f);
//				btm [1] = new Color (11f / 255f, 17f/255f, 90f / 255);
//				top [2] = Color.white;
//				btm [2] = new Color (23f / 255f, 23f/255f, 23f / 255);
//
//				BG.GetComponent<GradientColor> ().colorTop = top [_cp.Role];
//				BG.GetComponent<GradientColor> ().colorBottom = btm [_cp.Role];
//				BG.GetComponent<GradientColor> ().Refresh ();
                BG.sprite      = SystemScript.GetSprite("CardParts/BG/" + _cp.Role + "/" + _cp.Rea);
                Frame.sprite   = SystemScript.GetSprite("CardParts/frame/" + _cp.Role);
                Reality.sprite = SystemScript.GetSprite("CardParts/cost/" + _cp.Rea);
                Power.sprite   = SystemScript.GetSprite("CardParts/power/" + _cp.Role);
            }
        }
        Color a = new Color(1f, 1f, 1f, 1f);

        if (_CanSummon == false)
        {
            a = new Color(1f, 1f, 1f, 0.5f);
        }

        CardImage.color = a;
        BG.color        = a;
        Frame.color     = a;
        Reality.color   = a;
        Power.color     = a;
        if (Role != null)
        {
            Role.color = a;
        }
        if (Attribute != null)
        {
            Attribute.color = a;
        }
        Power.color = a;

//		int tempCost = 0;
//		int tempPower = 0;
//
//		for (int i = 0; i < _cp.Effect.Count; i++ ){
//			int effNum = _cp.Effect [i];
//			if (effNum == 12) {//コスト補正
//				tempCost = _cp.EffectValue[i];
//			}
//			if (effNum == 13) {//パワー補正
//				tempPower = _cp.EffectValue[i];
//			}
//		}

        CostText.text  = (_cp.Cost).ToString();
        PowerText.text = (_cp.Power).ToString();
        Pass           = _cp.Pass;
    }
示例#12
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);
    }
示例#13
0
 public void DeckTapNotify(int num)
 {
     SelectingCard = SortedDeck [num];
     ShowDetail();
 }
示例#14
0
    public void BoxCardTapNotify(int num)
    {
//		DataManager.Instance.SEPlay (0);
        SelectingCard = SortedBox [nowPage * 10 + num];
        ShowDetail();
    }
示例#15
0
    /// <summary>
    /// _Role -1=ALL 0=Charger 1=Attacker 2=Defender
    /// </summary>
    List <CardParam> CardRefine(List <CardParam> _Cards, List <int> _Attribute, int _Role)
    {
        var              xlsParams  = DataManager.Instance.xls_CardParam.sheets[0].list;
        string           refineText = "";
        List <CardParam> Result     = new List <CardParam> ();

        if (RefineIndex == 0)
        {
            refineText = "絞り込み";
        }
        else if (1 <= RefineIndex && RefineIndex <= 5)
        {
            string[] x = { "灼熱", "大雨", "竜巻", "光明", "暗黒" };
            refineText = x [RefineIndex - 1];
        }
        else
        {
            refineText = DataManager.Instance.xls_Groups.sheets [0].list [GroupIndexes [RefineIndex]].name;
        }
        for (int i = 0; i < _Cards.Count; i++)
        {
            CardParam cd    = _Cards [i];
            var       param = xlsParams [cd.ID];
            if (_Attribute.Count != 0)
            {
                if (!_Attribute.Contains(cd.Atr))
                {
                    continue;
                }
            }

            if (_Role != -1)
            {
                if (_Role != cd.Role)
                {
                    continue;
                }
            }
            if (RefineIndex == 0)
            {
                //絞り込みなし
            }
            else if (1 <= RefineIndex && RefineIndex <= 5)
            {
                //天候絞り込み
                bool     exist = false;
                string[] x     = { "灼熱", "大雨", "竜巻", "光明", "暗黒" };
                string   g     = x [RefineIndex - 1];
                for (int i2 = 0; i2 < param.skill.Length; i2++)
                {
                    if (param.skill [i2].Contains(g))
                    {
                        exist = true;
                    }
                }
                if (!exist)
                {
                    continue;
                }
            }
            else
            {
                //グループ絞り込み
                bool exist = false;
                if (!param.group.Contains(GroupIndexes [RefineIndex]))
                {
                    continue;
                }
            }

            Result.Add(cd);
        }
        boxObjs.SearchText.text = refineText;
        return(Result);
    }
示例#16
0
 public void DetailShow(CardParam _cp)
 {
     cardDatail.Refresh(_cp, DeckMode);
     cardDatail.ShowHide(true);
 }