protected override void ParseData(ISFSObject data) { base.ParseData(data); SfsHelper.Parse(data, ConstantData.KeyColor, ref CurColor); SfsHelper.Parse(data, ConstantData.KeyMapId, ref _dataId); SfsHelper.Parse(data, ConstantData.KeyMapType, ref _itemType); }
public override void Parse(ISFSObject userData) { base.Parse(userData); RollDiceData = new RollDiceData(); SfsHelper.Parse(userData, ConstantData.KeyPlayerStatus, ref _status); SfsHelper.Parse(userData, ConstantData.KeyColor, ref _playerColor); SfsHelper.Parse(userData, ConstantData.KeyControlDiceTime, ref _controlDiceTime); if (userData.ContainsKey(ConstantData.KeyPlaneInfo)) { var array = userData.GetSFSArray(ConstantData.KeyPlaneInfo); SetPlanesInfo(array); } if (userData.ContainsKey(ConstantData.KeyAuto)) { SfsHelper.Parse(userData, ConstantData.KeyAuto, ref IsAuto); } if (userData.ContainsKey(ConstantData.KeyChoosePlane)) { var planes = userData.GetIntArray(ConstantData.KeyChoosePlane); RollDiceData.OneMoreTime = false; RollDiceData.PlaneIds = planes.ToList(); YxDebug.LogError("可以选择的飞机数量是:" + planes.Length); foreach (var id in planes) { YxDebug.LogError(id); } RollDiceData.QuickModel = true; } }
protected override void ParseData(ISFSObject data) { base.ParseData(data); SfsHelper.Parse(data, RequestKey.KeyId, ref _id); SfsHelper.Parse(data, ConstantData.KeyPlaneStatus, ref _planeStatus); PlaneStateChange(_planeStatus); MovePath = new List <int>(); StartFitList = new List <int>(); if (data.ContainsKey(ConstantData.KeyMovePath)) { var path = data.GetSFSArray(ConstantData.KeyMovePath); for (int i = 0; i < path.Count; i++) { MovePath.Add(path.GetInt(i)); } } if (data.ContainsKey(ConstantData.KeyFitList)) { var fitList = data.GetSFSArray(ConstantData.KeyFitList); for (int i = 0; i < fitList.Count; i++) { StartFitList.Add(fitList.GetInt(i)); } } if (data.ContainsKey(ConstantData.KeyLocalPosition)) { SfsHelper.Parse(data, ConstantData.KeyLocalPosition, ref _localPosition); } }
/// <summary> /// 选择飞机消息数据处理 /// </summary> /// <param name="data"></param> public void OnChoosePlane(ISFSObject data) { ChooseResult = new ChoosePlaneResult(); if (data.ContainsKey(ConstantData.KeyChangeInfo)) { var infoArray = data.GetSFSArray(ConstantData.KeyChangeInfo); var count = infoArray.Count; ChooseResult.PlaneDataDic = new Dictionary <int, Dictionary <int, PludoPlaneData> >(); for (int i = 0; i < count; i++) { var dataItem = infoArray.GetSFSObject(i); var seat = dataItem.GetInt(RequestKey.KeySeat); var playerColor = GetPlayerInfo <PludoPlayerInfo>(seat, true).PlayerColor; var planeDic = new Dictionary <int, PludoPlaneData>(); for (int j = 0; j < ConstantData.ValuePlaneCount; j++) { if (dataItem.ContainsKey(j.ToString())) { var jData = dataItem.GetSFSObject(j.ToString()); var planeData = new PludoPlaneData(jData, playerColor); planeDic.Add(planeData.DataId, planeData); } } ChooseResult.PlaneDataDic.Add(seat, planeDic); } } SfsHelper.Parse(data, ConstantData.KeyCurrentPlayer, ref ChooseResult.OperationSeat); SfsHelper.Parse(data, ConstantData.KeyPlaneId, ref ChooseResult.OperationPlaneId); }
/// <summary> /// 投票数据 /// </summary> /// <param name="data"></param> public void OnGetHandUpDataInGame(ISFSObject data) { var type = 0; var id = 0; SfsHelper.Parse(data, RequestKey.KeyType, ref type); SfsHelper.Parse(data, RequestKey.KeyId, ref id); switch ((HandUpStatus)type) { case HandUpStatus.Start: StarHandData(new[] { id.ToString() }, HandUpTime); break; case HandUpStatus.Agree: case HandUpStatus.DisAgree: if (HandData.HandUpDic.ContainsKey(id.ToString())) { var itemData = HandData.HandUpDic[id.ToString()]; if (itemData != null) { itemData.SetHandState(type); Facade.EventCenter.DispatchEvent(LoaclRequest.HandUpLocalMessage, itemData); } } else { Debug.LogError("未找到本地投票数据!!!id 为:" + id); } break; } }
/// <summary> /// 获取大结算数据 /// </summary> /// <param name="data"></param> public void OnGetGameOverData(ISFSObject data) { OverData = new PludoGameOverData(); var winnner = 0; SfsHelper.Parse(data, ConstantData.KeyWinner, ref winnner); OverData.OverDatas = new List <PludoGameOverItemData>(); if (data.ContainsKey(RequestKey.KeyUserList)) { var array = data.GetSFSArray(RequestKey.KeyUserList); var count = Math.Min(array.Count, SeatTotalCount); for (int i = 0; i < count; i++) { var overInfo = new PludoGameOverItemData(array.GetSFSObject(i)); var playerInfo = GetPlayerInfo <PludoPlayerInfo>(overInfo.ServerSeat, true); overInfo.RelatePlayerInfo(playerInfo, RoomInfo.OwnerId); OverData.OverDatas.Add(overInfo); } } else { for (int i = 0; i < SeatTotalCount; i++) { var playerInfo = GetPlayerInfo <PludoPlayerInfo>(i, true); var overInfo = new PludoGameOverItemData(null); overInfo.RelatePlayerInfo(playerInfo, RoomInfo.OwnerId); OverData.OverDatas.Add(overInfo); } } OverData.RoomInfo = RoomInfo; var svt = 0L; SfsHelper.Parse(data, ConstantData.KeyServerNowTime, ref svt); OverData.Time = GetNowTime(svt); }
/// <summary> /// 获取其它信息 /// </summary> private void GetOtherInfo(ISFSObject data) { var consumeNum = 0; SfsHelper.Parse(data, ConstantData.KeyControlPointConsume, ref consumeNum); ControlPointConsume = consumeNum; CheckAutoState(); Facade.EventCenter.DispatchEvent(LoaclRequest.SettingInfoChange, SettingInfo); }
/// <summary> /// 遥控骰子失败交互 /// </summary> /// <param name="data"></param> private void ControlDicResult(ISFSObject data) { if (data.ContainsKey(RequestKey.KeyMessage)) { string errmeg = ""; SfsHelper.Parse(data, RequestKey.KeyMessage, ref errmeg); YxMessageTip.Show(errmeg); GameData.MainUser.OnControlDiceFail(); } }
/// <summary> /// 托管状态变化 /// </summary> /// <param name="data"></param> public void OnAutoStateChange(ISFSObject data) { bool tuoGuan = false; int seat = ConstantData.IntValue; SfsHelper.Parse(data, ConstantData.KeyAuto, ref tuoGuan); SfsHelper.Parse(data, RequestKey.KeySeat, ref seat); GetPlayer <PludoGamePlayer>(seat, true).AutoStateChange(tuoGuan); CheckAutoState(); }
public PludoGameResultItemData(ISFSObject data) { SfsHelper.Parse(data, RequestKey.KeySeat, ref ServerSeat); SfsHelper.Parse(data, RequestKey.KeyScore, ref ScoreNum); SfsHelper.Parse(data, ConstantData.KeyAttackNum, ref AttackNum); SfsHelper.Parse(data, ConstantData.KeyBeAttackNum, ref BeAttackNum); SfsHelper.Parse(data, ConstantData.KeyFinishNum, ref FinishNum); SfsHelper.Parse(data, RequestKey.KeyTotalGold, ref TotalGold); IsZero = FinishNum == ConstantData.IntValue; }
/// <summary> /// 设置当前玩家 /// </summary> /// <param name="data"></param> public void SetCurPlayer(ISFSObject data) { var curOpSeat = ConstantData.IntDefValue; SfsHelper.Parse(data, ConstantData.KeyCurrentPlayer, ref curOpSeat); CurOpUser = GetPlayer <PludoGamePlayer>(curOpSeat, true); if (data.ContainsKey(ConstantData.KeyControlDiceTime)) { var canuseTime = ConstantData.IntDefValue; SfsHelper.Parse(data, ConstantData.KeyControlDiceTime, ref canuseTime); CurUserInfo.SetControlDiceTime(canuseTime); } }
/// <summary> /// 获得重连投票数据 /// </summary> /// <param name="data"></param> public void GetHandUpDataRejoin(ISFSObject data) { if (data.ContainsKey(ConstantData.KeyHandsUp)) { var hup = ""; long svt = 0; long hst = 0; SfsHelper.Parse(data, ConstantData.KeyHandsUp, ref hup); SfsHelper.Parse(data, ConstantData.KeyServerNowTime, ref svt); SfsHelper.Parse(data, ConstantData.KeyHupStartTime, ref hst); var haveTime = HandUpTime - (svt - hst); haveTime = Math.Max(ConstantData.IntValue, haveTime); string[] ids = hup.Split(ConstantData.KeyHupSpliteFlag); StarHandData(ids, haveTime); } }
/// <summary> /// 获取当前操作信息(重连使用) /// </summary> /// <param name="data"></param> public void GetOperation(ISFSObject data) { long svt = 0; long st = 0; SfsHelper.Parse(data, ConstantData.KeyServerNowTime, ref svt); SfsHelper.Parse(data, ConstantData.KeyStateStartTime, ref st); var finish = svt - st; SetCurPlayer(data); var point = ConstantData.IntDefValue; SfsHelper.Parse(data, ConstantData.KeyRollPoint, ref point); CurUserInfo.RollDiceData.ShowPoint = point; CurUserInfo.SetStateTime(finish); }
/// <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 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); } } }
/// <summary> /// 解析打骰子结果 /// </summary> /// <param name="data"></param> private void ParseRollResult(ISFSObject data) { var point = ConstantData.IntDefValue; var more = false; var useControl = false; var cashCount = ConstantData.IntDefValue; SfsHelper.Parse(data, ConstantData.KeyMoreTime, ref more); SfsHelper.Parse(data, ConstantData.KeyRollPoint, ref point); SfsHelper.Parse(data, ConstantData.KeyCash, ref cashCount); SfsHelper.Parse(data, ConstantData.KeyUseControlDice, ref useControl); var list = new List <int>(); if (data.ContainsKey(ConstantData.KeyChoosePlane)) { var planes = data.GetIntArray(ConstantData.KeyChoosePlane); YxDebug.LogError("可以选择的飞机数量是:" + planes.Length); foreach (var id in planes) { YxDebug.LogError(id); } list.AddRange(planes); } CurUserInfo.RollDiceData = new RollDiceData() { QuickModel = false, OneMoreTime = more, ShowPoint = point, PlaneIds = list.ToList(), UseControlDice = useControl, HaveCashNum = cashCount, Sex = CurUserInfo.SexI, ShowAni = CurUserInfo.Seat == SelfSeat, CostCashNum = ControlPointConsume }; }
public override void InitCfg(ISFSObject cargs2) { base.InitCfg(cargs2); var baseUp = ""; if (SfsHelper.Parse(cargs2, "-baseUp", ref baseUp))//上分倍数 { int upScore; if (int.TryParse(baseUp, out upScore)) { BaseUpperScore = upScore; } } var needUpStr = ""; if (SfsHelper.Parse(cargs2, "-needUpCoin", ref needUpStr)) { bool needUpCoin; if (bool.TryParse(needUpStr, out needUpCoin)) { NeedUpperScore = needUpCoin; } } }
private void Parse(ISFSObject data) { SfsHelper.Parse(data, ConstantData.KeyRoomType, ref _roomType); SfsHelper.Parse(data, ConstantData.KeyRule, ref _rule); }