public void listAllUsers(ISFSObject dataObject) { ISFSArray datos = dataObject.GetSFSArray("usuarios"); foreach (SFSObject proyectoObject in datos){ allUsers.Add(proyectoObject.GetUtfString("nick")); } allUsersFullStrings = allUsers.ToArray(); }
public void listAllProject(ISFSObject dataObject) { ISFSArray datos = dataObject.GetSFSArray("proyectos"); foreach (SFSObject proyectoObject in datos){ projects.Add(proyectoObject.GetUtfString("sala")); projectsFull.Add(proyectoObject.GetUtfString("nombre")); } projectNameStrings = projects.ToArray(); projectFullStrings = projectsFull.ToArray(); }
public void listUserXProject(ISFSObject dataObject) { ISFSArray datos = dataObject.GetSFSArray("usuarios"); users.Clear(); usersFull.Clear(); foreach (SFSObject proyectoObject in datos){ users.Add(proyectoObject.GetUtfString("nick")); usersFull.Add(proyectoObject.GetUtfString("rol")); } usersNameStrings =users.ToArray(); usersFullStrings = usersFull.ToArray(); }
/// <summary> /// 房间模式结算 /// </summary> /// <param name="param"></param> public void OnRoomGameOver(ISFSObject param) { var gMgr = App.GetGameManager <TexasGameManager>(); var users = param.GetSFSArray("users"); var items = gMgr.RModelMagr.ResultItems; var index = 0; var biggestWinGold = 0; var biggestWinIndex = -1; YxDebug.LogError("----------------------------", "OnRoomGameOver"); var gdata = App.GameData; foreach (ISFSObject user in users) { int id = user.GetInt("id"); if (id < 0) { continue; } int seat = user.GetInt("seat"); var userInfo = gdata.GetPlayerInfo(seat, true); if (userInfo == null) { continue; } var item = items[index]; item.SetResultItem(user, userInfo); //存储最大赢钱数 if (item.WinGold > biggestWinGold) { biggestWinGold = item.WinGold; biggestWinIndex = index; } index++; } if (biggestWinIndex >= 0) { items[biggestWinIndex].SetBigWinnerMark(true); } gMgr.RModelMagr.ShowRoomResult(index - 1); }
/// <summary> /// 在线玩家列表信息(玩家信息同步) /// </summary> /// <param name="data"></param> /// <param name="freshRound"></param> public void GetOnLinePlayerList(ISFSObject data, bool freshRound) { var list = data.GetSFSArray(ConstantData.KeyPlayerList); if (list != null) { var count = list.Count; var onLineDatas = new List <NbjlOnLinePlayerData>(); for (int i = 0; i < count; i++) { var item = list.GetSFSObject(i); var info = new NbjlOnLinePlayerData(); info.Parse(item); onLineDatas.Add(info); } if (onLineDatas.Count >= 0) { foreach (var player in Players) { if (player != null) { var id = player.Id; NbjlOnLinePlayerData infodata = onLineDatas.Find(item => item.UserId == id); if (infodata != null) { player.FreshDatas(infodata); } } } if (freshRound) { foreach (var player in RoundPlayers) { if (player != null) { var id = player.Id; NbjlOnLinePlayerData infodata = onLineDatas.Find(item => item.UserId == id); if (infodata != null) { player.FreshDatas(infodata); } } } } } } }
/// <summary> /// 将数据加入到战绩中 /// </summary> /// <param name="data">传入的数据</param> public void GetHistoryInfo(ISFSObject data) { if (_curHistoryItemInfo.RoundVal <= 0) { return; } ISFSArray dataArray = data.GetSFSArray("players"); foreach (ISFSObject item in dataArray) { if (!item.ContainsKey("isPlayed") || !item.GetBool("isPlayed")) { continue; } int seat = item.GetInt("seat"); List <HistoryUserInfo> hisUsers = _curHistoryItemInfo.Users; for (int i = 0; i < hisUsers.Count; i++) { HistoryUserInfo tempUser = hisUsers[i]; if (tempUser.Seat != seat) { continue; } tempUser.IsFold = item.GetBool("isGiveUp"); tempUser.Score = item.GetInt("gold"); hisUsers[i] = tempUser; } } HistoryList.Add(_curHistoryItemInfo); //调整存储的个数 if (MaxCount == 0) //如果是0,则不限制个数 { return; } while (HistoryList.Count > MaxCount) { HistoryList.Remove(HistoryList[0]); } }
public void InitTurnResultInfo(ISFSObject data) { ISFSArray scroeArray = data.GetSFSArray("dunscore"); DunScore dunScore = new DunScore { NormalScore = new List <int>(), AddScore = new List <int>() }; foreach (ISFSObject score in scroeArray) { dunScore.NormalScore.Add(score.GetInt("normal")); dunScore.AddScore.Add(score.GetInt("add")); _scoreList.Add(dunScore); } }
public virtual void OnQueryHulist(ISFSObject data) { //int[] arr = data.GetIntArray("hulist"); var hulist = data.GetSFSArray("hulist"); var intList = new List <int>(); foreach (ISFSObject sfsobj in hulist) { var cds = sfsobj.GetIntArray("cards"); var len = cds.Length; for (int i = 0; i < len; i++) { if (D2MahjongMng.Instance.IsContainMahjongMeKey(cds[i])) { intList.Add(cds[i]); } } } int[] arr = intList.ToArray(); int cardValue = (int)data.GetInt("card"); if (currMahjong == null || currMahjong.MahjongItem.Value != cardValue || mahjongQueryCache.ContainsKey(cardValue)) { return; } mahjongQueryCache.Add(cardValue, FilterCards(arr)); QueryHulistData hulistData = new QueryHulistData((int)MahjongIcon.Flag.Ting, currMahjong.MahjongItem.Value, currMahjong.MahjongItem.MahjongIndex, laizi); hulistData.Cards = mahjongQueryCache[currMahjong.MahjongItem.Value]; if (null != arr || arr.Length > 0) { //任意牌 if (Array.Exists(arr, (a) => { return(a == 0); })) { hulistData.LeaveMahjongCnt = leaveMahjongCnt; } EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); } }
/// <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); }
///// <summary> ///// 将数据加入到战绩中 ///// </summary> ///// <param name="data">传入的数据</param> //public void GetHistoryInfo(ISFSObject data) //{ // //解析人物牌信息 // ISFSArray dataArray = data.GetSFSArray("playerinfo"); // foreach (ISFSObject item in dataArray) // { // int seat = item.GetInt("seat"); // SssPlayer sssUser = main.UserSeatSort[main.ToLocalSeat(seat)]; // if (sssUser.CurSssUserInfo != null) // { // //存入玩家信息 // HistoryUserInfo sssUserInfo = new HistoryUserInfo // { // SssUserInfo = sssUser.CurSssUserInfo, // Seat = seat, // }; // //存入扑克信息 // List<int> cards = new List<int>(); // ISFSArray dunsInfo = item.GetSFSArray("duninfo"); // foreach (ISFSObject dun in dunsInfo) // { // int[] tempArrey = dun.GetIntArray("cards"); // foreach (int card in tempArrey) // { // cards.Add(card); // } // } // //把信息处理完的玩家加入列表 // sssUserInfo.Pokers = cards.ToArray(); // historyInfo.Users.Add(sssUserInfo); // } // } // HistoryList.Add(historyInfo); // if (MaxCount == 0) //如果是0,则不限制个数 // return; // while(HistoryList.Count > MaxCount) // { // HistoryList.Remove(HistoryList[0]); // } //} public void AddHistoryInfo(ISFSObject data) { if (HistoryList == null) { return; } int listCount = HistoryList.Count; if (listCount <= 0) { return; } HistoryItemInfo curItem = HistoryList[listCount - 1]; List <HistoryUserInfo> usersInfo = curItem.Users; if (usersInfo == null || usersInfo.Count == 0) { YxDebug.LogError("HistoryItem init error,the HistoryUserInfo.users is NULL or EMPTY !!!!"); return; } if (data.ContainsKey("st")) { curItem.Time = data.GetLong("st"); } ISFSArray scoreArray = data.GetSFSArray("score"); foreach (ISFSObject scoreItem in scoreArray) { int scoreSeat = scoreItem.GetInt("seat"); for (int i = 0; i < usersInfo.Count; i++) { HistoryUserInfo info = usersInfo[i]; if (info.Seat != scoreSeat) { continue; } info.Score = scoreItem.GetInt("score"); usersInfo[i] = info; //由于是值类型,需要重新赋值 } } HistoryList[HistoryList.Count - 1] = curItem; }
public void SetResult(ISFSObject data) { Win = data.ContainsKey("win") ? data.GetInt("win") : -1; Total = data.ContainsKey("total") ? data.GetLong("total") :-1; WinArea = data.ContainsKey("winArea") ? data.GetInt("winArea") : -1; WinType = data.ContainsKey("winType") ? data.GetInt("winType") : -1; WinValue = data.ContainsKey("WinValue") ? data.GetInt("WinValue") : -1; IsHasLuck = data.ContainsKey("luck") && data.GetBool("luck"); Playerlist = data.ContainsKey("playerlist") ? data.GetSFSArray("playerlist") : null; if (Playerlist != null) { var gdata = App.GetGameData <RbwarGameData>(); gdata.AllUserWinGolds = 0; for (int i = 0; i < Playerlist.Count; i++) { var userData = Playerlist.GetSFSObject(i); var twentyBet = userData.ContainsKey("twentyBet") ? userData.GetInt("twentyBet") : -1; var win = userData.ContainsKey("win") ? userData.GetInt("win") : -1; var ttgold = userData.ContainsKey("ttgold") ? userData.GetLong("ttgold") : -1; var userName = userData.ContainsKey("username") ? userData.GetUtfString("username") : ""; var seat = userData.ContainsKey("seat") ? userData.GetInt("seat") : -1; var twentyWin = userData.ContainsKey("twentyWin") ? userData.GetInt("twentyWin") : -1; var userId = userData.ContainsKey("userid") ? userData.GetInt("userid") : -1; if (win > 0) { gdata.AllUserWinGolds += win; } for (int j = 0; j < gdata.AllUserInfos.Count; j++) { if (seat == gdata.AllUserInfos[j].Seat) { gdata.AllUserInfos[j].TwentyBet = twentyBet; gdata.AllUserInfos[j].WinCoin = win; gdata.AllUserInfos[j].CoinA = ttgold; gdata.AllUserInfos[j].NickM = userName; gdata.AllUserInfos[j].TwentyWin = twentyWin; gdata.AllUserInfos[j].UserId = userId.ToString(); } } } } }
/// <summary> /// 小结算数据处理 /// </summary> /// <param name="data"></param> public void OnGameResult(ISFSObject data) { ResultData = new PludoGameResultData(); ResultData.ResultList = new List <PludoGameResultItemData>(); if (data.ContainsKey(RequestKey.KeyPlayerList)) { var array = data.GetSFSArray(RequestKey.KeyPlayerList); var count = Math.Min(array.Count, SeatTotalCount); for (int i = 0; i < count; i++) { var resultItemData = new PludoGameResultItemData(array.GetSFSObject(i)); var player = GetPlayer <PludoGamePlayer>(resultItemData.ServerSeat, true); if (player) { resultItemData.SetOtherData(player.GetInfo <PludoPlayerInfo>(), ConstantData.ValuePlaneCount, resultItemData.ServerSeat == SelfSeat); player.Coin = resultItemData.TotalGold; player.ReadyState = false; player.GetInfo <PludoPlayerInfo>().IsAuto = false; player.AutoStateChange(false); } ResultData.ResultList.Add(resultItemData); } ResultData.ResultList.Sort((a, b) => { if (a.ScoreNum < b.ScoreNum) { return(1); } else if (a.ScoreNum == b.ScoreNum) { return(0); } else { return(-1); } }); } var svt = 0L; SfsHelper.Parse(data, ConstantData.KeyServerNowTime, ref svt); ResultData.Time = GetNowTime(svt); ResultData.RoomInfo = RoomInfo; CheckAutoState(); }
public void SetNum(ISFSObject responseData) { ISFSArray banbers = responseData.GetSFSArray("bankers"); var gdata = App.GetGameData <BrnnGameData>(); if (banbers == null || banbers.Size() == 0) { gdata.CurrentCanInGold = 0; Num.text = "0"; NumVal = 0; } else { NumVal = Convert.ToInt32((int)gdata.CurrentBanker.Coin / gdata.MaxNiuRate); Num.text = YxUtiles.ReduceNumber(NumVal); gdata.CurrentCanInGold = NumVal; } }
} //end OnViewNotificationsButtonclicked public void ViewMyNotifications(ISFSObject objIn) { //this function will get notifications from server and display it to the member useraccountinfo = objIn.GetSFSArray("Notifications"); Transverser.userinfo = null; Transverser.userinfo = useraccountinfo; //to store notifications Transverser.RoomID = Room_ID; //to store room ID Debug.Log("Display Notifications"); //display form that will show the notifications NotificationForm.gameObject.SetActive(true); //class that will deal with notification form contents ScrollableNotificationsPanel m = new ScrollableNotificationsPanel(); if (display > 0)//to allaw request notification from server each time { m.Start(); } display++; } //end viewMyNotifications
/// <summary> /// 游戏结算 /// </summary> /// <param name="responseData"></param> public void OnGameResult(ISFSObject responseData) { var gdata = App.GetGameData <TtzGameData>(); AnteGameObject.Hide(); RobBank.RobParentCtrl(); Tip.Close(); gdata.Kind = 2; PaiOperate(false); Clock.SetCountDown(0, ShowCards); _tuserData = responseData.GetSFSArray("users"); Tip.T("正在等待结果"); CancelInvoke("ShowCards"); Invoke("Fly2Bank", 3f); }
} //end OnViewFrendsButtonclicked public void ViewMyFriends(ISFSObject objIn) { //this function will get notifications from server and display it to the member Friends = objIn.GetSFSArray("Friends"); Transverser.Friends = null; Transverser.Friends = Friends; //to store friends Transverser.RoomID = Room_ID; //to store user roomID Debug.Log("Display friends"); //display form that will show the Friend friendsForm.gameObject.SetActive(true); //class that will allow user to manage his/her Frinds ScrollableFriendsPanel m = new ScrollableFriendsPanel(); if (display > 0) //to allow request Friends list from server each time { m.Start(); } display++; } //end ViewMyFriends
public void ViewMemberAccount(ISFSObject objIn) { //method to display user account info after it retrieve the info from server ISFSArray useraccountinfo = objIn.GetSFSArray("account");//object that contains all info View_username.text = useraccountinfo.GetSFSObject(0).GetUtfString("username");//display username pass = useraccountinfo.GetSFSObject(0).GetUtfString("password"); View_Password.text = pass;//display password as **** and encrypted ConPassword.text = pass;//display confirm password as **** and encrypted Email.text = useraccountinfo.GetSFSObject(0).GetUtfString("email");//display email FirstName.text = useraccountinfo.GetSFSObject(0).GetUtfString("firstName");//display frstname if (useraccountinfo.GetSFSObject(0).GetUtfString("biography") == null)//display bio Biography.text = ""; else Biography.text = useraccountinfo.GetSFSObject(0).GetUtfString("biography"); LastName.text = useraccountinfo.GetSFSObject(0).GetUtfString("lastName");//display lastname if (useraccountinfo.GetSFSObject(0).GetUtfString("hasRoom").Equals("Y")) ActivateRoom.isOn = true;//turn on room radio button else ActivateRoom.isOn = false;//turn off room radio button previousHasRoom = useraccountinfo.GetSFSObject(0).GetUtfString("hasRoom");//to store value if (useraccountinfo.GetSFSObject(0).GetUtfString("accountType").Equals("private")) AccountType.isOn = true;//turn on account type radio button else AccountType.isOn = false;//turn off account type radio button if (useraccountinfo.GetSFSObject(0).GetUtfString("avatar").Equals("F")) { FAvatar.isOn = true;//turn on female avatar radio button MAvatar.isOn = false;//turn off male avatar radio button } else { MAvatar.isOn = true;//turn on male avatar radio button FAvatar.isOn = false;//turn off female avatar radio button } Email.interactable = false;//disable changing email View_username.interactable = false;//disable changing username }
public override void GroupBet(ISFSObject responseData) { if (!responseData.ContainsKey("coin")) { return; } var sfsArray = responseData.GetSFSArray("coin"); var startPos = ChipCfg.StartPos; Facade.Instance <MusicManager>().Play("groupbet"); var tablePlayerMgr = App.GetGameManager <BrnnGameManager03>().TabelPlayerMgr; var gdata = App.GameData; var selfSeat = gdata.SelfSeat; int maxGold = 0; foreach (ISFSObject item in sfsArray) { int p = item.GetInt("p"); int gold = item.GetInt("gold"); int seat = item.GetInt("seat"); if (seat == selfSeat) { continue; } if (tablePlayerMgr.TableBet(seat, gold, p)) { continue; } if (gold >= maxGold) { maxGold = gold; } if (startPos.Length > 0) { InstantiateChip(p, startPos[0], gold); } } PlayAmazedSoud(maxGold, ref MaxGroupBet); }
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 virtual void GroupBet(ISFSObject responseData) { if (!responseData.ContainsKey("coin")) { return; } var sfsArray = responseData.GetSFSArray("coin"); var startPos = ChipCfg.StartPos; Facade.Instance <MusicManager>().Play("groupbet"); var gdata = App.GameData; var selfSeat = gdata.GetPlayerInfo().Seat; int maxGold = 0; // ReSharper disable once TooWideLocalVariableScope Random random = new Random(); foreach (ISFSObject item in sfsArray) { int p = item.GetInt("p"); int gold = item.GetInt("gold"); int seat = item.GetInt("seat"); if (seat == selfSeat) { continue; } if (gold >= maxGold) { maxGold = gold; } int len = startPos.Length; if (len > 0) { int startIndex = random.Next(0, 100) % len; InstantiateChip(p, startPos[startIndex], gold); } } PlayAmazedSoud(maxGold, ref MaxGroupBet); }
public void SetNum(ISFSObject responseData) { var gdata = App.GetGameData <BtwGameData>(); if (!responseData.ContainsKey("bankers")) { return; } var bankers = responseData.GetSFSArray("bankers"); var b = responseData.GetInt("banker"); YxBaseGameUserInfo info = null; if (b == -1) { info = new YxBaseGameUserInfo { NickM = "系统", CoinA = 1147483647, Seat = -1, TotalCount = 0, WinTotalCoin = 0 }; gdata.BankerPlayer.SetMaxCoin(1147483646); gdata.BankerPlayer.Info = info; _num = 1147483646; Num.text = "∞"; gdata.CurrentCanInGold = _num; return; } if (bankers.Size() == 0) { gdata.CurrentCanInGold = 0; _num = 0; Num.text = "0"; } else if (!gdata.BeginBet || bankers.Size() >= 1) { _num = gdata.BankerPlayer.Coin; Num.text = YxUtiles.ReduceNumber(_num); gdata.CurrentCanInGold = _num; } }
void InitUsersInfo(ISFSObject data) { ISFSArray users = data.GetSFSArray("users"); int index = 0; foreach (ISFSObject user in users) { if (user.GetInt("id") > 0) { SumUsers[index].Init(user); SetLabel(SumLabels[index], user.GetInt("gold")); } ++index; } ScoreGrid.hideInactive = true; ScoreGrid.Reposition(); UserInfoGrid.hideInactive = true; UserInfoGrid.Reposition(); }
/// <summary> /// 响应服务器OnGetGameInfo事件 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public static void OnGetGameInfo(object sender, DdzbaseEventArgs args) { _onGameInfoData = args.IsfObjData; var userSelf = _onGameInfoData.GetSFSObject(RequestKey.KeyUser); UserDic[userSelf.GetInt(RequestKey.KeySeat)] = userSelf; if (!_onGameInfoData.ContainsKey(RequestKey.KeyUserList)) { return; } ISFSArray users = _onGameInfoData.GetSFSArray(RequestKey.KeyUserList); foreach (ISFSObject user in users) { UserDic[user.GetInt(RequestKey.KeySeat)] = user; } //Debug.LogError(UserDic.Count); }
/// <summary> /// 流式下注 /// </summary> public void GetBetDatas(ISFSObject data) { if (data.ContainsKey(ConstantData.KeyCoin)) { var datas = data.GetSFSArray(ConstantData.KeyCoin); var count = datas.Count; var list = new List <BetData>(); for (int i = 0; i < count; i++) { ISFSObject item = datas.GetSFSObject(i); var betData = new BetData(item); if (betData.Seat == SelfSeat) { continue; } list.Add(betData); } FlushBetDatas = list.ToList(); } }
/// <summary> /// 设置总结算数据 /// </summary> public void SetData(ISFSObject data) { string time = DateTime.Now.Year + "." + DateTime.Now.Month + "." + DateTime.Now.Day + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second; Timedatelabel.text = time; SetidAndRoundInfo(); ISFSArray userArray = data.GetSFSArray("users"); DDzUtil.ClearPlayerGrid(GridGob); int maxScore = 0; ResultItem useritem = null; for (int i = 0; i < userArray.Count; i++) { var gob = NGUITools.AddChild(GridGob, ItemsOrgGob); gob.SetActive(true); var resultItem = gob.GetComponent <ResultItem>(); var isfData = userArray.GetSFSObject(i); resultItem.SetUserInfo(isfData); var curScore = isfData.GetInt("gold"); if (curScore != 0 && maxScore <= curScore) { maxScore = curScore; useritem = resultItem; } } //确定大赢家图标 if (useritem != null) { useritem.BigWinner.SetActive(true); } GridGob.GetComponent <UIGrid>().repositionNow = true; }
public override void GroupBet(ISFSObject responseData) { if (!responseData.ContainsKey("coin")) { return; } var sfsArray = responseData.GetSFSArray("coin"); var startPos = ChipCfg.StartPos; Facade.Instance <MusicManager>().Play("groupbet"); var gdata = App.GetGameData <BrttzGameData>(); var selfSeat = gdata.GetPlayerInfo().Seat; var manager = App.GetGameManager <BrttzGameManager>(); int maxGold = 0; // ReSharper disable once TooWideLocalVariableScope foreach (ISFSObject item in sfsArray) { string p = item.GetUtfString("p"); int target = GetInt(p); int gold = item.GetInt("gold"); int seat = item.GetInt("seat"); if (seat == selfSeat) { continue; } if (manager.PlayerManager.TablePlayerBet(seat, gold, target)) { continue; } if (gold >= maxGold) { maxGold = gold; } OtherMenBet(target, gold); } PlayAmazedSoud(maxGold, ref MaxGroupBet); }
private UserRecord[] GetUsersRecord(ISFSObject sfsObject) { ISFSArray tempArr = sfsObject.GetSFSArray("users"); var totalArr = new UserRecord[3]; for (int i = 0; i < tempArr.Count; i++) { var userData = tempArr.GetSFSObject(i); totalArr[i] = new UserRecord { /* SuperBoom = userData.GetInt("sboom"), * Gold = userData.GetInt("gold"), * ThrowOutNum = userData.GetInt("throwout"), * BoomNum = userData.GetInt("boom"), * TotalGold = userData.GetLong("ttscore"), * Score = userData.GetInt("score"), * RocketNum = userData.GetInt("rocket"), * Seat = userData.GetInt("seat"), * Cards = userData.GetIntArray("cards"), * Rate = userData.GetInt("rate"), * Nm = userData.GetInt("nm"), * Dz = userData.GetInt("dz"),*/ SuperBoom = userData.GetInt("sboom"), Gold = userData.GetInt("gold"), ThrowOutNum = userData.GetInt("throwout"), BoomNum = userData.GetInt("boom"), TotalGold = userData.GetLong("ttscore"), Score = userData.GetInt("score"), CardNum = userData.GetInt("cardnum"), RocketNum = userData.GetInt("rocket"), Seat = userData.GetInt("seat"), Ttgold = userData.GetLong("ttgold"), Cards = userData.GetIntArray("cards"), Win = userData.GetBool("win") }; App.GetGameData <GlobalData>().OnUserSocreChanged(userData.GetInt("seat"), userData.GetInt("gold")); } return(totalArr); }
public PludoGameOverItemData(ISFSObject data) { Scores = new List <PludoGameOverScoreItemData>(); if (data == null) { ServerSeat = ConstantData.IntDefValue; return; } SfsHelper.Parse(data, RequestKey.KeySeat, ref ServerSeat); if (data.ContainsKey(ConstantData.KeyRoundInfo)) { var roundInfo = data.GetSFSArray(ConstantData.KeyRoundInfo); var count = roundInfo.Count; for (int i = 0; i < count; i++) { var score = new PludoGameOverScoreItemData(); SfsHelper.Parse(roundInfo.GetSFSObject(i), RequestKey.KeyScore, ref score.ScoreNumber); Scores.Add(score); } } }
public void GetResultPlayerInfo(ISFSObject data) { if (!data.ContainsKey("playerlist")) { return; } var array = data.GetSFSArray("playerlist"); if (array == null || array.Count == 0) { return; } foreach (ISFSObject item in array) { int gold = item.GetInt("win"); if (gold > 0) { AddListInfo(item.GetUtfString("username"), gold, -1); } } }
/// <summary> /// 获得其他玩家的数据信息 /// </summary> /// <param name="data"></param> /// <returns></returns> protected Dictionary <int, ISFSObject> GetOtherUsesDic(ISFSObject data) { if (!data.ContainsKey(RequestKey.KeyUserList)) { throw new Exception("此isfobj data 不能获得玩家其他玩家的数据集合"); } //其他玩家数据集合 var otherUsers = data.GetSFSArray(RequestKey.KeyUserList); //座位号对应ISFSObject var dataDic = new Dictionary <int, ISFSObject>(); foreach (var user in otherUsers) { var isfobj = user as ISFSObject; if (isfobj != null) { dataDic[isfobj.GetInt(RequestKey.KeySeat)] = isfobj; } } return(dataDic); }
private void OnGzyz(object data) { ISFSObject obj = (ISFSObject)data; int chair = obj.GetInt("Chair"); int gold = obj.GetInt("Gold"); bool isWin = obj.GetBool("isWin"); int[] lostList = obj.GetIntArray("LostList"); string uname = obj.GetUtfString("Name"); Players[chair].ResetTimer(); Players[chair].RefreshCoin(); Pk.OnGzyz(uname, new EventDelegate(() => { foreach (var lChair in lostList) { Players[lChair].ShowCardsGray(); if (lChair == 0) { UserContrl.LiangPaiShow(); } } if (!isWin && gold != 0) { Players[chair].ShowMoveGold(-gold); } if (obj.ContainsKey("FanCha")) { ISFSArray arr = obj.GetSFSArray("FanCha"); for (int i = 0; i < arr.Count; i++) { ISFSObject arrObj = arr.GetSFSObject(i); int fChair = arrObj.GetInt("Chair"); Players[fChair].RefreshCoin(); } } })); }
public void OnGetGameResultInfo(ISFSObject gameInfo) { if (!gameObject.activeSelf) { return; } if (!gameInfo.ContainsKey(RequestKey.KeyPlayerList)) { return; } var gdata = App.GetGameData <TexasGameData>(); if (!gdata.IsRoomGame) { return; } _userInfoList.Clear(); ISFSArray userDataArray = gameInfo.GetSFSArray(RequestKey.KeyPlayerList); foreach (ISFSObject userData in userDataArray) { if (!userData.ContainsKey("isGiveUp")) { continue; } int serverSeat = userData.GetInt(RequestKey.KeySeat); var userInfo = gdata.GetPlayerInfo(serverSeat, true); TotalScoreUserInfo ttUserInfo = new TotalScoreUserInfo { TotalScore = userData.GetLong(Variation), ServerSeat = serverSeat, UserName = userInfo.NickM, UserId = userInfo.Id }; _userInfoList.Add(ttUserInfo); } RefreshItems(); SetBgSize(); }
/// <summary> /// 等待Globaldata的信息完成加载刷新以后,在弹出投票界面 /// </summary> /// <returns></returns> private IEnumerator WaitForGlobalDataUpdate(ISFSObject data, string[] ids, int time) { var userSelf = data.GetSFSObject(RequestKey.KeyUser); var userOthers = data.GetSFSArray(RequestKey.KeyUserList); var userIdtoNameDic = new Dictionary <int, string>(); userIdtoNameDic[userSelf.GetInt(RequestKey.KeyId)] = userSelf.GetUtfString(RequestKey.KeyName); foreach (ISFSObject otheruser in userOthers) { userIdtoNameDic[otheruser.GetInt(RequestKey.KeyId)] = otheruser.GetUtfString(RequestKey.KeyName); } //等待globaldata刷新好信息 while (true) { yield return(new WaitForEndOfFrame()); if (App.GetGameData <GlobalData>().GetUsersName().Length == userIdtoNameDic.Count) { break; } } //模拟每次投票的服务器发起信息,来重构投票 var len = ids.Length; for (int i = 0; i < len; i++) { //2发起投票 3同意 -1拒绝 ISFSObject userdata = new SFSObject(); userdata.PutUtfString("username", userIdtoNameDic[int.Parse(ids[i])]); userdata.PutInt("type", i == 0 ? 2 : 3); if (i == 0) { userdata.PutInt("cdTime", time); } var args = new DdzbaseEventArgs(userdata); OnHandUpEvt(null, args); } }
private void InstallItem(ISFSObject data) { if(data.GetBool("success")) mg.getNotificationManager().DisplayWindow("INSTALLED"); gameObject.GetComponent<InventoryManager>().UpdatePlayerInventory(data.GetSFSArray("inventory")); ISFSObject data2 = new SFSObject(); Gateway gtw = gameObject.GetComponent<TextManager>().gtw; data2.PutUtfString("selctedGateway", gtw.getState()); smartFox.Send(new ExtensionRequest("refreshGtw", data2, smartFox.LastJoinedRoom)); }
public void Update(ISFSObject obj) { this.owner = obj.GetUtfString("OWNER"); this.atk = obj.GetInt("ATK"); this.def = obj.GetInt("DEF"); ISFSArray sws = obj.GetSFSArray("SW"); this.sw = new string[3]; this.sw[0] = (string) sws.GetElementAt(0); this.sw[1] = (string) sws.GetElementAt(1); this.sw[2] = (string) sws.GetElementAt(2); }
private void OnResponseGetAssetsInfo(ISFSObject a_infoData) { //assetsinfo if(a_infoData.GetBool(Keys.SUCCESS)) { ISFSArray l_tempSfsArray = a_infoData.GetSFSArray(Keys.ASSETS_INFO); List<AssetsInfo> l_allCurrentInfoList = new List<AssetsInfo>(); for (int indexAssetInfo = 0; indexAssetInfo < l_tempSfsArray.Count; indexAssetInfo++) { AssetsInfo l_temp = new AssetsInfo(); l_temp.AssetID = (int)(l_tempSfsArray.GetSFSObject(indexAssetInfo)).GetLong("assetsid"); l_temp.ImageTargetID = (l_tempSfsArray.GetSFSObject(indexAssetInfo)).GetUtfString("imagetargetid"); l_temp.URL = (l_tempSfsArray.GetSFSObject(indexAssetInfo)).GetUtfString("assetsurl"); l_temp.AssetName = (l_tempSfsArray.GetSFSObject(indexAssetInfo)).GetUtfString("assetname"); l_allCurrentInfoList.Add(l_temp); } GameBaseEvent l_assetsInfoEvent = new GameBaseEvent(eGameEvents.getAssetsInfo.ToString()); GameEventArgs l_eventArg = new GameEventArgs(); l_eventArg.EventData = (object)l_allCurrentInfoList; l_assetsInfoEvent.Args = l_eventArg; dispatchEvent(this, l_assetsInfoEvent); } else { Debug.Log(a_infoData.GetUtfString(Keys.ERROR)); } }
/// <summary> /// Информация о игроках /// </summary> /// <param name="data"></param> void OnPlayersInfo(ISFSObject data) { SetupServerPlayers(data.GetSFSArray("players")); AddServerPlayerToClientPlayer(); }
public void Setup(ISFSObject obj) { particleSystem.renderer.sortingLayerName = "2 Middle Lower UI"; this.gwName = obj.GetUtfString("NAME"); this.state = obj.GetUtfString("STATE"); this.owner = obj.GetUtfString("OWNER"); this.atk = obj.GetInt("ATK"); this.def = obj.GetInt("DEF"); this.type = obj.GetUtfString("TYPE"); ISFSArray sws = obj.GetSFSArray("SW"); this.region = obj.GetUtfString("REGION"); this.sw = new string[3]; this.sw[0] = (string) sws.GetElementAt(0); this.sw[1] = (string) sws.GetElementAt(1); this.sw[2] = (string) sws.GetElementAt(2); mg = GameObject.Find("Manager").GetComponent<Manager>(); gameObject.transform.position = new Vector3((float)obj.GetDouble("X")*mg.getScale().x,(float)obj.GetDouble("Y")*mg.getScale().y,1F); gameObject.transform.localScale = new Vector3(0.25f,0.25f,0.25f); }
// Updating transform of the remote player from server private void HandleTransform(ISFSObject dt) { //Debug.Log("transform!!"); int userId = dt.GetInt("id"); // if (userId != smartFox.MySelf.Id) { // Update transform of the remote user object NetworkTransformReceiver recipient = PlayerManager.Instance.GetRecipient(userId); if (recipient==null) Debug.Log("me mameeeeee"); else Debug.Log("me llegan datos de "+userId); ISFSArray data = dt.GetSFSArray("transform"); //NetworkTransform ntransform = NetworkTransform.FromSFSObject(data); if (recipient!=null) { //recipient.ReceiveTransform(ntransform); recipient.addObject(data); //System.Threading.Thread.Sleep((int)Time.deltaTime); } /*ISFSArray buff = dt.GetSFSArray("transformBuffer"); if (buff == null) Debug.Log("ES NULLLLLLLL - BUFFER"); Debug.Log("SIZE BUFFER: "+buff.Size()); int num = 0; foreach (SFSObject obj in buff){ Debug.Log("Paquete NRO: " + num); num++; NetworkTransform ntransform = NetworkTransform.FromSFSObject(obj); if (recipient!=null) { recipient.addObject(ntransform); } } */ } }
/// <summary> /// Пришла информация о состоянии кружочков /// </summary> /// <param name="data"></param> void OnCirclesInfo(ISFSObject data) { SetupCircles(data.GetSFSArray("circles")); }
private void DisplayEndingStats(ISFSObject data) { GameObject.Find("BlackPanel").GetComponent<SpriteRenderer>().enabled = true; GameObject.Find("EndGameCamera").GetComponent<Camera>().enabled = true; gameEnded = true; Debug.Log("recieved endgame"); string text = ""; for(int i = 0; i < data.Size(); i++){ ISFSArray p = data.GetSFSArray("player"+i); p.GetBool(3);//won string victory = p.GetBool(3)?"VICTORY":"DEFEAT"; text += p.GetUtfString(0)+": "+victory+"\nConquered Gateway: "+p.GetInt(1)+"\nEarned Money: "+p.GetInt(2)+"\n\n"; } GameObject.Find("endStats").GetComponent<UILabel>().text = text; }
private void SetupInventory(ISFSObject data) { gameObject.GetComponent<InventoryManager>().UpdatePlayerInventory(data.GetSFSArray("inventory")); }
private void tracePath(ISFSObject data) { if(lost) { mg.getNotificationManager().DisplayWindow("ACTIONSDISABLED"); return; } ISFSArray path = data.GetSFSArray("hackingPath"); int i = 0; while(i < path.Size()-1) { String startC = (String) path.GetElementAt(i); String targetC =(String) path.GetElementAt(i+1); String[] coord_1 = startC.Split(':'); String[] coord_2 = targetC.Split(':'); Vector3 p0 = new Vector3(float.Parse(coord_1[0]), float.Parse(coord_1[1]), 1F); Vector3 p1 = new Vector3(float.Parse(coord_2[0]), float.Parse(coord_2[1]), 1F); float inclinazioneRay = Mathf.Atan((p1.y-p0.y)/(p1.x-p0.x))*Mathf.Rad2Deg; rotation.eulerAngles = new Vector3(0,0,inclinazioneRay); float distance = Vector3.Distance(p1,p0); rayLenght = distance; Vector3 d0 = new Vector3(-5.8f, 2.2f, 1f); Vector3 d1 = new Vector3(5.3f, 2.5f, 1f); if(!((p0 == d0 && p1 == d1)|| (p1 == d0 && p0 == d1))) { ray = Instantiate(rayPrefab) as GameObject; ray.transform.parent = GameObject.Find("UI").transform; ray.transform.localPosition = new Vector3((p1.x+p0.x)/2,(p1.y+p0.y)/2, 5F); ray.transform.localScale = new Vector2(rayLenght, 0.7F); ray.transform.rotation=rotation; } else { ray = Instantiate(rayPrefab) as GameObject; ray.transform.parent = GameObject.Find("UI").transform; ray.transform.localPosition = new Vector3(6.03F, 2.5F, 5F); ray.transform.localScale = new Vector2(1.18F, 0.7F); ray.transform.rotation=rotation; ray = Instantiate(rayPrefab) as GameObject; ray.transform.parent = GameObject.Find("UI").transform; ray.transform.localPosition = new Vector3(-6.25F, 2.18F, 5F); ray.transform.localScale = new Vector2(0.8F, 0.7F); ray.transform.rotation=rotation; } i++; } }
private void syncBlocks(ISFSObject msg) { var networkBlocks = msg.GetSFSArray("blocks"); for(int i = 0; i < networkBlocks.Size (); i++) { Debug.Log(_blocks[i].name); float[] coordinates = networkBlocks.GetSFSObject(i).GetFloatArray("position"); float[] velocityComponents = networkBlocks.GetSFSObject(i).GetFloatArray("velocity"); _blocks[i].transform.position = new Vector3(coordinates[0], _blocks[i].transform.position.y, coordinates[1]); _blocks[i].rigidbody.velocity = new Vector3(velocityComponents[0], 0, velocityComponents[1]); } }