Пример #1
0
        private async void SendCommand()
        {
            byte[]      CommandData = this.Command.ToByteArray();
            CardCommand Command     = new CardCommand(CommandData);


            try
            {
                this.IsSending = true;
                CardResponse Response = await this.CardReader.SmartCard.TransmitAsync(Command);

                this.SetAndInvoke(nameof(this.LastCommand), ref this.lastCommand, Command.ToString());
                this.SetAndInvoke(nameof(this.LastResponse), ref this.lastResponse, Response.ToString());
            }
            catch (Exception Exception)
            {
                this.commonDialogProvider.ShowError(Exception);
            }
            finally
            {
                this.IsSending = false;
            }
        }
Пример #2
0
        public void AddCommand(CardCommand command, int index)
        {
            Debug.Log(string.Format("[{0}] wants to add {1}, index={2}", DataService.GetName(Data.Code), command.ToString(), index));
            var    button   = ButtonPool.New();
            int    response = 0;
            string text;

            switch (command)
            {
            case CardCommand.Summon:
                text     = DataService.SysString(1151);
                response = index << 16;
                break;

            case CardCommand.SpSummon:
                text     = DataService.SysString(1152);
                response = (index << 16) + 1;
                break;

            case CardCommand.MSet:
                text     = DataService.SysString(1153);
                response = (index << 16) + 3;
                break;

            case CardCommand.SSet:
                text     = DataService.SysString(1153);
                response = (index << 16) + 4;
                break;

            case CardCommand.Repos:
                if ((Position & (int)CardPosition.FaceDown) > 0)
                {
                    text = DataService.SysString(1154);
                }
                else if ((Position & (int)CardPosition.Attack) > 0)
                {
                    text = DataService.SysString(1155);
                }
                else
                {
                    text = DataService.SysString(1156);
                }
                response = (index << 16) + 2;
                break;

            case CardCommand.Attack:
                //attackIndicator = AttackIndicator.AddNew(RealPosition + new Vector3(0, 0.2f, 0), Controller);
                text     = DataService.SysString(1157);
                response = (index << 16) + 1;
                break;

            default:
                text = "???";
                break;
            }
            button.Set(text, response, Transform);
            buttons.Add(button);
            for (int i = 0; i < buttons.Count; ++i)
            {
                buttons[i].ButtonObject.transform.localPosition = new Vector3(0, -2 * (buttons.Count - 1) * 0.5f + i * 2, -0.1f);
            }
        }