Exemplo n.º 1
0
        private void Init()
        {
            FrameNum = 0;
            Logger.Start(false);
            if (_mbEditor)
            {
#if UNITY_EDITOR
                _mResMgr = new EditorResource();
#endif
            }
            else
            {
                _mResMgr = new ProjectResource();
            }
            if (_mResMgr != null)
            {
                _mResMgr.Start();
            }

            _realTime = new Realtime();

            _mScene = new GOEGameScene();

            _audioMgr = new GOEAudioMgr();

            _qualityMgr = new GOEQualityMgr();
        }
Exemplo n.º 2
0
    private void DidConnectToRoom(Realtime realtime)
    {
        // This method will be called by Realtime when it connects to the room.

        // Fetch this client's clientID
        int localPlayerClientID = _realtime.clientID;

        print("client # " + localPlayerClientID + " just joined");

        // Clamp the spawnPointIndex between 0 and the total number of spawn points
        int spawnPointIndex = localPlayerClientID;

        if (spawnPointIndex < 0)
        {
            spawnPointIndex = 0;
        }
        if (spawnPointIndex >= _spawnPoints.Length)
        {
            spawnPointIndex = _spawnPoints.Length - 1;
        }

        Transform spawnPoint = _spawnPoints[spawnPointIndex];

        transform.position = spawnPoint.position;
        transform.rotation = spawnPoint.rotation;

        print("client " + localPlayerClientID + " spawned at " + transform.position + " with rotation " + transform.rotation);

        _realtimeAM.GetComponent <RealtimeAvatarManager>().enabled = true;

        StartSceneSequence();
    }
Exemplo n.º 3
0
        public static string tryConnect(string hubId, string token)
        {
            try {
                User user = User.getAutentification(token);
                Hub  hub  = Hub.get(hubId);

                if (user == null)
                {
                    return(new ErrorResponse(300, Constants.NetMsg.FORBIDDEN).ToJson());
                }
                if (hub == null)
                {
                    return(new ErrorResponse(300, Constants.NetMsg.KEY_NOT_FOUND).ToJson());
                }

                if (Realtime.getInstance().isUserConnected(user.id.ToString()))
                {
                    return(new ErrorResponse(300, Constants.NetMsg.ALREADY_CONNECTED).ToJson());
                }

                Realtime.getInstance().connectToHub(user.id.ToString(), hubId);

                return(new EmptyResponse().ToJson());
            } catch {
                return(new ErrorResponse(210, Constants.NetMsg.KEY_NOT_FOUND).ToJson());
            }
        }
Exemplo n.º 4
0
 private void Awake()
 {
     // Get the Realtime component on this game object
     _realtime = GetComponent <Realtime>();
     // Notify us when Realtime successfully connects to the room
     _realtime.didConnectToRoom += DidConnectToRoom;
 }
    // Start is called before the first frame update
    void Start()
    {
        _realtimeInstance = GetComponent <Realtime>();

        _realtimeInstance.didConnectToRoom      += connectedToRoom;
        _realtimeInstance.didDisconnectFromRoom += disconnectedFromRoom;
    }
Exemplo n.º 6
0
        private void DidConnectToRoom(Realtime realtime)
        {
            var playerPrefs      = FindObjectOfType <PlayerPreferences>();
            var playerTypeToLoad = "Player";

            if (playerPrefs != null)
            {
                switch (playerPrefs.Customization)
                {
                case Customizations.BunnyEars:
                    playerTypeToLoad = "PlayerWithEars";
                    break;

                case Customizations.Bunny:
                    playerTypeToLoad = "bunny1";
                    break;

                case Customizations.None:
                default:
                    break;
                }
            }

            InstantiateNewObjectInWorld(playerTypeToLoad, realtime, true);
        }
Exemplo n.º 7
0
    void Start()
    {
        NetworkSyncManager.OnNetworkTurnUpdate += PrepairTeamForTurn;
        realtime       = FindObjectOfType <Realtime>();
        realtimeView   = GetComponent <RealtimeView>();
        globalTurnSync = FindObjectOfType <NetworkSyncManager>();
        InstantiateTimer();
        LoadMine();
        LoadBomb();
        DisplayPlacard();
        if (realtimeView.isOwnedLocallyInHierarchy)
        {
            app.gameRefModel.localTeamModel = teamData;

            //mine setup
            teamData.totalMines = app.gameRefModel.startingMines;
            if (teamData.teamColor == GameRefModel.BoatColors.Yellow)
            {
                app.uiView.yellowMineText.text = "" + teamData.totalMines;
                app.uiView.yellowMineInventory.SetActive(true);
            }
            if (teamData.teamColor == GameRefModel.BoatColors.Red)
            {
                app.uiView.redMineText.text = "" + teamData.totalMines;
                app.uiView.redMineInventory.SetActive(true);
            }
        }
    }
Exemplo n.º 8
0
    public void Connect(Realtime rt)
    {
        double v = realtime.room.time % source.clip.length;

        source.time = (float)v;
        source.Play();
    }
Exemplo n.º 9
0
 private void ConnectToRoom(Realtime realtime)
 {
     if (!realtime.connected && !realtime.connecting)
     {
         realtime.Connect(ConnectionManager.CurrentRoomName);
     }
 }
Exemplo n.º 10
0
        public async Task Realtime131_PutObject_Can_Add_Realtime()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = Realtime.GetUri();

            var dataObject = CreateDataObject <RealtimeList, Realtime>(uri, Realtime);

            // Get Object Expecting it Not to Exist
            await GetAndAssert(handler, uri, Energistics.EtpErrorCodes.NotFound);

            // Put Object
            await PutAndAssert(handler, dataObject);

            // Get Object
            var args = await GetAndAssert(handler, uri);

            // Check Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var xml = args.Message.DataObject.GetString();

            var result = Parse <RealtimeList, Realtime>(xml);

            Assert.IsNotNull(result);
        }
Exemplo n.º 11
0
    // Inside of PullTowardsHand

    private void getHuman()
    {
        // Grab the owner of this blarp
        int ownerID = _realtimeView.ownerID;

        if (ownerID == -1)
        {
            print("NOOOOOOO");
        }                                    // No owner, this is a bug.

        print(ownerID);


        // Get a reference to the avatar manager that lives on the same game object as Realtime
        Realtime realtime = _realtimeView.realtime;
        RealtimeAvatarManager realtimeAvatarManager = realtime.GetComponent <RealtimeAvatarManager>();

        print(realtimeAvatarManager.avatars.Count);

        // Get a reference to the avatar, blarpatar, and then human
        RealtimeAvatar realtimeAvatar  = realtimeAvatarManager.avatars[ownerID];
        Blarpatar      avatarBlarpatar = realtimeAvatar.GetComponent <Blarpatar>();
        Human          h = avatarBlarpatar.human;


        // Here's your human
        human   = h;
        started = true;
    }
Exemplo n.º 12
0
        public static string getPlayListResponse(string token)
        {
            User user = User.getAutentification(token);

            if (user == null)
            {
                return(new ErrorResponse(300, Constants.NetMsg.FORBIDDEN).ToJson());
            }

            Player      player   = Realtime.getInstance().getPlayer(user.id.ToString());
            List <long> playlist = Realtime.getInstance().getPlayList(user.id.ToString());

            if (player == null || playlist == null)
            {
                return(new ErrorResponse(300, Constants.NetMsg.FORBIDDEN).ToJson());
            }

            List <PlaylistEntry> playlistForResponse = playlist.ConvertAll <PlaylistEntry>(el => {
                Track track = player.tracks[el];
                return(new PlaylistEntry()
                {
                    artist = track.artist,
                    dislikes = track.dislikes,
                    duration = track.duration,
                    id = el,
                    likes = track.likes,
                    publisher = track.publisher.name,
                    title = track.title
                });
            });

            return(new PlaylistResponse(playlistForResponse).ToJson());
        }
Exemplo n.º 13
0
        public void RedisMonitor(Stopwatch tiempoEjecucion)
        {
            string tiempoStyle = "success";

            if (tiempoEjecucion.ElapsedMilliseconds > 4000)
            {
                tiempoStyle = "warning";
            }
            if (tiempoEjecucion.ElapsedMilliseconds > 6000)
            {
                tiempoStyle = "error";
            }

            machine.LogBroadcast(tiempoStyle,
                                 string.Format("Tiempo de ejecucion (ms) {0} ",
                                               tiempoEjecucion.ElapsedMilliseconds)
                                 );

            JObject json = new JObject();

            json["tiempoEjecucion"] = tiempoEjecucion.ElapsedMilliseconds.ToString();
            json["aoibarcode"]      = machine.line_barcode.ToString();
            json["smd"]             = machine.smd.ToString();
            json["tipo"]            = machine.tipo.ToString();
            Realtime.send(json.ToString());
        }
 private void Start()
 {
     _realtime = GameObject.FindObjectOfType <Realtime>();
     _rt       = this.gameObject.GetComponent <RealtimeTransform>();
     //_rv.RequestOwnership();
     //_realtime.clientID;
     //Swap();
 }
Exemplo n.º 15
0
 // Start is called before the first frame update
 void Awake()
 {
     gameRefModel       = FindObjectOfType <GameRefModel>();
     gameRefController  = FindObjectOfType <GameRefController>();
     networkSyncManager = FindObjectOfType <NetworkSyncManager>();
     terrainController  = FindObjectOfType <TerrainController>();
     realtime           = FindObjectOfType <Realtime>();
 }
Exemplo n.º 16
0
    /* No sharks for now
     * private void OnTriggerStay(Collider other)
     * {
     *  if (other.tag == "sharkWaters" && !pathScript.running)
     *  {
     *      Debug.Log("In Shark Waters");
     *      InitiateSelfDestruct();
     *  }
     * }
     */

    private void InitiateSelfDestruct()
    {
        myTeam.boatList.Remove(gameObject);
        myTeam.UpdateBoatCount();
        Destroy(myBoatPlan);
        //GameObject boatExplosion = Realtime.Instantiate(prefabName: "Boat Explosion", ownedByClient: true, preventOwnershipTakeover: true, useInstance: app.realtime);
        //boatExplosion.transform.position = new Vector3(transform.position.x, boatExplosion.transform.position.y, transform.position.z);
        Realtime.Destroy(gameObject);
    }
 private void SpawnSphere(Realtime realtime)
 {
     Realtime.Instantiate("SpherePrefab",
                          position: spawnPosition.position,
                          rotation: Quaternion.identity,
                          ownedByClient: false,
                          preventOwnershipTakeover: false,
                          useInstance: realtime);
 }
Exemplo n.º 18
0
        private void StartInspection()
        {
            aoiLog.verbose("Localizando CSV de Inspeccion");

            // Obtengo archivos CSV en InspectionFolder
            IOrderedEnumerable <FileInfo> csv = FilesHandler.GetFiles("*", aoiConfig.inspectionCsvPath);
            int totalCsv = csv.Count();

            aoiWorker.SetProgressTotal(totalCsv);

            if (totalCsv > 0)
            {
                int file_count = 0;

                foreach (FileInfo file in csv)
                {
                    file_count++;

                    #region REDIS
                    // Dato a enviar
                    JObject json = new JObject();
                    json["mode"]    = "runtime";
                    json["tipo"]    = aoiConfig.machineType;
                    json["current"] = file_count.ToString();
                    json["total"]   = totalCsv.ToString();
                    // Enviar al canal
                    Realtime.send(json.ToString());
                    #endregion

                    aoiLog.info("---------------------------------------------");
                    aoiLog.info(" Procesando " + file_count + " / " + totalCsv);
                    aoiLog.info("---------------------------------------------");

                    HandleInspection(file);

                    aoiWorker.SetProgressWorking(file_count);
                }

                aoiLog.info("No hay mas CSV");
            }
            else
            {
                #region REDIS
                // Dato a enviar
                JObject json = new JObject();
                json["mode"]    = "runtime";
                json["tipo"]    = aoiConfig.machineType;
                json["current"] = 0;
                json["total"]   = 0;
                // Enviar al canal
                Realtime.send(json.ToString());
                #endregion

                aoiLog.info("No se encontraron inspecciones.");
            }
        }
Exemplo n.º 19
0
    private void Awake()
    {
        // Get the Realtime component on this game object
        _realtime = GetComponent <Realtime>();

        // Notify us when Realtime successfully connects to the room
        _realtime.didConnectToRoom += DidConnectToRoom;
        NetworkSyncManager.OnNetworkGameStateUpdate += OnGameStateUpdate;
        NetworkSyncManager.OnNetworkTurnUpdate      += OnTurnUpdate;
    }
Exemplo n.º 20
0
 private void LayBomb()
 {
     //Debug.Log("PotentialToLayBomb");
     if (plan.bombPosition == runPosition && !myTeam.hasBomb)
     {
         bombBlast = Realtime.Instantiate(prefabName: "Bomb Blast", ownedByClient: true, preventOwnershipTakeover: true, useInstance: app.realtime);
         bombBlast.transform.position = transform.position;
         myTeam.hasBomb = true;
     }
 }
Exemplo n.º 21
0
 private void SpawnCube(Realtime realtime)
 {
     //Instantiate the CubePlayer for this client once we've successfully connected to the room
     Realtime.Instantiate("NormcoreGrabbable",
                          position: spawnPosition.position,
                          rotation: Quaternion.identity,
                          ownedByClient: false,
                          preventOwnershipTakeover: false,
                          useInstance: realtime);
 }
 private void DidConnectToRoom(Realtime realtime)
 {
     // Instantiate the CubePlayer for this client once we've successfully connected to the room
     Realtime.Instantiate("CubePlayer",                   // Prefab name
                          position: Vector3.up,           // Start 1 meter in the air
                          rotation: Quaternion.identity,  // No rotation
                          ownedByClient: true,            // Make sure the RealtimeView on this prefab is owned by this client
                          preventOwnershipTakeover: true, // Prevent other clients from calling RequestOwnership() on the root RealtimeView.
                          useInstance: realtime);         // Use the instance of Realtime that fired the didConnectToRoom event.
 }
Exemplo n.º 23
0
        public async Task Realtime131_PutObject_Can_Update_Realtime()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = Realtime.GetUri();

            // Add a Comment to Data Object
            Realtime.CommonData = new CommonData()
            {
                Comments = "Test PutObject"
            };

            var dataObject = CreateDataObject <RealtimeList, Realtime>(uri, Realtime);

            // Get Object Expecting it Not to Exist
            await GetAndAssert(handler, uri, Energistics.EtpErrorCodes.NotFound);

            // Put Object for Add
            await PutAndAssert(handler, dataObject);

            // Get Added Object
            var args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var xml = args.Message.DataObject.GetString();

            var result = Parse <RealtimeList, Realtime>(xml);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.CommonData.Comments);

            // Remove Comment from Data Object
            result.CommonData.Comments = null;

            var updateDataObject = CreateDataObject <RealtimeList, Realtime>(uri, result);

            // Put Object for Update
            await PutAndAssert(handler, updateDataObject);

            // Get Updated Object
            args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var updateXml = args.Message.DataObject.GetString();

            result = Parse <RealtimeList, Realtime>(updateXml);
            Assert.IsNotNull(result);

            // Test Data Object overwrite
            Assert.IsNull(result.CommonData.Comments);
        }
Exemplo n.º 24
0
    private void DidConnectToRoom(Realtime realtime)
    {
        // Instantiate the Player for this client once we've successfully connected to the room
        GameObject playerGameObject = Realtime.Instantiate(prefabName: "Networked Boat",   // Prefab name
                                                           ownedByClient: true,            // Make sure the RealtimeView on this prefab is owned by this client
                                                           preventOwnershipTakeover: true, // Prevent other clients from calling RequestOwnership() on the root RealtimeView.
                                                           useInstance: realtime);         // Use the instance of Realtime that fired the didConnectToRoom event.

        // Get a reference to the player
        BoatMover player = playerGameObject.GetComponent <BoatMover>();
    }
Exemplo n.º 25
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "island")
     {
         Realtime.Destroy(gameObject);
         running     = false;
         runPosition = 0;
         points.Clear();
         //_globalTurnSync.NextTurn((int)boatColor);
     }
 }
Exemplo n.º 26
0
        private void InstantiateNewObjectInWorld(string prefab, Realtime realtime, bool ownedByClient = false)
        {
            Vector3 startingPosition = new Vector3(Random.Range(-4, 4), 3, Random.Range(-4, 4));

            Realtime.Instantiate(prefab,                         // Prefab name
                                 position: startingPosition,     // Start 1 meter in the air
                                 rotation: Quaternion.identity,  // No rotation
                                 ownedByClient: ownedByClient,   // Make sure the RealtimeView on this prefab is owned by this client
                                 preventOwnershipTakeover: true, // Prevent other clients from calling RequestOwnership() on the root RealtimeView.
                                 useInstance: realtime);         // Use the instance of Realtime that fired the didConnectToRoom event.
        }
Exemplo n.º 27
0
 public override void Create()
 {
     if (humans != null)
     {
         SafeInsert(humans);
     }
     camera = Camera.main.transform;
     if (realtime == null)
     {
         realtime = GameObject.FindGameObjectWithTag("REALTIME").GetComponent <Realtime>();
     }
 }
Exemplo n.º 28
0
 private void LayMine()
 {
     if (plan.minePosition == runPosition && !myTeam.hasMine)
     {
         GameObject placedMine = Realtime.Instantiate(prefabName: "Mine", ownedByClient: true, preventOwnershipTakeover: true, useInstance: app.realtime);
         placedMine.GetComponent <RealtimeTransform>().RequestOwnership();
         placedMine.transform.position = transform.position;
         myTeam.totalMines            -= 1;
         myTeam.UpdateMineCountDisplay();
         myTeam.hasMine = true;
     }
 }
Exemplo n.º 29
0
        public void RedisRuntime(string current = "0", string total = "0")
        {
            // Dato a enviar
            JObject json = new JObject();

            json["mode"]    = "runtime";
            json["tipo"]    = aoiConfig.machineType;
            json["current"] = current;
            json["total"]   = total;
            // Enviar al canal
            Realtime.send(json.ToString());
        }
Exemplo n.º 30
0
    private void Update()
    {
        if (!_realtime.connected)
        {
            return;
        }

        // Start by figuring out which hand we're tracking
        XRNode node         = _hand == Hand.LeftHand ? XRNode.LeftHand : XRNode.RightHand;
        string leftTrigger  = "Oculus_CrossPlatform_PrimaryIndexTrigger";
        string rightTrigger = "Oculus_CrossPlatform_SecondaryIndexTrigger";

        // Get the position & rotation of the hand
        bool handIsTracking = UpdatePose(node, ref _handPosition, ref _handRotation);

        // Figure out if the trigger is pressed or not
        bool triggerPressed = Input.GetAxisRaw(leftTrigger) > 0.1f || Input.GetAxisRaw(rightTrigger) > 0.1f;

        // If we lose tracking, stop drawing
        if (!handIsTracking)
        {
            triggerPressed = false;
        }

        // If the trigger is pressed and we haven't created a new brush stroke to draw, create one!
        if (triggerPressed && _activeBrushStroke == null)
        {
            // Instantiate a copy of the Brush Stroke prefab.
            // GameObject brushStrokeGameObject = Instantiate(_brushStrokePrefab);
            GameObject brushStrokeGameObject = Realtime.Instantiate(_brushStrokePrefab.name, ownedByClient: true, useInstance: _realtime);
            brushStrokeGameObject.tag = "brushStroke";

            // Grab the BrushStroke component from it
            _activeBrushStroke = brushStrokeGameObject.GetComponent <BrushStroke>();

            // Tell the BrushStroke to begin drawing at the current brush position
            _activeBrushStroke.BeginBrushStrokeWithBrushTipPoint(transform.position, transform.rotation);
        }

        // If the trigger is pressed, and we have a brush stroke, move the brush stroke to the new brush tip position
        if (triggerPressed)
        {
            _activeBrushStroke.MoveBrushTipToPoint(transform.position, transform.rotation);
        }

        // If the trigger is no longer pressed, and we still have an active brush stroke, mark it as finished and clear it.
        if (!triggerPressed && _activeBrushStroke != null)
        {
            _activeBrushStroke.EndBrushStrokeWithBrushTipPoint(transform.position, transform.rotation);
            _activeBrushStroke = null;
        }
    }