コード例 #1
0
ファイル: ItemsPanel.xaml.cs プロジェクト: redthefed/Farplane
        private void ItemButtonsOnButtonClicked(int buttonIndex)
        {
            if (_editingItem == buttonIndex)
            {
                return;
            }

            Refresh();

            var clickedItem = _currentItems[buttonIndex];
            var baseItem    = Item.Items.First(item => item.ID == clickedItem.ID);

            var itemIndex = Item.Items.ToList().IndexOf(baseItem);

            ComboItemList.SelectedIndex = itemIndex;
            ComboItemList.KeyDown      += ItemEditor_KeyDown;

            TextItemCount.Text = clickedItem.Count.ToString();

            _itemButtons.SetContent(buttonIndex, PanelEditItem);
            _editingItem = buttonIndex;

            TextItemCount.SelectionStart  = 0;
            TextItemCount.SelectionLength = TextItemCount.Text.Length;

            TextItemCount.Focus();
        }
コード例 #2
0
ファイル: ItemsPanel.xaml.cs プロジェクト: redthefed/Farplane
        public void Refresh()
        {
            _refreshing   = true;
            _editingItem  = -1;
            _currentItems = Item.ReadItems();

            // Refresh inventory items
            for (int i = 0; i < _currentItems.Length; i++)
            {
                if (_currentItems[i].ID == 0xFF)
                {
                    // Empty slot
                    _itemButtons.SetContent(i, "< EMPTY >");
                }
                else
                {
                    // Show item name and count
                    _itemButtons.SetContent(i, _currentItems[i].Name + " x" + _currentItems[i].Count);
                }
            }

            // Refresh key items and al bhed dictionaries
            var keyItemData = GameMemory.Read <byte>(_offsetKeyItem, 8, false);
            var alBhedData  = GameMemory.Read <byte>(_offsetAlBhed, 4, false);

            _keyItemState = BitHelper.GetBitArray(keyItemData, 58);
            _alBhedState  = BitHelper.GetBitArray(alBhedData, 26);

            // Key Items
            for (int i = 0; i < KeyItem.KeyItems.Length - 1; i++)
            {
                if (_keyItemState[KeyItem.KeyItems[i].BitIndex])
                {
                    // Key item owned
                    _keyItemButtons.Buttons[i].Foreground = _trueKeyItemBrush;
                    _keyItemButtons.SetContent(i, $"{KeyItem.KeyItems[i].Name}");
                }
                else
                {
                    // Key item not owned
                    _keyItemButtons.Buttons[i].Foreground = _falseKeyItemBrush;
                    _keyItemButtons.SetContent(i, $"{KeyItem.KeyItems[i].Name}");
                }
            }

            // Al Bhed Dictionaries
            for (int i = 0; i < 26; i++)
            {
                (PanelAlBhed.Children[i] as CheckBox).IsChecked = _alBhedState[i];
            }
            _refreshing = false;
        }
コード例 #3
0
        public BlitzballPlayerEditor()
        {
            InitializeComponent();

            foreach (var player in BlitzballValues.Players)
            {
                TreeBlitzPlayers.Items.Add(new TreeViewItem()
                {
                    Header = player.Name
                });
            }

            KnownTechs.Content = _buttons;
            for (int i = 0; i < BlitzballValues.Techs.Length; i++)
            {
                _buttons.SetContent(i, BlitzballValues.Techs[i].Name);
            }

            _buttons.ButtonClicked += ButtonsOnButtonClicked;
        }