public List <IntrinsicElectronicData> GetElectricalConnections(Vector3Int position) { var list = ElectricalPool.GetFPCList(); if (ServerObjects != null) { var collection = ServerObjects.Get(position); for (int i = collection.Count - 1; i >= 0; i--) { if (i < collection.Count && collection[i] != null && collection[i].ElectricalData != null && collection[i].ElectricalData.InData != null) { list.Add(collection[i].ElectricalData.InData); } } } if (metaDataLayer.Get(position)?.ElectricalData != null) { foreach (var electricalMetaData in metaDataLayer.Get(position).ElectricalData) { list.Add(electricalMetaData.InData); } } return(list); }
public List <PipeData> GetPipeConnections(Vector3Int position) { var list = new List <PipeData>(); var collection = ServerObjects.Get(position); //Logger.Log(collection.Count.ToString()); foreach (var t in collection) { if (t.PipeData != null) { list.Add(t.PipeData); } } var pipes = metaDataLayer.Get(position).PipeData; foreach (var PipeNode in pipes) { list.Add(PipeNode.pipeData); } return(list); }
public IEnumerable <ElectricalOIinheritance> GetElectricalConnections(Vector3Int position) { if (ServerObjects != null) { return(ServerObjects.Get(position).Select(x => x.GetComponent <ElectricalOIinheritance>()).Where(x => x != null)); } else { return(null); } }
public SoapMetadataSet(InProcess.InProcessMetadata inProcessMetadata, ServerObjects.Metadata serviceMetadata) { MapManager = inProcessMetadata.MapManager; ServiceMetadata = serviceMetadata; Id = serviceMetadata.MetadataId; Name = inProcessMetadata.Name; Value = inProcessMetadata.Value; Node = inProcessMetadata.Node; Relationship = inProcessMetadata.Relationship; ConnectionType = inProcessMetadata.ConnectionType; InProcessMetadata = inProcessMetadata; }
public void UpdateRelationship(ServerObjects.Relationship serviceRelationship) { ServiceRelationship = serviceRelationship; Id = ServiceRelationship.RelationshipUid; DomainId = ServiceRelationship.DomainUid; OriginalId = ServiceRelationship.RelationshipOriginalId; RelationshipType = MapManager.RelationshipTypes[ServiceRelationship.RelationshipTypeUid]; if (Status == LoadState.None) { Status = LoadState.Partial; } }
public void UpdateNode(ServerObjects.Node serviceNode) { ServiceNode = serviceNode; Id = ServiceNode.NodeUid; DomainId = ServiceNode.DomainUid; RootMapId = ServiceNode.RootMapUid; OriginalId = ServiceNode.NodeOriginalId; NodeType = MapManager.NodeTypes[ServiceNode.NodeTypeUid]; if (Status == LoadState.None) { Status = LoadState.Partial; } }
public SoapRelationship(InProcess.InProcessRelationship inProcessRelationship, ServerObjects.Relationship serviceRelationship) { ServiceRelationship = serviceRelationship; InProcessRelationship = inProcessRelationship; Id = serviceRelationship.RelationshipUid; DomainId = inProcessRelationship.DomainId; RootMapId = inProcessRelationship.RootMapId; OriginalId = inProcessRelationship.OriginalId; RelationshipType = inProcessRelationship.RelationshipType; Status = LoadState.Full; MapManager = inProcessRelationship.MapManager; Nodes = inProcessRelationship.Nodes; Metadata = inProcessRelationship.Metadata; }
public SoapNode(InProcess.InProcessNode inProcessNode, ServerObjects.Node serviceNode) { ServiceNode = serviceNode; InProcessNode = inProcessNode; Id = serviceNode.NodeUid; DomainId = inProcessNode.DomainId; RootMapId = inProcessNode.RootMapId; OriginalId = inProcessNode.OriginalId; NodeType = inProcessNode.NodeType; Status = LoadState.Full; MapManager = inProcessNode.MapManager; Relationships = inProcessNode.Relationships; Metadata = inProcessNode.Metadata; }
public SoapMetadataSet(IMapManager mapManager, ServerObjects.Metadata serviceMetadata, INode node, IRelationship relationship) { MapManager = mapManager; ServiceMetadata = serviceMetadata; Id = serviceMetadata.MetadataId; DomainId = serviceMetadata.DomainUid; RootMapId = serviceMetadata.RootMapUid; Name = serviceMetadata.MetadataName; Value = serviceMetadata.MetadataValue; if (serviceMetadata.NodeUid.HasValue && serviceMetadata.NodeUid == node.Id) { Node = node; } else if (serviceMetadata.NodeUid.HasValue && serviceMetadata.NodeUid != node.Id) { throw new NotSupportedException("The node ID in the service metadata object differs to the provided node."); } else { Node = null; } if (serviceMetadata.RelationshipUid.HasValue && serviceMetadata.RelationshipUid == relationship.Id) { Relationship = relationship; } else if (serviceMetadata.RelationshipUid.HasValue && serviceMetadata.RelationshipUid != relationship.Id) { throw new NotSupportedException("The relationship ID in the service metadata object differs to the provided relationship."); } else { Relationship = null; } ConnectionType = null; if (serviceMetadata.DescriptorTypeUid.HasValue && serviceMetadata.DescriptorTypeUid != Guid.Empty) { if (MapManager.ConnectionTypes.ContainsKey(serviceMetadata.DescriptorTypeUid.Value)) { ConnectionType = MapManager.ConnectionTypes[serviceMetadata.DescriptorTypeUid.Value]; } } }
public IMetadataSet Load(ServerObjects.Metadata serviceMetadata, IRelationship relationship) { IMetadataSet metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(serviceMetadata, Parent, relationship); if (!ContainedMetadata.Contains(metadataSet.Id)) { Metadata.Add(metadataSet); ContainedMetadata.Add(metadataSet.Id); } IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager; if (metadataSetManager != null) { metadataSetManager.Container = this; } return metadataSet; }
public List <IntrinsicElectronicData> GetElectricalConnections(Vector3Int position) { var list = ElectricalPool.GetFPCList(); if (ServerObjects != null) { foreach (var Object in ServerObjects.Get(position)) { if (Object?.ElectricalData?.InData != null) { list.Add(Object?.ElectricalData?.InData); } } } if (metaDataLayer.Get(position)?.ElectricalData != null) { foreach (var electricalMetaData in metaDataLayer.Get(position).ElectricalData) { list.Add(electricalMetaData.InData); } } return(list); }
//public IMetadataSet GetMetadata(Guid metadataId) //{ // if (Metadata.ContainsKey(metadataId)) // { // return Metadata[metadataId]; // } // return null; //} public IMetadataSet GetMetadata(ServerObjects.Metadata serviceMetadata, INode node, IRelationship relationship) { IMetadataSet metadataSet = null; if (Metadata.ContainsKey(serviceMetadata.MetadataId)) { metadataSet = Metadata[serviceMetadata.MetadataId]; if (metadataSet is IUpdatableMetadataSet) { IUpdatableMetadataSet updatableMetadataSet = metadataSet as IUpdatableMetadataSet; updatableMetadataSet.UpdateMetadataSet(serviceMetadata); } } else { metadataSet = new Soap.SoapMetadataSet(MapManager, serviceMetadata, node, relationship); Metadata[metadataSet.Id] = metadataSet; } return metadataSet; }
//public IMetadataSet GetMetadata(Guid metadataId, string name, string value, INode node, IRelationship relationship, ConnectionType connectionType) //{ // Soap.SoapMetadataSet newMetadatSet = new Soap.SoapMetadataSet(MapManager); // newMetadatSet.Id = metadataId; // newMetadatSet.Name = name; // newMetadatSet.Value = value; // newMetadatSet.Node = node; // newMetadatSet.Relationship = relationship; // newMetadatSet.ConnectionType = connectionType; // Metadata[metadataId] = newMetadatSet; // return newMetadatSet; //} public void UpgradeFacade(ISoapTransactionLink link, ServerObjects.Metadata serviceMetadata) { if (!InProcessMetadata.ContainsKey(link)) { return; } FacadeMetadataSet facadeMetadataSet = InProcessMetadata[link]; InProcess.InProcessMetadata inProcessMetadata = facadeMetadataSet.BaseMetadata as InProcess.InProcessMetadata; if (inProcessMetadata == null) { return; } Soap.SoapMetadataSet soapMetadataSet = new Soap.SoapMetadataSet(inProcessMetadata, serviceMetadata); IMetadataSetManager soapMetadataSetManager = soapMetadataSet as IMetadataSetManager; IMetadataSetManager inProcessMetadataSetManager = inProcessMetadata as IMetadataSetManager; if (soapMetadataSetManager != null && inProcessMetadataSetManager != null) { soapMetadataSetManager.Container = inProcessMetadataSetManager.Container; } facadeMetadataSet.BaseMetadata = soapMetadataSet; Metadata[soapMetadataSet.Id] = soapMetadataSet; InProcessMetadata.Remove(link); }
public INode FindNode(ServerObjects.Node serviceNode) { return NodeManager.FindNode(serviceNode); }
public void SortObjects() { ServerObjects = ServerObjects.OrderBy(i => i.Order).ToList(); }
public void AddNumbersTestMethod1() { ServerObjects sb = new ServerObjects(); Assert.AreEqual(sb.AddNumbers(2, 2), 4); }
public IRelationship FindRelationship(ServerObjects.Relationship serviceRelationship) { IRelationship relationship; if (ProxyRelationships.ContainsKey(serviceRelationship.RelationshipUid)) { relationship = ProxyRelationships[serviceRelationship.RelationshipUid]; SoapRelationship soapRelationship = relationship as SoapRelationship; /// Not all the relationships that are stored in the RelationshipManager are SoapRelationships, some are FacadeRelationships. In this scenario we want to check if they have an inner SoapRelationship and use that instead. if (soapRelationship == null) { if (relationship is FacadeRelationship) { FacadeRelationship facadeRelationship = relationship as FacadeRelationship; soapRelationship = facadeRelationship.BaseRelationship as SoapRelationship; } } if (soapRelationship != null) { soapRelationship.UpdateRelationship(serviceRelationship); } } else { SoapRelationship soapRelationship = new SoapRelationship(MapManager); soapRelationship.UpdateRelationship(serviceRelationship); ProxyRelationships.Add(soapRelationship.Id, soapRelationship); relationship = soapRelationship; } if (!ServiceRelationships.ContainsKey(serviceRelationship.RelationshipUid)) { ServiceRelationships.Add(serviceRelationship.RelationshipUid, serviceRelationship); } return relationship; }
public void DeleteNode(ServerObjects.Node serviceNode) { DeleteNode(serviceNode.NodeUid); }
void IUpdatableMetadataSet.UpdateMetadataSet(ServerObjects.Metadata metadataSet) { if (BaseMetadata is IUpdatableMetadataSet) { IUpdatableMetadataSet updatableMetadataSet = BaseMetadata as IUpdatableMetadataSet; updatableMetadataSet.UpdateMetadataSet(metadataSet); } }
public INode FindNode(ServerObjects.Node serviceNode) { INode node; if (ProxyNodes.ContainsKey(serviceNode.NodeUid)) { node = ProxyNodes[serviceNode.NodeUid]; SoapNode soapNode = node as SoapNode; /// Not all the nodes that are stored in the NodeManager are SoapNodes, some are FacadeNodes. In this scenario we want to check if they have an inner SoapNode and use that instead. if (soapNode == null) { if (node is FacadeNode) { FacadeNode facadeNode = node as FacadeNode; soapNode = facadeNode.BaseNode as SoapNode; } } if (soapNode != null) { soapNode.UpdateNode(serviceNode); } } else { SoapNode soapNode = new SoapNode(MapManager); soapNode.UpdateNode(serviceNode); ProxyNodes.Add(soapNode.Id, soapNode); node = soapNode; } if (!ServiceNodes.ContainsKey(serviceNode.NodeUid)) { ServiceNodes.Add(serviceNode.NodeUid, serviceNode); } return node; }
public void UpgradeFacade(TransactionFramework.ISoapTransactionLink transactionLink, ServerObjects.Node serviceNode) { if (InProcessNodes.ContainsKey(transactionLink)) { FacadeNode facadeNode = InProcessNodes[transactionLink]; InProcess.InProcessNode inProcessNode = facadeNode.BaseNode as InProcess.InProcessNode; if (inProcessNode != null) { SoapNode soapNode = new SoapNode(inProcessNode, serviceNode); facadeNode.BaseNode = soapNode; InProcessNodes.Remove(transactionLink); ProxyNodes[facadeNode.Id] = facadeNode; /// TODO: Need to consider a better way to do this. I don't like that there is a need to call this afterwards and maybe it should be done when creating the SoapNode. I don't like it because it doesn't have to be done everytime a new SoapNode is created e.g. if the SoapNode is created from a Service.NO as opposed to a returned call like here. soapNode.ProcessDelayedActions(); } } }
public void CreateNode(ServerObjects.Node serviceNode) { FindNode(serviceNode); }
public void DeleteRelationship(ServerObjects.Relationship serviceRelationship) { DeleteRelationship(serviceRelationship.RelationshipUid); }
void Awake() { Instance = this; }
void IUpdatableMetadataSet.UpdateMetadataSet(ServerObjects.Metadata metadataSet) { INode newNode = null; IRelationship newRelationship = null; ConnectionType newConnectionType = null; if (metadataSet.NodeUid.HasValue) { newNode = MapManager.NodeFactory.FindNode(metadataSet.NodeUid.Value); } if (metadataSet.RelationshipUid.HasValue) { newRelationship = MapManager.RelationshipFactory.FindRelationship(metadataSet.RelationshipUid.Value); } if (metadataSet.DescriptorTypeUid.HasValue) { newConnectionType = MapManager.ConnectionTypes[metadataSet.DescriptorTypeUid.Value]; } if (Node == newNode || Node.Id != newNode.Id) { Node = newNode; } if (Relationship == newRelationship || Relationship.Id != newRelationship.Id) { Relationship = newRelationship; } if (ConnectionType != newConnectionType) { ConnectionType = newConnectionType; } if (Name != metadataSet.MetadataName) { Name = metadataSet.MetadataName; } if (Value != metadataSet.MetadataValue) { Value = metadataSet.MetadataValue; } }
public void UpgradeFacade(TransactionFramework.ISoapTransactionLink transactionLink, ServerObjects.Relationship serviceRelationship) { if (InProcessRelationships.ContainsKey(transactionLink)) { FacadeRelationship facadeRelationship = InProcessRelationships[transactionLink]; InProcess.InProcessRelationship inProcessRelationship = facadeRelationship.BaseRelationship as InProcess.InProcessRelationship; if (inProcessRelationship != null) { SoapRelationship soapRelationship = new SoapRelationship(inProcessRelationship, serviceRelationship); facadeRelationship.BaseRelationship = soapRelationship; InProcessRelationships.Remove(transactionLink); ProxyRelationships[facadeRelationship.Id] = facadeRelationship; /// TODO: Need to consider a better way to do this. I don't like that there is a need to call this afterwards and maybe it should be done when creating the SoapRelationship. I don't like it because it doesn't have to be done everytime a new SoapRelationship is created e.g. if the SoapNode is created from a Service.RE as opposed to a returned call like here. soapRelationship.ProcessDelayedActions(); } } }
private void SetInitialReferences() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; /** CHECK IF OUR CLIENT IS CONNECTED TO NETWORK * > Find our client object. * > Check if our client is connected. * > Establish offline container if disconnected. * */ ourClient = GameObject.Find("[ Code - Networking ]").GetComponent <NetworkClient>(); ourClientIsConnected = ourClient.clientIsConnected; if (!ourClientIsConnected) { Debug.LogWarning("We are not connected to the server"); OfflineContainer = GameObject.Find("[ Offline Spawned Objects ]").GetComponent <Transform>(); OfflineSpawnables = ourClient.mServerSpawningScript.getServerSpawnables(); } //IF we are the current client OR we are NOT connected, then... if (mNetworkIdentity.IsControlling() || !ourClientIsConnected) { enableCameras(); } //-----------------// //---Script Refs---// //-----------------// if (GetComponent <Player_Movement>() != null) { mMovementScript = GetComponent <Player_Movement>(); mMovementScript.SetInitialReferences(); } else { Debug.LogError("Missing essential script"); } if (GetComponent <Player_Shooting>() != null) { mShootingScript = GetComponent <Player_Shooting>(); mShootingScript.SetInitialReferences(); } else { Debug.LogError("Missing essential script"); } if (GetComponent <Player_Rotation>() != null) { mRotationScript = GetComponent <Player_Rotation>(); mRotationScript.SetInitialReferences(); } else { Debug.LogError("Missing essential script"); } if (GetComponent <Player_Camera>() != null) { mCameraScript = GetComponent <Player_Camera>(); mCameraScript.SetInitialReferences(); } else { Debug.LogError("Missing essential script"); } }
public void CreateRelationship(ServerObjects.Relationship serviceRelationship) { FindRelationship(serviceRelationship); }