Example #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));
        }
Example #2
0
        void Update()
        {
            if (!Game.GameActive || PlayerInput.IsCursorOverUI)
            {
                return;
            }
            bool leftClick  = CheckLeftClick();
            bool rightClick = CheckRightClick();

            if (!leftClick && !rightClick)
            {
                _cam.UpdateInput();
                return;
            }
            _mouseRay = WorldControlMonitor.Cam.ScreenPointToRay(Input.mousePosition);
            var cnt = Physics.RaycastNonAlloc(_mouseRay, _hits, _rayDistance, _mask);

            _hits.SortByDistanceAsc(cnt);
            for (int i = 0; i < cnt; i++)
            {
                var   hit   = _hits[i];
                Actor actor = Actor.Get(hit.collider);
                if (actor != null)
                {
                    if (leftClick)
                    {
                        if (actor.Faction == Factions.Enemy && Player.SelectedActor != null)
                        {
                            var attack = Player.SelectedActor.GetAttack(Player.SelectedActor.ActionDistance(UICenterTarget.CurrentActor));
                            if (!attack.TryStart(UICenterTarget.CurrentActor))
                            {
                                UIFloatingText.Spawn(attack.LastStatusUpdate, 2f, Player.SelectedActor.PartySlot.RectTr, Color.yellow);
                            }
                        }
                        //else {
                        //    var playActor = actor as PlayerActor;
                        //    if (playActor != null) {
                        //        Player.SelectedActor = playActor;
                        //    }
                        //}
                    }
                    if (rightClick)
                    {
                        UIActionController.main.OpenRadial(actor);
                    }
                    continue;
                }
                if (LayerMasks.Environment.ContainsLayer(hit.transform.gameObject.layer))
                {
                    if (Player.SelectedActor != null)
                    {
                        var info = CellGridGraph.Current.GetNearest(hit.point, _constraint);
                        if (info.node != null)
                        {
                            Player.SelectedActor.StateController.MoveTo((Vector3)info.node.position);
                        }
                    }
                }
            }
        }
 private void StatusMessages(Entity item, string message)
 {
     if (_statusTimer.IsActive)
     {
         return;
     }
     _statusTimer.StartTimer();
     UIFloatingText.Spawn(message, transform as RectTransform, Color.yellow, _textOrientation);
 }
 protected void StatusMessages(string message, Color color)
 {
     if (_statusTimer.IsActive)
     {
         return;
     }
     _statusTimer.StartTimer();
     UIFloatingText.Spawn(message, transform as RectTransform, color, UIFloatingText.Orietation.Center);
 }
Example #5
0
        private void ChangeText()
        {
            var difference = Player.DefaultCurrencyHolder.Value - _lastValue;

            if (difference > 0)
            {
                UIFloatingText.Spawn(string.Format("+{0}", difference.ToString("F0")), 2.5f, transform as RectTransform, Color.green);
            }
            else if (difference < 0)
            {
                UIFloatingText.Spawn(string.Format("-{0}", difference.ToString("F0")), 2.5f, transform as RectTransform, Color.red);
            }
            _lastValue     = Player.DefaultCurrencyHolder.Value;
            _currency.text = _lastValue.ToString("F0");
        }
Example #6
0
        private void ConfirmRepair(int id)
        {
            if (id > 0 || UIDragDropHandler.CurrentData == null)
            {
                if (UIDragDropHandler.Active)
                {
                    UIDragDropHandler.Return();
                }
                return;
            }
            var price = GameOptions.RepairEstimate(UIDragDropHandler.CurrentData);

            UIFloatingText.Spawn(string.Format("Repaired for {0} {1}", price, GameText.DefaultCurrencyLabel), transform as RectTransform, Color.green, UIFloatingText.Orietation.Center);
            Player.DefaultCurrencyHolder.AddToValue(-price);
            //UIDragDropHandler.CurrentData.Durability.SetMax();
            UIDragDropHandler.Return();
        }
Example #7
0
        private void ConfirmIdentify(int id)
        {
            if (id > 0 || UIDragDropHandler.CurrentData == null)
            {
                if (UIDragDropHandler.Active)
                {
                    UIDragDropHandler.Return();
                }
                return;
            }
            var price = GameOptions.IdentifyEstimate(UIDragDropHandler.CurrentData);

            UIFloatingText.Spawn(string.Format("Identified for {0} {1}", price, GameLabels.Currency), transform as RectTransform, Color.green, UIFloatingText.Orietation.Center);
            Player.Currency.AddToValue(-price);
            UIDragDropHandler.CurrentData.Get <InventoryItem>(i => i.Identified = true);
            UIDragDropHandler.Return();
        }
Example #8
0
 private void FloatingText(RectTransform rectTr, string text)
 {
     UIFloatingText.Spawn(text, rectTr, Color.red, UIFloatingText.Orietation.Center);
 }