private void AddFightEventListener(ReserveCompanionStatus companionStatus, EventCategory eventCategory, bool status)
        {
            Dictionary <EventCategory, List <int> > dictionary = status ? m_companionsPerCategoryInvalidatingStatus : m_companionsPerCategoryInvalidatingView;

            if (!dictionary.TryGetValue(eventCategory, out List <int> value))
            {
                value = new List <int>();
                dictionary.Add(eventCategory, value);
                if (status)
                {
                    FightLogicExecutor.AddListenerUpdateStatus(companionStatus.ownerPlayer.fightId, OnCastingValidityUpdated, eventCategory);
                }
                else
                {
                    FightLogicExecutor.AddListenerUpdateView(companionStatus.ownerPlayer.fightId, OnCastingValidityViewUpdated, eventCategory);
                }
            }
            value.Add(companionStatus.definition.get_id());
        }
Exemple #2
0
        private void AddFightEventListeners(SpellStatus spellStatus, IEnumerable <EventCategory> eventsToAdd, bool status)
        {
            Dictionary <EventCategory, List <int> > dictionary = status ? m_spellsPerCategoryInvalidatingStatus : m_spellsPerCategoryInvalidatingView;

            foreach (EventCategory item in eventsToAdd)
            {
                if (!dictionary.TryGetValue(item, out List <int> value))
                {
                    value = new List <int>();
                    dictionary.Add(item, value);
                    if (status)
                    {
                        FightLogicExecutor.AddListenerUpdateStatus(spellStatus.ownerPlayer.fightId, OnCastingValidityUpdated, item);
                    }
                    else
                    {
                        FightLogicExecutor.AddListenerUpdateView(spellStatus.ownerPlayer.fightId, OnCastingValidityViewUpdated, item);
                    }
                }
                value.Add(spellStatus.instanceId);
            }
        }