public void OnClickPlayCard() { if (m_selectedCard == null) { Toast.instance.Show("必须选择一张卡牌!"); return; } if (m_selectedCard.type == CardType.ForOneTarget && m_selectedPlayer == null) { Toast.instance.Show("请选择一个玩家作为释放对象!"); return; } //当你手上有太阳航站或火星航站时,必须弃置水星航站。 if (mainPlayer.data.handCards.Any(a => a.tableID == 9) && mainPlayer.data.handCards.Any(a => a.tableID == 6 || a.tableID == 7) && m_selectedCard.tableID != 9) { Toast.instance.Show("当你手上有太阳航站或火星航站时,必须弃置水星航站。"); return; } if (m_selectedCard.tableID == 5 && m_guessCardID <= 0) { Toast.instance.Show("请选择一张猜测的卡牌!"); guessPanel.Show(); return; } GF.GetProxy <SosProxy>().PlayCard(m_selectedCard.id , m_selectedPlayer == null ? 0 : m_selectedPlayer.id , m_guessCardID <= 0 ? 0 : m_guessCardID); }
private void SendReconnect() { CBReconnectRequest msg = new CBReconnectRequest(); msg.SessionID = "";//TODO:LAST SESSION ID msg.Token = serverInfo.Token; SendMessage <CBReconnectRequest, CBReconnectReply>(msg, (rep) => { if (rep.RoomState == (int)RoomData.State.Dismiss) { room.SetState(0, rep.RoomState, 0); MessageBox.Show("房间已解散", "点击确认,退出房间!", MessageBoxStyle.OK, (res) => { GF.GetProxy <HallProxy>().CancelReconnect(1, 1); GF.ChangeState <HallState>(); }); return; } Reset(); isLogin = true; room.SetData(rep.RoomInfo); room.SetCards(rep.Cards); room.SetPlayers(rep.PlayerInfos); room.SetState(rep.WhoseTurn, rep.RoomState, rep.LeftCardCount); SendEvent(EventDef.SOS.Reconnected); }); }
public void SetData(Message.BattleResultPlayerInfo info) { var room = GF.GetProxy <SosProxy>().room; var player = room.GetPlayer(info.PlayrID); playerName.text = player.numTag; if (info.State == (int)PlayerData.State.Out) { emptyObj.SetActive(false); card.gameObject.SetActive(false); outObj.SetActive(true); } else { outObj.SetActive(false); if (info.Cards.Count <= 0) { card.gameObject.SetActive(false); emptyObj.SetActive(true); } else { emptyObj.SetActive(false); card.gameObject.SetActive(true); var cardData = room.GetCard(info.Cards[0]); card.SetData(cardData); } } }
public void OnClickSendMessage() { if (!string.IsNullOrEmpty(chatInput.text)) { GF.GetProxy <SosProxy>().SendChatMessage(chatInput.text); chatInput.text = ""; } }
public override void Leave() { GF.GetProxy <SosProxy>().Close(); if (UIManager.instance.GetView <BattleView>() != null) { UIManager.instance.Unload <BattleView>(); UIManager.instance.CloseAll(); } }
void OnClickExit() { if (roomData.state != Data.SOS.RoomData.State.End) { Toast.instance.Show("当前状态不能退出房间"); return; } GF.GetProxy <SosProxy>().Close(); GF.ChangeState <HallState>(); }
void OnClickBattle() { if (!m_isMatching) { GF.GetProxy <HallProxy>().BeginMatch(1, 1); } else { GF.GetProxy <HallProxy>().CancelMatch(); } }
public override void Leave() { if (GF.GetProxy <SosProxy>().room.state == Data.SOS.RoomData.State.Dismiss) { GF.GetProxy <SosProxy>().Close(); if (UIManager.instance.GetView <BattleView>() != null) { UIManager.instance.Unload <BattleView>(); UIManager.instance.CloseAll(); } } }
private void Connect() { GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_WAIT_RESPONSE, 50)); if (GF.GetProxy <HallProxy>().needReconnectBattle) { GF.GetProxy <SosProxy>().Reconnect(); } else { GF.GetProxy <SosProxy>().Connect(); } }
private void RefreshUI() { if (!isActiveAndEnabled) { return; } matching.SetActive(m_isMatching); var data = GF.GetProxy <HallProxy>().playerData; gold.text = "金币: {0}".FormatStr(data.gold); level.text = "等级: {0}".FormatStr(data.level); exp.text = "经验值: {0}/{1}".FormatStr(data.exp, data.levelUpExp); }
public override void Update() { if (!m_lastConnected && GF.GetProxy <SosProxy>().isConnected) { GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_WAIT_LOGIN, 70)); } m_lastConnected = GF.GetProxy <SosProxy>().isConnected; if (!m_lastLogin && GF.GetProxy <SosProxy>().isLogin) { GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.GENRAL_START, 98)); Task.WaitFor(1f, () => { GF.ChangeState <BattleState>(); }); } m_lastLogin = GF.GetProxy <SosProxy>().isLogin; }
private void Connect() { GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_WAIT_RESPONSE, 50)); GF.GetProxy <HallProxy>().Connect(); Task.WaitFor(3f, () => { if (!GF.GetProxy <HallProxy>().isConnected) { MessageBox.Show("连接失败", "连接服务器失败,是否重新连接?", MessageBoxStyle.OKClose , (result) => { if (result.result == MessageBoxResultType.OK) { Connect(); } }); } }); }
public void Connect() { m_needReconnnect = false; network.Connect(); Task.WaitFor(3f, () => { if (!GF.GetProxy <HallProxy>().isConnected) { MessageBox.Show("连接失败", "连接服务器失败,是否重新连接?", MessageBoxStyle.OKClose , (result) => { if (result.result == MessageBoxResultType.OK) { Connect(); } }); } }); }
private void Connect() { GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_WAIT_RESPONSE, 50)); GF.GetProxy <HallProxy>().Connect(); }
public override void Enter(params object[] param) { GF.GetProxy <SosProxy>().Reset(); GF.GetProxy <SosProxy>().InitSocket(); Connect(); }