Beispiel #1
0
        public void SetIsEnabled(Gem gem, int skillIndex, bool isEnabled)
        {
            var key = new DictKey(gem, skillIndex);

            if (_enabledDict.TryGetValue(key, out var value) && value == isEnabled)
            {
                return;
            }
            _enabledDict[key] = isEnabled;
            EnabledChangedForSlots?.Invoke(this, new[] { key.Tuple.itemSlot });
        }
Beispiel #2
0
        public void FromJson(JToken json)
        {
            var slots = _enabledDict.Keys.Select(k => k.Tuple.itemSlot).ToHashSet();

            _enabledDict.Clear();
            foreach (var representation in json.ToObject <JsonRepresentation[]>() !)
            {
                slots.Add(representation.ItemSlot);
                _enabledDict[new DictKey(representation)] = representation.IsEnabled;
            }
            EnabledChangedForSlots?.Invoke(this, slots);
        }