Commit 660052cb authored by Rolando Neira's avatar Rolando Neira

Actualización de servidor

parent c0cca978
var socket = io('10.131.0.30:5000');
socket.on('connect', function () {
socket.on('asignar_id', function (data) {
console.log(data);
//document.write('texto');
});
//socket.emit('actualizar_api', function (data) { });
socket.on('disconnect', function () {
console.log("Se desconecto");
});
});
\ No newline at end of file
...@@ -11,7 +11,7 @@ public class ConexionWebSocket : SocketIOComponent ...@@ -11,7 +11,7 @@ public class ConexionWebSocket : SocketIOComponent
[Header ("Pantallas de la Red")] [Header ("Pantallas de la Red")]
[SerializeField] [SerializeField]
private Transform listaPantantallas; //Contine todos los clientes que se encuentran conctados en la red private Transform listaPantantallas; //Contine todos los clientes que se encuentran conctados en la red
private Pantalla pantalla;
[SerializeField] [SerializeField]
public static string idPantalla {get; private set;} //Id de la pantalla cliente public static string idPantalla {get; private set;} //Id de la pantalla cliente
...@@ -32,6 +32,8 @@ public class ConexionWebSocket : SocketIOComponent ...@@ -32,6 +32,8 @@ public class ConexionWebSocket : SocketIOComponent
} }
private void InicializarComponentes(){ private void InicializarComponentes(){
pantalla = new Pantalla();
pantalla.id=DataManager.instancia.instanciaData.idPantalla;
listaSocketConexion = new Dictionary<string, GameObject>(); listaSocketConexion = new Dictionary<string, GameObject>();
} }
...@@ -39,12 +41,15 @@ public class ConexionWebSocket : SocketIOComponent ...@@ -39,12 +41,15 @@ public class ConexionWebSocket : SocketIOComponent
On("open", (E)=>{ On("open", (E)=>{
Debug.Log("Se conecto exitosamente"); Debug.Log("Se conecto exitosamente");
}); });
Emit("id_cliente_conectado", new JSONObject(JsonUtility.ToJson(pantalla)));
On("asignar_id", (E)=>{ On("asignar_id", (E)=>{
idPantalla = E.data["id"].ToString().EliminarQuotes(); idPantalla = E.data["id"].ToString().EliminarQuotes();
Debug. Log ("El id del cliete es: " + idPantalla); Debug. Log ("El id del cliete es: " + idPantalla);
}); });
On("agregar_pantalla", (E)=>{ On("agregar_pantalla", (E)=>{
string id = E.data["id"].ToString().EliminarQuotes(); string id = E.data["id"].ToString().EliminarQuotes();
GameObject go = new GameObject(id); GameObject go = new GameObject(id);
...@@ -52,18 +57,9 @@ public class ConexionWebSocket : SocketIOComponent ...@@ -52,18 +57,9 @@ public class ConexionWebSocket : SocketIOComponent
listaSocketConexion.Add(id, go); listaSocketConexion.Add(id, go);
}); });
On("actualizar_video", (E)=>{ On("actualizar_video", (E)=>{
//string id = E.data["id"].ToString().EliminarQuotes();
//E.data["videos"]["fecha_inicio"]
//float x = E.data["posicion"]["x"].f;
//float y = E.data["posicion"]["y"].f;
//IdentificadorDeRed ir = listaSocketConexion[id];
//ir.transform.position = new Vector3(x, y, 0);
GestorMenuInteractivo.instancia.ActualizarVideos(); GestorMenuInteractivo.instancia.ActualizarVideos();
}); });
On("desconectar_pantalla", (E)=>{ On("desconectar_pantalla", (E)=>{
string id = E.data["id"].ToString().EliminarQuotes(); string id = E.data["id"].ToString().EliminarQuotes();
GameObject go = listaSocketConexion[id]; GameObject go = listaSocketConexion[id];
...@@ -71,4 +67,10 @@ public class ConexionWebSocket : SocketIOComponent ...@@ -71,4 +67,10 @@ public class ConexionWebSocket : SocketIOComponent
listaSocketConexion.Remove(id); listaSocketConexion.Remove(id);
}); });
} }
}
[System.Serializable]
public class Pantalla{
public string id;
} }
\ No newline at end of file
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
public class Data public class Data
{ {
public string idPantalla="5e5fdfe92968283228069ad1";
public string apiPrincipal = "https://apps.utpl.edu.ec/observatorio/api/v1/visor"; public string apiPrincipal = "https://apps.utpl.edu.ec/observatorio/api/v1/visor";
} }
...@@ -357,9 +357,9 @@ MonoBehaviour: ...@@ -357,9 +357,9 @@ MonoBehaviour:
m_SceneHierarchy: m_SceneHierarchy:
m_TreeViewState: m_TreeViewState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs: 12570000
m_LastClickedID: 0 m_LastClickedID: 22290
m_ExpandedIDs: b2fbffff m_ExpandedIDs: 44f9ffff98faffffb2fbffff
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
...@@ -495,9 +495,9 @@ MonoBehaviour: ...@@ -495,9 +495,9 @@ MonoBehaviour:
m_isRotationLocked: 0 m_isRotationLocked: 0
m_AudioPlay: 0 m_AudioPlay: 0
m_Position: m_Position:
m_Target: {x: 1121.8595, y: 746.5815, z: 2.2675352} m_Target: {x: 693.6185, y: 1459.5941, z: -16.5}
speed: 2 speed: 2
m_Value: {x: 1121.8595, y: 746.5815, z: 2.2675352} m_Value: {x: 693.6185, y: 1459.5941, z: -16.5}
m_RenderMode: 0 m_RenderMode: 0
m_CameraMode: m_CameraMode:
drawMode: 0 drawMode: 0
...@@ -529,9 +529,9 @@ MonoBehaviour: ...@@ -529,9 +529,9 @@ MonoBehaviour:
speed: 2 speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1} m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size: m_Size:
m_Target: 1099.1251 m_Target: 2988.4065
speed: 2 speed: 2
m_Value: 1099.1251 m_Value: 2988.4065
m_Ortho: m_Ortho:
m_Target: 1 m_Target: 1
speed: 2 speed: 2
...@@ -581,20 +581,20 @@ MonoBehaviour: ...@@ -581,20 +581,20 @@ MonoBehaviour:
m_ShowAllHits: 0 m_ShowAllHits: 0
m_SearchArea: 1 m_SearchArea: 1
m_Folders: m_Folders:
- Assets - Assets/codigos/database
m_ViewMode: 1 m_ViewMode: 1
m_StartGridSize: 16 m_StartGridSize: 16
m_LastFolders: m_LastFolders:
- Assets - Assets/codigos/database
m_LastFoldersGridSize: 16 m_LastFoldersGridSize: 16
m_LastProjectPath: C:\Users\ROLAS\Documents\NODOLAB\GIT\pantallas\PantallaNodo_V2.0\PantallaNodo m_LastProjectPath: C:\Users\ROLAS\Documents\NODOLAB\GIT\pantallas\PantallaNodo_V2.0\PantallaNodo
m_LockTracker: m_LockTracker:
m_IsLocked: 0 m_IsLocked: 0
m_FolderTreeState: m_FolderTreeState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 2}
m_SelectedIDs: 742f0000 m_SelectedIDs: 00440000
m_LastClickedID: 12148 m_LastClickedID: 17408
m_ExpandedIDs: 00000000742f000062360000ae360000bc360000f03600007e3800003c3a0000543c00004a3d00001e3e0000c03f0000a4400000f8410000364200007043000018440000e44700001c490000f84b0000b0520000b2520000b4520000b6520000b8520000 m_ExpandedIDs: 00000000742f000062360000ae360000bc360000f03600007e3800003c3a00004a3d00001e3e0000623e0000c03f0000a4400000f84100003642000018440000e44700001c490000f84b0000b0520000b2520000b4520000b6520000b8520000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
...@@ -649,7 +649,7 @@ MonoBehaviour: ...@@ -649,7 +649,7 @@ MonoBehaviour:
m_ListAreaState: m_ListAreaState:
m_SelectedInstanceIDs: m_SelectedInstanceIDs:
m_LastClickedInstanceID: 0 m_LastClickedInstanceID: 0
m_HadKeyboardFocusLastEvent: 0 m_HadKeyboardFocusLastEvent: 1
m_ExpandedInstanceIDs: c6230000243b000068380000925a0000903100009c400000b648000086fd000090490000024400003257000028720000384a00002e5700008e590000226b0000063b00003e8e0000a8d3feff023b0000b84b0000068a0000565b00007e4b0000ba4c0000445b0000d04b0000083700003e2f0000e03f000080e0fbff720df5ff483700002e510000cc400000404000006c7100003a2f00001e610000bc40000070340000744c0000f0480000204600007664000086390000284100008c40000082340000e24e00007a4b0000c23d000070380000a25700005cb2fcff72380000fe42000092350000cc36000020490000f630000026360000a2bc0000c44f0000963500007a350000882a0000642a00000e2b0000f432000044ca0000cc2f000028370000982e00007a360000d82d0000ea3c0000a62e0000323f0000523f0000c61f0100d61e010044180000ee1d00005619000008170000f8320500f6320500701c0000024300003c3200000236000096440000283900002c3e0000e6410000663d00007c3b0000ec360000243600006e460000b4800000483401004c3401005c340100c23f0000e8480000363c0000a04100007c46000076350000d87500005a370000a0470000f4430000bc4300005a2f0000e83a0000763b0000444b0000743c000062370000a84700006263000068450000446e0000344c000050510000185d000032420000083800009e3c0000305a000000000000 m_ExpandedInstanceIDs: c6230000243b000068380000925a0000903100009c400000b648000086fd000090490000024400003257000028720000384a00002e5700008e590000226b0000063b00003e8e0000a8d3feff023b0000b84b0000068a0000565b00007e4b0000ba4c0000445b0000d04b0000083700003e2f0000e03f000080e0fbff720df5ff483700002e510000cc400000404000006c7100003a2f00001e610000bc40000070340000744c0000f0480000204600007664000086390000284100008c40000082340000e24e00007a4b0000c23d000070380000a25700005cb2fcff72380000fe42000092350000cc36000020490000f630000026360000a2bc0000c44f0000963500007a350000882a0000642a00000e2b0000f432000044ca0000cc2f000028370000982e00007a360000d82d0000ea3c0000a62e0000323f0000523f0000c61f0100d61e010044180000ee1d00005619000008170000f8320500f6320500701c0000024300003c3200000236000096440000283900002c3e0000e6410000663d00007c3b0000ec360000243600006e460000b4800000483401004c3401005c340100c23f0000e8480000363c0000a04100007c46000076350000d87500005a370000a0470000f4430000bc4300005a2f0000e83a0000763b0000444b0000743c000062370000a84700006263000068450000446e0000344c000050510000185d000032420000083800009e3c0000305a000000000000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
...@@ -1487,7 +1487,7 @@ MonoBehaviour: ...@@ -1487,7 +1487,7 @@ MonoBehaviour:
m_PersistentViewDataDictionary: {fileID: 0} m_PersistentViewDataDictionary: {fileID: 0}
m_LockTracker: m_LockTracker:
m_IsLocked: 0 m_IsLocked: 0
m_LastSelectedObjectID: 27170 m_LastSelectedObjectID: 22290
--- !u!114 &22 --- !u!114 &22
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
......
08d6b11ee47c7200.08d6b11ee6decc00
\ No newline at end of file
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"showFog":true,"showMaterialUpdate":false,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true},"in2DMode":true,"pivot":{"x":1121.8594970703125,"y":746.5814819335938,"z":2.2675352096557619},"rotation":{"x":0.0,"y":0.0,"z":0.0,"w":1.0},"size":1099.1251220703125,"orthographic":true} {"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"showFog":true,"showMaterialUpdate":false,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true},"in2DMode":true,"pivot":{"x":693.6185302734375,"y":1459.5941162109375,"z":-16.5},"rotation":{"x":0.0,"y":0.0,"z":0.0,"w":1.0},"size":2988.406494140625,"orthographic":true}
\ No newline at end of file \ No newline at end of file
Base path: C:/Program Files/Unity/Editor/Data Base path: C:/Program Files/Unity/Editor/Data
Cmd: initializeCompiler Cmd: initializeCompiler
Cmd: initializeCompiler Cmd: initializeCompiler
Cmd: initializeCompiler
...@@ -4,6 +4,7 @@ class Pantalla { ...@@ -4,6 +4,7 @@ class Pantalla {
constructor(){ constructor(){
this.id = "Pantalla_" + shortID.generate(); this.id = "Pantalla_" + shortID.generate();
this.user =''; this.user ='';
this.idPantallaActualizar ='';
this.estadoActualizar =0; this.estadoActualizar =0;
} }
...@@ -11,6 +12,10 @@ class Pantalla { ...@@ -11,6 +12,10 @@ class Pantalla {
this.user=user; this.user=user;
} }
SetIdPantallaActualizar(id){
this.idPantallaActualizar=id;
}
SetEstadoActualizar(estado){ SetEstadoActualizar(estado){
this.estadoActualizar=estado; this.estadoActualizar=estado;
} }
...@@ -19,6 +24,10 @@ class Pantalla { ...@@ -19,6 +24,10 @@ class Pantalla {
return this.user; return this.user;
} }
GetIdPantallaActualizar(){
return this.idPantallaActualizar;
}
GetEstadoActualizar(){ GetEstadoActualizar(){
return this.estadoActualizar; return this.estadoActualizar;
} }
......
...@@ -20,6 +20,12 @@ io.on("connection", function(socket){ ...@@ -20,6 +20,12 @@ io.on("connection", function(socket){
let idPantalla = nuevaPantalla.id; // Alamaceno el id que a generado el shortid de la instancia creada anteriormente let idPantalla = nuevaPantalla.id; // Alamaceno el id que a generado el shortid de la instancia creada anteriormente
listaPantallas[idPantalla] = nuevaPantalla; //Agrego la instancia creada en un array de tipo pantallas (La key es el id de la instancia Pantalla creadaa recientemente y el valor es la isntancia como tal) listaPantallas[idPantalla] = nuevaPantalla; //Agrego la instancia creada en un array de tipo pantallas (La key es el id de la instancia Pantalla creadaa recientemente y el valor es la isntancia como tal)
listaSockets[idPantalla] = socket; // Almaceno el socket que se acaba de conectar en un array de tipo socket (La key es el id de la instancia Pantalla creadaa recientemente y el valor es el socket de conexión de la pantalla que se acaba de conectar recientemente) listaSockets[idPantalla] = socket; // Almaceno el socket que se acaba de conectar en un array de tipo socket (La key es el id de la instancia Pantalla creadaa recientemente y el valor es el socket de conexión de la pantalla que se acaba de conectar recientemente)
socket.on('id_cliente_conectado', function(data){
console.log(data);
});
//============================================NOTIFICANDO A LOS CLIENTES DE LA EXISTENCIA DE UNA NUEVA CONEXIÓN==================================================================================== //============================================NOTIFICANDO A LOS CLIENTES DE LA EXISTENCIA DE UNA NUEVA CONEXIÓN====================================================================================
socket.emit('asignar_id', {id: idPantalla});//Avisar al cliente que esta es su id que le asigno el servidor socket.emit('asignar_id', {id: idPantalla});//Avisar al cliente que esta es su id que le asigno el servidor
...@@ -33,7 +39,9 @@ io.on("connection", function(socket){ ...@@ -33,7 +39,9 @@ io.on("connection", function(socket){
}*/ }*/
//============================================NOTIFICANDO AL CLIENTE DE LA ACTUALIZACIÓN QUE A TENIDO LA API PRINCIPAL==================================================================================== //============================================NOTIFICANDO AL CLIENTE DE LA ACTUALIZACIÓN QUE A TENIDO LA API PRINCIPAL====================================================================================
socket.on('actualizar_api', function(id){ socket.on('actualizar_api', function(data){
console.log(data.id)
nuevaPantalla.idPantallaActualizar=data.id;
nuevaPantalla.estadoActualizar=1; nuevaPantalla.estadoActualizar=1;
socket.emit('actualizar_api', nuevaPantalla); socket.emit('actualizar_api', nuevaPantalla);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment