Esempio n. 1
0
        public static Blanket AttachTo(Control parent)
        {
            var blanket = new Blanket();

            parent.Controls.Add(blanket);

            blanket.Top    = 0;
            blanket.Left   = 0;
            blanket.Width  = parent.Width;
            blanket.Height = parent.Height;
            blanket.BringToFront();

            blanket.Uncover();

            return(blanket);
        }
Esempio n. 2
0
        private void LoadUnit(Model.Unit unit)
        {
            if (unit == null)
            {
                return;
            }

            var message = "";

            lblName.Text = unit.GetDisplayName();

            if (!Enum.IsDefined(typeof(Enums.Character), unit.CharacterID) ||
                !Enum.IsDefined(typeof(Enums.Class), unit.ClassID))
            {
                lblUsesCustomData.Show();
            }
            else
            {
                lblUsesCustomData.Hide();
            }

            try { classAndLevel1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Class and Level data"; }

            try { stats1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Stats data"; }

            try { unitBlockInfo1.LoadUnit(_chapterSave, _selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Unit Block Info data"; }

            try { flags1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Flags data"; }

            try { battleData1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Battle data"; }

            try { skills1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Skills data"; }

            try { inventory1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Inventory data"; }

            try { accessories1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Accessories data"; }

            try { hairColor1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Hair Color data"; }

            try { weaponExperience1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Weapon Experience data"; }

            try { dragonVein1.LoadUnit(_selectedUnit); }
            catch (Exception) { message += Environment.NewLine + "Error loading Dragon Vein data"; }

            if (message.Length > 0)
            {
                message = "One or more values is invalid for this unit. You can still use the hex editor, though." + Environment.NewLine + Environment.NewLine + message;
                _unitViewerBlanket.SetMessage(message);
                _unitViewerBlanket.Cover();

                btnOpenHexEditor.BringToFront();
            }
            else
            {
                _unitViewerBlanket.Uncover();
            }

            // Support
            var supportData = Data.Database.Characters.GetByID(_selectedUnit.CharacterID)?.SupportPool;

            if ((supportData == null) ||
                (_selectedUnit.RawNumberOfSupports != supportData.Length) ||
                (supportData.Length == 0))
            {
                btnSupport.Enabled = false;
            }
            else
            {
                btnSupport.Enabled = true;
            }
        }
Esempio n. 3
0
        private void LoadCharacter(Model.Character character)
        {
            if (character == null)
            {
                return;
            }

            var message = "";

            if (Enum.IsDefined(typeof(Enums.Character), character.CharacterID))
            {
                if (character.CorrinName != null)
                {
                    lblName.Text = character.CorrinName;
                }
                else if (Data.Database.Characters.GetByID(character.CharacterID).IsPrisoner)
                {
                    lblName.Text = Data.Database.Prisoners.GetByID(character.PrisonerID).DisplayName;
                }
                else
                {
                    lblName.Text = Data.Database.Characters.GetByID(character.CharacterID).DisplayName;
                }
            }
            else
            {
                lblName.Text = character.CharacterID.ToString();
            }

            try { classAndLevel1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Class and Level data"; }

            try { stats1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Stats data"; }

            try { unitBlockInfo1.LoadCharacter(_chapterSave, _selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Unit Block Info data"; }

            try { flags1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Flags data"; }

            try { battleData1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Battle data"; }

            try { skills1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Skills data"; }

            try { inventory1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Inventory data"; }

            try { accessories1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Accessories data"; }

            try { hairColor1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Hair Color data"; }

            try { weaponExperience1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Weapon Experience data"; }

            try { dragonVein1.LoadCharacter(_selectedCharacter); }
            catch (Exception) { message += Environment.NewLine + "Error loading Dragon Vein data"; }

            if (message.Length > 0)
            {
                message = "One or more values is invalid for this character. You can still use the hex editor, though." + Environment.NewLine + Environment.NewLine + message;
                _unitViewerBlanket.SetMessage(message);
                _unitViewerBlanket.Cover();

                btnOpenHexEditor.BringToFront();
            }
            else
            {
                _unitViewerBlanket.Uncover();
            }
        }