Пример #1
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtProvider.Text))
                {
                    txtProvider.Error = Context.GetString(Resource.String.fragment_msg);
                    return;
                }
                _card             = new Card();
                _card.ProiderName = txtProvider.Text;
                _card.Prefix      = txtPrefix.Text;
                _card.Suffix      = txtSuffix.Text;
                _card.IsSelected  = true;
                _card.Position    = position;

                providerEventArgs args = new providerEventArgs(_card);
                CardAdded?.Invoke(this, args);

                this.Dismiss();
            }
            catch (Exception ex)
            {
                Log.Error("GetUserSetting", ex.Message);
            }
        }
Пример #2
0
    public void Add(Card card)
    {
        if (card == null)
        {
            return;
        }

        GameObject cardGameObject = card.Create();

        CardStackEntry.Attach(cardGameObject, card, this);

        Vector3 destination = transform.position + new Vector3(Random.Range(0, 0.2f), Random.Range(-0.2f, 0.1f), 0) + new Vector3((cardGameObjects.Count - 1) * 0.5f, 0);

        cardGameObject.transform.localScale = new Vector3(0.5f, 0.5f, 1);
        cardGameObject.transform.Rotate(0, 0, Random.Range(destination.x <= 0 ? 0 : -2.5f, 2.5f));

        cardGameObject.transform.position = transform.position + new Vector3(7.5f, 5, -transform.position.z);
        cardGameObject.transform.SetParent(transform, true);

        int oldValue = Value.NumberValue;

        cardGameObject.GetComponent <SpriteRenderer>().sortingOrder = cardGameObjects.Count + 1;
        cardGameObjects.Add(cardGameObject);
        cards.Add(card);

        cardMovementLerpInformations.Add(cardGameObjects.Count - 1,
                                         new LerpInformation <Vector3>(cardGameObject.transform.position, destination, 0.5f, Vector3.Lerp));

        CardAdded?.Invoke(this, new CardAddedEventArgs(this, card));
        ValueChanged?.Invoke(this, new ValueChangedEventArgs(oldValue, Value.NumberValue));
    }
Пример #3
0
    public void Add(T card, DeckPosition position = DeckPosition.Top)
    {
        if (card == null)
        {
            return;
        }
        int targetIndex = GetIndexFromPosition(position);

        if (targetIndex == LastIndex)
        {
            cards.Add(card);
        }
        else
        {
            cards.Insert(targetIndex, card);
        }
        CardAdded?.Invoke(card);
    }
Пример #4
0
    public void Add(T card, DeckPosition position = DeckPosition.Top)
    {
        //bodyguard
        if (card == null)
        {
            return;
        }

        int targetIndex = GetIndexFromPosition(position);

        // to add it to 'Top' we actually want to add it at the end, by default Inset() moves the current index upwards
        if (targetIndex == LastIndex)
        {
            _cards.Add(card);
        }
        else
        {
            _cards.Insert(targetIndex, card);
        }
        CardAdded?.Invoke(card);
    }
Пример #5
0
        private void Monitor_CardInserted(object sender, CardStatusEventArgs args)
        {
            if (blockCardEvents > 0)
            {
                return;
            }

            CardAdded?.Invoke(args.ReaderName);
            StatusMessage?.Invoke("Tag detected on " + args.ReaderName);

            try
            {
                HandleSmartCard(args.ReaderName);
            }
            catch (Exception e)
            {
                ErrorMessage?.Invoke("Error handling tag: " + e.Message);
            }

            CardHandlingDone?.Invoke(args.ReaderName);
        }
Пример #6
0
    public void Push(int card)
    {
        cards.Add(card);

        CardAdded?.Invoke(this, new CardEventArgs(card));
    }