// Use this for initialization
 void Start()
 {
     foreach (GameObject OutObj in OutObjList)
     {
         OutObj.SetActive(false);
     }
 }
Пример #2
0
        /// <summary>
        /// Send our row to TEDE
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSend_Click(object sender, EventArgs e)
        {
            string[] splStr = txtMMServer.Text.Split(':');

            //Create our batch ID
            int BatchID = (int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds;

            using (TcpClient Client = new TcpClient(splStr[0], int.Parse(splStr[1])))
                using (StreamWriter sW = new StreamWriter(Client.GetStream()))
                {
                    Type InType = BoundList.GetType().GetGenericArguments()[0];

                    sW.WriteLine("#" + BatchID.ToString() + "," + InType.GetCustomAttribute <FileNameAttribute>().FileName);
                    //Write our header
                    for (int a = 0; a < dgvData.Columns.Count; a++)
                    {
                        sW.Write((a == 0 ? "#" : ",") + dgvData.Columns[a].DataPropertyName);
                    }
                    sW.WriteLine();

                    //Write each row
                    foreach (Object OutObj in BoundList)
                    {
                        PropertyInfo[] pI = OutObj.GetType().GetProperties();
                        for (int a = 0; a < pI.Length; a++)
                        {
                            Object OutVal = pI[a].GetValue(OutObj);
                            if (OutVal == null)
                            {
                                sW.Write(a == 0 ? "" : ",");
                            }
                            else if (OutVal is bool)
                            {
                                sW.Write((a == 0 ? "" : ",") + ((bool)OutVal ? "T" : "F"));
                            }
                            else if (OutVal is DateTime)
                            {
                                sW.Write((a == 0 ? "" : ",") + ((DateTime)OutVal - new DateTime(1970, 1, 1)).TotalSeconds.ToString("0"));
                            }
                            else
                            {
                                sW.Write((a == 0 ? "" : ",") + OutVal.ToString());
                            }
                            sW.WriteLine();
                        }
                    }
                    sW.WriteLine("#" + BatchID.ToString());
                }
        }
Пример #3
0
 public void Show()
 {
     OutObj.Write(ObjString.GetObj());
 }
Пример #4
0
 public void Show()
 {
     OutObj.Write(ObjDateTime.GetObj());
 }
Пример #5
0
 public void Show()
 {
     OutObj.Write(ObjInt.GetObj());
 }
Пример #6
0
 public void Show()
 {
     OutObj.Write(Tobj.GetObj());
 }
    void Update()
    {
        KinectManager manager = KinectManager.Instance;

        if (manager && manager.IsInitialized() && foregroundCamera)
        {
            //			//backgroundImage.renderer.material.mainTexture = manager.GetUsersClrTex();
            //			if(backgroundImage && (backgroundImage.texture == null))
            //			{
            //				backgroundImage.texture = manager.GetUsersClrTex();
            //			}

            // get the background rectangle (use the portrait background, if available)
            Rect backgroundRect             = foregroundCamera.pixelRect;
            PortraitBackground portraitBack = PortraitBackground.Instance;

            if (portraitBack && portraitBack.enabled)
            {
                backgroundRect = portraitBack.GetBackgroundRect();
            }

            // overlay all joints in the skeleton
            if (manager.IsUserDetected(playerIndex))
            {
                DriverManager.instance.OutObjList[0].GetComponent <Text>().text = "Driver : Recognized";
                DriverManager.instance.OutObjList[0].SetActive(true);

                long userId      = manager.GetUserIdByIndex(playerIndex);
                int  jointsCount = manager.GetJointCount();

                for (int i = 0; i < jointsCount; i++)
                {
                    int joint = i;

                    if (manager.IsJointTracked(userId, joint))
                    {
                        Vector3 posJoint = manager.GetJointPosColorOverlay(userId, joint, foregroundCamera, backgroundRect);
                        //Vector3 posJoint = manager.GetJointPosition(userId, joint);

                        if (joints != null)
                        {
                            // overlay the joint
                            if (posJoint != Vector3.zero)
                            {
                                joints[i].SetActive(true);
                                joints[i].transform.position = posJoint;

                                Quaternion rotJoint = manager.GetJointOrientation(userId, joint, false);
                                rotJoint = initialRotation * rotJoint;
                                joints[i].transform.rotation = rotJoint;

                                ////Main Routine
                                if (joints[6].activeSelf)
                                {
                                    ///LeftArm Gaze
                                    if (joints[6].transform.position.y > joints[1].transform.position.y)
                                    {
                                        if ((joints[6].transform.position.y - joints[1].transform.position.y) > 0.05f)
                                        {
                                            DriverManager.instance.OutObjList[3].GetComponent <Text>().text = "LeftArm : Up";
                                            DriverManager.instance.OutObjList[3].SetActive(true);
                                        }
                                        else
                                        {
                                            DriverManager.instance.OutObjList[3].SetActive(true);
                                        }
                                    }
                                    else if ((joints[6].transform.position.x - joints[4].transform.position.x) > 0.05f)
                                    {
                                        DriverManager.instance.OutObjList[3].GetComponent <Text>().text = "LeftArm : Down";
                                        DriverManager.instance.OutObjList[3].SetActive(true);
                                    }
                                    else
                                    {
                                        DriverManager.instance.OutObjList[3].SetActive(false);
                                    }
                                    ///LeftArm Position
                                    if ((joints[4].transform.position.x - joints[6].transform.position.x) > 0.15f)
                                    {
                                        DriverManager.instance.OutObjList[1].GetComponent <Text>().text = "LeftArm : Left";
                                        DriverManager.instance.OutObjList[1].SetActive(true);
                                    }
                                    else
                                    {
                                        DriverManager.instance.OutObjList[1].SetActive(false);
                                    }
                                }
                                if (joints[10].activeSelf)
                                {
                                    ///RightArm Gaze
                                    if (joints[10].transform.position.y > joints[1].transform.position.y)
                                    {
                                        if ((joints[10].transform.position.y - joints[1].transform.position.y) > 0.05f)
                                        {
                                            DriverManager.instance.OutObjList[4].GetComponent <Text>().text = "RightArm : Up";
                                            DriverManager.instance.OutObjList[4].SetActive(true);
                                        }
                                        else
                                        {
                                            DriverManager.instance.OutObjList[4].SetActive(false);
                                        }
                                    }
                                    else if ((joints[8].transform.position.x - joints[10].transform.position.x) > 0.02f)
                                    {
                                        DriverManager.instance.OutObjList[4].GetComponent <Text>().text = "RightArm : Down";
                                        DriverManager.instance.OutObjList[4].SetActive(true);
                                    }
                                    else
                                    {
                                        DriverManager.instance.OutObjList[4].SetActive(false);
                                    }
                                    ///RightArm Position
                                    if ((joints[10].transform.position.x - joints[8].transform.position.x) > 0.1f)
                                    {
                                        DriverManager.instance.OutObjList[2].GetComponent <Text>().text = "RightArm : Right";
                                        DriverManager.instance.OutObjList[2].SetActive(true);
                                    }
                                    else
                                    {
                                        DriverManager.instance.OutObjList[2].SetActive(false);
                                    }
                                }
                                //Debug.Log("joint" + joints[6].transform.position.y.ToString());
                            }
                            else
                            {
                                joints[i].SetActive(false);
                            }
                        }
                    }
                    else
                    {
                        if (joints != null)
                        {
                            joints[i].SetActive(false);
                        }
                    }
                }
            }
            else
            {
                foreach (GameObject OutObj in DriverManager.instance.OutObjList)
                {
                    OutObj.SetActive(false);
                }
            }
        }
    }