private void Start() { CardDataProxy cardObj = new CardDataProxy(InitNumber, InitName, InitText, InitCost, InitScore, InitType, InitRarity); //初期表示 CardDataProxy.GetInstance().DisplayALLOriginalValues(); }
//ClientData配列を分解し、ClientDataClassに置き換える public Model.ClientData ArrayConvertClass(SendClientDataArray saverData) { CardDataProxy setdata = new CardDataProxy(saverData.Number, saverData.Name, saverData.Text, saverData.Cost, saverData.Score, saverData.Type, saverData.Rarity ); cData.CardDataProxy = setdata; cData._PlayerNum = saverData._PlayerNum; cData._CardPlayTime = saverData._CardPlayTime; cData._FieldPos = saverData._FieldPos; return(cData); }
/// <summary> /// デッキ初期化 /// </summary> private void DeckInitialize() { for (int i = (int)CardName.Restaurants; i < (int)CardName.CardEnd; i++)//種類分回す { //カード種類参照 CardDataProxy addCardData = new CardDataProxy(_AllCardDataObj.GetComponent <CardInfo>().AllCard[i].number, _AllCardDataObj.GetComponent <CardInfo>().AllCard[i].name, _AllCardDataObj.GetComponent <CardInfo>().AllCard[i].text, _AllCardDataObj.GetComponent <CardInfo>().AllCard[i].cost, _AllCardDataObj.GetComponent <CardInfo>().AllCard[i].score, _AllCardDataObj.GetComponent <CardInfo>().AllCard[i].type, _AllCardDataObj.GetComponent <CardInfo>().AllCard[i].rarity);; DeckDataProxy addData = new DeckDataProxy(addCardData, false); //枚数分追加 for (int j = 0; j < _AllCardDataObj.GetComponent <CardInfo>().AllCard[i].Maximum; j++) { //カードデータ作成 _DeckMgrObj.GetComponent <DeckManeger>().Deck.Add(addData); } } }
//ClientData構造体を分解し、ClientDataClassに置き換える public Model.ClientData SendArrayConvertClass(SendClientDataArray severData) { ClientData cData = new Model.ClientData(null, 0, 0, new Vector2()); CardDataProxy setdata = new CardDataProxy(severData.Number, severData.Name, severData.Text, severData.Cost, severData.Score, severData.Type, severData.Rarity ); cData.CardDataProxy = setdata; cData._PlayerNum = severData._PlayerNum; cData._CardPlayTime = severData._CardPlayTime; cData._FieldPos = severData._FieldPos; return(cData); }
/// <summary> /// 各プレイヤーのドローカード確定 /// ※カードを使う前に確定 /// </summary> public void DrawCardConfirm() { //全プレイヤーループ for (int player = (int)PlayerType.Player1; player > (int)PlayerType.EndPlayer; player++) { //カードを引く枚数の確定 int DrawNum = _CliantMgrObj.GetComponent <FromManeger>().Test(player).GetComponent <FromData>().From.Count(); //カード選出処理 for (int i = 0; i < DrawNum; i++) { CardDataProxy ConfirmCard = null; //ToDo:: ConfirmCard = DeckManegerからのカード引く処理 //ドローカードリストに追加 //_DrawCard[player].Add(ConfirmCard); } } }
//------------------- //変更しました //------------------- /// <summary> /// 各プレイヤーのドローカード確定 /// ※カードを使う前に確定 /// </summary> public void DrawCardConfirm() { //全プレイヤーループ for (int player = (int)PlayerType.Player1; player < (int)PlayerType.EndPlayer; player++) { //カードを引く枚数の確定 int DrawNum = _CliantMgrObj.GetComponent <FromManeger>().Test(player).GetComponent <FromData>().From.Count(); //カード選出処理 for (int i = 0; i < DrawNum; i++) { CardDataProxy ConfirmCard = new CardDataProxy(-1, null, null, -1, -1, -1, -1); //初期化を追加 //Debug.Log(_DeckMgrObj.GetComponent<DeckManeger>().Deck.Count()); //ドローカード確定 ConfirmCard = _DeckMgrObj.GetComponent <DeckManeger>().DrawCardConfirm(_DeckMgrObj.GetComponent <DeckManeger>().Deck.Count()); //ドローカードリストに追加 _DrawCard[player].Add(ConfirmCard); } } }
public CardDataProxy DrawCardRateConfirm(int Ranking) { bool confirm = false; CardDataProxy DrawCard; int Maximam = _Deck.Count(); System.Random r = new System.Random((int)DateTime.Now.Ticks); //秒数によってシード値を確定 int num = r.Next(100); //順位によって排出率を変更 switch (Ranking) { case 1: //好況カードを除いたのでー1にしています for (int i = 0; i < DeckName.Length; i++) { _AllCard.GetComponent <CardInfo>().Card[i].CardRarityEntity = FirstEmissionRate[i]; } break; case 2: //好況カードを除いたのでー1にしています for (int i = 0; i < DeckName.Length; i++) { _AllCard.GetComponent <CardInfo>().Card[i].CardRarityEntity = SecondEmissionRate[i]; } break; case 3: //好況カードを除いたのでー1にしています for (int i = 0; i < DeckName.Length; i++) { _AllCard.GetComponent <CardInfo>().Card[i].CardRarityEntity = TherdEmissionRate[i]; } break; case 4: //好況カードを除いたのでー1にしています for (int i = 0; i < DeckName.Length; i++) { _AllCard.GetComponent <CardInfo>().Card[i].CardRarityEntity = FourthEmissionRate[i]; } break; default: Debug.Log("ドローカードを決定する際に" + Ranking + "位の人がいました"); break; } //ここでカードの確定 while (!confirm) { //確率用変数 int Rate = 0; //チェック範囲 int CheckRange = 0; //ランダム数値 num = r.Next(100); //カード検索 for (int i = 0; i < DeckName.Length; i++) { //排出率をプラス Rate += _AllCard.GetComponent <CardInfo>().Card[i].CardRarityEntity; CheckRange += _AllCard.GetComponent <CardInfo>().Card[i].CardMaximumEntity; if (Rate > num) { for (int check = 0; check < _AllCard.GetComponent <CardInfo>().Card[i].CardMaximumEntity; check++) { if (_Deck[CheckRange + check].IsUse == false) { DrawCard = _Deck[CheckRange + check].CardData; _Deck[CheckRange + check].IsUse = true; confirm = true; CardDataProxy ReturnCard = new CardDataProxy(_AllCard.GetComponent <CardInfo>().Card[i].CardNumberEntity, _AllCard.GetComponent <CardInfo>().Card[i].CardNameEntity, _AllCard.GetComponent <CardInfo>().Card[i].CardTextEntity, _AllCard.GetComponent <CardInfo>().Card[i].CardCostEntity, _AllCard.GetComponent <CardInfo>().Card[i].CardScoreEntity, _AllCard.GetComponent <CardInfo>().Card[i].CardTypeEntity, _AllCard.GetComponent <CardInfo>().Card[i].CardRarityEntity); return(ReturnCard); } } } } return(null); } return(null); }
public void ChangeType() { CardDataProxy.GetInstance().ChangeType(Type); }
public void AddScore() { CardDataProxy.GetInstance().AddScore(AddScoreValue); }
public void AddCost() { CardDataProxy.GetInstance().AddCost(AddCostValue); }
public void ChangeText() { CardDataProxy.GetInstance().ChangeText(Text); }
public void ChangeName() { CardDataProxy.GetInstance().ChangeName(Name); }
public void AddNumber() { CardDataProxy.GetInstance().AddNumber(AddNumValue); }
//SendSeverDataArrayをRecvClientDataclassに変換 public RecvCliantData RecvArrayConvertClass(SendSeverDataArray sever) { RecvCliantData rData = new RecvCliantData(new FieldDataProxy[global.FieldSize.y, global.FieldSize.x], null, -1, null, null); int severCount = 0; for (int i = 0; i < global.FieldSize.y; i++) { for (int j = 0; j < global.FieldSize.x; j++) { CardDataProxy InitCard = new CardDataProxy(-1, "", "", -1, -1, -1, -1); FieldDataProxy Init = new FieldDataProxy(InitCard, -1, -1, false, -1); rData.AllFeildData[i, j] = Init; } } //プレイヤー初期化 PlayerDataProxy InitPlayer = new PlayerDataProxy(-1, -1, -1, -1); rData.AllPlayerData = new PlayerDataProxy[4]; for (int i = 0; i < 4; i++) { rData.AllPlayerData[i] = InitPlayer; } List <List <int> > InitDrawList = new List <List <int> >(); rData.DrawDataList = InitDrawList; List <CardDataProxy> InitCardData = new List <CardDataProxy>(); rData.DrawCardList = InitCardData; for (int i = 0; i < sever.AllFeildData.Length / global.FieldSize.x; i++) { for (int j = 0; j < sever.AllFeildData.Length / global.FieldSize.y; j++) { //カードデータをClassに変換する rData.AllFeildData[i, j]._CardData.Cost = sever.AllFeildData[severCount].SendCardData.Cost; rData.AllFeildData[i, j]._CardData.Name = sever.AllFeildData[severCount].SendCardData.Name; rData.AllFeildData[i, j]._CardData.Number = sever.AllFeildData[severCount].SendCardData.Number; rData.AllFeildData[i, j]._CardData.Rarity = sever.AllFeildData[severCount].SendCardData.Rarity; rData.AllFeildData[i, j]._CardData.Score = sever.AllFeildData[severCount].SendCardData.Score; rData.AllFeildData[i, j]._CardData.Text = sever.AllFeildData[severCount].SendCardData.Text; rData.AllFeildData[i, j]._CardData.Type = sever.AllFeildData[severCount].SendCardData.Type; //残りも変換 rData.AllFeildData[i, j].IsRankUp = sever.AllFeildData[severCount].IsRankUp; rData.AllFeildData[i, j].MaptipNumber = sever.AllFeildData[severCount].MaptipNumber; rData.AllFeildData[i, j].PossessionPlayer = sever.AllFeildData[severCount].PossessionPlayer; rData.AllFeildData[i, j].RankID = sever.AllFeildData[severCount].RankID; severCount++; } } //プレイヤーデータを構造体に変換 for (int i = (int)PlayerType.Player1; i < (int)PlayerType.EndPlayer; i++) { rData.AllPlayerData[i].PlayerNumber = sever.AllPlayerData[i].PlayerNumber; rData.AllPlayerData[i].Ranking = sever.AllPlayerData[i].Ranking; rData.AllPlayerData[i].ScorePerTurn = sever.AllPlayerData[i].ScorePerTurn; rData.AllPlayerData[i].TotalScore = sever.AllPlayerData[i].TotalScore; } //描画メソッドを構造体に変換 List <List <int> > AddData = new List <List <int> >(); for (int i = 0; i < sever.DrawDataList.Length; i++) { List <int> ListData = new List <int>(); for (int j = 0; j < sever.DrawDataList[i].vs.Length; j++) { ListData.Add(sever.DrawDataList[i].vs[j]); //rData.DrawDataList[i][j] = sever.DrawDataList[i].vs[j]; } AddData.Add(ListData); } rData.DrawDataList = new List <List <int> >(AddData); //引くカードのデータを構造体に変換 for (int i = 0; i < sever.DrawCardList.Length; i++) { CardDataProxy AddCardData = new CardDataProxy(sever.DrawCardList[i].Number, sever.DrawCardList[i].Name, sever.DrawCardList[i].Text, sever.DrawCardList[i].Cost, sever.DrawCardList[i].Score, sever.DrawCardList[i].Type, sever.DrawCardList[i].Rarity); rData.DrawCardList.Add(AddCardData); //rData.DrawCardList[i].Name = sever.DrawCardList[i].Name; //rData.DrawCardList[i].Number = sever.DrawCardList[i].Number; //rData.DrawCardList[i].Rarity = sever.DrawCardList[i].Rarity; //rData.DrawCardList[i].Score = sever.DrawCardList[i].Score; //rData.DrawCardList[i].Text = sever.DrawCardList[i].Text; //rData.DrawCardList[i].Type = sever.DrawCardList[i].Type; } return(rData); }
//情報をまとめて送り返す処理 public void CreateRecvObject(FieldDataProxy[][] Field, PlayerDataProxy[] Player, int Turn, List <List <int> > DrawData, List <CardDataProxy>[] DrawCard) { _PlayerObj = GameObject.FindGameObjectsWithTag("Player"); //プレイヤーごとの渡すデータを作成 for (int player = (int)PlayerType.Player1; player < (int)PlayerType.EndPlayer; player++) { //初期化 CardDataProxy InitCard = new CardDataProxy(-1, "", "", -1, -1, -1, -1); FieldDataProxy[,] AllFieldObj; AllFieldObj = new FieldDataProxy[_prm.FieldSize.y, _prm.FieldSize.x]; for (int i = 0; i < _prm.FieldSize.y; i++) { for (int j = 0; j < _prm.FieldSize.x; j++) { AllFieldObj[i, j] = Field[i][j]; } } recvData[player] = new RecvCliantData(AllFieldObj, Player, Turn, DrawData, DrawCard[player]); //ここから処理 //フィールドデータを詰める for (int i = 0; i < _prm.FieldSize.y; i++) { for (int j = 0; j < _prm.FieldSize.x; j++) { if (Field[i][j].Data != null) { Debug.Log(recvData[player].AllFeildData[i, j]._CardData = _FieldObj[i * _prm.FieldSize.y + j].GetComponent <TileData_Maneger>().Field._CardData); //各プレイヤーのrecvDataに対して、フィールドデータを入れている recvData[player].AllFeildData[i, j]._CardData = Field[i][j]._CardData; recvData[player].AllFeildData[i, j]._IsRankUp = Field[i][j]._IsRankUp; recvData[player].AllFeildData[i, j]._MaptipNumber = Field[i][j]._MaptipNumber; recvData[player].AllFeildData[i, j]._PossessionPlayer = Field[i][j]._PossessionPlayer; recvData[player].AllFeildData[i, j]._RankID = Field[i][j]._RankID; } else { print("ないよ"); } } } //プレイヤーデータを詰める for (int i = 0; i < _PlayerObj.Length; i++) { recvData[player].AllPlayerData[i] = Player[i]; } //現在のターン数を詰める recvData[player].NowTurn = Turn; //使ったカードの情報を詰める recvData[player].DrawDataList = DrawData; //ドローカード情報を詰める recvData[player].DrawCardList = DrawCard[player]; } //全プレイヤーの情報を詰める for (int player = (int)PlayerType.Player1; player < (int)PlayerType.EndPlayer; player++) { //クラスを構造体に変換し、構造体配列に代入 sendDataArray[player] = ClassConvertArray(recvData[player]); } //_RecvObj.GetComponent<RecvData>().Recv = recvData; }