public void HideAll(BlipType type) { foreach (var b in Blips.Where(x => x.Type == type)) { b.IsEnabled = false; } }
private void GlobalVariables_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action != NotifyCollectionChangedAction.Replace) { return; } int packageMin = TheEditor.GetIndexOfGlobal(GlobalVariable.Package1Collected); int packageMax = TheEditor.GetIndexOfGlobal(GlobalVariable.Package100Collected); int rampageMin = TheEditor.GetIndexOfGlobal(GlobalVariable.Rampage1Passed); int rampageMax = TheEditor.GetIndexOfGlobal(GlobalVariable.Rampage20Passed); int stuntJumpMin = TheEditor.GetIndexOfGlobal(GlobalVariable.StuntJump1Completed); int stuntJumpMax = TheEditor.GetIndexOfGlobal(GlobalVariable.StuntJump26Completed); int index = e.NewStartingIndex; bool isCollected = ((int)e.NewItems[0]) != 0; CollectibleBlip blip = null; if (index >= packageMin && index <= packageMax) { blip = Blips.Where(x => x.Type == BlipType.Package && x.Index == (index - packageMin)).FirstOrDefault(); } if (index >= rampageMin && index <= rampageMax) { blip = Blips.Where(x => x.Type == BlipType.Rampage && x.Index == (index - rampageMin)).FirstOrDefault(); } if (index >= stuntJumpMin && index <= stuntJumpMax) { blip = Blips.Where(x => x.Type == BlipType.StuntJump && x.Index == (index - stuntJumpMin)).FirstOrDefault(); } if (blip != null) { blip.IsCollected = isCollected; if (!isCollected || (isCollected && IsShowingCollected)) { blip.IsEnabled = true; } } }
public void PlotAll(BlipType type) { int stateArrayBase = -1; switch (type) { case BlipType.Package: stateArrayBase = (int)GlobalVariable.Package1Collected; break; case BlipType.Rampage: stateArrayBase = (int)GlobalVariable.Rampage1Passed; break; case BlipType.StuntJump: stateArrayBase = (int)GlobalVariable.StuntJump1Completed; break; } var b = Blips.Where(x => x.Type == type).ToArray(); for (int i = 0; i < b.Length; i++) { int state = TheEditor.GetGlobal(stateArrayBase + i); b[i].IsCollected = (state != 0); b[i].IsEnabled = true; } }