protected GameObject FindObject(ObjectMode findMode, string stringValue) { var findedObject = default(GameObject); switch (findMode) { case ObjectMode.FindName: findedObject = GameObject.Find(stringValue); break; case ObjectMode.FindTag: findedObject = GameObject.FindWithTag(stringValue); break; default: #if UNITY_EDITOR ExceptionUtility.SwitchDefault(); #endif break; } #if UNITY_EDITOR ExceptionUtility.IsNull(findedObject); #endif return(findedObject); }
protected BaseModel(Type derivedType, ObjectMode mode) { DateCreated = DateTime.Now; DateModified = DateTime.Now; DerivedType = derivedType; IsPersisted = mode != ObjectMode.New; }
public void OnSwitchObjectMode(ObjectMode newMode) { switch (newMode) { case (ObjectMode.Moving): wasMoving = true; selectedObjectMode = ObjectMode.Moving; zCoord = Camera.main.WorldToScreenPoint(selectedObject.transform.position).z; offset = selectedObject.transform.position - GetMouseAsWorldPoint(); selectedObject.GetComponent <MeshRenderer>().material.SetColor("_AmbientColor", Color.red); moveSound.Play(); break; case (ObjectMode.Rotating): wasMoving = false; selectedObjectMode = ObjectMode.Rotating; selectedObject.GetComponent <MeshRenderer>().material.SetColor("_AmbientColor", Color.green); rotateSound.Play(); break; case (ObjectMode.Stationary): selectedObjectMode = ObjectMode.Stationary; break; case (ObjectMode.None): default: selectedObject.GetComponent <MeshRenderer>().material.SetColor("_AmbientColor", savedColor); selectedObjectMode = ObjectMode.None; break; } }
public SharedObservableBag <T> OpenBag <T>(string name, ObjectMode mode, Action <CollectionConnectedEventArgs> onConnected) where T : INotifyPropertyChanged { var result = (SharedObservableBag <T>)Open <T>(name, mode, CollectionType.Unordered); result.RegisterConnectedCallback(onConnected); return(result); }
/// <summary> /// Opens a strongly typed Bag with the specified name /// </summary> /// <param name="name">The bag to open</param> /// <param name="mode">An ObjectMode value that specifies whether a bag is created if one does not exist, and determines whether the contents of existing bags are retained or overwritten.</param> /// <returns>A SharedObservableBag with the specified name</returns> public SharedObservableBag <T> OpenBag <T>(string name, ObjectMode mode, Action <CollectionConnectedEventArgs> onConnected) where T : INotifyPropertyChanged { if (name == Constants.PresenceCollectionName) { throw new ArgumentException("The name you specified is a reserved system name. To connect to the presence bag call OpenPresenceCollection", "name"); } return(this.CollectionsManager.OpenBag <T>(name, mode, onConnected)); }
/// <summary> /// Opens an object with the specified name /// </summary> /// <param name="name">The object to open</param> /// <param name="mode">An ObjectMode value that specifies whether an object is created if one does not exist, and determines whether the contents of existing object is retained or overwritten.</param> /// <returns>A shared object with the specified name</returns> public T Open <T>(string name, ObjectMode mode, Action <ObjectConnectedEventArgs> callback) where T : INotifyPropertyChanged, new() { client.VerifyAccess(); if (mode == ObjectMode.Create || mode == ObjectMode.Truncate) { throw new ArgumentException("mode", "Create and Truncate are not supported ObjectModes for named objects"); } if (!this.client.IsConnected) { throw new InvalidOperationException("Cannot open object before the Client is connected"); } if (this.pendingOpenOperations.ContainsKey(name)) { throw new InvalidOperationException("The specified named object is already in the process of being opened"); } ObjectEntry entry = null; if (this.ContainsKey(name)) { if (mode != ObjectMode.Open && mode != ObjectMode.OpenOrCreate) { throw new ArgumentException("Invalid ObjectMode. Specified object has already been opened on this client. Try using ObjectMode.Open", "mode"); } entry = this[name]; // Make sure type of object matches T if (entry.Type != typeof(T)) { throw new ArgumentException("Specified type does not match that of existing collection"); } if (callback != null) { // If callback was provided, call the opened callback callback(new ObjectConnectedEventArgs(entry.Object, entry.Name, false)); } } else { entry = new ObjectEntry(this.client, name, typeof(T)); // Add to internal dictionary tracking all the pending open operations this.pendingOpenOperations[entry.Name] = new OpenOperation() { Entry = entry, Callback = callback }; Payload eventData = new ObjectOpenedPayload(entry.ToPayload(), mode, this.client.ClientId); this.client.SendPublishEvent(eventData); entry.AddParent(new ParentEntry(this.client.Id, 0)); } return((T)entry.Object); }
/// <summary> /// Open the specified collection /// </summary> /// <typeparam name="T"></typeparam> /// <param name="name">The name of the collection to open</param> /// <param name="mode">The mode used to open the collection</param> /// <param name="collectionType">The type of the Collection (e.g. Ordered, Unordered)</param> /// <param name="connectedCallback">Callback to call when the collection is connected</param> /// <returns></returns> public SharedCollection Open <T>(string name, ObjectMode mode, CollectionType collectionType) where T : INotifyPropertyChanged { client.VerifyAccess(); if (!this.client.IsConnected) { throw new InvalidOperationException("Cannot open collection before the Client is connected"); } if (this.pendingCollections.ContainsKey(name)) { throw new InvalidOperationException("The specified collection is already in the process of being opened"); } CollectionEntry entry = null; if (this.ContainsKey(name)) { if (mode != ObjectMode.Open && mode != ObjectMode.OpenOrCreate) { throw new ArgumentException("Invalid ObjectMode. Specified collection has already been opened on this client. Try using ObjectMode.Open", "mode"); } entry = this[name]; // Make sure type of collection matches T if (entry.Type != typeof(T)) { throw new ArgumentException("Specified type does not match that of existing collection"); } } else { switch (collectionType) { case CollectionType.Ordered: entry = new OrderedCollectionEntry(this.client, name, typeof(T)); // Start the heartbeat timer when an ordered collection is created // TODO ransomr optimize heartbeats so only sent when there are ordered collections with changes, make thread safe if (this.HeartbeatTimer == null) { this.HeartbeatTimer = new DispatcherTimer(); this.HeartbeatTimer.Tick += this.SendCollectionHeartbeat; this.HeartbeatTimer.Interval = TimeSpan.FromSeconds(Constants.HeartbeatIntervalSeconds); this.HeartbeatTimer.Start(); } break; case CollectionType.Unordered: entry = new UnorderedCollectionEntry(this.client, name, typeof(T)); break; } AddCollection(entry, mode, Source.Client); } // Register a new reference to the SharedObservableCollection return(entry.Register <T>()); }
//OB2Toggle -> OB2 Mode //Adds one instance of the second object //in the position the user touched public void SetOB2Mode(bool active) { if (active) { Debug.Log("Setting Object Mode to OB2"); objectMode = ObjectMode.OB2; m_ARKitProjectUI.m_INVToggle.isOn = false; m_ARKitProjectUI.m_DELToggle.isOn = false; m_ARKitProjectUI.m_OB1Toggle.isOn = false; } }
//INVToggle -> INV Mode //Adds invisible squares with the InvisibleMask shader //in the point touched by the user //These will not be rendered but will occlude the objects behind them public void SetINVMode(bool active) { if (active) { Debug.Log("Setting Object Mode to INV"); objectMode = ObjectMode.INV; m_ARKitProjectUI.m_DELToggle.isOn = false; m_ARKitProjectUI.m_OB1Toggle.isOn = false; m_ARKitProjectUI.m_OB2Toggle.isOn = false; } }
//DELToggle -> Delete Mode //Destroys game objects when the user touches them public void SetDELMode(bool active) { if (active) { Debug.Log("Setting Object Mode to DEL"); objectMode = ObjectMode.DEL; m_ARKitProjectUI.m_INVToggle.isOn = false; m_ARKitProjectUI.m_OB1Toggle.isOn = false; m_ARKitProjectUI.m_OB2Toggle.isOn = false; } }
//OB1Toggle -> OB1 Mode //Adds one instance of the first object //in the position the user touched public void SetOB1Mode(bool active) { if (active) { Debug.Log("Setting Object Mode To TGO"); objectMode = ObjectMode.OB1; m_ARKitProjectUI.m_INVToggle.isOn = false; m_ARKitProjectUI.m_DELToggle.isOn = false; m_ARKitProjectUI.m_OB2Toggle.isOn = false; //something else? } }
public RFSViewModel() { if (!DesignerProperties.IsInDesignTool) { Client = new CRUD_ManagerServiceClient(); InitiateCommands(); // FormName = PermissionItemName.RFQForm; InitiatePermissionsMapper(); ManagePermissions(); ManageCustomePermissions(); FormMode = new ObjectMode(); FormMode = ObjectMode.StandBy; InitializeObjStatus(); InitiateCollections(); InitializeServiceEvents(); FillBasicCollections(); } }
private void ChangeObjectMode(ObjectMode o) { switch (o) { case ObjectMode.NewObject: ResetObject(); break; case ObjectMode.LoadedFromDb: break; case ObjectMode.MarkedForDeletion: break; case ObjectMode.StandBy: ResetObject(); break; } }
/// <summary> /// /// </summary> /// <param name="initMode">同じくストリングefあるタグとネームを区別させるため、タイプを指定</param> /// <param name="stringValue"></param> public ObjectSelector(ObjectMode initMode, string stringValue) { switch (initMode) { case ObjectMode.FindName: case ObjectMode.FindTag: // case ObjectMode.FindTagAll: mode = initMode; targetNameOrTag = stringValue; Save(); break; default: #if UNITY_EDITOR ExceptionUtility.SwitchDefault(); #endif break; } }
private void ResetViewModel(ObjectMode objMode) { FormMode = objMode; InitiateCollections(); FillBasicCollections(); TransID = null; ObjStatus = new ObjectStatus { IsNew = true }; SupplierID = null; BrandCode = null; SeasonCode = null; SeasonProp = null; BrandProp = null; SupplierProp = null; DocNum = null; IsSearchingMode = false; AllFollowupApproved = false; IsLoaded = objMode == ObjectMode.NewObject || objMode == ObjectMode.LoadedFromDb; }
private void AddCollection(CollectionEntry entry, ObjectMode mode, Source source) { // Client created a new collection - send create payload to server if (source == Source.Client) { if (this.client.IsConnected) { Payload eventData = new CollectionOpenedPayload(entry.Name, entry.Id, entry.Type.AssemblyQualifiedName, mode, entry.CollectionType, this.client.ClientId); this.client.SendPublishEvent(eventData); Debug.Assert(entry.Items.Count == 0); } else { // Client is not connected throw exception throw new InvalidOperationException("Cannot Add Collection before Client is connected"); } } // Add to internal dictionary tracking all the known collections this.pendingCollections[entry.Name] = entry; }
private object ReadJsonInternal(Type innerType, Type objectType, JsonReader reader, JsonSerializer serializer, object retVal, ObjectMode mode) { if (reader.TokenType == JsonToken.StartObject || reader.TokenType == JsonToken.String || reader.TokenType == JsonToken.Boolean || reader.TokenType == JsonToken.Date || reader.TokenType == JsonToken.Bytes || reader.TokenType == JsonToken.Float || reader.TokenType == JsonToken.Integer) { var instance = serializer.Deserialize(reader, innerType); if (mode == ObjectMode.Array) { var myArrayObject = Activator.CreateInstance(objectType, 1); var array = myArrayObject as object[]; array[0] = instance; retVal = array; } else if (mode == ObjectMode.List) { var myListObject = Activator.CreateInstance(objectType); var list = myListObject as IList; list.Add(instance); retVal = list; } } else if (reader.TokenType == JsonToken.StartArray) { retVal = serializer.Deserialize(reader, objectType); } else if (reader.TokenType == JsonToken.Null) { retVal = null; } return(retVal); }
public CollectionOpenedPayload(string name, Guid id, string type, ObjectMode mode, CollectionType collectionType, Guid clientId) : base(name, id, clientId) { this.Type = type; this.Mode = mode; this.CollectionType = collectionType; }
public VehicleManufacturerWrapper(ObjectMode mode) : base(typeof(VehicleManufacturerWrapper), mode) { }
public Photo(ObjectMode mode) : base(typeof(Photo), mode) { Type = PhotoType.HighResolution; }
/// <summary> /// Opens an object with the specified name and provides a callback for notification when the object is connected to the server /// </summary> /// <param name="name">The object to open</param> /// <param name="mode">An ObjectMode value that specifies whether an object is created if one does not exist, and determines whether the contents of existing object is retained or overwritten.</param> /// <param name="callback">Method to execute when the object is connected to the server</param> /// <returns>A shared object with the specified name</returns> public T OpenObject <T>(string name, ObjectMode mode, Action <ObjectConnectedEventArgs> callback) where T : INotifyPropertyChanged, new() { return(this.ObjectsManager.Open <T>(name, mode, callback)); }
public VehicleSecurityType(ObjectMode mode) : base(typeof(VehicleSecurityType), mode) { }
public TheftMethod(ObjectMode mode) : base(typeof(TheftMethod), mode) { }
public ObjectSelector() { mode = ObjectMode.Specify; }
public override void Deserialize(IPayloadReader reader) { base.Deserialize(reader); this.ObjectPayload = (ObjectPayload)reader.ReadObject("Object", Payload.CreateInstance); this.Mode = (ObjectMode)reader.ReadByte("Mode"); }
public Colour(ObjectMode mode) : base(typeof(Colour), mode) { }
/// <summary> /// Opens a Bag with the specified name /// </summary> /// <param name="name">The bag to open</param> /// <param name="mode">An ObjectMode value that specifies whether a bag is created if one does not exist, and determines whether the contents of existing bags are retained or overwritten.</param> /// <returns>A SharedObservableBag with the specified name</returns> public SharedObservableBag <INotifyPropertyChanged> OpenBag(string name, ObjectMode mode, Action <CollectionConnectedEventArgs> onConnected) { return(this.OpenBag <INotifyPropertyChanged>(name, mode, onConnected)); }
public ObjectOpenedPayload(ObjectPayload objectPayload, ObjectMode mode, Guid clientId) : base(clientId) { if (objectPayload == null) { throw new ArgumentNullException("objectPayload"); } this.ObjectPayload = objectPayload; this.Mode = mode; }
public VehicleModelWrapper(ObjectMode mode) : base(typeof(VehicleModelWrapper), mode) { }
public Vehicle(ObjectMode mode) : base(typeof(Vehicle), mode) { Status = VehicleStatus.Active; TheftLocationPlaces = new List <Place>(); }
public Place(ObjectMode mode) : base(typeof(Place), mode) { }
public Video(ObjectMode mode) : base(typeof(Video), mode) { }
/// <summary> /// Opens an object with the specified name /// </summary> /// <param name="name">The object to open</param> /// <param name="mode">An ObjectMode value that specifies whether an object is created if one does not exist, and determines whether the contents of existing object is retained or overwritten.</param> /// <returns>A shared object with the specified name</returns> public T OpenObject <T>(string name, ObjectMode mode) where T : INotifyPropertyChanged, new() { return(this.ObjectsManager.Open <T>(name, mode, null)); }