Пример #1
0
        public ItemTrackerComponent(LiveSplitState state, AutoCounterComponentSettings settings, ItemTracker item)
        {
            CurrentState = state;
            Settings     = settings;
            Item         = item;
            Cache        = new GraphicsCache();

            NameLabel = new SimpleLabel()
            {
                HorizontalAlignment = StringAlignment.Near
            };
            CountLabel = new SimpleLabel()
            {
                HorizontalAlignment = StringAlignment.Far
            };
            GoalLabel = new SimpleLabel()
            {
                HorizontalAlignment = StringAlignment.Far
            };
            LabelsList = new List <SimpleLabel>()
            {
                CountLabel, GoalLabel
            };

            VerticalHeight = 31;

            DisplayIcon = Settings.DisplayIcons;
            ShowGoal    = Settings.ShowGoal;
        }
        private void RebuildComponentList()
        {
            Components.Clear();
            ItemComponents.Clear();

            int count = Settings.ItemList.Count;

            for (int i = 0; i < count; i++)
            {
                if (i == count - 1)
                {
                    Components.Add(new SeparatorComponent());
                }

                ItemTracker item          = Settings.ItemList[i];
                var         itemComponent = new ItemTrackerComponent(CurrentState, Settings, item);
                Components.Add(itemComponent);
                ItemComponents.Add(itemComponent);

                if (i < count - 2)
                {
                    Components.Add(new ThinSeparatorComponent());
                }
            }
        }
Пример #3
0
        private void btn_addItem_Click(object sender, EventArgs e)
        {
            var newItem = new ItemTracker();

            ItemList.Add(newItem);
            itemGrid.ClearSelection();
            itemGrid.CurrentCell          = itemGrid.Rows[ItemList.Count - 1].Cells[0];
            itemGrid.CurrentCell.Selected = true;
        }
Пример #4
0
        public void SetSettings(XmlNode node)
        {
            var element = (XmlElement)node;

            DisplayIcons              = SettingsHelper.ParseBool(element["DisplayIcons"]);
            ShowGoal                  = SettingsHelper.ParseBool(element["ShowGoal"]);
            OverrideFont              = SettingsHelper.ParseBool(element["OverrideFont"]);
            NameFont                  = SettingsHelper.GetFontFromElement(element["NameFont"]);
            CountFont                 = SettingsHelper.GetFontFromElement(element["CountFont"]);
            GoalFont                  = SettingsHelper.GetFontFromElement(element["GoalFont"]);
            BackgroundColor           = SettingsHelper.ParseColor(element["BackgroundColor"], Color.Transparent);
            GoalColor                 = SettingsHelper.ParseColor(element["GoalColor"], Color.FromArgb(51, 115, 244));
            IconSize                  = SettingsHelper.ParseFloat(element["IconSize"], 24f);
            OldPersonalBest_Label     = SettingsHelper.ParseString(element["OldPersonalBest_Label"]);
            CurrentPersonalBest_Label = SettingsHelper.ParseString(element["CurrentPersonalBest_Label"]);

            var itemsElement = element["ItemList"];

            ItemList.Clear();
            foreach (var child in itemsElement.ChildNodes)
            {
                ItemList.Add(ItemTracker.FromXml((XmlNode)child));
            }
        }
Пример #5
0
        void itemGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.RowIndex < ItemList.Count)
            {
                ItemTracker item = ItemList[e.RowIndex];

                if (e.ColumnIndex == NAMEINDEX)
                {
                    e.Value = item.Name;
                }
                else if (e.ColumnIndex == ICONINDEX)
                {
                    e.Value = item.Icon;
                }
                else if (e.ColumnIndex == INITIALINDEX)
                {
                    e.Value = item.Initial;
                }
                else if (e.ColumnIndex == GOALINDEX)
                {
                    e.Value = item.Goal;
                }
            }
        }