예제 #1
0
    void TakeObject()
    {
        Debug.Log("Mano " + handType.ToString() + " agarro!");

        if (grabbableObject != null)
        {
            grabbableObject.GetComponent <Rigidbody>().isKinematic = true;
            grabbableObject.transform.parent        = transform;
            grabbableObject.transform.localPosition = Vector3.zero;
            grabbingObject = true;
        }
    }
    // 色や位置などの更新
    private void onTargetUpdate(Cmd cmd)
    {
        if (cmd.hand.type != type.ToString())
        {
            return;
        }
        if (this.targetRenderer == null)
        {
            return;
        }

        // 「にぎる」度合い 0〜1
        if (cmd.hand.grabStrength != 0)
        {
            // 手を閉じてる時
            this.targetRenderer.material.color = this.color;
        }
        else
        {
            // 手を開いてる時
            this.targetRenderer.material.color = this.defaultColor;
        }

        // palmPosition 手のひらの中心位置 [X座標, Y座標, Z座標]
        float x = (float)Math.Round((float)cmd.hand.palmPosition[0] / 10.0f, 1, MidpointRounding.AwayFromZero);  // cmd.hand.palmPosition[0]/100;
        float y = (float)Math.Round((float)cmd.hand.palmPosition[1] / 10.0f, 1, MidpointRounding.AwayFromZero);  // cmd.hand.palmPosition[1]/100;
        float z = (float)Math.Round((float)cmd.hand.palmPosition[2] / 10.0f, 1, MidpointRounding.AwayFromZero) * -1;

        this.rb.MovePosition(new Vector3(this.targetOffsetPosition.x + x,
                                         this.targetOffsetPosition.y + y,
                                         this.targetOffsetPosition.z + z));
    }
예제 #3
0
    void SetKeyAndSprite(PlayerID id, HandType hand)
    {
        GameObject playerHand = GameObject.Find(id.ToString() + hand.ToString());

        key          = playerHand.transform.Find("Key").gameObject;
        keyText      = key.GetComponent <Graphic>();
        weaponSprite = playerHand.transform.Find("WeaponSprite").GetComponent <Image>();
        weaponText   = playerHand.transform.Find("WeaponName").GetComponent <Text>();
    }
예제 #4
0
    public void CalculateHandStrength()
    {
        strength = (15 - (int)playerHand) * 100;
        int rankAddition = 0;

        switch (playerHand)
        {
        case HandType.RoyalFlush:
            break;

        case HandType.StraightFlush:
            rankAddition += Cards[4].rank;
            break;

        case HandType.FourOfAKind:
            rankAddition += (Cards[2].rank * 4);
            break;

        case HandType.FullHouse:
            rankAddition += Cards[2].rank;
            break;

        case HandType.Flush:
            rankAddition += Cards[4].rank;
            break;

        case HandType.Straight:
            rankAddition += Cards[4].rank;
            break;

        case HandType.ThreeOfAKind:
            rankAddition += Cards[2].rank;
            break;

        case HandType.TwoPairs:
            rankAddition += Cards[4].rank;
            break;

        case HandType.OnePair:
            rankAddition += Cards[4].rank;
            break;

        case HandType.HighCard:
            rankAddition += Cards[4].rank;
            break;

        default:
            break;
        }
        strength += rankAddition;
        Debug.Log("type: " + playerHand.ToString() + " strength: " + strength + " card[4]: " + Cards[4]);
    }
예제 #5
0
 public WatchHand(HandType type, HandStyle style, float centerX, float centerY, int length)
 {
     handType  = type;
     HandStyle = style;
     _centerX  = (int)centerX;
     _centerY  = (int)centerY;
     _length   = length;
     if (string.IsNullOrEmpty(name))
     {
         name = type.ToString();
     }
     _isStartingAtCenter = style == HandStyle.CENTRIC;
     _startingRadius     = centerX;
     _endingRadius       = centerX;
 }
예제 #6
0
 private void SetupPayoffChart()
 {
     for (int i = 0; i < MAX_COL; i++)
     {
         Text[] texts = columns[i].GetComponentsInChildren <Text>();
         for (int j = 0; j < HandAnalyzer.MAX_HANDS - 1; j++)
         {
             HandType hand = (HandType)j;
             if (i == 0)
             {
                 texts[j].text = hand.ToString().Replace('_', ' ');
             }
             else
             {
                 texts[j].text = Payoffs.Payoff(hand, i).ToString();
             }
         }
     }
 }
예제 #7
0
 public string typeToString()
 {
     return(type.ToString());
 }
예제 #8
0
 public override string ToString()
 {
     return(hand.ToString() + ", " + kicker.ToString() + " kicker, " + pair.ToString() + " pair, " + draw.ToString() + " draw, " + straightDraw.ToString() + " straightdraw - " + GetRating().ToString());
 }
예제 #9
0
    // Update is called once per frame
    void Update()
    {
        if (Execute && !lastState)
        {
            //Pickup the object
            MSimulationState state = new MSimulationState(this.avatar.GetPosture(), this.avatar.GetPosture());


            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "idle: " + ObjectToTurn.name, "idle");

            MInstruction reachInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Reach: " + ObjectToTurn.name, "Pose/Reach")
            {
                Properties = new Dictionary <string, string>()
                {
                    { "Hand", "Right" },
                    { "TargetID", GraspTarget.MSceneObject.ID }
                }
            };


            if (this.HandPose != null)
            {
                MInstruction moveFingersInstruction = new MInstruction(System.Guid.NewGuid().ToString(), "Move fingers", "Pose/MoveFingers")
                {
                    Properties = new Dictionary <string, string>()
                    {
                        { "Hand", this.HandPose.HandType.ToString() }
                    },
                    Constraints    = new List <MConstraint>(),
                    StartCondition = reachInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
                };

                if (HandPose != null)
                {
                    string constraintID = Guid.NewGuid().ToString();
                    moveFingersInstruction.Properties.Add("HandPose", constraintID);
                    moveFingersInstruction.Constraints.Add(new MConstraint()
                    {
                        ID = constraintID,
                        PostureConstraint = HandPose.GetPostureConstraint()
                    });
                }


                this.avatar.CoSimulator.AssignInstruction(moveFingersInstruction, state);
            }

            MInstruction turnObjectInstruction = new MInstruction(Guid.NewGuid().ToString(), "turn: " + ObjectToTurn.name, "Object/Turn")
            {
                Properties = new Dictionary <string, string>()
                {
                    { "SubjectID", ObjectToTurn.MSceneObject.ID },
                    { "Axis", this.TurnAxis.MSceneObject.ID },
                    { "Repetitions", this.Repetitions.ToString() },
                    { "Angle", this.Angle.ToString(System.Globalization.CultureInfo.InvariantCulture) },
                    { "Hand", Hand.ToString() }
                },
                Constraints    = new List <MConstraint>(),
                StartCondition = reachInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            InstructionValidation validator = new InstructionValidation();
            MBoolResponse         res       = validator.Validate(turnObjectInstruction, this.avatar.MMUAccess.GetLoadableMMUs());

            if (!res.Successful)
            {
                foreach (string s in res.LogData)
                {
                    Debug.LogError(s);
                }
            }

            this.avatar.CoSimulator.AssignInstruction(idleInstruction, state);
            this.avatar.CoSimulator.AssignInstruction(reachInstruction, state);
            this.avatar.CoSimulator.AssignInstruction(turnObjectInstruction, state);
        }

        if (!Execute && lastState)
        {
            //Terminate
            this.avatar.CoSimulator.Abort();
        }

        lastState = Execute;
    }
예제 #10
0
        // Update is called once per frame
        void Update()
        {
            //GameObject controllerDot = NibiruAxis.NxrPlayerCtrl.Instance.GetControllerLaserDot();
            //if (controllerDot != null)
            //{
            //    Debug.Log("Contoller Dot:" + controllerDot.transform.position.ToString());
            //}
            //NxrReticle reticle = NxrViewer.Instance.GetNxrReticle();
            //if (reticle.IsShowing())
            //{
            //    Debug.Log("Reticle:" + reticle.GetReticlePointer().transform.position.ToString());
            //}

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_CENTER))
            {
                textMesh.text = "HMD Enter : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_CENTER))
            {
                textMesh.text = "HMD Enter : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_CENTER))
            {
                textMesh.text = "HMD Enter  : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_BACK))
            {
                textMesh.text = "HMD Back : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_BACK))
            {
                textMesh.text = "HMD Back : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_BACK))
            {
                textMesh.text = "HMD Back : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_LEFT))
            {
                textMesh.text = "HMD Left : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_LEFT))
            {
                textMesh.text = "HMD Left : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_LEFT))
            {
                textMesh.text = "HMD Left : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_RIGHT))
            {
                textMesh.text = "HMD Right : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_RIGHT))
            {
                textMesh.text = "HMD Right : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_RIGHT))
            {
                textMesh.text = "HMD Right : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_UP))
            {
                textMesh.text = "HMD Up : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_UP))
            {
                textMesh.text = "HMD Up : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_UP))
            {
                textMesh.text = "HMD Up : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_DOWN))
            {
                textMesh.text = "HMD Down : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_DOWN))
            {
                textMesh.text = "HMD Down : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_DOWN))
            {
                textMesh.text = "HMD Down : Up";
            }

            // 3DOF Controller
            if (InteractionManager.Is3DofControllerConnected())
            {
                InteractionManager.NACTION_HAND_TYPE mHandType = InteractionManager.GetHandTypeByHandMode();
                TextMesh textMeshController = textMeshControllerRight;
                if (mHandType == InteractionManager.NACTION_HAND_TYPE.HAND_LEFT)
                {
                    textMeshController = textMeshControllerLeft;
                }

                bool HasKeyDown = false;
                for (int i = 0, size = threeDofCtrlKeyCode.Length; i < size; i++)
                {
                    int    keyCode = threeDofCtrlKeyCode[i];
                    string keyStr  = threeDofCtrlKeyStr[i];
                    if (NxrInput.GetControllerKeyDown(keyCode))
                    {
                        textMeshController.text = keyStr + "Down_" + mHandType.ToString();
                        HasKeyDown = true;
                    }

                    if (!HasKeyDown && NxrInput.GetControllerKeyPressed(keyCode))
                    {
                        textMeshController.text = keyStr + "Pressed_" + mHandType.ToString();
                        HasKeyDown = true;
                    }

                    if (!HasKeyDown)
                    {
                        if (NxrInput.GetControllerKeyUp(keyCode))
                        {
                            textMeshController.text = keyStr + "Up_" + mHandType.ToString();
                        }
                    }
                }
            }
            else
            {
                // SixDof Controller
                foreach (InteractionManager.NACTION_HAND_TYPE HandType in handTypes)
                {
                    TextMesh textMeshCtrl = null;
                    if (HandType == InteractionManager.NACTION_HAND_TYPE.HAND_LEFT)
                    {
                        textMeshCtrl = textMeshControllerLeft;
                    }
                    else
                    {
                        textMeshCtrl = textMeshControllerRight;
                    }

                    bool HasKeyDown = false;
                    for (int i = 0, size = sixDofCtrlKeyCode.Length; i < size; i++)
                    {
                        int    keyCode = sixDofCtrlKeyCode[i];
                        string keyStr  = sixDofCtrlKeyStr[i];
                        if (NxrInput.GetControllerKeyDown(keyCode, HandType))
                        {
                            textMeshCtrl.text = keyStr + "Down_" + HandType.ToString();
                            HasKeyDown        = true;
                        }

                        if (!HasKeyDown && NxrInput.GetControllerKeyPressed(keyCode, HandType))
                        {
                            textMeshCtrl.text = keyStr + "Pressed_" + HandType.ToString();
                            HasKeyDown        = true;
                        }

                        if (!HasKeyDown)
                        {
                            if (NxrInput.GetControllerKeyUp(keyCode, HandType))
                            {
                                textMeshCtrl.text = keyStr + "Up_" + HandType.ToString();
                            }
                        }
                    }
                }
            }
        }
예제 #11
0
        private void TurnOffPressedEffect()
        {
            isPressedOn = false;

            switch (Type) {
            case HandType.Rock:
            case HandType.RockPressed:
                Type = HandType.Rock;
                break;
            case HandType.Paper:
            case HandType.PaperPressed:
                Type = HandType.Paper;
                break;
            case HandType.Scissors:
            case HandType.ScissorsPressed:
                Type = HandType.Scissors;
                break;
            default:
                throw new Exception (string.Format ("Unrecognized Hand Type: {0}", Type.ToString ()));
            }
        }
예제 #12
0
        private void RenderPointer(PointF position, PointF unclampedPosition, float handReachExtent, TimeSpan timeCounter, ulong trackingId, HandType handType)
        {
            try
            {
                if (trackingId > 0 && firstTrackId == 0)
                {
                    firstTrackId = trackingId;
                }
                if (firstTrackId == trackingId && firstTrackId != 0)
                {
                    PosX = unclampedPosition.X * mainScreen.ActualWidth - 60 / 2;
                    PosY = unclampedPosition.Y * mainScreen.ActualHeight - 60 / 2;
                    Canvas.SetLeft(handType.ToString() == "LEFT" ? imgHandLeft : imgHandRight, PosX);
                    Canvas.SetTop(handType.ToString() == "LEFT" ? imgHandLeft : imgHandRight, PosY);
                    HandTypeID = handType.ToString() == "LEFT" ? HandTypeEnum.LEFT : HandTypeEnum.RIGHT;

                    int scrnH = (int)System.Windows.SystemParameters.PrimaryScreenHeight;
                    int scrnW = (int)System.Windows.SystemParameters.PrimaryScreenWidth;

                    //Si ya se cargaron las imagenes desde el Thread (falta mostrar algo que diga CARGANDO IMAGENES)
                    if (workerObject.IsLoadPages)
                    {
                        if (FirstExecution)
                        {
                            loading.Visibility = System.Windows.Visibility.Hidden;
                            ChangePages(1, Convert.ToInt32(PosX), true, IsSidePage);
                            FirstExecution = false;
                        }

                        //Si estoy en cualquiera de los laterales
                        if (PositionActual == SectionsPages.LEFT || PositionActual == SectionsPages.RIGHT)
                        {
                            IsSidePage = PositionActual;
                        }

                        if (HandTypeID == HandTypeEnum.RIGHT)
                        {
                            //Estoy dentro de la seccion lateral izquierda
                            if (PosX >= 0 && PosX <= WithSideSection && PosY >= 0 && PosY <= scrnH)
                            {
                                //izquierdo
                                if (IsChangingPage)
                                {
                                    //Esto hace que solo se cambie de pagina luego de haber pasado la pagina por completo, es decir, vengo del lado derecho al izquierdo.
                                    if (IsSidePage == SectionsPages.RIGHT)
                                    {
                                        //Si la mano esta por debajo de la mitad de la pantalla, dejo fija las paginas y cancelo el efecto de cambio de pagina
                                        if (PosY > scrnH / 2)
                                        {
                                            IsChangingPage = false;
                                            ChangePages(PageActual, Convert.ToInt32(PosX), true, IsSidePage);
                                            IsSidePage = SectionsPages.WINDOW;
                                        }
                                    }
                                }
                                else
                                {
                                    //Si la mano esta por encima de la mitad de la pantalla, hago el cambio de posicion para posteriormente aplicar el efecto
                                    if (PosY < scrnH / 2)
                                    {
                                        PositionActual = SectionsPages.LEFT;
                                    }
                                }
                            }
                            //O del lateral derecho
                            else if (PosX >= scrnW - WithSideSection && PosX <= scrnW && PosY >= 0 && PosY <= scrnH)
                            {
                                //derecho
                                if (IsChangingPage)
                                {
                                    //Esto hace que solo se cambie de pagina luego de haber pasado la pagina por completo, es decir, vengo del lado izquierda al derecho.
                                    if (IsSidePage == SectionsPages.LEFT)
                                    {
                                        //Si la mano esta por debajo de la mitad de la pantalla, dejo fija las paginas y cancelo el efecto de cambio de pagina
                                        if (PosY > scrnH / 2)
                                        {
                                            IsChangingPage = false;
                                            ChangePages(PageActual, Convert.ToInt32(PosX), true, IsSidePage);
                                            IsSidePage = SectionsPages.WINDOW;
                                        }
                                    }
                                }
                                else
                                {
                                    //Si la mano esta por encima de la mitad de la pantalla, hago el cambio de posicion para posteriormente aplicar el efecto
                                    if (PosY < scrnH / 2)
                                    {
                                        PositionActual = SectionsPages.RIGHT;
                                    }
                                }
                            }
                            //Ejecuto el cambio de pagina luego que me salgo del sector izquierdo o derecho
                            else if (PosX >= WithSideSection && PosX <= scrnW - WithSideSection && PosY >= 0 && PosY <= scrnH)
                            {
                                if (!IsChangingPage)
                                {
                                    if (IsSidePage == SectionsPages.RIGHT)
                                    {
                                        if (PageActual + 2 < PagesNumbers)
                                        {
                                            PageActual    += 2;
                                            IsChangingPage = true;
                                        }
                                    }
                                    else if (IsSidePage == SectionsPages.LEFT)
                                    {
                                        if (PageActual - 2 >= 1)
                                        {
                                            PageActual    -= 2;
                                            IsChangingPage = true;
                                        }
                                    }
                                }

                                PositionActual = SectionsPages.WINDOW;

                                //Si ya estuve en algunos de los laterales y luego me salgo de esa zona y el flag IschanginPage es true, aplico efecto de cambio de pagina
                                if ((PositionActual == SectionsPages.WINDOW) && (IsChangingPage))
                                {
                                    ChangePages(PageActual, Convert.ToInt32(PosX), false, IsSidePage);
                                }
                            }
                            else
                            {
                                PositionActual = SectionsPages.OUT;
                            }
                        }
                    }

                    texto.Text = "pos X: " + PosX.ToString() + "/ pos Y: " + PosY.ToString() + " / POSITION (" + PositionActual.ToString() + ") / Pagina: " + PageActual.ToString() + " / ChangingPage: " + IsChangingPage.ToString() + " / Side: " + IsSidePage.ToString();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #13
0
        public static KeyValuePair <string, string> Evaluate(IDictionary <string, PokerHand> hands)
        {
            if (HasDuplicates(hands.Values.ToList()))
            {
                throw new Exception("There are duplicate cards");
            }

            var      len         = Enum.GetValues(typeof(HandType)).Length;
            var      winners     = new List <string>();
            HandType winningType = HandType.HighCard;

            foreach (var name in hands.Keys)
            {
                for (var handType = HandType.RoyalFlush; (int)handType < len; handType = handType + 1)
                {
                    var hand = hands[name];
                    if (hand.IsValid(handType)) // Is hand one of the valid types?
                    {
                        int compareHands = 0, compareCards = 0;
                        if (winners.Count == 0 || // Are there any winning hands? If no winning hands, add one.
                            (compareHands = winningType.CompareTo(handType)) > 0 || // Proceed to next check if current handType does not beat winning handType. If it does, add to winners.
                            compareHands == 0 && // Proceed to next check if hands are equal. If current hand is worse than winning hand, do nothing.
                            (compareCards = hand.CompareTo(hands[winners[0]])) >= 0)  // Check to see if current hand beats winning hand. New Winner?
                        {
                            if (compareHands > 0 || compareCards > 0)
                            {
                                winners.Clear();
                            }
                            winners.Add(name);
                            winningType = handType;
                        }
                        break;
                    }
                }
            }
            KeyValuePair <string, string> winner = new KeyValuePair <string, string>(winners.First(), winningType.ToString());

            return(winner);
        }
예제 #14
0
        private void RenderPointer(PointF position, PointF unclampedPosition, float handReachExtent, TimeSpan timeCounter, ulong trackingId, HandType handType)
        {
            if (trackingId > 0 && firstTrackId == 0)
            {
                firstTrackId = trackingId;
            }
            if (firstTrackId == trackingId && firstTrackId != 0)
            {
                double posX = unclampedPosition.X * mainScreen.ActualWidth - 60 / 2;
                double posY = unclampedPosition.Y * mainScreen.ActualHeight - 60 / 2;

                Canvas.SetLeft(handType.ToString() == "LEFT" ? imgHandLeft : imgHandRight, posX);
                Canvas.SetTop(handType.ToString() == "LEFT" ? imgHandLeft : imgHandRight, posY);

                int manoID = handType.ToString() == "LEFT" ? HandLeftId : HandRightId;

                if (manoID == HandRightId)
                {
                    bool encontro = false;
                    int  offsetX  = (WidthScreen - GetWithTotalThumbnails()) / 2;

                    for (int x = 0; x < GalleriesLoaded; x++)
                    {
                        int i      = GalleriesSecuence[x];
                        int offset = offsetX + i * (thumbnailWidth + 10);
                        if (posX > offset && posX < offset + thumbnailWidth && posY > 0 && posY < thumbnailHeight)
                        {
                            if (thumbnailWhere == x)
                            {
                                thumbnailCounter++;
                                if (thumbnailCounter >= 30)
                                {
                                    vista360.Children.Clear();
                                    GalleriesSecuence[autoActual] = GalleriesSecuence[x];
                                    autoActual           = x;
                                    GalleriesSecuence[x] = -1;
                                    vista360.Children.Add(lstGallery[autoActual].getImages()[0]);
                                    thumbnailCounter = 0;
                                    ReorderThumbnails();
                                }
                            }
                            else
                            {
                                thumbnailWhere   = x;
                                thumbnailCounter = 1;
                            }
                            encontro = true;
                            break;
                        }
                        //texto.Text = "pos X: " + posX.ToString() + "/ pos Y: " + posY.ToString() + " / OffSet: " + offset.ToString();
                    }
                    if (!encontro)
                    {
                        thumbnailCounter = 0;
                        thumbnailWhere   = -1;
                    }
                }

                int cantImg = lstGallery[autoActual].getQtyImages();
                //Aqui se determina que imagen se va a tomar del Array. Esto basado en la posicion en X y considerando que se toma el doble de imagenes
                //Se compara ahora la cantidad de imagenes respecto al total de maximo de frames... Esto es porque si son muchos frames, no es necesario multiplicar la cantidad de imagenes para dar el efecto
                //de movimiento. Para los casos de Videos, seria bueno tener mas frames pero hay que tener cuidado con la memoria del sistema
                int imagen = (int)((posX * (cantImg * ((cantImg < maxFrames) ? 2 : 1)) - 1) / WidthScreen) + 1;
                //texto.Text = "pos X: " + posX.ToString() + "/ pos Y: " + posY.ToString() + " / Image: " + imagen.ToString();

                if (imagen > cantImg)
                {
                    imagen -= cantImg;
                }
                imagen -= 1;

                if (imagen < 0 || imagen > cantImg - 1)
                {
                    //texto.Content += " NULL";
                }
                else if (posY > initMove && posY < endMove)
                {
                    vista360.Children.Clear();
                    vista360.Children.Add(lstGallery[autoActual].getImages()[imagen]);
                    ReorderThumbnails();
                }
            }
        }
예제 #15
0
 public void CheckHand()
 {
     playerHand        = CalculateHand();
     handTypeText.text = playerHand.ToString();
     //handTypeText.enabled = true;
 }
예제 #16
0
        private void RenderPointer(PointF position, PointF unclampedPosition, float handReachExtent, TimeSpan timeCounter, ulong trackingId, HandType handType)
        {
            /*manoLeft.Margin = new Thickness(unclampedPosition.X * prueba2.ActualWidth, unclampedPosition.Y * prueba2.ActualHeight, 0, 0);
             * manoRight.Margin = new Thickness(position.X * prueba2.ActualWidth, position.Y * prueba2.ActualHeight, 0, 0);*/
            //texto.Content = "(" + unclampedPosition.X + " * " + mainScreen.ActualWidth + ", " + unclampedPosition.Y + " * " + mainScreen.ActualHeight + ")";
            if (trackingId > 0 && firstTrackId == 0)
            {
                firstTrackId = trackingId;
            }
            if (firstTrackId == trackingId && firstTrackId != 0)
            {
                double posX = unclampedPosition.X * mainScreen.ActualWidth - 60 / 2;
                double posY = unclampedPosition.Y * mainScreen.ActualHeight - 60 / 2;
                //texto.Content = "A     ";
                Canvas.SetLeft(handType.ToString() == "LEFT" ? manoLeft : manoRight, posX);
                Canvas.SetTop(handType.ToString() == "LEFT" ? manoLeft : manoRight, posY);
                int manoID = handType.ToString() == "LEFT" ? manoLeftID : manoRightID;
                //vientoActivado[manoID] = true;
                //texto.Content = manoID+" - "+posX+" - "+posY;
                if (tipoBarrido == 2)
                {
                    double distancia = Math.Sqrt(Math.Pow(posX - posInicialMano[manoID].X, 2) + Math.Pow(posY - posInicialMano[manoID].Y, 2));
                    vientoActivado[manoID] = (distancia > 100);
                    if (vientoActivado[manoID])
                    {
                        Line line = new Line();
                        line.Stroke = Brushes.Red;
                        line.X1     = posX;
                        line.Y1     = posY;
                        line.X2     = posInicialMano[manoID].X;
                        line.Y2     = posInicialMano[manoID].Y;
                        ventanaIco.Children.Add(line);
                    }
                    if (timeMano[manoID] + 40 <= timeCounter.TotalMilliseconds)
                    {
                        timeMano[manoID]       = timeCounter.TotalMilliseconds;
                        posInicialMano[manoID] = new Point(posX, posY);
                    }
                    //texto.Content = "     " + vientoActivado[0] + " " + vientoActivado[1] + " " + (float)distancia;
                    //texto.Content = "          "+timeCounter.Seconds+" "+timeCounter.TotalMilliseconds;

                    if (vientoActivado[manoID] == true)
                    {
                        //barridoViento((int)posX, (int)posY);
                    }
                }
                else
                {
                    foreach (Image img in iconos)
                    {
                        if (img == null)
                        {
                            continue;
                        }
                        double imgTop  = Canvas.GetTop(img);
                        double imgLeft = Canvas.GetLeft(img);
                        if (tipoBarrido == 0)
                        {
                            if (posX + 32 >= imgLeft && posX <= imgLeft + anchoLogo && posY - 32 <= imgTop && posY >= imgTop - altoLogo)
                            {
                                ventanaIco.Children.Remove(img);
                            }
                        }
                        else if (tipoBarrido == 1)
                        {
                            if (manoIcoPointer[manoID] == null)
                            {
                                if (posX + 32 >= imgLeft && posX <= imgLeft + anchoLogo && posY - 32 <= imgTop && posY >= imgTop - altoLogo)
                                {
                                    manoIcoPointer[manoID] = img;
                                }
                            }
                        }
                    }
                    if (tipoBarrido == 1)
                    {
                        if (manoIcoPointer[manoID] != null)
                        {
                            Canvas.SetLeft(manoIcoPointer[manoID], posX);
                            Canvas.SetTop(manoIcoPointer[manoID], posY);
                            //texto.Content = "A     " + (int)posX + " <= " + (int)(0 - anchoLogo) + " || " + (int)posX + " >= " + (int)anchoRes + " || " + (int)posY + " <= " + (0 - altoLogo )+ " || " + (int)posY + " >= " + (int)altoRes;

                            if (posX <= 0 - anchoLogo || posX >= anchoRes || posY <= 0 - altoLogo || posY >= altoRes)
                            {
                                manoIcoPointer[manoID] = null;
                            }
                        }
                    }
                }
            }
        }
예제 #17
0
 public void SetHandDisplay(HandType handType)
 {
     display.text = (handType == HandType.OTHER) ? string.Empty : handType.ToString().Replace('_', ' ');
 }
예제 #18
0
 public static string GetName(HandType value)
 {
     Utility.CheckEnumValue(value);
     return value.ToString().Replace("_", " ");
 }
예제 #19
0
 public override string ToString()
 {
     return(type.ToString());
 }
예제 #20
0
 public void ShowPressedEffect(GameTime gameTime)
 {
     isPressedOn = true;
     pressedEffectStartTime = gameTime.TotalGameTime;
     switch (Type) {
     case HandType.Rock:
     case HandType.RockPressed:
         Type = HandType.RockPressed;
         break;
     case HandType.Paper:
     case HandType.PaperPressed:
         Type = HandType.PaperPressed;
         break;
     case HandType.Scissors:
     case HandType.ScissorsPressed:
         Type = HandType.ScissorsPressed;
         break;
     default:
         throw new Exception (string.Format ("Unrecognized Hand Type: {0}", Type.ToString ()));
     }
 }