protected void RegisterState(Vector3Event evt, UnityAction <Vector3> call, OwnershipMode mode = OwnershipMode.OnGrabbed) { if (networkMode == NetworkMode.Standalone) { evt.AddListener(call); } #if USING_PHOTON else { PhotonVector3 photon = gameObject.GetComponent <PhotonVector3>(); if (photon == null) { photon = gameObject.AddComponent <PhotonVector3>(); } photon.AddClient(evt, call); if (mode == OwnershipMode.OnGrabbed) { onGrab.AddListener(photon.ChangeOwnership); } else { onFocus.AddListener(photon.ChangeOwnership); } } #endif }
public void SetOwnershipMode(OwnershipMode mode) { if (ownershipMode == mode) { return; } ownershipMode = mode; UpdateMinimap(true); }
protected override WISE_RESULT OnCreateDatabase(string strDatabaseName, DatabaseHandle hDatabase, DatabaseHandle hTemplateDatabase, DatabaseDistType eDatabaseDistType, DatabaseType eDatabaseType, OwnershipMode eModeOwnership, AttributeQualityMode eModeAttributeQuality, AttributeTimeMode eModeAttributeTime) { WISE_RESULT result = WISEError.WISE_OK; // Call base class implementation result = base.OnCreateDatabase(strDatabaseName, hDatabase, hTemplateDatabase, eDatabaseDistType, eDatabaseType, eModeOwnership, eModeAttributeQuality, eModeAttributeTime); WISEError.CheckCallFailedEx(result); if (eDatabaseType == DatabaseType.Application) { // // TODO: Open driver communication for the specified database. // Uri baseAddress = new Uri(string.Format("{0}:{1}", _baseAddress, _port)); IService service = new Service(this.WISE, hDatabase); _serviceHost = new WebServiceHost(service, baseAddress); ServiceEndpoint serviceEndpoint = _serviceHost.AddServiceEndpoint(typeof(IService), new WebHttpBinding(), ""); WebHttpBehavior webHttpBehavior = _serviceHost.Description.Behaviors.Find<WebHttpBehavior>(); if (webHttpBehavior != null) { webHttpBehavior.AutomaticFormatSelectionEnabled = true; } else { WebHttpBehavior webBehavior = new WebHttpBehavior(); webBehavior.AutomaticFormatSelectionEnabled = true; serviceEndpoint.Behaviors.Add(webBehavior); } // // Enable metadata // //ServiceMetadataBehavior metadataBehavior = new ServiceMetadataBehavior(); //metadataBehavior.MetadataExporter.PolicyVersion = PolicyVersion.Policy15; //metadataBehavior.HttpGetEnabled = true; //_serviceHost.Description.Behaviors.Add(metadataBehavior); //_serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), //MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); //WebHttpBinding webHttpBinding = new WebHttpBinding(); //webHttpBinding. //_serviceHost.AddServiceEndpoint(typeof(IService), webHttpBinding, ""); // Initialize generated code. // TODO: handle error code Model.InitializeModel(this.WISE); _serviceHost.Open(); } return WISEError.WISE_OK; }
protected override WISE_RESULT OnConnectDatabase(string strDatabaseName, DatabaseHandle hDatabase, DatabaseDistType eDatabaseDistType, DatabaseType eDatabaseType, OwnershipMode eModeOwnership, AttributeQualityMode eModeAttributeQuality, AttributeTimeMode eModeAttributeTime) { WISE_RESULT result = WISEError.WISE_OK; // Implementation of this method is optional. // Call base class implementation result = base.OnConnectDatabase(strDatabaseName, hDatabase, eDatabaseDistType, eDatabaseType, eModeOwnership, eModeAttributeQuality, eModeAttributeTime); WISEError.CheckCallFailedEx(result); if (eDatabaseType == DatabaseType.Application) { // // TODO: Open driver communication for the specified database. // } return WISEError.WISE_OK; }