コード例 #1
0
    public void SetupUserInterface(CardCommand FirstCom, CardCommand SecondCom)
    {
        // Dynamically generates action icons based on card info passed in
        int ChooseBase = 0;

        // Use blue card base if both actions are moves, red otherwise
        if ((FirstCom == CardCommand.CC_MoveLeft ||
             FirstCom == CardCommand.CC_MoveRight ||
             FirstCom == CardCommand.CC_MoveUp ||
             FirstCom == CardCommand.CC_MoveDown)
            &&
            (SecondCom == CardCommand.CC_MoveLeft ||
             SecondCom == CardCommand.CC_MoveRight ||
             SecondCom == CardCommand.CC_MoveUp ||
             SecondCom == CardCommand.CC_MoveDown))
        {
            ChooseBase = 1;
        }

        renderer.material = BaseMaterials[ChooseBase];


        if ((int)FirstCom < CommandTextures.Length && FirstCommand != null)
        {
            FirstCommand.renderer.material.mainTexture = CommandTextures[(int)FirstCom];
        }

        if ((int)SecondCom < CommandTextures.Length && SecondCommand != null)
        {
            SecondCommand.renderer.material.mainTexture = CommandTextures[(int)SecondCom];
        }
    }
コード例 #2
0
ファイル: SmartCard.cs プロジェクト: whiletrue-eu/libraries
        public Task <CardResponse> TransmitAsync(CardCommand command, IVariableResolver resolver)
        {
            this.CheckRemoved();
            this.CheckConnected();

            return(this.reader.TransmitAsync(command, resolver));
        }
コード例 #3
0
ファイル: FormEditorControl.cs プロジェクト: xmatakt/DP
        private void ApplyLastCommand()
        {
            CardCommand command = Commands.Last();

            if (command != null)
            {
                switch (command.Command)
                {
                case Enums.CardCommandEnum.MoveUp:
                    command.Card.MoveDown(true);
                    break;

                case Enums.CardCommandEnum.MoveDown:
                    command.Card.MoveUp(true);
                    break;

                case Enums.CardCommandEnum.Add:
                    command.Card.RemoveCard(true);
                    break;

                case Enums.CardCommandEnum.Remove:
                    command.Card.IsRemoved = false;
                    command.Card.Visible   = true;
                    break;

                default:
                    break;
                }
                Commands.Remove(command);
                UpdateBackButtonVisibility();
                RedrawFormular();
                command.Card.Focus();
            }
        }
コード例 #4
0
        public CardResponse Transmit(CardCommand command)
        {
            this.LogCommand(command, "");
            CardResponse Response = this.Channel.Transmit(command);

            this.LogResponse(Response, "");
            return(Response);
        }
コード例 #5
0
 private void MouseEvent()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (GlobalBattleInfo.PlayerFocusCard != null && GlobalBattleInfo.PlayerFocusCard.IsPrePrepareToPlay)
         {
             GlobalBattleInfo.PlayerPlayCard = GlobalBattleInfo.PlayerFocusCard;
         }
         if (GlobalBattleInfo.IsWaitForSelectRegion)
         {
             GlobalBattleInfo.SelectRegion = GlobalBattleInfo.PlayerFocusRegion;
         }
         if (GlobalBattleInfo.IsWaitForSelectLocation)
         {
             if (GlobalBattleInfo.PlayerFocusRegion != null && GlobalBattleInfo.PlayerFocusRegion.CanBeSelected)
             {
                 //print("选择位置" + GlobalBattleInfo.PlayerFocusRegion.Rank);
                 GlobalBattleInfo.SelectRegion   = GlobalBattleInfo.PlayerFocusRegion;
                 GlobalBattleInfo.SelectLocation = GlobalBattleInfo.PlayerFocusRegion.Rank;
             }
         }
         // print($"所在行为{GlobalBattleInfo.PlayerFocusCard.Row},所在坐标为{GlobalBattleInfo.PlayerFocusCard.Location}");
     }
     if (Input.GetMouseButton(0))
     {
         LayerMask mask = 1 << LayerMask.NameToLayer("Default");
         if (Physics.Raycast(ray, out RaycastHit HitInfo, 100, mask))
         {
             GlobalBattleInfo.DragToPoint = HitInfo.point;
         }
     }
     if (Input.GetMouseButtonUp(0))
     {
         if (GlobalBattleInfo.PlayerPlayCard != null)
         {
             if (GlobalBattleInfo.PlayerFocusRegion != null)
             {
                 if (GlobalBattleInfo.PlayerFocusRegion.name == "我方_墓地")
                 {
                     _ = CardCommand.DisCard();
                 }
                 else if (GlobalBattleInfo.PlayerFocusRegion.name == "我方_手牌")
                 {
                     GlobalBattleInfo.PlayerPlayCard = null;
                 }
                 else
                 {
                     _ = CardCommand.PlayCard();
                 }
             }
             else
             {
                 _ = CardCommand.PlayCard();
             }
         }
     }
 }
コード例 #6
0
ファイル: FormEditorControl.cs プロジェクト: xmatakt/DP
        public void AddCommand(CardCommand command)
        {
            if (Commands == null)
            {
                Commands = new List <CardCommand>();
            }

            Commands.Add(command);
            UpdateBackButtonVisibility();
        }
コード例 #7
0
 internal CardCommand GetNextCommand(CardCommand command, CardResponse response)
 {
     foreach (AutoResponseTrigger Trigger in this.InnerList)
     {
         if (Trigger.IsMatch(command, response))
         {
             return(Trigger.GetCommand(command, response));
         }
     }
     return(null);
 }
コード例 #8
0
ファイル: RowControl.cs プロジェクト: red-gezi/TouHouCard
        public async Task CreatTempCard()
        {
            //print("创建临时卡片"+ RowsInfo.GetRegionCardList(RegionName_Other.My_Uesd).ThisRowCard[0].CardId);

            SingleInfo.TempCard = await CardCommand.CreatCard(RowsInfo.GetRegionCardList(RegionName_Other.My_Uesd).ThisRowCard[0].CardId);

            SingleInfo.TempCard.IsTemp   = true;
            SingleInfo.TempCard.IsCanSee = true;
            SingleInfo.ThisRowCard.Insert(SingleInfo.Rank, SingleInfo.TempCard);
            SingleInfo.TempCard.Init();
        }
コード例 #9
0
        internal CardCommand GetCommand(CardCommand command, CardResponse response)
        {
            this.commandMatch  = this.originalCommandTrigger.Match(Conversion.ToHexString(command.Serialize()));
            this.responseMatch = this.originalResponseTrigger.Match(Conversion.ToHexString(response.Serialize()));

            string DynamicCommand = this.Resolve(this.dynamicCommandConstructionExpression);

            this.commandMatch  = null;
            this.responseMatch = null;

            return(new CardCommand(Conversion.ToByteArray(DynamicCommand)));
        }
コード例 #10
0
        private void ClearDisplay()
        {
            CardCommand Command = new CardCommand();

            Command.Cla = 0x20;
            Command.Ins = 0x17;
            Command.P1  = 0x40;             // Display
            Command.P2  = 0x00;
            Command.AppendData(0x50, 0x00); //Display empty message (->reset to default message)

            this.SendCommandToReader(Command);
        }
コード例 #11
0
        public CardResponse Transmit(CardCommand command)
        {
            CardResponse Response            = this.channel.Transmit(command);
            CardCommand  AutoResponseCommand = this.autoResponseTrigger.GetNextCommand(command, Response);

            if (AutoResponseCommand != null)
            {
                return(this.channel.Transmit(AutoResponseCommand));
            }
            else
            {
                return(Response);
            }
        }
コード例 #12
0
 /// <summary>
 /// Transmits the given command to the card. If the command conatins variables, teh variables are resolved using the <see cref="ResolveVariable"/> method.
 /// </summary>
 protected internal CardResponse Transmit(CardCommand command, IVariableResolver resolver)
 {
     if (command is VariableCardCommand)
     {
         //Resolve variables
         VariableCardCommand VariableCommand = (VariableCardCommand)command;
         foreach (Variable Variable in VariableCommand.Variables)
         {
             if (Variable.IsResolved == false)
             {
                 this.ResolveVariable(Variable, resolver);
             }
         }
     }
     return(new CardResponse(this.Transmit(command.Serialize(this.SmartCard.Protocol == Protocol.T1))));
 }
コード例 #13
0
        public async Task <string> CardCommand(string cardName)
        {
            var msg = string.Empty;

            var command = new CardCommand();

            command.Execute(new Message()
            {
                Text = "/c " + cardName, Chat = new Chat()
                {
                    Id = 186070199
                }
            }, await Bot.Get(), context);

            return(msg);
        }
コード例 #14
0
ファイル: CardManager.cs プロジェクト: TylerPham9/GGJ14
    public void GenerateValues(bool bIsPureMove)
    {
        if (bIsPureMove)
        {
            FirstCommand  = (CardCommand)Random.Range(0, (int)CardCommand.CC_MoveDown + 1);
            SecondCommand = (CardCommand)Random.Range(0, (int)CardCommand.CC_MoveDown + 1);

//			Debug.Log("Card Generated: 1st: " + FirstCommand.ToString() + ", 2nd: " + SecondCommand.ToString());
        }
        else
        {
            FirstCommand  = (CardCommand)Random.Range(0, (int)CardCommand.CC_LASTINDEX);
            SecondCommand = (CardCommand)Random.Range(0, (int)CardCommand.CC_LASTINDEX);

//			Debug.Log("Card Generated: 1st: " + FirstCommand.ToString() + ", 2nd: " + SecondCommand.ToString());
        }

        // We need to prevent redundant movements - if it's redundant, we're just going to double up
        // @ZackM: THIS IS ALSO BAD CODE. AAAHHHHHHHH!!!!
        bool bIsRedundant = false;

        switch (FirstCommand)
        {
        case CardCommand.CC_MoveDown:
            bIsRedundant = (SecondCommand == CardCommand.CC_MoveUp);
            break;

        case CardCommand.CC_MoveLeft:
            bIsRedundant = (SecondCommand == CardCommand.CC_MoveRight);
            break;

        case CardCommand.CC_MoveRight:
            bIsRedundant = (SecondCommand == CardCommand.CC_MoveLeft);
            break;

        case CardCommand.CC_MoveUp:
            bIsRedundant = (SecondCommand == CardCommand.CC_MoveDown);
            break;
        }

        if (bIsRedundant)
        {
//			Debug.Log("Redundancy detected, doubling up move");
            SecondCommand = FirstCommand;
        }
    }
コード例 #15
0
        private void DisplayMessage(string message, TimeSpan duration)
        {
            int         Duration = (duration.TotalSeconds <= 60 ? (int)duration.TotalSeconds : 60);
            CardCommand Command  = new CardCommand();

            Command.Cla = 0x20;
            Command.Ins = 0x17;
            Command.P1  = 0x40;                                         // Display
            Command.P2  = 0x00;
            Command.AppendData(0x50, Encoding.ASCII.GetBytes(message)); //Display Message
            if (duration != TimeSpan.Zero)
            {
                Command.AppendData(0x80, 0x60); //timeout: take 60: the real timeout is performed by 'sleep'
            }

            this.SendCommandToReader(Command);
            Thread.Sleep(Duration * 1000);
        }
コード例 #16
0
        private CardResponse SendCommandToReader(CardCommand command)
        {
            // Write command to a buffer that contains a SCARD_CONTROL_REQUEST header needed by the MKT
            byte[] SerializedCommand = command.Serialize();
            byte[] ReaderCommand     = new byte[20 + SerializedCommand.Length];
            ReaderCommand[0]  = 0x01;                             //int value!
            ReaderCommand[4]  = 0x02;                             //int value!
            ReaderCommand[8]  = (byte)(SerializedCommand.Length); //int value!
            ReaderCommand[13] = 4;
            Array.Copy(SerializedCommand, 0, ReaderCommand, 20, SerializedCommand.Length);

            //Call card reader
            byte[] ReaderResponse = this.scardApi.ControlCardReader(this.CardHandle, ReaderCommand);

            //Extract Response (strip header)
            byte[] SerializedResponse = new byte[ReaderResponse.Length - 20];
            Array.Copy(ReaderResponse, 20, SerializedResponse, 0, SerializedResponse.Length);
            return(new CardResponse(SerializedResponse));
        }
コード例 #17
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;
            }
        }
コード例 #18
0
        private byte[] GetVariableValue(string message, Variable variable, IVariableResolver resolver)
        {
            byte[] Data = null;
            do
            {
                CardCommand Command = new CardCommand();
                Command.Cla = 0x20;
                Command.Ins = 0x16;
                Command.P1  = 0x50;                                         // Keyboard
                Command.P2  = 0x02;                                         // Display '*'
                Command.AppendData(0x50, Encoding.ASCII.GetBytes(message)); //Display Message
                Command.AppendData(0x80, 0x60);                             //Timeout
                //For variable timeout use: Command.Append(0x80, (byte) (timeout.TotalSeconds <= 60 ? timeout.TotalSeconds : 60)); //Timeout
                Command.Le = 0x00;

                CardResponse Response;
                try
                {
                    resolver.NotifyVariableEntryBegins(variable.Name);
                    Response = this.SendCommandToReader(Command);
                }
                finally
                {
                    resolver.NotifyVariableEntryEnded();
                }

                switch (Response.Status)
                {
                case 0x9000:
                    Data = Response.Data;
                    break;

                case 0x6401:
                    throw new UserCancelException();

                case 0x6410:
                    //TODO: auslagern in UIHandler
                    if (MessageBox.Show("The card readers pinpad is disabled.\n Please turn it on.", "Message", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        continue;
                    }
                    else
                    {
                        throw new UserCancelException();
                    }

                case 0x6400:
                    //TODO: auslagern in UIHandler
                    if (MessageBox.Show("There was a timeout entering the PIN at the card reader.\nDo you want to retry?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        continue;
                    }
                    else
                    {
                        throw new UserCancelException();
                    }

                default:
                    throw new UnableToResolveVariableException(variable, $"Card reader returned unknown code 0x{Response.Status:4X}");
                }

                if (Data != null && (Data.Length < variable.MinLength || Data.Length > variable.Length))
                {
                    this.DisplayMessage(Orgamkt5CardReader.LayoutDisplayMessage("Pin entry error!\nPlease retry!", 0), TimeSpan.FromSeconds(2));
                    Data = null;
                }
            } while (Data == null);

            this.ClearDisplay();

            return(Data);
        }
コード例 #19
0
 protected void LogCommand(CardCommand command, string additionalInformation)
 {
     this.logger.LogCommand(this.Channel.SmartCard, this.streamName, command, additionalInformation);
 }
コード例 #20
0
            //初始化接收响应
            private static void InitAsyncConnection()
            {
                AsyncConnect = new WebSocket($"ws://{ip}/AsyncInfo");
                AsyncConnect.Connect();
                AsyncConnect.OnMessage += (sender, e) =>
                {
                    try
                    {
                        Debug.Log("收到信息" + e.Data);
                        object[]     receiveInfo = e.Data.ToObject <GeneralCommand>().Datas;
                        NetAcyncType Type        = (NetAcyncType)int.Parse(receiveInfo[0].ToString());
                        switch (Type)
                        {
                        case NetAcyncType.FocusCard:
                        {
                            int X = int.Parse(receiveInfo[2].ToString());
                            int Y = int.Parse(receiveInfo[3].ToString());
                            Info.AgainstInfo.OpponentFocusCard = Info.RowsInfo.GetCard(X, Y);
                            break;
                        }

                        case NetAcyncType.PlayCard:
                        {
                            //Debug.Log("触发卡牌同步");
                            int X = int.Parse(receiveInfo[2].ToString());
                            int Y = int.Parse(receiveInfo[3].ToString());
                            //Command.CardCommand.PlayCard(Info.RowsInfo.GetCard(X, Y), false).Wait();
                            Card targetCard = Info.RowsInfo.GetCard(X, Y);
                            Task.Run(async() =>
                                {
                                    await GameSystem.TransSystem.PlayCard(new TriggerInfo(targetCard, targetCard), false);
                                    Info.AgainstInfo.IsCardEffectCompleted = true;
                                });
                            break;
                        }

                        case NetAcyncType.SelectRegion:
                        {
                            //Debug.Log("触发区域同步");
                            int X = int.Parse(receiveInfo[2].ToString());
                            Info.AgainstInfo.SelectRegion = Info.RowsInfo.GetSingleRowInfoById(X);
                            break;
                        }

                        case NetAcyncType.SelectUnites:
                        {
                            //Debug.Log("收到同步单位信息为" + rawData);
                            List <Location> Locations = receiveInfo[2].ToString().ToObject <List <Location> >();
                            Info.AgainstInfo.SelectUnits.AddRange(Locations.Select(location => Info.RowsInfo.GetCard(location.x, location.y)));
                            break;
                        }

                        case NetAcyncType.SelectLocation:
                        {
                            Debug.Log("触发坐标同步");
                            int X = int.Parse(receiveInfo[2].ToString());
                            int Y = int.Parse(receiveInfo[3].ToString());
                            //Info.RowsInfo.SingleRowInfos.First(infos => infos.ThisRowCard == Info.RowsInfo.GlobalCardList[X]);
                            Info.AgainstInfo.SelectRegion   = Info.RowsInfo.GetSingleRowInfoById(X);
                            Info.AgainstInfo.SelectLocation = Y;
                            Debug.Log($"坐标为:{X}:{Y}");
                            Debug.Log($"信息为:{"gezi"}:{Info.AgainstInfo.SelectLocation}");
                            break;
                        }

                        case NetAcyncType.Pass:
                        {
                            GameUI.UiCommand.SetCurrentPass();
                            break;
                        }

                        case NetAcyncType.Surrender:
                        {
                            Task.Run(async() =>
                                {
                                    Debug.Log("收到结束指令");
                                    await StateCommand.BattleEnd(true, true);
                                });
                            break;
                        }

                        case NetAcyncType.ExchangeCard:
                        {
                            Debug.Log("交换卡牌信息");
                            // Debug.Log("收到信息" + rawData);
                            Location location   = receiveInfo[2].ToString().ToObject <Location>();
                            int      randomRank = int.Parse(receiveInfo[3].ToString());
                            _ = CardCommand.ExchangeCard(Info.RowsInfo.GetCard(location), false, RandomRank: randomRank);
                            break;
                        }

                        case NetAcyncType.RoundStartExchangeOver:
                            if (Info.AgainstInfo.isPlayer1)
                            {
                                Info.AgainstInfo.isPlayer2RoundStartExchangeOver = true;
                            }
                            else
                            {
                                Info.AgainstInfo.isPlayer1RoundStartExchangeOver = true;
                            }
                            break;

                        case NetAcyncType.SelectProperty:
                        {
                            Info.AgainstInfo.SelectProperty = (Region)int.Parse(receiveInfo[2].ToString());
                            Debug.Log("通过网络同步当前属性为" + Info.AgainstInfo.SelectProperty);
                            break;
                        }

                        case NetAcyncType.SelectBoardCard:
                            Info.AgainstInfo.selectBoardCardRanks    = receiveInfo[2].ToString().ToObject <List <int> >();;
                            Info.AgainstInfo.IsFinishSelectBoardCard = (bool)receiveInfo[3];
                            break;

                        case NetAcyncType.Init:
                            break;

                        default:
                            break;
                        }
                    }
                    catch (System.Exception ex)
                    {
                        Debug.Log(ex);
                        throw;
                    }
                };
                AsyncConnect.OnError += (sender, e) =>
                {
                    Debug.Log("连接失败" + e.Message);
                    Debug.Log("连接失败" + e.Exception);
                };
                Debug.LogError("初始化数据" + new GeneralCommand(NetAcyncType.Init, Info.AgainstInfo.RoomID, Info.AgainstInfo.isPlayer1).ToJson());
                AsyncConnect.Send(new GeneralCommand(NetAcyncType.Init, Info.AgainstInfo.RoomID, Info.AgainstInfo.isPlayer1).ToJson());
            }
コード例 #21
0
ファイル: CardManager.cs プロジェクト: TylerPham9/GGJ14
 public Card(bool bGenerateAsPureMove)
 {
     FirstCommand  = CardCommand.CC_LASTINDEX;
     SecondCommand = CardCommand.CC_LASTINDEX;
     GenerateValues(bGenerateAsPureMove);
 }
コード例 #22
0
    // ONLY execute move if true, ONLY execute action if true
    // NOTE: ZACKM - THIS IS HORRENDOUS CODE. OH MY GOODNESS GRACIOUS!
    void ExecuteGBCommand(GameboardCommand GBCom, int CurrCycle, bool bExecuteMove, bool bExecuteAction)
    {
        CardCommand CommandToExecute = GBCom.GetCard().GetCommands()[CurrCycle];

        switch (CommandToExecute)
        {
        case CardCommand.CC_MoveLeft:
            if (bExecuteMove)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " moved left");
                GBController.MoveCharacter(GBCom.GetCharacter(), TileClass.WEST);
            }
            break;

        case CardCommand.CC_MoveRight:
            if (bExecuteMove)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " moved right");
                GBController.MoveCharacter(GBCom.GetCharacter(), TileClass.EAST);
            }
            break;

        case CardCommand.CC_MoveUp:
            if (bExecuteMove)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " moved up");
                GBController.MoveCharacter(GBCom.GetCharacter(), TileClass.NORTH);
            }
            break;

        case CardCommand.CC_MoveDown:
            if (bExecuteMove)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " moved down");
                GBController.MoveCharacter(GBCom.GetCharacter(), TileClass.SOUTH);
            }
            break;

        case CardCommand.CC_AttackAdj:
            if (bExecuteAction)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " attacked adjacently");
                GBController.CharacterSwipe(GBCom.GetCharacter());
            }
            break;

        case CardCommand.CC_ShootLeft:
            if (bExecuteAction)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " shot to the left");
                GBController.CharacterShoot(GBCom.GetCharacter(), TileClass.WEST);
            }
            break;

        case CardCommand.CC_ShootRight:
            if (bExecuteAction)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " shot to the right");
                GBController.CharacterShoot(GBCom.GetCharacter(), TileClass.EAST);
            }
            break;

        case CardCommand.CC_ShootUp:
            if (bExecuteAction)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " shot up");
                GBController.CharacterShoot(GBCom.GetCharacter(), TileClass.NORTH);
            }
            break;

        case CardCommand.CC_ShootDown:
            if (bExecuteAction)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " shot down");
                GBController.CharacterShoot(GBCom.GetCharacter(), TileClass.SOUTH);
            }
            break;

        case CardCommand.CC_HoldPosition:
            if (bExecuteMove)
            {
//					Debug.Log(GBCom.GetCharacter().tag + " did not move");
            }
            break;
        }
    }
コード例 #23
0
ファイル: SmartCard.cs プロジェクト: whiletrue-eu/libraries
 public Task <CardResponse> TransmitAsync(CardCommand command)
 {
     return(this.TransmitAsync(command, new UnsupportedVariableResolver()));
 }
コード例 #24
0
ファイル: SmartCard.cs プロジェクト: whiletrue-eu/libraries
 public CardResponse Transmit(CardCommand command)
 {
     return(this.Transmit(command, new UnsupportedVariableResolver()));
 }
コード例 #25
0
 public CardResponse Transmit(CardCommand command)
 {
     return(this.SmartCard.Transmit(command));
 }
コード例 #26
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);
            }
        }
コード例 #27
0
 internal bool IsMatch(CardCommand command, CardResponse response)
 {
     return(this.originalCommandTrigger.IsMatch(Conversion.ToHexString(command.Serialize())) &&
            this.originalResponseTrigger.IsMatch(Conversion.ToHexString(response.Serialize())));
 }
コード例 #28
0
 /// <summary>
 /// Transmits the given command to the card. If the command conatins variables, teh variables are resolved using the <see cref="ResolveVariable"/> method.
 /// </summary>
 protected internal Task <CardResponse> TransmitAsync(CardCommand command, IVariableResolver resolver)
 {
     return(Task.Run(() => this.Transmit(command, resolver)));
 }