void Start() { UdpPB.Instance().StartClientUdp(); UdpPB.Instance().mes_battle_start = Message_Battle_Start; UdpPB.Instance().mes_frame_operation = Message_Frame_Operation; UdpPB.Instance().mes_delta_frame_data = Message_Delta_Frame_Data; UdpPB.Instance().mes_down_game_over = Message_Down_Game_Over; isBattleStart = false; StartCoroutine("WaitInitData"); }
public void AddNewFrameData(int _frameID, AllPlayerOperation _op) { dic_frameDate [_frameID] = _op; for (int i = maxFrameID + 1; i < _frameID; i++) { lackFrame.Add(i); Debug.Log("缺失 :" + i); } maxFrameID = _frameID; //发送缺失帧数据 if (lackFrame.Count > 0) { if (lackFrame.Count > maxSendNum) { List <int> sendList = lackFrame.GetRange(0, maxSendNum); UdpPB.Instance().SendDeltaFrames(selfOperation.battleID, sendList); } else { UdpPB.Instance().SendDeltaFrames(selfOperation.battleID, lackFrame); } } }
void Send_operation() { UdpPB.Instance().SendOperation(); }
void Send_BattleReady() { UdpPB.Instance().SendBattleReady(NetGlobal.Instance().userUid, BattleData.Instance.battleID); }
void OnDestroy() { BattleData.Instance.ClearData(); UdpPB.Instance().Destory(); instance = null; }
void SendGameOver() { UdpPB.Instance().SendGameOver(BattleData.Instance.battleID); }
void OnApplicationQuit() { MarsTcp.Instance.EndClient(); UdpPB.Instance().Destory(); }