public virtual void OnDrop(MyHand hand) { // deactivate ActionSet if (activateActionSet != null) { activateActionSet.Deactivate(hand.handType); } // enable controller model if (hideControllerModelOnPickUp) { hand.controllerRenderer.SetMeshRendererState(true); } // enable hand model if (hideHandModelOnPickUp) { hand.handRenderer.enabled = true; } // blend to normal skeleton if (skeletonPoser != null) { if (hand.skeleton != null) { hand.skeleton.BlendToSkeleton(releasePoseBlendTime); } } }
public override void OnPickup(MyHand hand) { base.OnPickup(hand); // hide picked up item GetComponent <MeshRenderer>().enabled = false; // enables rocket hand model hand.transform.GetChild(2).gameObject.SetActive(true); }
public override void OnDrop(MyHand hand) { transform.position = backportPoint.position; transform.rotation = backportPoint.rotation; isGrabbed = false; visableHand.SetActive(false); base.OnDrop(hand); }
// get if the letting grap go condition has been met private bool GetGrapUp(MyHand hand, float lastGrap) { if (grapAction.GetAxis(hand.handType) < grapStrengthTreshhold && lastGrap > grapStrengthTreshhold) { return(true); } return(false); }
private void ExecuteRotateCardCommand(object obj) { var card = (HandCard)obj; card.Rotate(); //card.Angle = (card.Angle + 180) % 360; MyHand.UpdateCards(MyHand.Cards.ToList()); }
public override void OnDrop(MyHand hand) { // enables picked up item GetComponent <MeshRenderer>().enabled = true; // disables rocket hand model hand.transform.GetChild(2).gameObject.SetActive(false); base.OnDrop(hand); }
private bool GetGrapUp(MyHand hand, float lastGrap) { if (grapAction.GetAxis(hand.handType) < grapStrenghtTreshold && lastGrap > grapStrenghtTreshold) { Debug.Log("GetGrapUp true"); return(true); } return(false); }
public void InitMyData() { shoe = new Shoe(); dealerHand = new DealerHand(); myHand = new MyHand(); advStrategy = new AdvStrategy(); this.Location = new Point(10, 100); UpdateBoxCards(); }
// get if the grap condition has been met private bool GetGrap(MyHand hand) { if (grapAction.GetAxis(hand.handType) > grapStrengthTreshhold) { return(true); } else { return(false); } }
private void HandleHandInfoMessage(HandInfoMessage handInfoMessage) { ReadyButtonVisibility = Visibility.Hidden; OnPropertyChanged(nameof(ReadyButtonVisibility)); MyHand.UpdateCards(handInfoMessage.HandCards); CurrentPlayer.Role = handInfoMessage.Role; RoleImage = handInfoMessage.Role.ImagePath; OnPropertyChanged(nameof(RoleImage)); }
private void HandleActionMessage(ActionMessage message) { if (message.RecepientId == CurrentPlayer.Id) { MyHand.UpdateEquipment(message.Players.First(pl => pl.Id == CurrentPlayer.Id).BrokenEquipments); } else { EnemyHand.UpdateEquipment(message.Players.First(pl => pl.Id == message.RecepientId).BrokenEquipments); } }
private void InitHand(List <Card> allCards) { int[] cardValueCount = CardMapper(allCards); if (CheckForRoyalFlush(allCards)) { InitHelper5Symbols(InitStraightFlush(allCards), PokerHand.RoyalFlush); return; } if (CheckForStraightFlush(allCards)) { InitHelper5Symbols(InitStraightFlush(allCards), PokerHand.StraightFlush); return; } MyHand sameOfAKind = CheckForSameOfAKind(allCards); if (sameOfAKind == MyHand.FourOfAKind) { InitHelperDynamicSymbols(cardValueCount, 4, PokerHand.FourOfAKind, 1, 1); return; } if (sameOfAKind == MyHand.FullHouse) { InitHelperDynamicSymbols(cardValueCount, 3, PokerHand.FullHouse, 2, 1); return; } if (CheckForFlush(allCards)) { InitHelper5Symbols(InitFlush(allCards), PokerHand.Flush); return; } if (CheckForStraight(allCards)) { InitHelper5Symbols(InitStraight(cardValueCount), PokerHand.Straight); return; } if (sameOfAKind == MyHand.ThreeOfAKind) { InitHelperDynamicSymbols(cardValueCount, 3, PokerHand.ThreeOfAKind, 1, 2); return; } if (sameOfAKind == MyHand.TwoPair) { InitHelperTwoPair(cardValueCount); return; } if (sameOfAKind == MyHand.OnePair) { InitHelperDynamicSymbols(cardValueCount, 2, PokerHand.OnePair, 1, 3); return; } InitHighcard(allCards); }
private bool GetGrap(MyHand hand) { if (grapAction.GetAxis(hand.handType) > grapStrenghtTreshold) { return(true); } else { Debug.Log("GetGrap false"); return(false); } }
public virtual void OnDrop(MyHand hand) { // deactivate ActionSet if (activateActionSet != null) { activateActionSet.Deactivate(hand.handType); } // enable Hand model if (hideHandModelOnPickUp) { hand.transform.GetChild(0).gameObject.SetActive(true); } }
private void HandleUpdateTableMessage(UpdateTableMessage message) { MyHand.UpdateCards(message.Hand); CardsInDeck = message.CardsLeftInDeck; OnPropertyChanged(nameof(CardsInDeck)); _isMyTurn = message.IsMyTurn; if (message.RoleCard != null) { CurrentPlayer.Role = message.RoleCard; RoleImage = message.RoleCard.ImagePath; OnPropertyChanged(nameof(RoleImage)); } }
public virtual void OnPickup(MyHand hand) { // activate ActionSet if (activateActionSet != null) { activateActionSet.Activate(hand.handType); } // hide hand model if (hideHandModelOnPickUp) { hand.transform.GetChild(0).gameObject.SetActive(false); } }
// Start is called before the first frame update void Start() { //Configuration for Captoglove sensor as Right Hand RightHand = new MyHand(2443, MyHand.HandType.TYPE_RIGHT_HAND); RightHand.SetLogEnabled(true); RightHand.SetHandObject(transform); RightHand.SetFingerObject(tThumb, tIndex, tMiddle, tRing, tPinky); //Messages in display style = new GUIStyle(); style.normal.textColor = Color.black; //Starts Captoglove sensor RightHand.Start(); }
private void ExecuteSelectToFoldCommand(object card) { var selectedCard = (HandCard)card; if (_cardsToFold.Contains(selectedCard)) { _cardsToFold.Remove(selectedCard); selectedCard.SelectedMargin = 0; } else { _cardsToFold.Add(selectedCard); selectedCard.SelectedMargin = -10; } MyHand.UpdateCards(MyHand.Cards.ToList()); }
public virtual void OnPickup(MyHand hand) { // activate ActionSet if (activateActionSet != null) { activateActionSet.Activate(hand.handType); } // hide controller model if (hideControllerModelOnPickUp) { hand.controllerRenderer.SetMeshRendererState(false); } // hide hand model if (hideHandModelOnPickUp) { hand.handRenderer.enabled = false; } // blend to poser skeleton if (skeletonPoser != null && hand.skeleton != null) { hand.skeleton.BlendToPoser(skeletonPoser); } }
public override void OnPickup(MyHand hand) { isGrabbed = true; visableHand.SetActive(true); base.OnPickup(hand); }
public Quaternion GetHandRot(MyHand hand) { return(flyDirection.GetLocalRotation(hand.handType)); }
void Start() { hand = GetComponent <MyHand>(); previousPosition = hand.transform.localPosition; }
public int HowManyCardsInMyhands() { return(MyHand.ReturnHowManyCardsIHave()); }
private void TextBoxInput_KeyDown(object sender, KeyEventArgs e) { int hMenu = 0; if (e.KeyCode == Keys.Enter) { string textBox = textBoxInput.Text; char[] delims = { ' ', '.', ',', '\n' }; string[] words = textBox.Split(delims); foreach (string s in words) { switch (s.ToLower()) { #region Card To Shoe case "2": { shoe.SetAddCardToShoe(2); AddToTable(2); break; } case "3": { shoe.SetAddCardToShoe(3); AddToTable(3); break; } case "4": { shoe.SetAddCardToShoe(4); AddToTable(4); break; } case "5": { shoe.SetAddCardToShoe(5); AddToTable(5); break; } case "6": { shoe.SetAddCardToShoe(6); AddToTable(6); break; } case "7": { shoe.SetAddCardToShoe(7); AddToTable(7); break; } case "8": { shoe.SetAddCardToShoe(8); AddToTable(8); break; } case "9": { shoe.SetAddCardToShoe(9); AddToTable(9); break; } case "10": { shoe.SetAddCardToShoe(10); AddToTable(10); break; } case "11": { shoe.SetAddCardToShoe(11); AddToTable(11); break; } case "12": { shoe.SetAddCardToShoe(12); AddToTable(12); break; } case "13": { shoe.SetAddCardToShoe(13); AddToTable(13); break; } case "14": { shoe.SetAddCardToShoe(14); AddToTable(14); break; } case "a": { shoe.SetAddCardToShoe(11); AddToTable(11); break; } case "j": { shoe.SetAddCardToShoe(12); AddToTable(12); break; } case "q": { shoe.SetAddCardToShoe(13); AddToTable(13); break; } case "k": { shoe.SetAddCardToShoe(14); AddToTable(14); break; } #endregion #region Card To hand case "m2": { myHand.SetAddCardInHand(2); break; } case "m3": { myHand.SetAddCardInHand(3); break; } case "m4": { myHand.SetAddCardInHand(4); break; } case "m5": { myHand.SetAddCardInHand(5); break; } case "m6": { myHand.SetAddCardInHand(6); break; } case "m7": { myHand.SetAddCardInHand(7); break; } case "m8": { myHand.SetAddCardInHand(8); break; } case "m9": { myHand.SetAddCardInHand(9); break; } case "m10": { myHand.SetAddCardInHand(10); break; } case "m11": { myHand.SetAddCardInHand(11); break; } case "m12": { myHand.SetAddCardInHand(12); break; } case "m13": { myHand.SetAddCardInHand(13); break; } case "m14": { myHand.SetAddCardInHand(14); break; } case "ma": { myHand.SetAddCardInHand(11); break; } case "mj": { myHand.SetAddCardInHand(12); break; } case "mq": { myHand.SetAddCardInHand(13); break; } case "mk": { myHand.SetAddCardInHand(14); break; } #endregion #region Dealer Hand case "d2": { dealerHand.SetDealerCard(2); break; } case "d3": { dealerHand.SetDealerCard(3); break; } case "d4": { dealerHand.SetDealerCard(4); break; } case "d5": { dealerHand.SetDealerCard(5); break; } case "d6": { dealerHand.SetDealerCard(6); break; } case "d7": { dealerHand.SetDealerCard(7); break; } case "d8": { dealerHand.SetDealerCard(8); break; } case "d9": { dealerHand.SetDealerCard(9); break; } case "d10": { dealerHand.SetDealerCard(10); break; } case "d11": { dealerHand.SetDealerCard(11); break; } case "d12": { dealerHand.SetDealerCard(12); break; } case "d13": { dealerHand.SetDealerCard(13); break; } case "d14": { dealerHand.SetDealerCard(14); break; } case "da": { dealerHand.SetDealerCard(11); break; } case "dj": { dealerHand.SetDealerCard(12); break; } case "dq": { dealerHand.SetDealerCard(13); break; } case "dk": { dealerHand.SetDealerCard(14); break; } #endregion #region Remove Card Shoe case "-2": { shoe.SetDelCardFromShoe(2); break; } case "-3": { shoe.SetDelCardFromShoe(3); break; } case "-4": { shoe.SetDelCardFromShoe(4); break; } case "-5": { shoe.SetDelCardFromShoe(5); break; } case "-6": { shoe.SetDelCardFromShoe(6); break; } case "-7": { shoe.SetDelCardFromShoe(7); break; } case "-8": { shoe.SetDelCardFromShoe(8); break; } case "-9": { shoe.SetDelCardFromShoe(9); break; } case "-10": { shoe.SetDelCardFromShoe(10); break; } case "-11": { shoe.SetDelCardFromShoe(11); break; } case "-12": { shoe.SetDelCardFromShoe(12); break; } case "-13": { shoe.SetDelCardFromShoe(13); break; } case "-14": { shoe.SetDelCardFromShoe(14); break; } case "-a": { shoe.SetDelCardFromShoe(11); break; } case "-j": { shoe.SetDelCardFromShoe(12); break; } case "-q": { shoe.SetDelCardFromShoe(13); break; } case "-k": { shoe.SetDelCardFromShoe(14); break; } #endregion //// new shoe case "r": { shoe = new Shoe(); myHand = new MyHand(); dealerHand = new DealerHand(); CleanTable(); break; } //// new table case "xt": { myHand = new MyHand(); dealerHand = new DealerHand(); CleanTable(); break; } //// new dealer hand case "xd": { dealerHand = new DealerHand(); break; } //// new my hand case "xm": { myHand = new MyHand(); break; } //// help screen case "h": { ShowHelpMenu(); hMenu = 1; break; } #region tests_show //// a random shoe + display case "trs": { shoe = new Shoe(); myHand = new MyHand(); dealerHand = new DealerHand(); shoe.GenerateShoe(); dealerHand.SetDealerCard(shoe.GetTheXCardFromShoe(shoe.GetNrCardsDrawn() + 1)); myHand.SetAddCardInHand(shoe.GetTheXCardFromShoe(shoe.GetNrCardsDrawn() + 2)); myHand.SetAddCardInHand(shoe.GetTheXCardFromShoe(shoe.GetNrCardsDrawn() + 3)); shoe.SetAddCardToShoeSIM(shoe.GetTheXCardFromShoe(shoe.GetNrCardsDrawn() + 1)); shoe.SetAddCardToShoeSIM(shoe.GetTheXCardFromShoe(shoe.GetNrCardsDrawn() + 2)); shoe.SetAddCardToShoeSIM(shoe.GetTheXCardFromShoe(shoe.GetNrCardsDrawn() + 3)); shoe.SetCardsDrawn(shoe.GetNrCardsDrawn() + 3); break; } //// show the shoe //// case "tss": { UpdateBoxSuggestionsTestShoe(shoe.GetNrCardsDrawn() + 1); hMenu = 1; break; } //// hit a card //// case "thc": { myHand.SetAddCardInHand(shoe.GetTheXCardFromShoe(shoe.GetNrCardsDrawn() + 1)); shoe.SetCardsDrawn(shoe.GetNrCardsDrawn() + 1); break; } #endregion tests_show //// nothing to do default: { break; } } } if (hMenu == 0) { ShowWhatToDo(); } UpdateBoxCards(); textBoxInput.Clear(); } }
private void Button2_Click(object sender, RoutedEventArgs e) { Button2.IsEnabled = false; var rmList = (from object i in MyFiveCards.Items let cName = (i as MyHand).CardName let cSuit = (i as MyHand).SuitName let a = (i as MyHand).Discard where a select cName + cSuit).ToList(); foreach (var r in rmList) { var ct = 0; foreach (var i in MyFiveCards.Items) { var cName = (i as MyHand).CardName; var cSuit = (i as MyHand).SuitName; var a = (i as MyHand).Discard; if (a) { MyFiveCards.Items.RemoveAt(ct); break; } ct++; } } foreach (var r in rmList) { var rnd = new Random(); var rndCard = rnd.Next(0, 52); var c = NewDeck.Items[rndCard]; if (MyFiveCards.Items.Count > 0) { var moveOn = false; while (!moveOn) { moveOn = true; foreach (var crd in MyFiveCards.Items) { var rmListMatch = ((PlayingCard)crd).CardName + ((PlayingCard)crd).SuitName; //Don''t accept any cards you already are holding if (((PlayingCard)crd).CardName == ((PlayingCard)c).CardName && ((PlayingCard)crd).SuitName == ((PlayingCard)c).SuitName) { rndCard = rnd.Next(0, 52); c = NewDeck.Items[rndCard]; moveOn = false; break; } //Don''t accept any discarded cards if (rmListMatch == r) { rndCard = rnd.Next(0, 52); c = NewDeck.Items[rndCard]; moveOn = false; break; } } } } var h = new MyHand { CardName = (c as PlayingCard).CardName, SuitName = (c as PlayingCard).SuitName, SuitColorName = (c as PlayingCard).SuitColorName, SuitColor = (c as PlayingCard).SuitColor, HierarchyValue = (c as PlayingCard).HierarchyValue, OverAllHierarchyCardValue = (c as PlayingCard).OverAllHierarchyCardValue, Discard = false }; //Default to Spades var path = AppDomain.CurrentDomain.BaseDirectory; path = path.Replace(@"\bin\Debug\", ""); var imagePath = path + @"\img\Spade.png"; var switchData = h.SuitName; switch (switchData) { case "CLUBS": imagePath = path + @"\img\Club.png"; break; case "HEARTS": imagePath = path + @"\img\Heart.png"; break; case "DIAMONDS": imagePath = path + @"\img\Diamond.png"; break; } Uri uri = new Uri(imagePath); var bmp = new System.Windows.Media.Imaging.BitmapImage(uri); var myImage = bmp; //System.Drawing.Image.FromFile(imagePath); h.Image = myImage; MyFiveCards.Items.Add(h); SortDataGrid(MyFiveCards, 4, ListSortDirection.Ascending); } }
private void Button1_Click(object sender, RoutedEventArgs e) { Button2.IsEnabled = true; MyFiveCards.Items.Clear(); var rnd = new Random(); for (int i = 0; i < 5; i++) { var rndCard = rnd.Next(0, 52); var c = NewDeck.Items[rndCard]; var moveOn = false; if (MyFiveCards.Items.Count > 0) { while (!moveOn) { moveOn = true; if (!MyFiveCards.Items.Cast <object>().Any(crd => ((PlayingCard)crd).CardName == ((PlayingCard)c).CardName && ((PlayingCard)crd).SuitName == ((PlayingCard)c).SuitName)) { continue; } rndCard = rnd.Next(0, 52); c = NewDeck.Items[rndCard]; moveOn = false; } } var h = new MyHand { CardName = (c as PlayingCard).CardName, SuitName = (c as PlayingCard).SuitName, SuitColorName = (c as PlayingCard).SuitColorName, SuitColor = (c as PlayingCard).SuitColor, HierarchyValue = (c as PlayingCard).HierarchyValue, OverAllHierarchyCardValue = (c as PlayingCard).OverAllHierarchyCardValue, Discard = false }; //Default to Spades var path = AppDomain.CurrentDomain.BaseDirectory; path = path.Replace(@"\bin\Debug\", ""); var imagePath = path + @"\img\Spade.png"; var switchData = h.SuitName; switch (switchData) { case "CLUBS": imagePath = path + @"\img\Club.png"; break; case "HEARTS": imagePath = path + @"\img\Heart.png"; break; case "DIAMONDS": imagePath = path + @"\img\Diamond.png"; break; } Uri uri = new Uri(imagePath); var bmp = new System.Windows.Media.Imaging.BitmapImage(uri); var myImage = bmp; //System.Drawing.Image.FromFile(imagePath); h.Image = myImage; MyFiveCards.Items.Add(h); } SortDataGrid(MyFiveCards, 4, ListSortDirection.Ascending); }