コード例 #1
0
        public void SaveUnits(bool isInit = false)
        {
            var unitsList = new List <UnitLoadObject>();

            foreach (var unit in _unitsController.GetUnits())
            {
                var unitObject = new UnitLoadObject
                {
                    key        = unit.Key,
                    experience = unit.Experience,
                    level      = unit.Level,
                    isLocked   = unit.IsLocked,
                    outfit     = unit.Outfit
                };

                unitsList.Add(unitObject);
            }

            var units = new UnitsLoadObject
            {
                groupCount = _unitsController.GroupCount,
                units      = unitsList
            };

            _saveObject.unitsInfo = units;

            if (!isInit)
            {
                Save();
            }
        }
コード例 #2
0
        public void CreateUnits()
        {
            if (_cells.Count != 0)
            {
                RemoveUnits();
            }

            var battleSection = _partyMenuController.Battle;
            var attackTypes   = battleSection.ActiveCell.AttackTypes;
            var allyUnits     = battleSection.AllyUnits;
            var units         = _unitsController.GetUnits()
                                .Where(x => attackTypes.Any(y => x.AttackType == y))
                                .Where(x => allyUnits.All(y => x != y.Unit))
                                .OrderBy(x => x.UnitType)
                                .ToList();

            foreach (var unit in units)
            {
                var cell = _unitCellFactory.Create(parent);
                cell.SetProductData(unit);
            }

            var rectTransform = parent.GetComponent <RectTransform>();
            var width         = 240 * units.Count + 10 * (units.Count - 1);

            rectTransform.sizeDelta = new Vector2(width, 240);

            _cells[0].SetActiveItem();
        }
コード例 #3
0
        public void InitData()
        {
            foreach (var cell in _enemyUnits)
            {
                var unit = _unitsController.GetUnits().First();
                cell.SetData(unit);
            }

            ActiveCell = _allyUnits[0];
            ActiveCell.SetActiveCell();
        }
コード例 #4
0
        public void SetUnitsData()
        {
            var units = _unitsController.GetUnits()
                        .Where(x => x.UnitType == ActiveType).ToList();

            for (var i = 0; i < units.Count; i++)
            {
                _units[i].SetProductData(units[i]);
            }

            _units[0].SetActiveItem();
        }