Пример #1
0
        protected override void OnDropEvent()
        {
            if (UIDragDropHandler.CurrentData == null)
            {
                if (UIDragDropHandler.Active)
                {
                    UIDragDropHandler.Return();
                }
                return;
            }
            if (UIDragDropHandler.CurrentData.Get <InventoryItem>()?.Identified ?? false)
            {
                UIFloatingText.Spawn("Doesn't need to be identified", transform as RectTransform, Color.green, UIFloatingText.Orietation.Center);
                UIDragDropHandler.Return();
                return;
            }
            var price = GameOptions.IdentifyEstimate(UIDragDropHandler.CurrentData);

            if (Player.Currency.Value < price)
            {
                UIFloatingText.Spawn(string.Format("Identify Cost: {0} Not enough {1}", price, GameLabels.Currency), transform as RectTransform, Color.green, UIFloatingText.Orietation.Center);
                UIDragDropHandler.Return();
                return;
            }
            UIModalQuestion.Set(ConfirmIdentify, string.Format("Identify for {0} {1}?", price, GameLabels.Currency));
        }
Пример #2
0
 public void SetInputListen(InputMapper.Context context)
 {
     PlayerInput.AllInputBlocked = true;
     _inputMapper.Start(context);
     UIModalQuestion.Set((int i) => {
         PlayerInput.AllInputBlocked = false;
         _inputMapper.Stop();
     }, "Press the new button", "Cancel");
 }
Пример #3
0
 private void OnStopped(InputMapper.StoppedEventData data)
 {
     UIModalQuestion.Stop();
     PlayerInput.AllInputBlocked = false;
     ReInput.userDataStore.Save();
     for (int i = 0; i < _targetOptions.Count; i++)
     {
         ItemPool.Despawn(_targetOptions[i]);
     }
     _targetOptions.Clear();
     RefreshControls();
 }
Пример #4
0
        private void SellClickDel(UISimpleGameDataButton button, PointerEventData.InputButton buttonEvent)
        {
            var item = button.Data.Get <InventoryItem>();

            if (item == null)
            {
                return;
            }
            if (Player.MainInventory.IsFull)
            {
                FloatingText(button.RectTransform, "Inventory full");
                return;
            }
            var price = GameOptions.PriceEstimateSell(item.GetEntity());

            _currentButton = button;
            UIModalQuestion.Set(CheckSell, string.Format("Sell for {0} {1}?", price, GameLabels.Currency));
        }
Пример #5
0
        private void TryBuy()
        {
            if (Data == null)
            {
                return;
            }
            if (Player.MainInventory.IsFull)
            {
                StatusMessages("Inventory full");
                return;
            }
            var sellPrice = RulesSystem.TotalPrice(InventoryItem);

            if (Player.DefaultCurrencyHolder.Value < sellPrice)
            {
                StatusMessages(string.Format("Costs {0}, Not enough {1}", sellPrice, GameText.DefaultCurrencyLabel));
                return;
            }
            UIModalQuestion.Set(CheckBuy, string.Format("Buy for {0} {1}?", sellPrice, GameText.DefaultCurrencyLabel));
        }
Пример #6
0
        private void TryBuy()
        {
            if (Data == null)
            {
                return;
            }
            if (Player.MainInventory.IsFull)
            {
                StatusMessages(null, "Inventory full");
                return;
            }
            var sellPrice = InventoryItem.TotalPrice();

            if (Player.Currency.Value < sellPrice)
            {
                StatusMessages(null, string.Format("Costs {0}, Not enough {1}", sellPrice, GameLabels.Currency));
                return;
            }
            UIModalQuestion.Set(CheckBuy, string.Format("Buy for {0} {1}?", sellPrice, GameLabels.Currency));
        }
Пример #7
0
        private void BuyClickDel(UISimpleGameDataButton button, PointerEventData.InputButton buttonEvent)
        {
            var item = button.Data.Get <InventoryItem>();

            if (item == null)
            {
                return;
            }
            if (Player.MainInventory.IsFull)
            {
                FloatingText(button.RectTransform, "Inventory full");
                return;
            }
            var sellPrice = item.TotalPrice();

            if (Player.Currency.Value < sellPrice)
            {
                FloatingText(button.RectTransform, string.Format("Costs {0}, Not enough {1}", sellPrice, GameLabels.Currency));

                return;
            }
            _currentButton = button;
            UIModalQuestion.Set(CheckBuy, string.Format("Buy for {0} {1}?", sellPrice, GameLabels.Currency));
        }
Пример #8
0
 private void CheckQuit(int index)
 {
     UIModalQuestion.Set(QuitConfirm, "Are you sure you want to Quit?", "Yes", "No");
 }