/// <summary> /// 更新游戏排行榜数据 /// </summary> /// <param name="_ms"></param> public bool UpdateGameRankingData(UMessage _ms) { CCustomDialog.CloseCustomWaitUI(); RightChessScrolllRect.vertical = true; byte State = _ms.ReadByte(); if (State != 0) { Debug.Log("比赛排行榜数据错误!错误码:" + State); return(false); } SerializableDictionary <int, CPlayerRankingInfo> GameRankingDataDictionary = null; long ContestID = _ms.ReadLong(); if (!ContestRankingDataDictionary.ContainsKey(ContestID)) { ContestRankingDataDictionary.Add(ContestID, new SerializableDictionary <int, CPlayerRankingInfo>()); } GameRankingDataDictionary = ContestRankingDataDictionary[ContestID]; ushort StartIndex = _ms.ReaduShort(); byte DataNum = _ms.ReadByte(); ushort EndIndex = (ushort)(StartIndex + DataNum - 1); CPlayerRankingInfo PlayerRankingInfo = null; for (int index = 0; index < DataNum; ++index) { PlayerRankingInfo = new CPlayerRankingInfo(); PlayerRankingInfo.PlayerName = _ms.ReadString(); PlayerRankingInfo.PlayerIconUrl = _ms.ReadString(); PlayerRankingInfo.PlayerFaceID = _ms.ReadInt(); PlayerRankingInfo.PlayerScore = _ms.ReadInt(); PlayerRankingInfo.PlayerOppScore = _ms.ReadInt(); PlayerRankingInfo.ShengJuValue = _ms.ReadByte(); PlayerRankingInfo.ZhiShengValue = _ms.ReadByte(); PlayerRankingInfo.HouShouValue = _ms.ReadByte(); int RankIndex = StartIndex + index; if (GameRankingDataDictionary.ContainsKey(RankIndex)) { GameRankingDataDictionary[RankIndex] = PlayerRankingInfo; } else { GameRankingDataDictionary.Add(RankIndex, PlayerRankingInfo); } } if (m_ContestID == ContestID) { RefreshGameContestRankingPlayerPanel(StartIndex, EndIndex); } return(true); }
/// <summary> /// 登陆失败返回消息处理 /// </summary> /// <param name="_msgType"></param> /// <param name="_ms"></param> /// <returns></returns> private bool LoginFailed(uint _msgType, UMessage _ms) { CCustomDialog.CloseCustomWaitUI(); byte errState = _ms.ReadByte(); switch (errState) { //app版本不符 case 1: { CCustomDialog.OpenCustomConfirmUI(1019); } break; } return(true); }
/// <summary> /// 保存金钱排行榜的数据 /// </summary> bool BackUpdateCoinRank(uint _msgType, UMessage _ms) { //m_lstCoinRank.Clear(); //int nSize = _ms.ReadInt(); short nBeginSign = _ms.ReadShort(); short nSize = _ms.ReadShort(); if (nBeginSign == 0) { m_lstCoinRank.Clear(); } for (int i = 0; i < nSize; i++) { strCoinRank nRank = new strCoinRank(); nRank.nUseID = _ms.ReadUInt(); nRank.faceid = _ms.ReadUInt(); nRank.url = _ms.ReadString(); nRank.nCoin = _ms.ReadLong(); nRank.sNickName = _ms.ReadString(); m_lstCoinRank.Add(nRank); Debug.Log("Add coin rank data!Index:" + i.ToString() + " Name:" + nRank.sNickName + " Coin:" + nRank.nCoin.ToString()); } if (nBeginSign == -1) { CCustomDialog.CloseCustomWaitUI(); if (m_iCoinRankState == 2) { FillCoinRankData(); } else { m_iCoinRankState = 3; } } else { nBeginSign += nSize; SendGetCoinRankData(nBeginSign); } return(true); }
bool BackReqConnIdForWxQR(uint _msgType, UMessage _ms) { uint connId = _ms.ReadUInt(); uint GateLoginConnId = _ms.ReadUInt(); CCustomDialog.CloseCustomWaitUI(); //申请微信登录扫描登录二维码 //string QRCodeurl = CWechatUserAuth.GetInstance().ReqBuildAuthQRcode(connId, GateLoginConnId); //if (CanvasObj == null) // CanvasObj = GameObject.Find("Canvas/Root"); //GameObject QRCodePanel = CanvasObj.transform.FindChild("Login").FindChild("ImageQRcode").gameObject; //QRCodePanel.SetActive(true); //WebBrowser2D browser = QRCodePanel.transform.FindChild("ImageIcon").GetComponent<WebBrowser2D >(); //browser.OnNavigate(QRCodeurl); return(true); }
/// <summary> /// 处理兑换记录数据消息 /// </summary> private bool HandleExchangeRecordDataMsg(uint msgType, UMessage umsg) { CCustomDialog.CloseCustomWaitUI(); uint playerid = umsg.ReadUInt(); int recordcount = umsg.ReadInt(); for (int i = 0; i < recordcount; i++) { string orderid = umsg.ReadString(); byte orderstate = umsg.ReadByte(); uint itemid = umsg.ReadUInt(); AddExchangeRecordData(orderid, itemid, orderstate); } UpdateExchangeRecordData(); return(true); }
public void OnEnd(long diamond = 0) { if (RoomTfm == null) { return; } GameMain.hall_.GameBaseObj.OnDisconnect(false); ShowTable(false); m_bMoving = true; RoomTfm.gameObject.SetActive(true); if (diamond == 0) { diamond = GameMain.hall_.GetPlayerData().GetDiamond(); } UpdateDiamond(diamond); CustomAudio.GetInstance().PlayCustomAudio(1001, true); CCustomDialog.CloseCustomWaitUI(); m_nBystanderRoom = 0; }
/// <summary> /// 玩家购买结果消息处理 /// </summary> /// <param name="msgType"></param> /// <param name="umsg"></param> /// <returns></returns> private bool PlayerBuyResultHandle(uint msgType, UMessage umsg) { uint playerid = umsg.ReadUInt(); if (playerid == GetPlayerId()) { bBuyingProcess = false; uint itemid = umsg.ReadUInt(); byte buystate = umsg.ReadByte(); ShopItemdata itemdata = CCsvDataManager.Instance.ShopItemDataMgr.GetShopItemData(itemid); if (itemdata == null) { return(false); } //购买钻石时由支付平台返回值处理关闭等待框 //if(itemdata.ItemType != Shop.ITEMTYPE.ITEMTYPE_DIAMOND) CCustomDialog.CloseCustomWaitUI(); #if UKGAME_SDK CCustomDialog.CloseCustomWaitUI(); #endif #if UNITY_EDITOR || WINDOWS_GUEST //编辑器模式下购买钻石没有支付平台返回结果 if (itemdata.ItemType == Shop.ITEMTYPE.ITEMTYPE_DIAMOND) { CCustomDialog.CloseCustomWaitUI(); } #endif if (buystate == 0) { //京东卡和手机充值 if (itemdata.ItemType == Shop.ITEMTYPE.ITEMTYPE_JINGDONG || itemdata.ItemType == Shop.ITEMTYPE.ITEMTYPE_MOBILE || itemdata.ItemType == Shop.ITEMTYPE.ITEMTYPE_GOODS) { string tradeNoId = umsg.ReadString(); Bag.GetBagInstance().AddExchangeRecordData(tradeNoId, itemid, 0); Bag.GetBagInstance().SetItemInfoPanelActive(false); CCustomDialog.OpenCustomConfirmUIWithFormatParam(1113, itemdata.ItemName); } else { //GameMain.hall_.shop.OpenBuyResultDialogUI(itemdata.ItemIcon, itemdata.ItemType, itemdata.ItemNum + itemdata.PresentItemNum, 1101); //GameMain.hall_.gift.ShowBuyItemIcon((int)itemdata.ItemID); } } else { uint tipsID = 0; //0表示成功 ,1验证不通过,2购买所需的货币不足,3商品库存不足 switch (buystate) { case 1: tipsID = 1104; break; case 2: { if (itemdata.CurrencyType == Shop.CURRENCYTYPE.CURRENCYTYPE_DIAMOND) { tipsID = 1102; } else if (itemdata.CurrencyType == Shop.CURRENCYTYPE.CURRENCYTYPE_LOTTERY) { tipsID = 1103; } else if (itemdata.CurrencyType == Shop.CURRENCYTYPE.CURRENCYTYPE_GOODS) { tipsID = 1114; } } break; case 3: tipsID = 1105; break; } CCustomDialog.OpenCustomConfirmUI(tipsID); } } return(true); }
//处理商店购买失败(非玩家原因) public static void BuyEnd() { GameMain.hall_.GetPlayer().bBuyingProcess = false; CCustomDialog.CloseCustomWaitUI(); }
bool HandleEnterDesk(uint _msgType, UMessage _ms) { if (m_nDeskNum == 0) { return(false); } CCustomDialog.CloseCustomWaitUI(); byte state = _ms.ReadByte(); if (state > 0) { if (state == 7) { //int coin = _ms.ReadInt(); CCustomDialog.OpenCustomConfirmUI(1652); } else if (state == 8)//进入旁观 { m_nBystanderRoom = _ms.ReadUInt(); GameMain.hall_.GameBaseObj.StartLoad(); } else { uint code = 2005; if (state == 6) { code = 1704; } CCustomDialog.OpenCustomConfirmUI(code); } return(false); } Dictionary <byte, AppointmentRecordPlayer> players = new Dictionary <byte, AppointmentRecordPlayer>(); AppointmentRecordPlayer player; byte num = _ms.ReadByte(); for (int i = 0; i < num; i++) { player = new AppointmentRecordPlayer(); byte sit = _ms.ReadByte(); player.playerid = _ms.ReadUInt(); player.faceid = _ms.ReadInt(); player.url = _ms.ReadString(); player.coin = _ms.ReadLong(); player.playerName = _ms.ReadString(); player.master = _ms.ReadSingle(); player.sex = _ms.ReadByte(); player.ready = _ms.ReadByte(); players[sit] = player; } byte roomId = _ms.ReadByte(); uint deskId = _ms.ReadUInt(); ShowTable(true, players, roomId, deskId); GameMain.hall_.GameBaseObj.StartLoad(); return(true); }
bool HandleGameNetMsg(uint _msgType, UMessage _ms) { if (m_nDeskNum == 0) { return(false); } GameCity.EMSG_ENUM eMsg = (GameCity.EMSG_ENUM)_msgType; switch (eMsg) { case GameCity.EMSG_ENUM.CrazyCityMsg_SM_UPDATEENTERROOMANDSITTOREADYALL: { byte sit = _ms.ReadByte(); uint userId = _ms.ReadUInt(); int faceId = _ms.ReadInt(); string url = _ms.ReadString(); string name = _ms.ReadString(); ushort desk = _ms.ReaduShort(); m_dictIndexDesks[desk].ShowPlayer(sit, true, name, url, userId, faceId); } break; case GameCity.EMSG_ENUM.CrazyCityMsg_SM_APPLYLEAVEROOMANDSIT: { sbyte state = _ms.ReadSByte(); if (state == 0) { long diamond = _ms.ReadLong(); OnEnd(diamond); } else { CCustomDialog.CloseCustomWaitUI(); CCustomDialog.OpenCustomConfirmUI(2206); } } break; case GameCity.EMSG_ENUM.CrazyCityMsg_SM_UPDATELEAVEROOMANDSIT: { byte sit = _ms.ReadByte(); uint userId = _ms.ReadUInt(); string name = _ms.ReadString(); if (sit < m_ChairList.Count) { m_ChairList[sit].Show(false); } } break; case GameCity.EMSG_ENUM.CrazyCityMsg_SM_UPDATELEAVEROOMANDSITTOREADYALL: { byte sit = _ms.ReadByte(); uint deskId = _ms.ReadByte(); m_dictIndexDesks[deskId].ShowPlayer(sit, false); } break; case GameCity.EMSG_ENUM.CrazyCityMsg_SM_APPLYREADY: { byte state = _ms.ReadByte(); if (state == 0) { byte sit = _ms.ReadByte(); if (sit < m_ChairList.Count) { m_ChairList[sit].SetReady(true); } ShowKickTip(false); } else { TableTfm.Find("bottom/Button_Ready").GetComponent <Button>().interactable = true; } } break; case GameCity.EMSG_ENUM.CrazyCityMsg_SM_UPDATEAPPLYREADY: { byte sit = _ms.ReadByte(); if (sit < m_ChairList.Count) { m_ChairList[sit].SetReady(true); } } break; case GameCity.EMSG_ENUM.CrazyCityMsg_SM_KICKOUTROOM: { byte state = _ms.ReadByte(); //1 长时间不点准备 2 不够入场钱 3 不够台费 uint tipsID = 2601; switch (state) { case 1: tipsID = 1647; break; case 2: tipsID = 1652; break; case 3: tipsID = 1664; break; } CCustomDialog.CloseCustomWaitUI(); CCustomDialog.OpenCustomConfirmUI(tipsID, (obj) => { OnEnd(); }); } break; case GameCity.EMSG_ENUM.CrazyCityMsg_UPDATERECHARGETOROOMSER: { uint userId = _ms.ReadUInt(); uint diamond = _ms.ReadUInt(); UpdateDiamond(diamond); } break; default: break; } return(true); }
/// <summary> /// 登陆成功处理 /// </summary> /// <param name="_msgType"></param> /// <param name="_ms"></param> /// <returns></returns> bool LoginSuccess(uint _msgType, UMessage _ms) { PlayerData playerdata = GameMain.hall_.GetPlayerData(); uint lastLoginPlayerId = playerdata.GetPlayerID(); playerdata.ReadPlayerData(_ms, ref CRankUI.Instance.m_fLeftCoinRankTime); //检测是否切换角色了 if (lastLoginPlayerId != 0 && lastLoginPlayerId != playerdata.GetPlayerID()) { } GameMain.hall_.IntelentType = Application.internetReachability; WriteAccountConfig(); //GameMain.hall_.SendGetCoinRankData(); //m_bIsSendMobileNum = false; CCustomDialog.CloseCustomWaitUI(); GameMain.hall_.AfterLogin(); #if ScFish GameMain.hall_.OnClickRoomIconBtn((byte)GameKind_Enum.GameKind_Fishing, 1); return(true); #endif //GameMain.hall_.LoadHallResource(); if (playerdata.nGameMode_Before >= 0) { Debug.Log("断线重连GameId:" + playerdata.nGameKind_Before + ",GameMode:" + playerdata.nGameMode_Before); string strSign = string.Empty; GameKind_Enum CurbeforeGameKind = (GameKind_Enum)playerdata.nGameKind_Before; if (playerdata.nGameMode_Before == 0) { CurbeforeGameKind = (GameKind_Enum)(Mathf.Log(playerdata.nGameKind_Before, 2)); for (GameKind_Enum gameKind = GameKind_Enum.GameKind_CarPort; gameKind < GameKind_Enum.GameKind_Max; ++gameKind) { if (gameKind != GameKind_Enum.GameKind_LandLords && gameKind != GameKind_Enum.GameKind_Mahjong && gameKind != GameKind_Enum.GameKind_GuanDan && gameKind != GameKind_Enum.GameKind_YcMahjong && gameKind != GameKind_Enum.GameKind_CzMahjong && gameKind != GameKind_Enum.GameKind_GouJi && gameKind != GameKind_Enum.GameKind_HongZhong && gameKind != GameKind_Enum.GameKind_Answer && gameKind != GameKind_Enum.GameKind_Chess) { if (GameKind.HasFlag((int)gameKind, (int)playerdata.nGameKind_Before)) { GameData gamedata = CCsvDataManager.Instance.GameDataMgr.GetGameData((byte)CurbeforeGameKind); if (gamedata != null) { strSign += gamedata.GameName; } else { strSign += "未知游戏"; } } } } } if (!string.IsNullOrEmpty(strSign)) { CCustomDialog.OpenCustomWaitUI(2014, strSign); } else { if (GameMain.hall_.contestui_) { GameMain.hall_.contestui_.SetActive(false); } GameMain.hall_.ReconnectLoadGame(CurbeforeGameKind, (GameTye_Enum)playerdata.nGameMode_Before); } } else { if (Application.platform == RuntimePlatform.Android) { #if UNITY_ANDROID && !UNITY_EDITOR AlipayWeChatPay.GetAndroidActivity().Call("GetGameRoomID"); #endif } } GameMain.hall_.ReconnectGameServer(); UMessage activemsg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_GETTODAYREDBAGINFO); activemsg.Add(GameMain.hall_.GetPlayerId()); NetWorkClient.GetInstance().SendMsg(activemsg); BagDataManager.GetBagDataInstance(); if (GameMain.hall_.GetPlayerData().itemNumber > 0) { UMessage bagmsg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_REQUESTPLAYERPACKETINFO); bagmsg.Add(GameMain.hall_.GetPlayerId()); NetWorkClient.GetInstance().SendMsg(bagmsg); } PlayerInfoUI.Instance.Ask4PlayerTotalData(); return(true); }