Ejemplo n.º 1
0
        /// <summary>
        /// 卡片进入墓地时,墓地控件的操作
        /// </summary>
        /// <param name="cv">墓地控件</param>
        /// <param name="card">卡片</param>
        public static void add2Graveyrad(MyCanvas cv, CardUI card)
        {
            card.reSetAtk();
            card.centerAtVerticalInParent();
            card.clearSigns();
            if (card.Status == Status.BACK_ATK)
            {
                CardAnimation.turn(card);
            }
            else
            {
                card.set2FrontAtk();
            }

            card.ContextMenu = AllMenu.Instance.cm_graveyard;


            #region 指令发送

            MoveInfo moveInfo = new MoveInfo();
            moveInfo.cardID    = CardOperate.getCardID(card);
            moveInfo.isAdd     = true;
            moveInfo.aimArea   = cv.area;
            moveInfo.aimStatus = Status.FRONT_ATK;
            String contentJson = JsonConvert.SerializeObject(moveInfo);

            BaseJson bj = new BaseJson();
            bj.guid   = DuelOperate.getInstance().myself.userindex;
            bj.cid    = "";
            bj.action = ActionCommand.CARD_MOVE;
            bj.json   = contentJson;
            String json = JsonConvert.SerializeObject(bj);
            DuelOperate.getInstance().sendMsg(json);

            #endregion
            //card.set2FrontAtk();
        }
        private void sendSignInfo()
        {
            #region 指令发送

            SignInfo signInfo = new SignInfo();
            int      cardid   = CardOperate.getCardID(this.Tag as CardUI);
            signInfo.cardID = cardid;
            StackPanel sp = this.Parent as StackPanel;
            foreach (SignTextBlock item in sp.Children)
            {
                signInfo.signs.Add(new SignInfo.SignMessage(item.BorderBrush, item.Content.ToString(), item.ToolTip == null ? null : item.ToolTip.ToString()));
            }
            String contentJson = JsonConvert.SerializeObject(signInfo);

            BaseJson bj = new BaseJson();
            bj.guid   = DuelOperate.getInstance().myself.userindex;
            bj.cid    = "";
            bj.action = ActionCommand.CARD_SIGN_ACTION;
            bj.json   = contentJson;
            String json = JsonConvert.SerializeObject(bj);
            DuelOperate.getInstance().sendMsg(json);

            #endregion
        }
Ejemplo n.º 3
0
        public static void execute_Addsign(object sender, ExecutedRoutedEventArgs e)
        {
            CardUI        card = e.OriginalSource as CardUI;
            StackPanel    sp   = (sender as MyCanvas).signs;
            SignTextBlock stb  = new SignTextBlock(true);

            stb.Height  = 25;
            stb.Width   = 25;
            stb.Content = "1";
            switch ((e.Command as RoutedUICommand).Name)
            {
            case "addBlueSign":
                stb.BorderBrush = Brushes.Blue;
                break;

            case "addBlackSign":
                stb.BorderBrush = Brushes.Black;
                break;

            case "addRedSign":
                stb.BorderBrush = Brushes.Red;
                break;

            case "addGreenSign":
                stb.BorderBrush = Brushes.Green;
                break;

            default:
                break;
            }
            card.signs.Add(stb);
            stb.Tag = card;
            sp.Children.Add(stb);
            e.Handled = true;

            #region 指令发送

            SignInfo signInfo = new SignInfo();
            int      cardid   = CardOperate.getCardID(card);
            signInfo.cardID = cardid;
            foreach (SignTextBlock item in sp.Children)
            {
                //Dictionary<string, string> content = new Dictionary<string, string>();
                //content.Add(item.Content.ToString(), item.ToolTip.ToString());
                signInfo.signs.Add(new SignInfo.SignMessage(item.BorderBrush, item.Content.ToString(), item.ToolTip == null?null:item.ToolTip.ToString()));
            }
            String contentJson = JsonConvert.SerializeObject(signInfo);

            BaseJson bj = new BaseJson();
            bj.guid   = DuelOperate.getInstance().myself.userindex;
            bj.cid    = "";
            bj.action = ActionCommand.CARD_SIGN_ACTION;
            bj.json   = contentJson;
            String json = JsonConvert.SerializeObject(bj);
            DuelOperate.getInstance().sendMsg(json);

            #endregion
            //addBlueSign = new RoutedUICommand("addBlueSign", "addBlueSign", typeof(CardCommands));
            //addBlackSign = new RoutedUICommand("addBlackSign", "addBlackSign", typeof(CardCommands));
            //addRedSign = new RoutedUICommand("addRedSign", "addRedSign", typeof(CardCommands));
            //addGreenSign = new RoutedUICommand("addGreenSign", "addGreenSign", typeof(CardCommands));
        }