private bool doCommonDiscardClick() { pokerface.MsgCardHand prevCardHand = null; int specialCardID = -1; if (CurrentAllowPlayerReAction != null) { prevCardHand = CurrentAllowPlayerReAction.prevActionHand; if (CurrentAllowPlayerReAction.timeoutInSeconds > 255) { specialCardID = (int)pokerface.CardID.R2H; } } else if (CurrentAllowPlayerAction != null) { if (CurrentAllowPlayerAction.timeoutInSeconds > 255) { specialCardID = (int)pokerface.CardID.R3H; } } var discardedList = new List <int>(); if (!DiscardWnd.ShowDialog(discardedList, prevCardHand, specialCardID, this)) { return(false); } OnTakeActionDiscardTile(discardedList); return(true); }
public static bool ShowDialog(List <int> tileDiscarded, TileStackWnd owner) { var tiles2Discarded = owner.TilesHandList; tileDiscarded.Clear(); var x = new DiscardWnd(); x.SetOwner(owner); x.BtnExtra.Visibility = Visibility.Hidden; x.BtnExtraXX.Visibility = Visibility.Hidden; x.SetReadyHandTips(tiles2Discarded); //x.prevCardHand = prevCardHand; //x.specialCardID = specialCardID; //if (prevCardHand != null) //{ //var currents = AgariIndex.FindGreatThanCardHand(prevCardHand, tiles2Discarded,specialCardID); //if (null == currents || currents.Count == 0) //{ // MessageBox.Show("oh shit, a huge bug"); // throw new System.Exception("huge bug"); //} //if (currents.Count > 1) //{ // x.BtnExtra.Visibility = Visibility.Visible; // x.BtnExtra.Content = "下一个提示"; //} //var current = currents[0]; //x.SelectedTiles.AddRange(current.cards); //foreach(var c in current.cards) //{ // x.HandTiles.Remove(c); //} //x.discardAbleTips = currents; //x.discardAbleTipsIndex = 0; // x.Hand2UI(); // x.Selected2UI(); //} //else { //var current = AgariIndex.SearchLongestDiscardCardHand(tiles2Discarded, specialCardID); //x.SelectedTiles.AddRange(current.cards); //foreach (var c in current.cards) //{ // x.HandTiles.Remove(c); //} x.Hand2UI(); x.Selected2UI(); } var result = x.ShowDialog(); if (result == null || !result.Value) { // snip return(false); } tileDiscarded.AddRange(x.SelectedTiles); return(true); }