Ejemplo n.º 1
0
        private void OnTradeStart(Object sender, EventArgs e)
        {
            String  text    = "TradingScreen/" + m_tradingBackgroundName;
            Texture texture = Helper.ResourcesLoad <Texture>(text);

            if (texture == null)
            {
                Debug.LogError("Could not load texture from: " + text);
            }
            if (m_background.mainTexture != texture)
            {
                Texture mainTexture = m_background.mainTexture;
                m_background.mainTexture = texture;
                if (mainTexture != null)
                {
                    mainTexture.UnloadAsset();
                }
            }
            NPCTradeEventArgs npctradeEventArgs = e as NPCTradeEventArgs;

            if (npctradeEventArgs != null)
            {
                TradingScreen.ItemContainer.SetInventory(npctradeEventArgs.Inventory);
            }
            ToggleTrade();
            PartyScreen.OpenInventoryTab();
        }
        public void StopTrading()
        {
            m_isTrading = false;
            LegacyLogic.Instance.ConversationManager._ShowNPCs();
            NPCTradeEventArgs p_eventArgs = new NPCTradeEventArgs(this);

            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.NPC_TRADE_STOP, p_eventArgs);
        }
        public void StartTrade()
        {
            m_inventory.Clear();
            m_isTrading = true;
            foreach (TradingItemOffer tradingItemOffer in m_offers)
            {
                if (tradingItemOffer.CheckConditions(m_npc) == EDialogState.NORMAL)
                {
                    tradingItemOffer.AddItemsToInventory(this);
                }
            }
            LegacyLogic.Instance.ConversationManager._HideNPCs();
            NPCTradeEventArgs p_eventArgs = new NPCTradeEventArgs(this);

            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.NPC_TRADE_START, p_eventArgs);
        }