Example #1
0
        public void LoadRoster()
        {
            if (!File.Exists("Content/Roster.bin"))
            {
                return;
            }

            FileStream   FS = new FileStream("Content/Roster.bin", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS);

            int ListCharacterCount = BR.ReadInt32();

            ListCharacter = new List <Character>(ListCharacterCount);

            for (int C = 0; C < ListCharacterCount; C++)
            {
                Character NewCharacter = new Character(BR.ReadString(), null, DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget);

                lstCharacters.Items.Add(NewCharacter.FullName);
                lstCharactersToShareFrom.Items.Add(NewCharacter.FullName);
                ListCharacter.Add(NewCharacter);

                int DicCharacterLinkCount = BR.ReadInt32();
                for (int L = 0; L < DicCharacterLinkCount; L++)
                {
                    string Key = BR.ReadString();
                    Character.CharacterLinkTypes CharacterLinkType = (Character.CharacterLinkTypes)BR.ReadByte();
                    NewCharacter.DicCharacterLink.Add(Key, CharacterLinkType);
                }
            }

            int ListUnitCount = BR.ReadInt32();

            ListUnit = new List <Unit>(ListUnitCount);

            for (int U = 0; U < ListUnitCount; U++)
            {
                string UnitTypeName = BR.ReadString();
                string UnitName     = BR.ReadString();
                string EventID      = BR.ReadString();
                Unit   NewUnit      = Unit.FromType(UnitTypeName, UnitName, null, DicUnitType, DicRequirement, DicEffect, DicAutomaticSkillTarget);
                NewUnit.TeamEventID = EventID;

                lstUnits.Items.Add(NewUnit.ItemName);
                lstUnitsToShareFrom.Items.Add(NewUnit.ItemName);
                ListUnit.Add(NewUnit);

                int DicUnitLinkCount = BR.ReadInt32();
                for (int L = 0; L < DicUnitLinkCount; L++)
                {
                    string Key = BR.ReadString();
                    UnitStats.UnitLinkTypes UnitLinkType = (UnitStats.UnitLinkTypes)BR.ReadByte();
                    NewUnit.UnitStat.DicUnitLink.Add(Key, UnitLinkType);
                }
            }

            BR.Close();
            FS.Close();
        }
Example #2
0
        public void LoadRoster()
        {
            if (!File.Exists("Content/Roster.bin"))
            {
                return;
            }

            FileStream   FS = new FileStream("Content/Roster.bin", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS);

            int DicCharacterCount = BR.ReadInt32();

            DicRosterCharacter = new Dictionary <string, RosterCharacter>(DicCharacterCount);

            for (int C = 0; C < DicCharacterCount; C++)
            {
                RosterCharacter NewCharacter = new RosterCharacter(BR.ReadString());

                DicRosterCharacter.Add(NewCharacter.FilePath, NewCharacter);

                int DicCharacterLinkCount = BR.ReadInt32();
                for (int L = 0; L < DicCharacterLinkCount; L++)
                {
                    string Key = BR.ReadString();
                    Character.CharacterLinkTypes CharacterLinkType = (Character.CharacterLinkTypes)BR.ReadByte();
                    NewCharacter.DicCharacterLink.Add(Key, CharacterLinkType);
                }
            }

            int DicUnitCount = BR.ReadInt32();

            DicRosterUnit = new Dictionary <string, RosterUnit>(DicUnitCount);

            for (int U = 0; U < DicUnitCount; U++)
            {
                string     UnitTypeName = BR.ReadString();
                string     UnitName     = BR.ReadString();
                string     EventID      = BR.ReadString();
                RosterUnit NewUnit      = new RosterUnit(UnitTypeName, UnitName, EventID);

                DicRosterUnit.Add(EventID, NewUnit);

                int DicUnitLinkCount = BR.ReadInt32();
                for (int L = 0; L < DicUnitLinkCount; L++)
                {
                    string Key = BR.ReadString();
                    UnitStats.UnitLinkTypes UnitLinkType = (UnitStats.UnitLinkTypes)BR.ReadByte();
                    NewUnit.DicUnitLink.Add(Key, UnitLinkType);
                }
            }

            BR.Close();
            FS.Close();

            CreateCharacterRosterDependencies();
            CreateUnitRosterDependencies();
        }
Example #3
0
 public void ShareStats(Unit UnitToShareFrom, UnitStats.UnitLinkTypes UnitLinkType)
 {
     _UnitStat.ShareStats(UnitToShareFrom._UnitStat, UnitLinkType);
 }
Example #4
0
        private void lstUnits_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstUnits.SelectedIndex >= 0)
            {
                Unit ActiveUnit = ListUnit[lstUnits.SelectedIndex];
                lblMaxHP.Text       = ActiveUnit.MaxHP.ToString();
                lblMaxEN.Text       = ActiveUnit.MaxEN.ToString();
                lblRegenEN.Text     = ActiveUnit.RegenEN.ToString();
                lblArmor.Text       = ActiveUnit.Armor.ToString();
                lblMobility.Text    = ActiveUnit.Mobility.ToString();
                lblMaxMovement.Text = ActiveUnit.MaxMovement.ToString();
                txtEventID.Text     = ActiveUnit.TeamEventID;

                UnitStats.UnitLinkTypes UnitLinkType = UnitStats.UnitLinkTypes.None;

                if (lstUnitsToShareFrom.SelectedIndex >= 0)
                {
                    string OtherUnitName = ListUnit[lstUnitsToShareFrom.SelectedIndex].UnitStat.Name;
                    if (ActiveUnit.UnitStat.DicUnitLink.ContainsKey(OtherUnitName))
                    {
                        UnitLinkType = ActiveUnit.UnitStat.DicUnitLink[OtherUnitName];
                    }

                    if ((UnitLinkType & UnitStats.UnitLinkTypes.MaxHP) == UnitStats.UnitLinkTypes.MaxHP)
                    {
                        cbShareMaxHP.Checked = true;
                    }
                    else
                    {
                        cbShareMaxHP.Checked = false;
                    }

                    if ((UnitLinkType & UnitStats.UnitLinkTypes.MaxEN) == UnitStats.UnitLinkTypes.MaxEN)
                    {
                        cbShareMaxEN.Checked = true;
                    }
                    else
                    {
                        cbShareMaxEN.Checked = false;
                    }

                    if ((UnitLinkType & UnitStats.UnitLinkTypes.RegenEN) == UnitStats.UnitLinkTypes.RegenEN)
                    {
                        cbShareRegenEN.Checked = true;
                    }
                    else
                    {
                        cbShareRegenEN.Checked = false;
                    }

                    if ((UnitLinkType & UnitStats.UnitLinkTypes.Armor) == UnitStats.UnitLinkTypes.Armor)
                    {
                        cbShareArmor.Checked = true;
                    }
                    else
                    {
                        cbShareArmor.Checked = false;
                    }

                    if ((UnitLinkType & UnitStats.UnitLinkTypes.Mobility) == UnitStats.UnitLinkTypes.Mobility)
                    {
                        cbShareMobility.Checked = true;
                    }
                    else
                    {
                        cbShareMobility.Checked = false;
                    }

                    if ((UnitLinkType & UnitStats.UnitLinkTypes.MaxMovement) == UnitStats.UnitLinkTypes.MaxMovement)
                    {
                        cbShareMaxMovement.Checked = true;
                    }
                    else
                    {
                        cbShareMaxMovement.Checked = false;
                    }
                }
            }
        }
Example #5
0
        private void cbUnitShare_CheckedChanged(object sender, EventArgs e)
        {
            if (lstUnits.SelectedIndex >= 0 && lstUnitsToShareFrom.SelectedIndex >= 0)
            {
                Unit   ActiveUnit    = ListUnit[lstUnits.SelectedIndex];
                string OtherUnitName = ListUnit[lstUnitsToShareFrom.SelectedIndex].UnitStat.Name;

                if (!ActiveUnit.UnitStat.DicUnitLink.ContainsKey(OtherUnitName))
                {
                    ActiveUnit.UnitStat.DicUnitLink.Add(OtherUnitName, UnitStats.UnitLinkTypes.None);
                }

                UnitStats.UnitLinkTypes UnitLinkType = UnitStats.UnitLinkTypes.None;

                if (cbShareMaxHP.Checked)
                {
                    UnitLinkType = UnitLinkType | UnitStats.UnitLinkTypes.MaxHP;
                }
                else
                {
                    UnitLinkType = UnitLinkType & ~UnitStats.UnitLinkTypes.MaxHP;
                }

                if (cbShareMaxEN.Checked)
                {
                    UnitLinkType = UnitLinkType | UnitStats.UnitLinkTypes.MaxEN;
                }
                else
                {
                    UnitLinkType = UnitLinkType & ~UnitStats.UnitLinkTypes.MaxEN;
                }

                if (cbShareRegenEN.Checked)
                {
                    UnitLinkType = UnitLinkType | UnitStats.UnitLinkTypes.RegenEN;
                }
                else
                {
                    UnitLinkType = UnitLinkType & ~UnitStats.UnitLinkTypes.RegenEN;
                }

                if (cbShareArmor.Checked)
                {
                    UnitLinkType = UnitLinkType | UnitStats.UnitLinkTypes.Armor;
                }
                else
                {
                    UnitLinkType = UnitLinkType & ~UnitStats.UnitLinkTypes.Armor;
                }

                if (cbShareMobility.Checked)
                {
                    UnitLinkType = UnitLinkType | UnitStats.UnitLinkTypes.Mobility;
                }
                else
                {
                    UnitLinkType = UnitLinkType & ~UnitStats.UnitLinkTypes.Mobility;
                }

                if (cbShareMaxMovement.Checked)
                {
                    UnitLinkType = UnitLinkType | UnitStats.UnitLinkTypes.MaxMovement;
                }
                else
                {
                    UnitLinkType = UnitLinkType & ~UnitStats.UnitLinkTypes.MaxMovement;
                }

                ActiveUnit.UnitStat.DicUnitLink[OtherUnitName] = UnitLinkType;
            }
        }