예제 #1
0
        public void Update(PacketHeader context, PacketLapData data, AsyncUI callback)
        {
            if (circuit != null)
            {
                circuit.Update(data);

                for (int i = 0; i < participantsData.numActiveCars; i++)
                {
                    if (data.lapData[i].currentLapNum >= 0)
                    {
                        lock (playerInfo)
                        {
                            var playerData = GetPlayerByIndex(i);
                            currentLapNum[i] = data.lapData[i].currentLapNum;
                            if (playerData != null)
                            {
                                var lapInfo = playerData.AddLapData(context, data.lapData[i]);
                                if (lapInfo != null)
                                {
                                    circuit.AddLapInfo(lapInfo);
                                    callback.LogLine($"{playerData.CarNumber}:{playerData.Name} - lap {data.lapData[i].currentLapNum} : {lapInfo.lapTime.ToString()}");
                                    LapDatabase.Add(
                                        new CompletedLap()
                                    {
                                        circuitInfo = this.circuit.CircuitData,
                                        playerInfo  = participantsData.participants[i],
                                        lap         = lapInfo
                                    });
                                }
                            }
                        }
                    }
                    else
                    {
                        currentLapNum[i] = data.lapData[i].currentLapNum;
                    }
                }
                circuit.CheckMyApex(context.frameIdentifier, data.lapData[context.playerCarIndex]);
            }
            else
            {
                for (int i = 0; i < currentLapNum.Length; i++)
                {
                    currentLapNum[i] = -1;
                }
            }
        }
예제 #2
0
 // Sla packetlapdata op, wordt gebruikt om lapinformatie te tonen (rechterkant)
 public void Update(PacketLapData data)
 {
     LapData = data;
 }