コード例 #1
0
        static void Main()
        {
            /*Application.SetHighDpiMode(HighDpiMode.SystemAware);
             * Application.EnableVisualStyles();
             * Application.SetCompatibleTextRenderingDefault(false);
             * Application.Run(new Form1());*/

            VRClient client = new VRClient("145.48.6.10", 6666);

            if (client.Connect())
            {
                List <DVRSessionItem> sessionList = client.GetSessionList();
                for (int i = 0; i < sessionList.Count; i++)
                {
                    Console.WriteLine($"{i + 1} {sessionList[i].clientinfo.user}");
                }

                Console.Write("Select Session: ");

                int selectedSession;
                while (!int.TryParse(Console.ReadLine(), out selectedSession))
                {
                    Console.Write("Select Session: ");
                }

                Console.Write("Enter key (leave empty if not needed): ");
                string key = Console.ReadLine();

                try
                {
                    VRTunnel tunnel = client.CreateTunnel(sessionList[selectedSession - 1].id, key);

                    if (tunnel != null)
                    {
                        bool succeded = false;
                        while (!succeded)
                        {
                            try
                            {
                                succeded = SetScene(tunnel);
                            }
                            catch (VRCallbackException ex)
                            {
                                Console.WriteLine($"Error package: {ex.Message}");
                            }
                        }
                    }
                }
                catch (VRClientException ex)
                {
                    Console.WriteLine($"Create Tunnel failed: {ex.Message}");
                }
            }
            else
            {
                Console.WriteLine("Connection Failed!");
            }
        }
コード例 #2
0
 public VRConnectForm(Client client)
 {
     InitializeComponent();
     this.client   = client;
     this.vrClient = new VRClient("145.48.6.10", 6666);
     if (this.vrClient.Connect())
     {
         this.sessionList = vrClient.GetSessionList();
         foreach (var sessionItem in this.sessionList)
         {
             dataGridView1.Rows.Add(sessionItem.clientinfo.user, sessionItem.id);
         }
     }
 }
コード例 #3
0
        private void DeleteClientConfig(ConnectionInfo connectionInfo, Client client)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                VRClient vrc = m.VRClients.Where(x => x.ID == client.ClientID).FirstOrDefault();

                if (vrc != null)
                {
                    vrc.IsDeleted = true;
                    m.SaveChanges();
                    //m.Cache.Release(m.VRClients);
                }
            }

            //BuildInternalClientStatus();

            GetConfiguredClientList(connectionInfo);
        }
コード例 #4
0
        private void UpdateInternalClientStatus(string ipAddress, string machineName, VRGameSelectorDTO.Enums.LiveClientStatus liveClientStatus, string addInfo)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAddress).FirstOrDefault();

                if (iClientStatus != null)
                {
                    VRClient vrc = m.VRClients.Where(x => x.IPAddress == ipAddress && !x.IsDeleted).FirstOrDefault();

                    if (vrc != null && !vrc.MachineName.ToString().Equals(machineName))
                    {
                        vrc.MachineName = machineName;
                        m.SaveChanges();
                        //m.Cache.Release(m.VRClients);
                    }

                    iClientStatus.ClientName     = machineName;
                    iClientStatus.ClientStatus   = (VRGameSelectorServerDTO.Enums.LiveClientStatus)liveClientStatus;
                    iClientStatus.AdditionalInfo = addInfo;
                }
            }
        }
コード例 #5
0
        private void ModifyClientConfig(ConnectionInfo connectionInfo, Client client)
        {
            bool isChangeConfigSetOnly = false;

            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                VRClient vrc = m.VRClients.Where <VRClient>(x => x.ID == client.ClientID).FirstOrDefault();

                if (vrc != null)
                {
                    if (vrc.IPAddress == client.IPAddress && vrc.DashboardModuleIP == client.DashboardModuleIP)
                    {
                        isChangeConfigSetOnly = true;
                    }
                    else
                    {
                        vrc.IPAddress         = client.IPAddress;
                        vrc.DashboardModuleIP = client.DashboardModuleIP;
                    }

                    vrc.TileConfigSetID = client.TileConfigSetID;

                    m.SaveChanges();
                    //m.Cache.Release(m.VRClients);
                }
            }

            if (isChangeConfigSetOnly)
            {
                RefreshConfigSetForClient(client.ClientID, client.TileConfigSetID);
            }

            //BuildInternalClientStatus();

            GetConfiguredClientList(connectionInfo);
        }
コード例 #6
0
        private void AddClientConfig(ConnectionInfo connectionInfo, Client client)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                VRClient vrc = new VRClient()
                {
                    IPAddress         = client.IPAddress,
                    DashboardModuleIP = client.DashboardModuleIP,
                    TileConfigSetID   = client.TileConfigSetID,
                    Tileconfigset     = null,
                    MachineName       = "",
                    VRClienthistories = null,
                    IsDeleted         = false
                };

                m.Add(vrc);
                m.SaveChanges();
                //m.Cache.Release(m.VRClients);
            }

            //BuildInternalClientStatus();

            GetConfiguredClientList(connectionInfo);
        }
コード例 #7
0
        private void ClientSetAllTileConfig(ConnectionInfo connectionInfo, bool withImage = false)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                string ipAdd = ((IPEndPoint)connectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString();

                InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault();

                VRClient vrc = m.VRClients.Where(x => x.IPAddress == ipAdd && !x.IsDeleted).FirstOrDefault();

                if (vrc != null)
                {
                    List <VRTileconfig> lvrt0 = m.VRTileconfigs.Where(x => x.TileConfigSetID == vrc.TileConfigSetID && x.VRTileconfigID == 0 && !x.IsDeleted).ToList(); // root level

                    if (lvrt0 != null)
                    {
                        VRGameSelectorDTO.TileConfig tc = new VRGameSelectorDTO.TileConfig();

                        foreach (VRTileconfig vrt in lvrt0)                                                  // first process root level
                        {
                            string imagePath = (vrt.ImageData.Length > 0) ? vrt.ID.ToString() + ".bmp" : ""; // full path will be decided on client end

                            if (withImage)
                            {
                                GetType();
                            }

                            VRGameSelectorDTO.ImageInfo ii = new VRGameSelectorDTO.ImageInfo(vrt.ImageData, !withImage);

                            Tile t = new Tile(vrt.TileHeight, vrt.TileWidth, vrt.TileRowNumber, vrt.ID.ToString(), vrt.TileTitle, imagePath, vrt.TileDesc, vrt.Command, vrt.Arguments, vrt.WorkingPath, ii, vrt.AgeRequire, vrt.VideoURL);

                            tc.MainScreenTiles.Add(t);
                        }

                        List <VRTileconfig> lvrt1 = m.VRTileconfigs.Where(x => x.TileConfigSetID == vrc.TileConfigSetID && x.VRTileconfigID != 0 && !x.IsDeleted).ToList(); // sub level

                        if (lvrt1 != null)
                        {
                            foreach (VRTileconfig vrt in lvrt1)
                            {
                                Tile targetVrt = tc.MainScreenTiles.Where(x => x.TileID == vrt.VRTileconfigID.ToString()).FirstOrDefault();

                                if (targetVrt != null)
                                {
                                    string imagePath = (vrt.ImageData.Length > 0) ? vrt.ID.ToString() + ".bmp" : ""; // full path will be decided on client end

                                    VRGameSelectorDTO.ImageInfo ii = new VRGameSelectorDTO.ImageInfo(vrt.ImageData, !withImage);


                                    Tile t = new Tile(vrt.TileHeight, vrt.TileWidth, vrt.TileRowNumber, vrt.ID.ToString(), vrt.TileTitle, imagePath, vrt.TileDesc, vrt.Command, vrt.Arguments, vrt.WorkingPath, ii, vrt.AgeRequire, vrt.VideoURL);

                                    targetVrt.ChildTiles.Add(t);
                                }
                            }
                        }



                        VRCommand vcs = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.GET_ALL_TILE_CONFIG, tc);

                        SendCommandToPeer(connectionInfo, vcs);

                        if (iClientStatus != null)
                        {
                            iClientStatus.LastTileConfigDownloadTimestamp = DateTime.Now;
                        }
                    }
                }
            }
        }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        //store bones in a list for easier access, everything except Hip_Center will be one
        //higher than the corresponding Kinect.NuiSkeletonPositionIndex (because of the hip_override)
        //        _bones = new GameObject[25] {
        //null, Hip_Center, Spine, Shoulder_Center,
        //Collar_Left, Shoulder_Left, Elbow_Left, Wrist_Left,
        //Collar_Right, Shoulder_Right, Elbow_Right, Wrist_Right,
        //Hip_Override, Hip_Left, Knee_Left, Ankle_Left,
        //null, Hip_Right, Knee_Right, Ankle_Right,
        ////extra joints to determine the direction of some bones
        //Head, Hand_Left, Hand_Right, Foot_Left, Foot_Right};

        _bones = new GameObject[(int)Kinect.NuiSkeletonPositionIndex.Count + 5] {
            null, Hip_Center, Spine, Shoulder_Center,
            Collar_Left, Shoulder_Left, Elbow_Left, Wrist_Left,
            Collar_Right, Shoulder_Right, Elbow_Right, Wrist_Right,
            Hip_Override, Hip_Left, Knee_Left, Ankle_Left,
            null, Hips_Right, Knee_Right, Ankle_Right,
            //extra joints to determine the direction of some bones
            Head, Hand_Left, Hand_Right, Foot_Left, Foot_Right
        };


        //determine which bones are not available
        for (int ii = 0; ii < _bones.Length; ii++)
        {
            if (_bones[ii] == null)
            {
                _nullMask |= (uint)(1 << ii);
            }
        }

        //store the base rotations and bone directions (in bone-local space)
        _baseRotation = new Quaternion[20];
        _boneDir      = new Vector3[20];

        //first save the special rotations for the hip and spine
        _hipRight = Hips_Right.transform.position - Hip_Left.transform.position;
        _hipRight = Hip_Override.transform.InverseTransformDirection(_hipRight);

        _chestRight = Shoulder_Right.transform.position - Shoulder_Left.transform.position;
        _chestRight = Spine.transform.InverseTransformDirection(_chestRight);

        //get direction of all other bones
        for (int ii = 0; ii < 20; ii++)
        {
            if ((_nullMask & (uint)(1 << ii)) <= 0)
            {
                //save initial rotation
                _baseRotation[ii] = _bones[ii].transform.localRotation;

                //if the bone is the end of a limb, get direction from this bone to one of the extras (hand or foot).
                if (ii % 4 == 3 && ((_nullMask & (uint)(1 << (ii / 4) + 20)) <= 0))
                {
                    _boneDir[ii] = _bones[(ii / 4) + 20].transform.position - _bones[ii].transform.position;
                }
                //if the bone is the hip_override (at boneindex Hip_Left, get direction from average of left and right hips
                else if (ii == 12)
                {
                    _boneDir[ii] = ((Hips_Right.transform.position + Hip_Left.transform.position) / 2F) - Hip_Override.transform.position;
                }
                //otherwise, get the vector from this bone to the next.
                else if ((_nullMask & (uint)(1 << ii + 1)) <= 0)
                {
                    _boneDir[ii] = _bones[ii + 1].transform.position - _bones[ii].transform.position;
                }
                else
                {
                    continue;
                }
                //Since the spine of the kinect data is ~40 degrees back from the hip,
                //check what angle the spine is at and rotate the saved direction back to match the data
                if (ii == 1)
                {
                    float angle = Vector3.Angle(transform.up, _boneDir[ii]);
                    _boneDir[ii] = Quaternion.AngleAxis(-40 + angle, transform.right) * _boneDir[ii];
                }
                //transform the direction into local space.
                _boneDir[ii] = _bones[ii].transform.InverseTransformDirection(_boneDir[ii]);
            }
        }
        //make _chestRight orthogonal to the direction of the spine.
        _chestRight -= Vector3.Project(_chestRight, _boneDir[1]);
        //make _hipRight orthogonal to the direction of the hip override
        Vector3.OrthoNormalize(ref _boneDir[12], ref _hipRight);


        m_bonePos           = new Vector3[2, 20];
        kinectToWorld       = Matrix4x4.zero;
        kinectToWorld[0, 0] = 1;
        kinectToWorld[1, 1] = 1;
        kinectToWorld[1, 3] = 1;
        kinectToWorld[2, 2] = -1;
        kinectToWorld[2, 3] = 2;
        kinectToWorld[3, 3] = 1;

        m_client = new VRClient(stion);
        new Thread(() => {
            m_client.Start();
        }).Start();
    }
コード例 #9
0
        public void ProcessBarcode(string ipAdd, string barcode)
        {
            try
            {
                logger.Debug("BARCODE IN  " + barcode);
                logger.Debug("From dashboard: " + ipAdd);

                InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.DashboardModuleIP == ipAdd).FirstOrDefault();

                Ascii85 a85 = new Ascii85();
                //Guid guid = new Guid(Convert.FromBase64String(barcode.BarcodeReadout + "=="));

                Guid guid = new Guid(a85.Decode(barcode));

                logger.Debug(guid.ToString());

                if (iClientStatus != null && guid != null && guid != Guid.Empty)
                {
                    logger.Debug("P1");
                    using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
                    {
                        VRTicket vrt = m.VRTickets.Where(x => x.GUID == guid.ToString() && !x.IsDeleted).FirstOrDefault();

                        if (vrt != null && vrt.VRTicketType != null)
                        {
                            logger.Debug("P2");
                            List <ClientParm> clientParm = new List <ClientParm>();
                            IPAddress         ipa        = null;
                            if (!IPAddress.TryParse(ipAdd, out ipa))
                            {
                                ipa = IPAddress.Parse("0.0.0.0");
                            }

                            OperationInfo opInfo = new OperationInfo()
                            {
                                ConnectionInfo = new ConnectionInfo(new IPEndPoint(ipa, 0)),
                                TicketGUID     = vrt.GUID,
                                SourceType     = VRGameSelectorServerDTO.Enums.SourceType.LCD_BARCODE_MODULE,
                                ClientID       = iClientStatus.ClientID
                            };

                            if (vrt.VRTicketType.Type == "TICKET" && iClientStatus.ClientStatus == VRGameSelectorServerDTO.Enums.LiveClientStatus.CLEANING_DONE)
                            {
                                if (Math.Abs(DateTime.Now.Subtract(vrt.TimeStampCreate).TotalMinutes) <= 60)
                                {
                                    logger.Debug("P3");
                                    VRClient vrc = m.VRClients.Where(x => x.ID == iClientStatus.ClientID).FirstOrDefault();

                                    if (vrt.Minutes == 0)
                                    {
                                        // non-timing
                                        clientParm.Add(new ClientParm(iClientStatus.ClientID));
                                        SendStartNow(clientParm, opInfo);
                                        logger.Debug("NON-TIMING");
                                    }
                                    else
                                    {
                                        // timing
                                        Dictionary <string, string> dict = new Dictionary <string, string>()
                                        {
                                            { "Duration", vrt.Minutes.ToString() }
                                        };

                                        clientParm.Add(new ClientParm(iClientStatus.ClientID, dict));
                                        SendStartTiming(clientParm, opInfo);
                                        logger.Debug("TIMING:" + vrt.Minutes.ToString());
                                    }

                                    vrt.IsDeleted       = true;
                                    vrt.TimeStampDelete = DateTime.Now;
                                    vrt.VRClientID      = (vrc != null) ? (int?)vrc.ID : null;

                                    m.SaveChanges();
                                }
                                else
                                {
                                    logger.Debug("P4");
                                }
                            }
                            else if (vrt.VRTicketType.Type == "KEY-START-NON-TIMING")
                            {
                                clientParm.Add(new ClientParm(iClientStatus.ClientID));
                                SendStartNow(clientParm, opInfo);
                            }
                            else if (vrt.VRTicketType.Type == "KEY-START-TIMING")
                            {
                                Dictionary <string, string> dict = new Dictionary <string, string>()
                                {
                                    { "Duration", vrt.Minutes.ToString() }
                                };

                                clientParm.Add(new ClientParm(iClientStatus.ClientID, dict));
                                SendStartTiming(clientParm, opInfo);
                            }
                            else if (vrt.VRTicketType.Type == "KEY-END-GAME")
                            {
                                Dictionary <string, string> dict = new Dictionary <string, string>()
                                {
                                    { "EndMode", "Manual" }
                                };

                                clientParm.Add(new ClientParm(iClientStatus.ClientID, dict));
                                SendEndNow(clientParm, opInfo);
                            }
                            else if (vrt.VRTicketType.Type == "KEY-REBOOT")
                            {
                                clientParm.Add(new ClientParm(iClientStatus.ClientID));
                                SendReboot(clientParm, opInfo);
                            }
                            else if (vrt.VRTicketType.Type == "KEY-TURNOFF")
                            {
                                clientParm.Add(new ClientParm(iClientStatus.ClientID));
                                SendTurnOff(clientParm, opInfo);
                            }
                            else if (vrt.VRTicketType.Type == "KEY-KMU-ON")
                            {
                                clientParm.Add(new ClientParm(iClientStatus.ClientID));
                                SendTurnOnKMU(clientParm, opInfo);
                            }
                            else if (vrt.VRTicketType.Type == "KEY-KMU-OFF")
                            {
                                clientParm.Add(new ClientParm(iClientStatus.ClientID));
                                SendTurnOffKMU(clientParm, opInfo);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Debug("Barcode Decoding Error: " + ex.Message);
            }
        }
コード例 #10
0
 public LocalPlayer(VRClient client)
 {
     this.client = client;
 }