/// <summary> /// 卡片以覆盖方式进入手卡区时,手卡区控件的操作 /// </summary> /// <param name="cv">手卡区控件</param> /// <param name="card">卡片</param> public static void add2Banish(MyCanvas cv, CardUI card) { card.reSetAtk(); card.centerAtVerticalInParent(); card.clearSigns(); card.ContextMenu = AllMenu.Instance.cm_outside; }
/// <summary> /// 卡片以覆盖方式进入怪物区时,怪物区控件的操作 /// </summary> /// <param name="cv">怪物区控件</param> /// <param name="card">卡片</param> public static void add2MagicTrapOP(MyCanvas cv, CardUI card) { card.reSetAtk(); switch (card.Status) { case Status.FRONT_ATK: case Status.FRONT_DEF: card.set2FrontAtk(); break; case Status.BACK_ATK: case Status.BACK_DEF: card.set2BackAtk(); break; default: break; } int count = cv.Children.Count; if (count == 1) { card.centerAtVerticalInParent(); card.ContextMenu = AllMenu.Instance.cm_magictrap; //添加指示物 showSigns(cv, card); } }
/// <summary> /// 卡片以覆盖方式进入手卡区时,手卡区控件的操作 /// </summary> /// <param name="cv">手卡区控件</param> /// <param name="card">卡片</param> public static void add2HandOP(MyCanvas cv, CardUI card) { card.clearSigns(); card.reSetAtk(); card.set2BackAtk(); Service.CardOperate.sort_HandCard(cv); }
/// <summary> /// 卡片进入墓地时,墓地控件的操作 /// </summary> /// <param name="cv">墓地控件</param> /// <param name="card">卡片</param> public static void add2GraveyradOP(MyCanvas cv, CardUI card) { card.reSetAtk(); card.centerAtVerticalInParent(); card.clearSigns(); if ((card.StatusLast == Status.BACK_DEF || card.StatusLast == Status.BACK_ATK) && card.Status == Status.FRONT_ATK) { CardAnimation.turn(card); } //card.set2FrontAtk(); }
/// <summary> /// 卡片以覆盖方式进入手卡区时,手卡区控件的操作 /// </summary> /// <param name="cv">手卡区控件</param> /// <param name="card">卡片</param> public static void add2ExtraOP(MyCanvas cv, CardUI card) { card.reSetAtk(); if (card.info.CardDType.Contains("灵摆")) { card.set2FrontAtk(); } else { card.set2BackAtk(); } card.centerAtVerticalInParent(); card.clearSigns(); }
/// <summary> /// 卡片以覆盖方式进入手卡区时,手卡区控件的操作 /// </summary> /// <param name="cv">手卡区控件</param> /// <param name="card">卡片</param> public static void add2Hand(MyCanvas cv, CardUI card) { card.clearSigns(); card.reSetAtk(); card.set2FrontAtk(); card.CurLocation = new Location(cv.area, cv.Children.IndexOf(card)); card.outputChange(); int count = cv.Children.Count; Service.CardOperate.sort_HandCard(cv); card.ContextMenu = AllMenu.Instance.cm_hand; }
/// <summary> /// 卡片以覆盖方式进入手卡区时,手卡区控件的操作 /// </summary> /// <param name="cv">手卡区控件</param> /// <param name="card">卡片</param> public static void add2DeckOP(MyCanvas cv, CardUI card) { card.reSetAtk(); card.centerAtVerticalInParent(); card.clearSigns(); if (card.Status == Status.FRONT_ATK) { CardAnimation.turn2Back(card); } else { card.set2BackAtk(); } card.ContextMenu = AllMenu.Instance.cm_deck; }
public static void insert2MonsterOP(MyCanvas mcv, CardUI card) { if (mcv.Children.Count == 0) { if (card.Status == Status.BACK_ATK || card.Status == Status.FRONT_ATK) { card.centerAtVerticalInParent(); } else { card.centerAtHorizontalInParent(); } card.ContextMenu = AllMenu.Instance.cm_monster; } if (mcv.Children.Count > 1) { card.reSetAtk(); int count = mcv.Children.Count; CardUI top = mcv.Children[count - 1] as CardUI; if (top.Status == Status.FRONT_ATK || top.Status == Status.BACK_ATK) { //Canvas.SetTop(card, (cv.ActualHeight - card.ActualHeight) / 2.0); //Canvas.SetLeft(card, 0); Canvas.SetLeft(card, -card.Width); Canvas.SetTop(card, (mcv.ActualHeight - card.Height) / 2); Service.CardOperate.sort_XYZ_atk(mcv); } else { Canvas.SetTop(card, (mcv.ActualHeight - card.ActualHeight) / 2.0); Canvas.SetLeft(card, -card.ActualWidth); Service.CardOperate.sort_XYZ_def2(mcv); //if (count == 2) //{ //} //else //{ // Canvas.SetTop(card, (mcv.ActualHeight - card.ActualHeight) / 2.0); // Canvas.SetLeft(card, 0); // Service.CardOperate.sort_XYZ_def2(mcv); // } } }
/// <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(); }
/// <summary> /// 卡片以覆盖方式进入怪物区时,怪物区控件的操作 /// </summary> /// <param name="mcv">怪物区控件</param> /// <param name="card">卡片</param> public static void add2MonsterOP(MyCanvas mcv, CardUI card) { int count = mcv.Children.Count; if (count == 1) { if (card.Status == Status.BACK_ATK || card.Status == Status.FRONT_ATK) { card.centerAtVerticalInParent(); Service.CardOperate.sort_XYZ_atk(mcv); } else { card.centerAtHorizontalInParent(); Service.CardOperate.sort_XYZ_atk(mcv); } card.ContextMenu = AllMenu.Instance.cm_monster; } else { Canvas.SetLeft(card, mcv.ActualWidth - card.Width); Canvas.SetTop(card, (mcv.ActualHeight - card.Height) / 2); card.ContextMenuOpening += (sender, e) => { card.ContextMenu.DataContext = card; }; CardUI second = mcv.Children[count - 2] as CardUI; second.reSetAtk(); //当被叠放时要重置攻击力 second.clearSigns(); //当被叠放时要清除卡片指示物 /* * 判断加入前最顶层的卡的状态,若是只要是存在背面或防守,则应先启动相关动画 */ //CardAnimation.setTransformGroup(second); TransLibrary.StoryboardChain animator0 = new TransLibrary.StoryboardChain(); if (second.Status == Status.BACK_DEF) { //MyStoryboard msb1 = CardAnimation.ScaleX_120_Rotate(-90, 0, 150, 200); MyStoryboard msb1 = CardAnimation.scalX_120_rotate_9020(); msb1.card = second; msb1.Completed += (object sender_, EventArgs e_) => { //卡片切换为背面 msb1.card.set2FrontAtk(); //msb1.card.showImg(); }; animator0.Animates.Add(msb1); MyStoryboard msb2 = CardAnimation.scalX_021(); animator0.Animates.Add(msb2); } if (second.Status == Status.FRONT_DEF) { MyStoryboard msb = CardAnimation.Rotate_D2A(); msb.card = second; msb.Completed += (object sender_, EventArgs e_) => { msb.card.set2FrontAtk(); }; animator0.Animates.Add(msb); } animator0.Begin(second); Service.CardOperate.sort_XYZ_atk(mcv); //Canvas.SetTop(card, (mcv.ActualHeight - card.ActualHeight) / 2.0); //Canvas.SetLeft(card, mcv.ActualWidth - card.ActualWidth); //MainWindow mainwin = Application.Current.MainWindow as MainWindow; //Point summon2 = mcv.TranslatePoint(new Point(0.5, 0.5), mainwin.OpBattle); //Canvas.SetLeft(mainwin.img_overlay_op, summon2.X - ((mainwin.img_overlay_op.Width - mcv.ActualWidth) / 2)); //Canvas.SetTop(mainwin.img_overlay_op, summon2.Y - ((mainwin.img_overlay_op.Height - mcv.ActualHeight) / 2)); //CardAnimation.Rotate_Scale_FadeInAndOut(mainwin.img_overlay_op); } //MainWindow mainwin = Application.Current.MainWindow as MainWindow; #region 攻守显示绑定卡片 if (card.Status != Status.BACK_ATK && card.Status != Status.BACK_DEF) { bindingAtk(mcv, card); } #endregion //添加指示物 showSigns(mcv, card); }
/// <summary> /// 卡片以顶层覆盖方式进入P卡区时,P卡区控件的操作 /// </summary> /// <param name="cv">P卡区控件</param> /// <param name="card">卡片</param> public static void add2PendulumOP(MyCanvas cv, CardUI card) { card.reSetAtk(); card.centerAtVerticalInParent(); card.ContextMenu = AllMenu.Instance.cm_pendulum; }