private void Process(ClientScanProgress msg) { var entryData = PDAScanner.GetEntryData(msg.tech); if (entryData == null) { return; } using (new MessageBlocker()) { PDAScanner.Entry entry; if (!PDAScanner.GetPartialEntryByKey(msg.tech, out entry)) { var methodAdd = typeof(PDAScanner).GetMethod("Add", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof(TechType), typeof(int) }, null); entry = (PDAScanner.Entry)methodAdd.Invoke(null, new object[] { msg.tech, 0 }); } if (entry != null) { entry.unlocked = msg.progress; if (entry.unlocked >= entryData.totalFragments) { var partial = (List <PDAScanner.Entry>)(typeof(PDAScanner).GetField("partial", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null)); var complete = (HashSet <TechType>)(typeof(PDAScanner).GetField("complete", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null)); partial.Remove(entry); complete.Add(entry.techType); } } } }
public static void AddProgress(TechType tech, int progress) { if (tech == TechType.None || Multiplayer.main.blocked) { return; } var res = new ClientScanProgress(); res.tech = tech; res.progress = progress; Multiplayer.main.Send(res); }