private void PopulatePackList() { this._availablePacksList.Clear(); this._enabledPacksList.Clear(); this.CleanUpResourcePackPriority(); IEnumerable <ResourcePack> enabledPacks = this._packsList.EnabledPacks; IEnumerable <ResourcePack> disabledPacks = this._packsList.DisabledPacks; int num1 = 0; foreach (ResourcePack resourcePack in disabledPacks) { UIResourcePack uiResourcePack1 = new UIResourcePack(resourcePack, num1); uiResourcePack1.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f); UIResourcePack uiResourcePack2 = uiResourcePack1; UIElement packToggleButton = this.CreatePackToggleButton(resourcePack); packToggleButton.OnUpdate += new UIElement.ElementEvent(this.EnablePackUpdate); packToggleButton.SetSnapPoint("ToggleToOn", num1, new Vector2?(), new Vector2?()); uiResourcePack2.ContentPanel.Append(packToggleButton); UIElement packInfoButton = this.CreatePackInfoButton(resourcePack); packInfoButton.OnUpdate += new UIElement.ElementEvent(this.SeeInfoUpdate); packInfoButton.SetSnapPoint("InfoOff", num1, new Vector2?(), new Vector2?()); uiResourcePack2.ContentPanel.Append(packInfoButton); this._availablePacksList.Add((UIElement)uiResourcePack2); ++num1; } int num2 = 0; foreach (ResourcePack resourcePack in enabledPacks) { UIResourcePack uiResourcePack1 = new UIResourcePack(resourcePack, num2); uiResourcePack1.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f); UIResourcePack uiResourcePack2 = uiResourcePack1; if (resourcePack.IsEnabled) { UIElement packToggleButton = this.CreatePackToggleButton(resourcePack); packToggleButton.Left = new StyleDimension(0.0f, 0.0f); packToggleButton.Width = new StyleDimension(0.0f, 0.5f); packToggleButton.OnUpdate += new UIElement.ElementEvent(this.DisablePackUpdate); packToggleButton.SetSnapPoint("ToggleToOff", num2, new Vector2?(), new Vector2?()); uiResourcePack2.ContentPanel.Append(packToggleButton); UIElement packInfoButton = this.CreatePackInfoButton(resourcePack); packInfoButton.OnUpdate += new UIElement.ElementEvent(this.SeeInfoUpdate); packInfoButton.Left = new StyleDimension(0.0f, 0.5f); packInfoButton.Width = new StyleDimension(0.0f, 0.1666667f); packInfoButton.SetSnapPoint("InfoOn", num2, new Vector2?(), new Vector2?()); uiResourcePack2.ContentPanel.Append(packInfoButton); UIElement offsetButton1 = this.CreateOffsetButton(resourcePack, -1); offsetButton1.Left = new StyleDimension(0.0f, 0.6666667f); offsetButton1.Width = new StyleDimension(0.0f, 0.1666667f); offsetButton1.SetSnapPoint("OrderUp", num2, new Vector2?(), new Vector2?()); uiResourcePack2.ContentPanel.Append(offsetButton1); UIElement offsetButton2 = this.CreateOffsetButton(resourcePack, 1); offsetButton2.Left = new StyleDimension(0.0f, 0.8333334f); offsetButton2.Width = new StyleDimension(0.0f, 0.1666667f); offsetButton2.SetSnapPoint("OrderDown", num2, new Vector2?(), new Vector2?()); uiResourcePack2.ContentPanel.Append(offsetButton2); } this._enabledPacksList.Add((UIElement)uiResourcePack2); ++num2; } this.UpdateTitles(); }
private void PopulatePackList() { _availablePacksList.Clear(); _enabledPacksList.Clear(); CleanUpResourcePackPriority(); IEnumerable <ResourcePack> enabledPacks = _packsList.EnabledPacks; IEnumerable <ResourcePack> disabledPacks = _packsList.DisabledPacks; int num = 0; foreach (ResourcePack item in disabledPacks) { UIResourcePack uIResourcePack = new UIResourcePack(item, num) { Width = StyleDimension.FromPixelsAndPercent(0f, 1f) }; UIElement uIElement = CreatePackToggleButton(item); uIElement.OnUpdate += EnablePackUpdate; uIElement.SetSnapPoint("ToggleToOn", num); uIResourcePack.ContentPanel.Append(uIElement); uIElement = CreatePackInfoButton(item); uIElement.OnUpdate += SeeInfoUpdate; uIElement.SetSnapPoint("InfoOff", num); uIResourcePack.ContentPanel.Append(uIElement); _availablePacksList.Add(uIResourcePack); num++; } num = 0; foreach (ResourcePack item2 in enabledPacks) { UIResourcePack uIResourcePack2 = new UIResourcePack(item2, num) { Width = StyleDimension.FromPixelsAndPercent(0f, 1f) }; if (item2.IsEnabled) { UIElement uIElement2 = CreatePackToggleButton(item2); uIElement2.Left = new StyleDimension(0f, 0f); uIElement2.Width = new StyleDimension(0f, 0.5f); uIElement2.OnUpdate += DisablePackUpdate; uIElement2.SetSnapPoint("ToggleToOff", num); uIResourcePack2.ContentPanel.Append(uIElement2); uIElement2 = CreatePackInfoButton(item2); uIElement2.OnUpdate += SeeInfoUpdate; uIElement2.Left = new StyleDimension(0f, 0.5f); uIElement2.Width = new StyleDimension(0f, 355f / (678f * (float)Math.PI)); uIElement2.SetSnapPoint("InfoOn", num); uIResourcePack2.ContentPanel.Append(uIElement2); uIElement2 = CreateOffsetButton(item2, -1); uIElement2.Left = new StyleDimension(0f, 2f / 3f); uIElement2.Width = new StyleDimension(0f, 355f / (678f * (float)Math.PI)); uIElement2.SetSnapPoint("OrderUp", num); uIResourcePack2.ContentPanel.Append(uIElement2); uIElement2 = CreateOffsetButton(item2, 1); uIElement2.Left = new StyleDimension(0f, 0.8333334f); uIElement2.Width = new StyleDimension(0f, 355f / (678f * (float)Math.PI)); uIElement2.SetSnapPoint("OrderDown", num); uIResourcePack2.ContentPanel.Append(uIElement2); } _enabledPacksList.Add(uIResourcePack2); num++; } UpdateTitles(); }