void GetOrganizationLists() { if (!File.Exists(orgList)) { return; } string[] lines = File.ReadAllLines(orgList); bool lastLineWasWheelName = false; foreach (string line in lines) { if (String.IsNullOrWhiteSpace(line)) { continue; } string l = line.Trim(); if (l.Contains("[") && l.Contains("]")) { if (lastLineWasWheelName) { NativeWheel.WheelList.Remove(NativeWheel.WheelList.Last()); } var wheel = new NativeWheel(l.Substring(1, l.Length - 2)); NativeWheel.WheelList.Add(wheel); lastLineWasWheelName = true; continue; } if (WheelListIsPopulated() && validStationNames.Any(s => s.Equals(l))) { NativeWheel.WheelList.Last().stationList.Add(l); lastLineWasWheelName = false; } } if (WheelListIsPopulated()) { currentWheel = NativeWheel.WheelList[0]; //foreach (var w in NativeWheel.WheelList) //{ // w.stationList.ForEach(x => Logger.Log(x, logPath)); //} } }
void OnTick(object sender, EventArgs e) { if (GTAFunction.HasCheatStringJustBeenEntered("radio_reload")) { UnhideAllStations(); NativeWheel.WheelList = null; currentWheel = null; GetOrganizationLists(); loaded = true; Wait(150); } if (RadioNativeFunctions.IsRadioHudComponentVisible()) { if (!loaded && Game.Player.CanControlCharacter) { LogAllStations(); GetOrganizationLists(); loaded = true; } ShowHelpTexts(); ControlWheelChange(); if (Event_JUST_OPENED_OnNextOpen) { OnJustOpened(); } DisableNativeScrollRadioControls(); Event_JUST_OPENED_OnNextOpen = false; } else { if (!loaded) { return; } if (!Event_JUST_OPENED_OnNextOpen) { OnJustClosed(); Event_JUST_OPENED_OnNextOpen = true; } } }
void ControlWheelChange() { if (!WheelListIsPopulated()) { return; } if (Game.IsControlJustPressed(2, ControlNextWheel)) { currentWheel = NativeWheel.WheelList.GetNext(currentWheel); UpdateWheelThisFrame(); } else if (Game.IsControlJustPressed(2, ControlPrevWheel)) { currentWheel = NativeWheel.WheelList.GetPrevious(currentWheel); UpdateWheelThisFrame(); } }