/// <summary> /// 初始化玩家的手牌信息 /// </summary> /// <param name="info"></param> /// <returns></returns> UserMatchInfo GetMatchInfo(ISFSObject info) { UserMatchInfo userMatchInfo = ParseMatchInfo(info); ISFSArray cardInfos = info.GetSFSArray("duninfo") ?? info.GetSFSObject("duns").GetSFSArray("duninfo"); AddDunInfo(ref userMatchInfo, cardInfos); //检测 YxDebug.LogArray(userMatchInfo.Cards); if (userMatchInfo.Cards.Count != 13) { Debug.LogError("手牌不是十三张!!"); string errorMsg = string.Empty; foreach (var card in userMatchInfo.Cards) { errorMsg += card + " , "; } Debug.LogError(errorMsg); } ISFSObject userScore = info.GetSFSObject("userscore"); AddScoreInfo(ref userMatchInfo, userScore); if (info.ContainsKey("daqiang")) { userMatchInfo.Shoot = GetShootInfo(info); } return(userMatchInfo); }
void AddDunInfo(ref UserMatchInfo matchInfo, ISFSArray cardInfo) { YxDebug.Log(" ========== " + matchInfo.Seat + " ========== "); foreach (ISFSObject info in cardInfo) { matchInfo.DunTypeList.Insert(0, info.GetInt("type")); int[] cards = info.GetIntArray("cards"); YxDebug.LogArray(cards); foreach (int card in cards) { matchInfo.Cards.Insert(0, card); } } }
/// <summary> /// Save userMatchInfo /// </summary> /// <returns>Tracking task</returns> public async Task UserMatchInfoSave(string senderEmail, string senderAadId, string receiverEmail, string recipientAadId) { await this.EnsureInitializedAsync(); var userInfo = new UserMatchInfo() { SenderEmail = senderEmail, SenderAadId = senderAadId, RecipientEmail = receiverEmail, RecipientAadId = recipientAadId, Created = DateTime.Now.ToUniversalTime(), }; await this.documentClient.UpsertDocumentAsync(this.usersMatchInfoCollection.SelfLink, userInfo); }
UserMatchInfo ParseMatchInfo(ISFSObject info) { UserMatchInfo userMatchInfo = new UserMatchInfo { Seat = info.GetInt("seat"), Special = info.GetInt("special"), Swat = false, Cards = new List <int>(), DunTypeList = new List <int>(), NormalScores = new List <int>(), AddScore = new List <int>(), Shoot = new ShootInfo() }; return(userMatchInfo); }
UserMatchInfo GetMatchInfoOnInitUserGameState(ISFSObject info) { UserMatchInfo userMatchInfo = ParseMatchInfo(info); ISFSArray playerInfo = info.GetSFSArray("playerinfo"); ISFSArray dunInfo = playerInfo.GetSFSObject(0).GetSFSArray("duninfo"); AddDunInfo(ref userMatchInfo, dunInfo); ISFSObject scoreInfo = playerInfo.GetSFSObject(1); AddScoreInfo(ref userMatchInfo, scoreInfo); var shootInfo = GetShootInfo(info); userMatchInfo.Shoot = shootInfo; return(userMatchInfo); }
/// <summary> /// 初始化玩家的手牌信息 /// </summary> /// <param name="info"></param> /// <returns></returns> UserMatchInfo GetCardsInfo(ISFSObject info) { UserMatchInfo userMatchInfo = new UserMatchInfo { Seat = info.GetInt("seat"), Special = info.GetInt("special"), Cards = new List <int>(), DunTypeList = new List <int>(), NormalScores = new List <int>(), AddScore = new List <int>(), TtScore = info.GetInt("score") }; ISFSArray cardInfos = info.GetSFSArray("duninfo"); foreach (ISFSObject cardInfo in cardInfos) { userMatchInfo.DunTypeList.Add(cardInfo.GetInt("type")); int[] cards = cardInfo.GetIntArray("cards"); foreach (int card in cards) { userMatchInfo.Cards.Add(card); } } ISFSObject userScore = info.GetSFSObject("userscore"); ISFSArray scoreArray = userScore.GetSFSArray("dunscore"); foreach (ISFSObject score in scoreArray) { userMatchInfo.NormalScores.Add(score.GetInt("normal")); userMatchInfo.AddScore.Add(score.GetInt("add")); } if (info.ContainsKey("daqiang")) { userMatchInfo.Shoot = GetShootInfo(info); } if (userScore.ContainsKey("basesocre")) { userMatchInfo.ShootScore = userScore.GetIntArray("basesocre"); } return(userMatchInfo); }
void AddScoreInfo(ref UserMatchInfo matchInfo, ISFSObject scoreInfo) { matchInfo.Swat = scoreInfo.ContainsKey("quanleida") && scoreInfo.GetBool("quanleida"); matchInfo.TtScore = scoreInfo.GetInt("score"); ISFSArray scoreArray = scoreInfo.GetSFSArray("dunscore"); foreach (ISFSObject score in scoreArray) { matchInfo.NormalScores.Insert(0, score.GetInt("normal")); matchInfo.AddScore.Insert(0, score.GetInt("add")); } if (scoreInfo.ContainsKey("basesocre")) { matchInfo.ShootScore = scoreInfo.GetIntArray("basesocre"); } }
public bool AddUserMatchInfo(UserMatchInfo info) { bool flag = false; try { SqlParameter[] SqlParameters = new SqlParameter[14]; SqlParameters[0] = new SqlParameter("@ID", (object)info.ID); SqlParameters[0].Direction = ParameterDirection.Output; SqlParameters[1] = new SqlParameter("@UserID", (object)info.UserID); SqlParameters[2] = new SqlParameter("@dailyScore", (object)info.dailyScore); SqlParameters[3] = new SqlParameter("@dailyWinCount", (object)info.dailyWinCount); SqlParameters[4] = new SqlParameter("@dailyGameCount", (object)info.dailyGameCount); SqlParameters[5] = new SqlParameter("@DailyLeagueFirst", (object)(int)(info.DailyLeagueFirst ? 1 : 0)); SqlParameters[6] = new SqlParameter("@DailyLeagueLastScore", (object)info.DailyLeagueLastScore); SqlParameters[7] = new SqlParameter("@weeklyScore", (object)info.weeklyScore); SqlParameters[8] = new SqlParameter("@weeklyGameCount", (object)info.weeklyGameCount); SqlParameters[9] = new SqlParameter("@weeklyRanking", (object)info.weeklyRanking); SqlParameters[10] = new SqlParameter("@addDayPrestge", (object)info.addDayPrestge); SqlParameters[11] = new SqlParameter("@totalPrestige", (object)info.totalPrestige); SqlParameters[12] = new SqlParameter("@restCount", (object)info.restCount); SqlParameters[13] = new SqlParameter("@Result", SqlDbType.Int); SqlParameters[13].Direction = ParameterDirection.ReturnValue; this.db.RunProcedure("SP_UserMatch_Add", SqlParameters); flag = (int)SqlParameters[13].Value == 0; info.ID = (int)SqlParameters[0].Value; info.IsDirty = false; } catch (Exception ex) { if (BaseBussiness.log.IsErrorEnabled) BaseBussiness.log.Error((object)"Init", ex); } return flag; }
public bool UpdateUserMatchInfo(UserMatchInfo info) { bool flag = false; try { SqlParameter[] SqlParameters = new SqlParameter[14] { new SqlParameter("@ID", (object) info.ID), new SqlParameter("@UserID", (object) info.UserID), new SqlParameter("@dailyScore", (object) info.dailyScore), new SqlParameter("@dailyWinCount", (object) info.dailyWinCount), new SqlParameter("@dailyGameCount", (object) info.dailyGameCount), new SqlParameter("@DailyLeagueFirst", (object) (int) (info.DailyLeagueFirst ? 1 : 0)), new SqlParameter("@DailyLeagueLastScore", (object) info.DailyLeagueLastScore), new SqlParameter("@weeklyScore", (object) info.weeklyScore), new SqlParameter("@weeklyGameCount", (object) info.weeklyGameCount), new SqlParameter("@weeklyRanking", (object) info.weeklyRanking), new SqlParameter("@addDayPrestge", (object) info.addDayPrestge), new SqlParameter("@totalPrestige", (object) info.totalPrestige), new SqlParameter("@restCount", (object) info.restCount), new SqlParameter("@Result", SqlDbType.Int) }; SqlParameters[13].Direction = ParameterDirection.ReturnValue; this.db.RunProcedure("SP_UpdateUserMatch", SqlParameters); flag = (int)SqlParameters[13].Value == 0; } catch (Exception ex) { if (BaseBussiness.log.IsErrorEnabled) BaseBussiness.log.Error((object)"SP_UpdateUserMatch", ex); } return flag; }
protected override IEnumerator MatchPlayerCards() { var main = App.GetGameManager <SssjpGameManager>(); var gdata = App.GetGameData <SssGameData>(); int selfSeat = gdata.SelfSeat; //每行开始展示 if (SpecialList.Count > 0) //特殊牌型不参与比牌,给出特殊牌型提示 { for (int i = 0; i < SpecialList.Count; i++) { gdata.GetPlayer <SssPlayer>(SpecialList[i].Seat, true).HandCardsType.SetSpecialMarkActive(true); } } for (int i = 0; i < 3; i++) //展示手牌的行数 { SortList(MatchInfoList, i); //对列表进行排序,这样可以依次展示手牌 for (int j = 0; j < MatchInfoList.Count; j++) { UserMatchInfo tempInfo = MatchInfoList[j]; var panel = gdata.GetPlayer <SssPlayer>(tempInfo.Seat, true); //展示玩家手牌 panel.ShowHandPoker(i, tempInfo); panel.ShowCardType(i, tempInfo); yield return(new WaitForSeconds(0.6f)); } //main.TurnRes.ShowResultItem(i, DunScoreList[0].NormalScore[i], DunScoreList[0].AddScore[i]); ShowAllPlayerLineTotalScore(i); } //播放打枪 if (gdata.HaveShoot && ShootList.Count > 0) { ShootList.Sort((s1, s2) => Sequence * (s1.ShootCount - s2.ShootCount)); foreach (ShootInfo item in ShootList) { if (item.ShootTargs == null || item.ShootTargs.Length <= 0) { //ShootList.Remove(item); continue; } for (int i = 0; i < item.ShootTargs.Length; i++) { int serverTargSeat = item.ShootTargs[i]; int serverShootSeat = item.Seat; Facade.Instance <MusicManager>().Play("beforeshoot"); yield return(new WaitForSeconds(.7f)); gdata.GetPlayer <SssPlayer>(serverShootSeat, true) .ShootSomeone(gdata.GetPlayer <SssPlayer>(serverTargSeat, true)); //打枪需要修改总分 if (serverShootSeat == selfSeat) //说明是自己打枪,获取额外得分 { //设置总分数 int shootScore = gdata.ShootScore == 0 ? ShootScoreArray[serverTargSeat] : gdata.ShootScore; main.TurnRes.ResultTotal.SetValue(shootScore); } if (serverTargSeat == selfSeat) //说明自己被打枪,扣除额外分数 { int shootScore = gdata.ShootScore == 0 ? ShootScoreArray[serverShootSeat] : -gdata.ShootScore; main.TurnRes.ResultTotal.SetValue(shootScore); } yield return(new WaitForSeconds(.7f)); } } } //播放特殊牌型 if (SpecialList.Count > 0) { foreach (UserMatchInfo item in SpecialList) { Renderer component = SpecialLabelParticle.GetComponent <Renderer>(); CardType cardType = (CardType)item.Special; string typeName = cardType.ToString(); component.material.mainTexture = SpecialTextureList.Find(tex => tex.name == typeName); //播放特殊牌型效果(特效) ShowSpecialPar(); Facade.Instance <MusicManager>().Play(typeName, "special"); //播放音效 SpecialPlayer.ShowSpecialPlayerInfo(item); //显示玩家信息 yield return(new WaitForSeconds(3f)); SpecialPlayer.HideSpecialPlayerInfo(); StopParticle(SpecialParticle); var player = gdata.GetPlayer <SssPlayer>(item.Seat, true); player.HandCardsType.SetSpecialMarkActive(false); player.ShowAllHandPoker(item); player.SetSpecialType(item.Special); } } if (_hasSwat) { main.ShowSwatAnim(); Facade.Instance <MusicManager>().Play("swat"); yield return(new WaitForSeconds(1f)); } ShowAllPlayerTotalScore(); IsMatching = false; }