Example #1
0
    public void SendVolumeUpRequest()
    {
        VRCommand cmd = new VRCommand(Enums.ControlMessage.UNITY_DASHBOARD_VOLUMEUP);

        SendCommandToServer(cmd);
    }
Example #2
0
        // incomming vr command
        private void HandleIncomingCommand(PacketHeader packetHeader, Connection connection, VRCommand vrCommand)
        {
            switch (vrCommand.ControlMessage)
            {
            case Enums.ControlMessage.PLAY_LOG:

                infoText = connection.ToString() + " Play Log: '" + vrCommand.PlayLog.TileID.ToString() + "', '" + vrCommand.PlayLog.SignalType.ToString() + "'";

                break;

            case Enums.ControlMessage.LOAD_CONFIG:

                TileConfig tc  = BuildMockTileData();
                VRCommand  cmd = new VRCommand(tc);
                SendCommandToClientSpecific(connection, cmd);

                break;

            case Enums.ControlMessage.STATUS:

                infoText = connection.ToString() + " Client Status: '" + vrCommand.ClientStatus.ClientIP + "'";

                break;

            case Enums.ControlMessage.CLIENT_UI_READY:

                EndNow();

                //Task.Delay(1000).ContinueWith(t => EndNow());

                infoText = connection.ToString() + " Client UI Ready.";

                break;

            default:
                break;
            }
        }
Example #3
0
    // all incoming command are handled here
    private void HandleIncomingCommand(PacketHeader packetHeader, Connection connection, VRCommand vrCommand)
    {
        switch (vrCommand.ControlMessage)
        {
        case Enums.ControlMessage.UNITY_DASHBOARD_GETRUNNINGGAMES:

            //Debug.Log(connection + Environment.NewLine + " Get Running Games");

            if (vrCommand.RunningGameInfo != null && vrCommand.RunningGameInfo.IsPostTerminationCheck)
            {
                // post termination check
                //SendRunningGames(true);
            }
            else
            {
                //SendRunningGames(false);
            }

            break;

        case Enums.ControlMessage.UNITY_DASHBOARD_SETDASHINFO:

            dashboardInfo = vrCommand.DashboardInfo;

            break;

        default:
            break;
        }
    }
        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;
                        }
                    }
                }
            }
        }
        // incomming vr command for game selector Dashboard
        private void HandleIncomingCommandDashboard(PacketHeader packetHeader, Connection connection, VRCommand vrCommand)
        {
            switch (vrCommand.ControlMessage)
            {
            case Enums.ControlMessage.REQUEST_HELP:

                Debug.WriteLine(connection.ToString() + " Help Requested!");

                VRCommand cmd = new VRCommand(Enums.ControlMessage.REQUEST_HELP);

                SendCommandToServer(cmd);

                break;

            case Enums.ControlMessage.UNITY_DASHBOARD_EXITGAME:

                Debug.WriteLine(connection.ToString() + " ExitGame Received!");

                if (_internalCurrentClientStatus == Enums.LiveClientStatus.IN_GAME)
                {
                    _exitGameFlag = true;
                }

                break;

            case Enums.ControlMessage.UNITY_DASHBOARD_GETRUNNINGGAMES:

                Debug.WriteLine(connection.ToString() + " Running Games Result incoming!");

                break;

            case Enums.ControlMessage.UNITY_DASHBOARD_GETTIMELEFT:

                Debug.WriteLine(connection.ToString() + " Get Time Left!");

                break;

            case Enums.ControlMessage.UNITY_DASHBOARD_VOLUMEUP:

                Debug.WriteLine(connection.ToString() + " Volume Up Received!");

                VolumeControl("UP");

                break;

            case Enums.ControlMessage.UNITY_DASHBOARD_VOLUMEDOWN:

                Debug.WriteLine(connection.ToString() + " Volume Down Requested!");

                VolumeControl("DOWN");

                break;
            }

            _targetDashboardClientLastCommunicationTime = DateTime.Now;
        }
Example #6
0
        private void SendDashboardInfo()
        {
            VRCommand vrc = new VRCommand(new DashboardInfo(_internalClientRunningMode));

            SendCommandToDashboardClient(vrc);
        }
Example #7
0
        private void GetTileConfigFromServerWithImage()
        {
            VRCommand vrc = new VRCommand(Enums.ControlMessage.GET_ALL_TILE_CONFIG_WITH_IMAGE);

            SendCommandToServer(vrc);
        }
Example #8
0
        private void GetAllSysConfigFromServer()
        {
            VRCommand vrc = new VRCommand(Enums.ControlMessage.GET_ALL_SYSCONFIG);

            SendCommandToServer(vrc);
        }
Example #9
0
        private void GetClientStatusFromServer()
        {
            VRCommand vrc = new VRCommand(Enums.ControlMessage.STATUS);

            SendCommandToServer(vrc);
        }
Example #10
0
        private void HandleIncomingCommandClientDaemon(PacketHeader packetHeader, Connection connection, VRCommand vrCommand)
        {
            switch (vrCommand.ControlMessage)
            {
            case VRGameSelectorDTO.Enums.ControlMessage.NONE:

                HandleClientDaemonPing(connection.ConnectionInfo);

                break;

            case VRGameSelectorDTO.Enums.ControlMessage.GET_ALL_SYSCONFIG:

                ClientSetAllSysConfig(connection.ConnectionInfo);

                break;

            case VRGameSelectorDTO.Enums.ControlMessage.GET_ALL_TILE_CONFIG:

                if (CheckAbleToSendAllTileConfig(connection.ConnectionInfo))
                {
                    ClientSetAllTileConfig(connection.ConnectionInfo);
                }

                break;

            case Enums.ControlMessage.GET_ALL_TILE_CONFIG_WITH_IMAGE:

                if (CheckAbleToSendAllTileConfig(connection.ConnectionInfo))
                {
                    ClientSetAllTileConfigWithImage(connection.ConnectionInfo);
                }

                break;

            case VRGameSelectorDTO.Enums.ControlMessage.START_TIMING:
                break;

            case VRGameSelectorDTO.Enums.ControlMessage.START_NOW:
                break;

            case VRGameSelectorDTO.Enums.ControlMessage.END_NOW:
                break;

            case VRGameSelectorDTO.Enums.ControlMessage.TURN_OFF:
                break;

            case VRGameSelectorDTO.Enums.ControlMessage.STATUS:

                ClientSetRunningMode(connection.ConnectionInfo);

                break;

            case VRGameSelectorDTO.Enums.ControlMessage.LOAD_CONFIG:
                break;

            case VRGameSelectorDTO.Enums.ControlMessage.PLAY_LOG:

                ProcessPlayLog(connection.ConnectionInfo, vrCommand.PlayLog);

                break;

            case VRGameSelectorDTO.Enums.ControlMessage.CLIENT_UI_READY:
                break;

            case VRGameSelectorDTO.Enums.ControlMessage.REQUEST_HELP:

                OperationInfo opInfo = new OperationInfo()
                {
                    SourceType = VRGameSelectorServerDTO.Enums.SourceType.CLIENT, ConnectionInfo = connection.ConnectionInfo
                };
                SetHelpRequestStatus(connection.ConnectionInfo, opInfo);

                break;

            default:
                break;
            }

            IPEndPoint ep = (IPEndPoint)connection.ConnectionInfo.RemoteEndPoint;

            string ipAdd       = ep.Address.MapToIPv4().ToString();
            string machineName = (vrCommand.MachineName != null) ? vrCommand.MachineName : "";

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

            if (iClientStatus != null && (iClientStatus.ClientName != machineName || iClientStatus.ClientStatus != (VRGameSelectorServerDTO.Enums.LiveClientStatus)vrCommand.LiveClientStatus))
            {
                UpdateInternalClientStatus(ipAdd, machineName, vrCommand.LiveClientStatus, vrCommand.AdditionalInfo);
                isManageSystemPushRequired = true;
            }
        }