Example #1
0
        public void EntryProgressChanged(NitroxTechType techType, float progress, int unlocked, NitroxId nitroxId)
        {
            if (!PartiallyUnlockedByTechType.TryGetValue(techType, out PDAEntry pdaEntry))
            {
                PartiallyUnlockedByTechType[techType] = pdaEntry = new PDAEntry(techType, progress, unlocked);
            }

            // Update progress for specific entity if NitroxID is provided.
            if (nitroxId != null)
            {
                if (!CachedProgress.TryGetValue(techType, out PDAProgressEntry pdaProgressEntry))
                {
                    CachedProgress.Add(techType, pdaProgressEntry = new PDAProgressEntry(techType, new Dictionary <NitroxId, float>()));
                }
                // Prevents decreasing progress
                if (!pdaProgressEntry.Entries.ContainsKey(nitroxId) || (unlocked == pdaEntry.Unlocked && pdaProgressEntry.Entries.TryGetValue(nitroxId, out float oldProgress) && oldProgress < progress))
                {
                    pdaProgressEntry.Entries[nitroxId] = progress;
                    pdaEntry.Progress = progress;
                }
            }

            // This needs to occur after the progress update because
            // progress update needs to know what was the old unlocked state
            pdaEntry.Unlocked = unlocked;
        }
Example #2
0
        public void EntryProgressChanged(NitroxTechType techType, float progress, int unlocked)
        {
            if (!PartiallyUnlockedByTechType.TryGetValue(techType, out PDAEntry pdaEntry))
            {
                PartiallyUnlockedByTechType[techType] = pdaEntry = new PDAEntry(techType, progress, unlocked);
            }

            pdaEntry.Progress = progress;
            pdaEntry.Unlocked = unlocked;
        }
Example #3
0
 public void UnlockedTechType(NitroxTechType techType)
 {
     PartiallyUnlockedByTechType.Remove(techType);
     CachedProgress.Remove(techType);
     if (!UnlockedTechTypes.Contains(techType))
     {
         UnlockedTechTypes.Add(techType);
     }
     else
     {
         Log.Debug($"There was an attempt of adding a duplicated entry in the UnlockedTechTypes: [{techType.Name}]");
     }
 }
Example #4
0
 public void UnlockedTechType(TechTypeModel techType)
 {
     PartiallyUnlockedByTechType.Remove(techType);
     UnlockedTechTypes.Add(techType);
 }
Example #5
0
 public void UnlockedTechType(NitroxTechType techType)
 {
     PartiallyUnlockedByTechType.Remove(techType);
     CachedProgress.Remove(techType);
     UnlockedTechTypes.Add(techType);
 }