Пример #1
0
        public MapView(Provinces provinces, Units units,
            RenderInstruction[][] standardInstrs,
            RenderInstruction[][] idleInstrs,
            DialogManager dialogMgr, Wars wars)
        {
            _provinces = provinces;
            _units = units;
            _wars = wars;
            _dialogMgr = dialogMgr;
            _provinceSelection = new ProvinceSelection();
            _unitsSelection = new UnitsSelection();
            _standardInstrs = standardInstrs;
            _idleInstrs = idleInstrs;
            _labelBoxes = provinces.Boundaries.Select(mpoly => mpoly.Polys[0].FindBestLabelBox()).ToArray();

            // The boundary depends on the size of the army text,
            // so the actual boxes are written in the draw method.
            _labelClickableBoundaries = new Dictionary<int, AABB>();

            _units.OnDelete += _unitsSelection.Deselect;
        }
        public void Read()
        {
            UnitsSelection initialUnitsSelection = UnitsSelection.United_States_Customary_Units_IP;

            string appSettingsUnitsSelection = null;

            try
            {
                //appSettingsUnitsSelection = Properties.Settings.Default.UnitsSelection;
            }
            catch
            { }

            if (string.IsNullOrWhiteSpace(appSettingsUnitsSelection))
            {
                _UnitsSelection = initialUnitsSelection;
            }
            else if (Enum.TryParse <UnitsSelection>(appSettingsUnitsSelection, out initialUnitsSelection))
            {
                _UnitsSelection = initialUnitsSelection;
            }
        }