コード例 #1
0
        public InventoryCheckBox(int index, GroupBox p, PasswordView pv, Checksum c)
        {
            checkbox       = new CheckBox();
            parentGroupBox = p;
            passwordView   = pv;
            checksumButton = c;

            int xPosition = index / 9;
            int yPosition = index % 9;

            checkbox.AutoSize = true;
            checkbox.Location = new System.Drawing.Point(9 + (127 * xPosition), 60 + (23 * yPosition));
            checkbox.Name     = $"checkBox{index}";
            checkbox.Size     = new System.Drawing.Size(74, 17);
            checkbox.TabIndex = 2;
            checkbox.Text     = Names.AllItems[index];
            checkbox.UseVisualStyleBackColor = true;

            if (index == 48)
            {
                // The one ring can be legally encoded into the password. That being said, the bit is ignored by the game.
                checkbox.ForeColor = Color.Gray;
            }

            parentGroupBox.Controls.Add(checkbox);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: clandrew/lotrpwcheck
        public Form1()
        {
            InitializeComponent();

            this.DoubleBuffered = true;

            this.MinimizeBox     = false;
            this.MaximizeBox     = false;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            passwordView = new PasswordView(passwordUI);
            checksum     = new Checksum(passwordView, groupBox1);

            locationComboBox.Items.Add("Hobbiton");
            locationComboBox.Items.Add("Brandywine Bridge");
            locationComboBox.Items.Add("Farmer Maggot");
            locationComboBox.Items.Add("Ferry");
            locationComboBox.Items.Add("Crickhollow");
            locationComboBox.Items.Add("Tom Bombadil's House");
            locationComboBox.Items.Add("Barrow Downs Stones");
            locationComboBox.Items.Add("Crossroads");
            locationComboBox.Items.Add("Rivendell");
            locationComboBox.Items.Add("Moria entrance");
            locationComboBox.Items.Add("Moria 1 (glitched)");
            locationComboBox.Items.Add("Moria 2 (glitched)");
            locationComboBox.Items.Add("(invalid)");
            locationComboBox.DropDownStyle = ComboBoxStyle.DropDownList;


            inventoryCheckboxes = new InventoryCheckBox[54];
            for (int i = 0; i < 54; ++i)
            {
                inventoryCheckboxes[i] = new InventoryCheckBox(i, this.groupBox1, passwordView, checksum);
                inventoryCheckboxes[i].GetCheckboxUIElement().CheckedChanged += OnInventoryCheckboxCheckChanged;
            }

            int xDisp = 128;

            characterUIs = new List <CharacterUI>();

            characterUIs.Add(new CharacterUI("Samwise", this.groupBox1, 9 + (xDisp * 0), 302, passwordView, checksum, 0));
            characterUIs.Add(new CharacterUI("Merry", this.groupBox1, 9 + (xDisp * 1), 302, passwordView, checksum, 3));
            characterUIs.Add(new CharacterUI("Frodo", this.groupBox1, 9 + (xDisp * 2), 302, passwordView, checksum, 6));
            characterUIs.Add(new CharacterUI("Pippin", this.groupBox1, 9 + (xDisp * 3), 302, passwordView, checksum, 9));

            characterUIs.Add(new CharacterUI("Legolas", this.groupBox1, 9 + (xDisp * 0), 432, passwordView, checksum, 12));
            characterUIs.Add(new CharacterUI("Aragorn", this.groupBox1, 9 + (xDisp * 1), 432, passwordView, checksum, 15));
            characterUIs.Add(new CharacterUI("Gimli", this.groupBox1, 9 + (xDisp * 2), 432, passwordView, checksum, 18));
            characterUIs.Add(new CharacterUI("Gandalf", this.groupBox1, 9 + (xDisp * 3), 432, passwordView, checksum, 21));

            UpdateLocationDropdownUI();
            UpdateInventoryCheckboxUI();
            checksum.UpdateButtonState(passwordView.IsValidChecksum());
        }
コード例 #3
0
ファイル: Checksum.cs プロジェクト: clandrew/lotrpwcheck
        public Checksum(PasswordView pv, GroupBox parentBox)
        {
            passwordView        = pv;
            this.checksumButton = new System.Windows.Forms.Button();

            //
            // checksumButton
            //
            this.checksumButton.Location = new System.Drawing.Point(637, 491);
            this.checksumButton.Name     = "checksumButton";
            this.checksumButton.Size     = new System.Drawing.Size(128, 62);
            this.checksumButton.TabIndex = 0;
            this.checksumButton.Text     = "button1";
            this.checksumButton.UseVisualStyleBackColor = true;
            this.checksumButton.Click += new System.EventHandler(this.ChecksumButton_Click);

            parentBox.Controls.Add(this.checksumButton);
        }
コード例 #4
0
ファイル: CharacterUI.cs プロジェクト: clandrew/lotrpwcheck
        public CharacterUI(string characterName, GroupBox parentGroupBox, int x, int y, PasswordView pv, Checksum c, int psi)
        {
            this.characterEnabledCheckBox = new System.Windows.Forms.CheckBox();
            this.levelNumericUpDown       = new System.Windows.Forms.NumericUpDown();
            this.weaponComboBox           = new System.Windows.Forms.ComboBox();
            this.armorComboBox            = new System.Windows.Forms.ComboBox();
            this.groupBox   = new System.Windows.Forms.GroupBox();
            this.levelLabel = new System.Windows.Forms.Label();

            string lowercaseName = characterName.ToLower();

            Point groupBoxLocation = new System.Drawing.Point(x, y);

            passwordView               = pv;
            checksumButton             = c;
            passwordStartIndex         = psi;
            shouldUpdatePasswordString = true;

            //
            // groupBox6
            //
            this.groupBox.Controls.Add(this.characterEnabledCheckBox);
            this.groupBox.Controls.Add(this.levelNumericUpDown);
            this.groupBox.Controls.Add(this.levelLabel);
            this.groupBox.Controls.Add(this.armorComboBox);
            this.groupBox.Controls.Add(this.weaponComboBox);
            this.groupBox.Location = groupBoxLocation;
            this.groupBox.Name     = "groupBox6";
            this.groupBox.Size     = new System.Drawing.Size(122, 124);
            this.groupBox.TabIndex = 7;
            this.groupBox.TabStop  = false;
            this.groupBox.Text     = characterName;

            this.characterEnabledCheckBox.AutoSize = true;
            this.characterEnabledCheckBox.Location = new System.Drawing.Point(9, 19);
            this.characterEnabledCheckBox.Name     = $"{lowercaseName}EnabledCheckBox";
            this.characterEnabledCheckBox.Size     = new System.Drawing.Size(65, 17);
            this.characterEnabledCheckBox.TabIndex = 9;
            this.characterEnabledCheckBox.Text     = "Enabled";
            this.characterEnabledCheckBox.UseVisualStyleBackColor = true;
            this.characterEnabledCheckBox.CheckedChanged         += new System.EventHandler(this.EnabledCheckBox_CheckedChanged);

            this.levelNumericUpDown.Location = new System.Drawing.Point(49, 41);
            this.levelNumericUpDown.Maximum  = new decimal(new int[] {
                99,
                0,
                0,
                0
            });
            this.levelNumericUpDown.Name          = $"{lowercaseName}LevelNumericUpDown";
            this.levelNumericUpDown.Size          = new System.Drawing.Size(66, 20);
            this.levelNumericUpDown.TabIndex      = 13;
            this.levelNumericUpDown.ValueChanged += new System.EventHandler(this.LevelNumericUpDown_ValueChanged);
            //
            // label3
            //
            this.levelLabel.AutoSize = true;
            this.levelLabel.Location = new System.Drawing.Point(6, 43);
            this.levelLabel.Name     = "levelLabel";
            this.levelLabel.Size     = new System.Drawing.Size(36, 13);
            this.levelLabel.TabIndex = 10;
            this.levelLabel.Text     = "Level:";

            this.armorComboBox.FormattingEnabled = true;
            this.armorComboBox.Location          = new System.Drawing.Point(9, 93);
            this.armorComboBox.Name                  = $"{lowercaseName}ArmorComboBox";
            this.armorComboBox.Size                  = new System.Drawing.Size(106, 21);
            this.armorComboBox.TabIndex              = 12;
            this.armorComboBox.SelectedIndexChanged += new System.EventHandler(this.ArmorComboBox_SelectedIndexChanged);

            this.weaponComboBox.FormattingEnabled = true;
            this.weaponComboBox.Location          = new System.Drawing.Point(9, 66);
            this.weaponComboBox.Name                  = $"{lowercaseName}WeaponComboBox";
            this.weaponComboBox.Size                  = new System.Drawing.Size(106, 21);
            this.weaponComboBox.TabIndex              = 11;
            this.weaponComboBox.SelectedIndexChanged += new System.EventHandler(this.WeaponComboBox_SelectedIndexChanged);

            parentGroupBox.Controls.Add(groupBox);

            foreach (var s in Names.AllWeapons)
            {
                weaponComboBox.Items.Add(s);
            }

            foreach (var s in Names.AllArmor)
            {
                armorComboBox.Items.Add(s);
            }

            levelLabel.Enabled         = false;
            levelNumericUpDown.Enabled = false;
            armorComboBox.Enabled      = false;
            weaponComboBox.Enabled     = false;

            weaponComboBox.SelectedIndex = 0;
            armorComboBox.SelectedIndex  = 0;
        }