コード例 #1
0
        private void Initialize(IList <CombatActButton> buttons)
        {
            var acts        = _combatActModule.CalcCombatActs();
            var actsOrdered = acts.OrderBy(x => x.Scheme?.Sid).Take(MAX_COMBAT_ACT_COUNT).ToArray();

            foreach (var act in actsOrdered)
            {
                var tags = act.Scheme?.Stats?.Tags?.Where(x => x != null)?.Select(x => x !)?.ToArray() ??
                           Array.Empty <string>();
                var button = new CombatActButton(_uiContentStorage.GetButtonTexture(),
                                                 _uiContentStorage.GetCombatActIconTexture(act.Scheme?.Sid, tags),
                                                 selectedMarkerTexture: _uiContentStorage.GetSelectedButtonMarkerTexture(),
                                                 _buttonGroup,
                                                 act,
                                                 new Rectangle(0, 0, COMBAT_ACT_BUTTON_SIZE, COMBAT_ACT_BUTTON_SIZE));

                button.OnClick += (s, e) =>
                {
                    _sectorUiState.TacticalAct = act;
                    _buttonGroup.Selected      = (CombatActButton?)s;
                };

                if (act == _sectorUiState.TacticalAct)
                {
                    _buttonGroup.Selected = button;
                }

                buttons.Add(button);
            }
        }