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(); }
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(); }
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()); } }
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; }
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); }
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); } } }
public void Connect(Realtime rt) { double v = realtime.room.time % source.clip.length; source.time = (float)v; source.Play(); }
private void ConnectToRoom(Realtime realtime) { if (!realtime.connected && !realtime.connecting) { realtime.Connect(ConnectionManager.CurrentRoomName); } }
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); }
// 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; }
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()); }
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(); }
// 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>(); }
/* 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); }
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."); } }
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; }
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; } }
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. }
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); }
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>(); }
private void OnTriggerEnter(Collider other) { if (other.tag == "island") { Realtime.Destroy(gameObject); running = false; runPosition = 0; points.Clear(); //_globalTurnSync.NextTurn((int)boatColor); } }
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. }
public override void Create() { if (humans != null) { SafeInsert(humans); } camera = Camera.main.transform; if (realtime == null) { realtime = GameObject.FindGameObjectWithTag("REALTIME").GetComponent <Realtime>(); } }
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; } }
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()); }
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; } }