Exemple #1
0
        public Form1()
        {
            InitializeComponent();
            this.Size = new Size(1040, 627);
            this.CenterToScreen();
            editorPanel.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right);

            var tabPanels = new Panel[] { appearancePanel, inventoryPanel, factsPanel, statsPanel };

            foreach (Panel singleTab in tabPanels)
            {
                editorPanel.Controls.Add(singleTab);
                singleTab.Dock    = DockStyle.Fill;
                singleTab.Visible = false;
            }

            factsListView.AfterLabelEdit  += factsListView_AfterLabelEdit;
            factsListView.MouseUp         += factsListView_MouseUp;
            factsListView.ColumnClick     += factsListView_ColumnClick;
            inventoryListView.DoubleClick += inventoryListView_DoubleClick;
            inventoryListView.ColumnClick += inventoryListView_ColumnClick;

            inventoryColumnSorter = new ListViewColumnSorter();
            factsColumnSorter     = new ListViewColumnSorter();
            inventoryListView.ListViewItemSorter = inventoryColumnSorter;
            factsListView.ListViewItemSorter     = factsColumnSorter;

            factsSearchBox.GotFocus      += SearchBoxGotFocus;
            factsSearchBox.LostFocus     += SearchBoxLostFocus;
            inventorySearchBox.GotFocus  += SearchBoxGotFocus;
            inventorySearchBox.LostFocus += SearchBoxLostFocus;

            levelUpDown.ValueChanged      += PlayerStatChanged;
            streetCredUpDown.ValueChanged += PlayerStatChanged;

            bodyUpDown.ValueChanged             += PlayerStatChanged;
            reflexesUpDown.ValueChanged         += PlayerStatChanged;
            technicalAbilityUpDown.ValueChanged += PlayerStatChanged;
            intelligenceUpDown.ValueChanged     += PlayerStatChanged;
            coolUpDown.ValueChanged             += PlayerStatChanged;
            perkPointsUpDown.ValueChanged       += PlayerStatChanged;
            attrPointsUpDown.ValueChanged       += PlayerStatChanged;

            itemClasses = JsonConvert.DeserializeObject <Dictionary <string, string> >(CP2077SaveEditor.Properties.Resources.ItemClasses);
        }
        public Form1()
        {
            InitializeComponent();
            this.Size = new Size(1040, 627);
            this.CenterToScreen();
            editorPanel.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right);

            var tabPanels = new Panel[] { appearancePanel, inventoryPanel, factsPanel, statsPanel };

            foreach (Panel singleTab in tabPanels)
            {
                editorPanel.Controls.Add(singleTab);
                singleTab.Dock    = DockStyle.Fill;
                singleTab.Visible = false;
            }

            factsListView.AfterLabelEdit  += factsListView_AfterLabelEdit;
            factsListView.MouseUp         += factsListView_MouseUp;
            factsListView.ColumnClick     += factsListView_ColumnClick;
            inventoryListView.DoubleClick += inventoryListView_DoubleClick;
            inventoryListView.ColumnClick += inventoryListView_ColumnClick;
            inventoryListView.KeyDown     += inventoryListView_KeyDown;

            inventoryColumnSorter = new ListViewColumnSorter();
            factsColumnSorter     = new ListViewColumnSorter();
            inventoryListView.ListViewItemSorter = inventoryColumnSorter;
            factsListView.ListViewItemSorter     = factsColumnSorter;

            factsSearchBox.GotFocus      += SearchBoxGotFocus;
            factsSearchBox.LostFocus     += SearchBoxLostFocus;
            inventorySearchBox.GotFocus  += SearchBoxGotFocus;
            inventorySearchBox.LostFocus += SearchBoxLostFocus;

            levelUpDown.ValueChanged      += PlayerStatChanged;
            streetCredUpDown.ValueChanged += PlayerStatChanged;

            bodyUpDown.ValueChanged             += PlayerStatChanged;
            reflexesUpDown.ValueChanged         += PlayerStatChanged;
            technicalAbilityUpDown.ValueChanged += PlayerStatChanged;
            intelligenceUpDown.ValueChanged     += PlayerStatChanged;
            coolUpDown.ValueChanged             += PlayerStatChanged;
            perkPointsUpDown.ValueChanged       += PlayerStatChanged;
            attrPointsUpDown.ValueChanged       += PlayerStatChanged;

            athleticsUpDown.ValueChanged      += PlayerStatChanged;
            annihilationUpDown.ValueChanged   += PlayerStatChanged;
            streetBrawlerUpDown.ValueChanged  += PlayerStatChanged;
            assaultUpDown.ValueChanged        += PlayerStatChanged;
            handgunsUpDown.ValueChanged       += PlayerStatChanged;
            bladesUpDown.ValueChanged         += PlayerStatChanged;
            craftingUpDown.ValueChanged       += PlayerStatChanged;
            engineeringUpDown.ValueChanged    += PlayerStatChanged;
            breachProtocolUpDown.ValueChanged += PlayerStatChanged;
            quickhackingUpDown.ValueChanged   += PlayerStatChanged;
            stealthUpDown.ValueChanged        += PlayerStatChanged;
            coldBloodUpDown.ValueChanged      += PlayerStatChanged;

            attrFields = new Dictionary <Enum, NumericUpDown>
            {
                { gamedataStatType.Strength, bodyUpDown },
                { gamedataStatType.Reflexes, reflexesUpDown },
                { gamedataStatType.TechnicalAbility, technicalAbilityUpDown },
                { gamedataStatType.Intelligence, intelligenceUpDown },
                { gamedataStatType.Cool, coolUpDown }
            };

            proficFields = new Dictionary <Enum, NumericUpDown> {
                { gamedataProficiencyType.Level, levelUpDown },
                { gamedataProficiencyType.StreetCred, streetCredUpDown },
                { gamedataProficiencyType.Athletics, athleticsUpDown },
                { gamedataProficiencyType.Demolition, annihilationUpDown },
                { gamedataProficiencyType.Brawling, streetBrawlerUpDown },
                { gamedataProficiencyType.Invalid, assaultUpDown },
                { gamedataProficiencyType.Gunslinger, handgunsUpDown },
                { gamedataProficiencyType.Kenjutsu, bladesUpDown },
                { gamedataProficiencyType.Crafting, craftingUpDown },
                { gamedataProficiencyType.Engineering, engineeringUpDown },
                { gamedataProficiencyType.Hacking, breachProtocolUpDown },
                { gamedataProficiencyType.CombatHacking, quickhackingUpDown },
                { gamedataProficiencyType.Stealth, stealthUpDown },
                { gamedataProficiencyType.ColdBlood, coldBloodUpDown }
            };

            itemClasses = JsonConvert.DeserializeObject <Dictionary <string, string> >(CP2077SaveEditor.Properties.Resources.ItemClasses);
        }