Esempio n. 1
0
    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");
    }
Esempio n. 2
0
    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);
            }
        }
    }
Esempio n. 3
0
 void Send_operation()
 {
     UdpPB.Instance().SendOperation();
 }
Esempio n. 4
0
 void Send_BattleReady()
 {
     UdpPB.Instance().SendBattleReady(NetGlobal.Instance().userUid, BattleData.Instance.battleID);
 }
Esempio n. 5
0
 void OnDestroy()
 {
     BattleData.Instance.ClearData();
     UdpPB.Instance().Destory();
     instance = null;
 }
Esempio n. 6
0
 void SendGameOver()
 {
     UdpPB.Instance().SendGameOver(BattleData.Instance.battleID);
 }
Esempio n. 7
0
 void OnApplicationQuit()
 {
     MarsTcp.Instance.EndClient();
     UdpPB.Instance().Destory();
 }