Esempio n. 1
0
        public void CanOverrideCause(FailureCause cause)
        {
            var failed = new _TestFailed {
                Cause = cause
            };

            Assert.Equal(cause, failed.Cause);
        }
        protected virtual void NotifyFailedToCraft(Item item, FailureCause cause)
        {
            switch (cause)
            {
            case FailureCause.ContainerFull:
                InventoryManager.Notifications.containerFull.Show(this.m_ResultStorageContainer.Name);
                ExecuteEvent <ITriggerFailedToCraftItem>(Execute, item, FailureCause.ContainerFull);
                break;

            case FailureCause.Unknown:
                InventoryManager.Notifications.failedToCraft.Show(item.DisplayName);
                ExecuteEvent <ITriggerFailedToCraftItem>(Execute, item, FailureCause.Unknown);
                break;
            }
        }
Esempio n. 3
0
 protected static void Execute(ITriggerFailedToBuyItem handler, Item item, GameObject player, FailureCause failureCause)
 {
     handler.OnFailedToBuyItem(item, player, failureCause);
 }
        protected void ExecuteEvent <T>(FailureItemEventFunction <T> func, Item item, FailureCause failureCause, bool includeDisabled = false) where T : ITriggerEventHandler
        {
            for (int i = 0; i < this.m_TriggerEvents.Length; i++)
            {
                ITriggerEventHandler handler = this.m_TriggerEvents[i];
                if (ShouldSendEvent <T>(handler, includeDisabled))
                {
                    func.Invoke((T)handler, item, InventoryManager.current.PlayerInfo.gameObject, failureCause);
                }
            }

            string eventID = string.Empty;

            if (this.m_CallbackHandlers.TryGetValue(typeof(T), out eventID))
            {
                CallbackEventData triggerEventData = new CallbackEventData();
                triggerEventData.AddData("Trigger", this);
                triggerEventData.AddData("Player", PlayerInfo.gameObject);
                triggerEventData.AddData("EventData", new PointerEventData(EventSystem.current));
                triggerEventData.AddData("Item", item);
                triggerEventData.AddData("FailureCause", failureCause);
                base.Execute(eventID, triggerEventData);
            }
        }
 protected static void Execute(ITriggerFailedCraftStart handler, Item item, GameObject player, FailureCause failureCause)
 {
     handler.OnFailedCraftStart(item, player, failureCause);
 }