예제 #1
0
 public void LoadChapterSave(Model.IChapterSave chapterSave)
 {
     _chapterSave = chapterSave;
     UnbindEvents();
     PopulateControls();
     BindEvents();
 }
예제 #2
0
        public void LoadChapterSave(Model.IChapterSave chapterSave)
        {
            _chapterSave = chapterSave;
            _timeMachine = new Model.NewGamePlus.TimeMachine(_chapterSave);

            PopulateControls();
        }
예제 #3
0
        private static bool WeaponNameIsInUse(Model.IChapterSave chapterSave, byte nameId)
        {
            bool nameInUse = false;

            nameInUse = chapterSave.ConvoyRegion.Convoy.Any((x) => x.IsNamed && x.WeaponNameID == nameId);

            if (!nameInUse)
            {
                foreach (var unit in chapterSave.UnitRegion.Units)
                {
                    nameInUse |= unit.Item_1.IsNamed && unit.Item_1.WeaponNameID == nameId;
                    nameInUse |= unit.Item_2.IsNamed && unit.Item_2.WeaponNameID == nameId;
                    nameInUse |= unit.Item_3.IsNamed && unit.Item_3.WeaponNameID == nameId;
                    nameInUse |= unit.Item_4.IsNamed && unit.Item_4.WeaponNameID == nameId;
                    nameInUse |= unit.Item_5.IsNamed && unit.Item_5.WeaponNameID == nameId;

                    if (nameInUse)
                    {
                        break;
                    }
                }
            }

            return(nameInUse);
        }
예제 #4
0
        public void LoadChapterSave(Model.IChapterSave chapterSave)
        {
            _chapterSave = chapterSave;

            skills1.LoadChapterSave(_chapterSave);

            PopulateControls();
        }
예제 #5
0
 public Supports(Model.IChapterSave chapterSave, Model.Unit unit)
 {
     _chapterSave = chapterSave;
     _unit        = unit;
     InitializeComponent();
     SetTitle();
     BindEvents();
 }
예제 #6
0
        public static void RemoveWeaponNameIfUnused(Model.IChapterSave chapterSave, byte nameId)
        {
            bool nameInUse = WeaponNameIsInUse(chapterSave, nameId);

            if (!nameInUse)
            {
                chapterSave.WeaponNameRegion.WeaponNames.RemoveAll((x) => x.ID == nameId);
            }
        }
예제 #7
0
 public static void RemoveNamesFromHeldWeaponsWithInvalidNames(Model.IChapterSave chapterSave, Model.Unit unit)
 {
     if (unit.Item_1.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_1.WeaponNameID))
     {
         unit.Item_1.IsNamed = false;
     }
     if (unit.Item_2.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_2.WeaponNameID))
     {
         unit.Item_2.IsNamed = false;
     }
     if (unit.Item_3.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_3.WeaponNameID))
     {
         unit.Item_3.IsNamed = false;
     }
     if (unit.Item_4.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_4.WeaponNameID))
     {
         unit.Item_4.IsNamed = false;
     }
     if (unit.Item_5.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_5.WeaponNameID))
     {
         unit.Item_5.IsNamed = false;
     }
 }
예제 #8
0
        private void LoadFile(string path)
        {
            var saveFile = Model.SaveFile.FromPath(path);

            if (saveFile.Type != Enums.SaveFileType.Chapter &&
                saveFile.Type != Enums.SaveFileType.Map &&
                saveFile.Type != Enums.SaveFileType.Global)
            {
                MessageBox.Show("This type of save is not supported yet. Only 'Chapter', 'Map', and 'Global' saves are supported right now.");
                return;
            }
            else
            {
                _saveFile = saveFile;
            }

            UpdateTitleBar(path);

            Cursor.Current = Cursors.WaitCursor;

            switch (_saveFile.Type)
            {
            case Enums.SaveFileType.Chapter:
            case Enums.SaveFileType.Map:
                if (_saveFile.Type == Enums.SaveFileType.Chapter)
                {
                    _chapterSave = Model.ChapterSave.FromSaveFile(_saveFile);
                }
                else if (_saveFile.Type == Enums.SaveFileType.Map)
                {
                    _chapterSave = Model.MapSave.FromSaveFile(_saveFile);
                }

                _globalSave = null;

                LoadChapterData();
                LoadUnitViewer();

                tabChapterData.Enabled = true;
                tabUnitViewer.Enabled  = true;
                tabMegacheats.Enabled  = true;
                tabConvoy.Enabled      = true;
                tabGlobalData.Enabled  = false;

                break;

            case Enums.SaveFileType.Global:
                _globalSave  = Model.GlobalSave.FromSaveFile(_saveFile);
                _chapterSave = null;

                LoadGlobalData();

                tabChapterData.Enabled = false;
                tabUnitViewer.Enabled  = false;
                tabMegacheats.Enabled  = false;
                tabConvoy.Enabled      = false;
                tabGlobalData.Enabled  = true;

                break;

            default: break;
            }

            Cursor.Current = Cursors.AppStarting;

            tabControl1.Enabled = true;
        }
예제 #9
0
 public void LoadUnit(Model.IChapterSave chapterSave, Model.Unit unit)
 {
     _chapterSave = chapterSave;
     _unit        = unit;
     PopulateControls();
 }
예제 #10
0
 public Randomizer(Model.IChapterSave chapterSave)
 {
     _rng         = new Random();
     _chapterSave = chapterSave;
 }
예제 #11
0
 public void LoadItem(Model.IChapterSave chapterSave, Model.ConvoyItem convoyItem)
 {
     _chapterSave = chapterSave;
     _item        = convoyItem;
     PopulateControls();
 }
예제 #12
0
 public TimeMachine(Model.IChapterSave chapterSave)
 {
     _chapterSave = chapterSave;
 }
예제 #13
0
 public static void RemoveAllUnusedWeaponNames(Model.IChapterSave chapterSave)
 {
     chapterSave.WeaponNameRegion.WeaponNames.RemoveAll((x) => !WeaponNameIsInUse(chapterSave, x.ID));
 }