void AddMap() { if (LstMaps.CurrentSelection < 0) { return; } string mapluafile = MapLuaFiles[LstMaps.CurrentSelection]; int[] modeIndices = LstModes.GetCheckedIndices(); int[] eraIndices = LstEras.GetCheckedIndices(); for (int i = 0; i < modeIndices.Length; ++i) { SubIcon modeSub = ModeSubs[modeIndices[i]]; for (int j = 0; j < eraIndices.Length; j++) { SubIcon eraSub = EraSubs[eraIndices[j]]; string mapName = ENV.GetLocalizedMapName(mapluafile); PhxListBoxItem item = LstRotation.AddItem(mapName); item.SetIcon(modeSub.Icon); item.SetIcon2(eraSub.Icon); string mapScript = SWBFHelpers.Format(mapluafile, eraSub.Sub, modeSub.Sub); RotationLuaFiles.Add(mapScript); } } }
void OnMapSelectionChanged(int newIdx) { string mapluafile = MapLuaFiles[newIdx]; LstModes.Clear(); LstEras.Clear(); ModeSubs.Clear(); EraSubs.Clear(); object[] res = RT.CallLuaFunction("missionlist_ExpandModelist", 1, mapluafile); PhxLuaRuntime.Table modes = res[0] as PhxLuaRuntime.Table; foreach (KeyValuePair <object, object> entry in modes) { PhxLuaRuntime.Table mode = entry.Value as PhxLuaRuntime.Table; string modeNamePath = mode.Get <string>("showstr"); if (mode.Get("bIsWildcard") == null) { PhxListBoxItem item = LstModes.AddItem(ENV.GetLocalized(modeNamePath)); Texture2D icon = TextureLoader.Instance.ImportUITexture(mode.Get <string>("icon")); item.SetIcon(icon); string key = mode.Get <string>("key"); item.SetChecked(LastCheckedModes.Contains(key)); item.OnCheckChanged += (bool check) => { if (check) { LastCheckedModes.Add(key); } else { LastCheckedModes.Remove(key); } }; ModeSubs.Add(new SubIcon { Sub = mode.Get <string>("subst"), Icon = icon }); } } res = RT.CallLuaFunction("missionlist_ExpandEralist", 1, mapluafile); PhxLuaRuntime.Table eras = res[0] as PhxLuaRuntime.Table; foreach (KeyValuePair <object, object> entry in eras) { PhxLuaRuntime.Table era = entry.Value as PhxLuaRuntime.Table; string eraNamePath = era.Get <string>("showstr"); if (era.Get("bIsWildcard") == null) { PhxListBoxItem item = LstEras.AddItem(ENV.GetLocalized(eraNamePath)); Texture2D icon = TextureLoader.Instance.ImportUITexture(era.Get <string>("icon2")); item.SetIcon(icon); string key = era.Get <string>("key"); item.SetChecked(LastCheckedEras.Contains(key)); item.OnCheckChanged += (bool check) => { if (check) { LastCheckedEras.Add(key); } else { LastCheckedEras.Remove(key); } }; EraSubs.Add(new SubIcon { Sub = era.Get <string>("subst"), Icon = icon }); } } }