コード例 #1
0
ファイル: PDAStateData.cs プロジェクト: x0n1c/Nitrox
 public void AddPDALogEntry(PDALogEntry entry)
 {
     lock (pdaLogEntries)
     {
         pdaLogEntries.Add(entry);
     }
 }
コード例 #2
0
ファイル: PDAStateData.cs プロジェクト: MrPurple6411/Nitrox
 public void AddPDALogEntry(PDALogEntry entry)
 {
     if (!PdaLog.Any(logEntry => logEntry.Key == entry.Key))
     {
         PdaLog.Add(entry);
     }
     else
     {
         Log.Debug($"There was an attempt of adding a duplicated entry in the PDALog: [{entry.Key}]");
     }
 }
コード例 #3
0
        public void GameDataTest()
        {
            for (int serializerIndex = 0; serializerIndex < worldsDataAfter.Length; serializerIndex++)
            {
                PersistedWorldData worldDataAfter = worldsDataAfter[serializerIndex];
                Assert.IsTrue(worldData.WorldData.GameData.PDAState.UnlockedTechTypes.SequenceEqual(worldDataAfter.WorldData.GameData.PDAState.UnlockedTechTypes), $"WorldData.GameData.PDAState.UnlockedTechTypes is not equal while using {serverSerializers[serializerIndex]}.");
                Assert.IsTrue(worldData.WorldData.GameData.PDAState.KnownTechTypes.SequenceEqual(worldDataAfter.WorldData.GameData.PDAState.KnownTechTypes), $"WorldData.GameData.PDAState.KnownTechTypes is not equal while using {serverSerializers[serializerIndex]}.");
                Assert.IsTrue(worldData.WorldData.GameData.PDAState.EncyclopediaEntries.SequenceEqual(worldDataAfter.WorldData.GameData.PDAState.EncyclopediaEntries), $"WorldData.GameData.PDAState.EncyclopediaEntries is not equal while using {serverSerializers[serializerIndex]}.");

                Assert.AreEqual(worldData.WorldData.GameData.PDAState.PartiallyUnlockedByTechType.Count, worldDataAfter.WorldData.GameData.PDAState.PartiallyUnlockedByTechType.Count, $"WorldData.GameData.PDAState.PartiallyUnlockedByTechType.Count is not equal while using {serverSerializers[serializerIndex]}.");
                for (int index = 0; index < worldData.WorldData.GameData.PDAState.PartiallyUnlockedByTechType.Count; index++)
                {
                    KeyValuePair <NitroxTechType, PDAEntry> entry      = worldData.WorldData.GameData.PDAState.PartiallyUnlockedByTechType.ElementAt(index);
                    KeyValuePair <NitroxTechType, PDAEntry> entryAfter = worldData.WorldData.GameData.PDAState.PartiallyUnlockedByTechType.ElementAt(index);

                    Assert.AreEqual(entry.Key, entryAfter.Key, $"WorldData.GameData.PDAState.PartiallyUnlockedByTechType.Key is not equal while using {serverSerializers[serializerIndex]}.");
                    Assert.AreEqual(entry.Value.Progress, entryAfter.Value.Progress, $"WorldData.GameData.PDAState.PartiallyUnlockedByTechType.Value.Progress is not equal while using {serverSerializers[serializerIndex]}.");
                    Assert.AreEqual(entry.Value.TechType, entryAfter.Value.TechType, $"WorldData.GameData.PDAState.PartiallyUnlockedByTechType.Value.TechType is not equal while using {serverSerializers[serializerIndex]}.");
                    Assert.AreEqual(entry.Value.Unlocked, entryAfter.Value.Unlocked, $"WorldData.GameData.PDAState.PartiallyUnlockedByTechType.Value.Unlocked is not equal while using {serverSerializers[serializerIndex]}.");
                }

                Assert.AreEqual(worldData.WorldData.GameData.PDAState.PdaLog.Count, worldDataAfter.WorldData.GameData.PDAState.PdaLog.Count, $"WorldData.GameData.PDAState.PdaLog.Count is not equal while using {serverSerializers[serializerIndex]}.");
                for (int index = 0; index < worldData.WorldData.GameData.PDAState.PdaLog.Count; index++)
                {
                    PDALogEntry logEntry      = worldData.WorldData.GameData.PDAState.PdaLog[index];
                    PDALogEntry logEntryAfter = worldDataAfter.WorldData.GameData.PDAState.PdaLog[index];

                    Assert.AreEqual(logEntry.Key, logEntryAfter.Key, $"WorldData.GameData.PDAState.PdaLog.Key is not equal while using {serverSerializers[serializerIndex]}.");
                    Assert.AreEqual(logEntry.Timestamp, logEntryAfter.Timestamp, $"WorldData.GameData.PDAState.PdaLog.Timestamp is not equal while using {serverSerializers[serializerIndex]}.");
                }

                Assert.IsTrue(worldData.WorldData.GameData.StoryGoals.CompletedGoals.SequenceEqual(worldDataAfter.WorldData.GameData.StoryGoals.CompletedGoals), $"WorldData.GameData.StoryGoals.CompletedGoals is not equal while using {serverSerializers[serializerIndex]}.");
                Assert.IsTrue(worldData.WorldData.GameData.StoryGoals.RadioQueue.SequenceEqual(worldDataAfter.WorldData.GameData.StoryGoals.RadioQueue), $"WorldData.GameData.StoryGoals.RadioQueue is not equal while using {serverSerializers[serializerIndex]}.");
                Assert.IsTrue(worldData.WorldData.GameData.StoryGoals.GoalUnlocks.SequenceEqual(worldDataAfter.WorldData.GameData.StoryGoals.GoalUnlocks), $"WorldData.GameData.StoryGoals.GoalUnlocks is not equal while using {serverSerializers[serializerIndex]}.");

                Assert.AreEqual(worldData.WorldData.GameData.StoryTiming.ElapsedTime, worldDataAfter.WorldData.GameData.StoryTiming.ElapsedTime, $"WorldData.GameData.StoryTiming.ElapsedTime is not equal while using {serverSerializers[serializerIndex]}.");
                Assert.AreEqual(worldData.WorldData.GameData.StoryTiming.AuroraExplosionTime, worldDataAfter.WorldData.GameData.StoryTiming.AuroraExplosionTime, $"WorldData.GameData.StoryTiming.AuroraExplosionTime is not equal while using {serverSerializers[serializerIndex]}.");
            }
        }
コード例 #4
0
ファイル: PDAStateData.cs プロジェクト: EmidioMata/1.2
 public void AddPDALogEntry(PDALogEntry entry)
 {
     PdaLog.Add(entry);
 }