Пример #1
0
        public void SetListeners(bool enable)
        {
            if (!Application.isPlaying || (enable && m_isListening) || (!enable && !m_isListening))
            {
                return;
            }
            m_isListening = enable;
            if (enable)
            {
                switch (updateMode)
                {
                case QuestCounterUpdateMode.DataSync:
                    MessageSystem.AddListener(this, DataSynchronizer.DataSourceValueChangedMessage, name);
                    break;

                case QuestCounterUpdateMode.Messages:
                    MessageSystem.AddListener(this, QuestMachineMessages.SetQuestCounterMessage, name);
                    MessageSystem.AddListener(this, QuestMachineMessages.IncrementQuestCounterMessage, name);
                    break;

                default:
                    if (Debug.isDebugBuild)
                    {
                        Debug.LogWarning("Quest Machine: Internal error. Unrecognized counter update mode '" + updateMode + "'. Please contact the developer.", m_quest);
                    }
                    break;
                }
                if (messageEventList != null)
                {
                    for (int i = 0; i < messageEventList.Count; i++)
                    {
                        var messageEvent = messageEventList[i];
                        if (messageEvent != null)
                        {
                            MessageSystem.AddListener(this, QuestMachineTags.ReplaceTags(messageEvent.message, m_quest), QuestMachineTags.ReplaceTags(messageEvent.parameter, m_quest));
                        }
                    }
                }
            }
            else
            {
                MessageSystem.RemoveListener(this);
            }
        }
 protected virtual void UnregisterWithMessageSystem()
 {
     MessageSystem.RemoveListener(this, QuestMachineMessages.SetIndicatorStateMessage, string.Empty);
     MessageSystem.RemoveListener(this, QuestMachineMessages.RefreshIndicatorMessage, string.Empty);
     MessageSystem.RemoveListener(this, QuestMachineMessages.RefreshUIsMessage, string.Empty);
 }
Пример #3
0
 public void RemoveListener(int key, Action <object[]> callback)
 {
     _msgSystem.RemoveListener(key, callback);
 }
Пример #4
0
 protected virtual void UnregisterWithMessageSystem()
 {
     MessageSystem.RemoveListener(this);
 }
 private void OnDestroy()
 {
     MessageSystem.RemoveListener(this, "Pause Player", string.Empty);
     MessageSystem.RemoveListener(this, "Unpause Player", string.Empty);
 }
Пример #6
0
 public void OnDisable()
 {
     MessageSystem.RemoveListener(MessageType.SuccessfulInteract, OnSuccessfulInteract);
 }
 protected virtual void OnDisable()
 {
     MessageSystem.RemoveListener(this);
 }
Пример #8
0
 public override void StopChecking()
 {
     base.StopChecking();
     MessageSystem.RemoveListener(this);
 }
 private void OnDisable()
 {
     MessageSystem.RemoveListener(this);
 }
Пример #10
0
 public override void OnDisable()
 {
     base.OnDisable();
     MessageSystem.RemoveListener(this);
 }
Пример #11
0
 public void OnDisable()
 {
     MessageSystem.RemoveListener(MessageType.FinishTask, OnFinishTask);
 }