/// <summary> /// マッチング成功時 /// </summary> void OnMatched() { //データ送信 if (alert != null) { alert.OpenClose(false); } Reconnectend = false; int uid = DataManager.Instance.uid; string uname = DataManager.Instance.PlayerName; roomName = PhotonNetwork.room.Name; if (PhotonNetwork.isMasterClient) { Initiative = Random.Range(0, 2); //0だったらマスタークライアントが先攻 Seed = Random.Range(0, 999999999); PhotonNetwork.room.IsOpen = false; } myDeck = SystemScript.ShuffleCP(SystemScript.cdTocp(DataManager.Deck.GetDeckData())); string deckjson = JsonMapper.ToJson(myDeck); photonView.RPC("RPC_StartDatas", PhotonTargets.OthersBuffered, uid, uname, Initiative, Seed, deckjson); //対戦できるかチェック CanBattle(); }
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(); }
//マッチング開始 public void Matching(BattleMode mode, string roomKeyword) { if (netMode == NetMode.NODE) { //node List <CardParam> deck = SystemScript.cdTocp(DataManager.Deck.GetDeckData(DataManager.Instance.UseDeck)); deck = SystemScript.ShuffleCP(deck); Manager ["/pvp"].Emit("toLobby", new object[] { JsonMapper.ToJson(deck) }); } else { //pun battleMode = mode; punButtle.roomKeyword = roomKeyword; punButtle.Matching(mode, roomKeyword); } }
public void ToTestMatch(int num) { ChangeScene(2); StartCoroutine(DataManager.Instance.BGMFade(2, FadeWait)); int useDeck = DataManager.Instance.UseDeck; if (num == 5) { battleScript.BattleStartOffline(new int[] { 50, 50 }, new int[] { 10, 200 } , SystemScript.cdTocp(DataManager.Deck.GetDeckData(useDeck)), SystemScript.GetEnemyDeck(num)); } else { battleScript.BattleStartOffline(new int[] { 50, 50 }, new int[] { 10, 10 } , SystemScript.cdTocp(DataManager.Deck.GetDeckData(useDeck)), SystemScript.GetEnemyDeck(num)); } }
public void ToCPUArenaBattle(XLS_ArenaData.Param param, int difficulty) { ChangeScene(2); // param. // battleScript.gameObject.SetActive (true); StartCoroutine(DataManager.Instance.BGMFade(2, FadeWait)); int useDeck = DataManager.Instance.UseDeck; battleScript.BattleStartOffline(new int[] { 40, param.HP[difficulty] }, new int[] { 10, 10 } , SystemScript.cdTocp(DataManager.Deck.GetDeckData(useDeck)), SystemScript.GetEnemyDeck(param.deck)); // if (_num == 0) { // } // if (_num == 1) { //// battleScript.BattleStartOffline (new int[]{ 40, 40 }, new int[]{ 10, 10 } //// ,SystemScript.cdTocp( DataManager.Deck.GetDeckData (useDeck)), SystemScript.GetEnemyDeck (0)); // battleScript.BattleStartOffline (new int[]{ 40, 40 }, new int[]{ 10, 10 } // ,SystemScript.cdTocp( DataManager.Deck.GetDeckData (useDeck)),SystemScript.cdTocp( DataManager.Deck.GetDeckData (useDeck))); // } }
public void DeckRefresh() { //デッキ取得 SortedDeck = SystemScript.cdTocp(DataManager.Deck.GetDeckData(useDeck)); //そーと Sort(SortedDeck); //絞り込み // SortedDeck = CardRefine(SortedDeck,new List<int>(),-1); //データ表示 & カードデータ生成 deckObjs.Info.text = "デッキ枚数 [" + SortedDeck.Count + " / 30]\n■タップで詳細を見る"; //Node破壊 // foreach ( Transform n in deckObjs.ScrollContent ) // { // GameObject.Destroy(n.gameObject); // } // List<CardParam> lcp = new List<CardParam>(); // for (int i = 0; i < 30; i++ ){ // lcp.AddRange (SortedDeck); // } itemCtrls [0].cards = SortedDeck; itemCtrls [0].DeckMode = DeckMode; infinitys [0].show(); // //Node生成 // for (int i = 0; i < SortedDeck.Count; i++ ){ // CardNodeScript node = Instantiate (cardNode); // node.name = i + ""; // node.Delegate = gameObject; // node.transform.SetParent (deckObjs.ScrollContent); // node.transform.localScale = Vector3.one; // node.transform.localPosition = Vector3.zero; // CardData cd = new CardData ().Set (SortedDeck [i]); // node.Refresh (cd,false); // // } }
public static List <CardParam> GetCardParam() { return(SystemScript.cdTocp(DataManager.Instance.box)); }
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); }