예제 #1
0
        // Add this DistributedObject to the repository.
        public void AddObject(IDistributedObject obj)
        {
            DistributedObjectId doId = obj.DistributedObjectId;

            // Store in the dictionary of objects
            mObjectIds[doId] = obj;
        }
예제 #2
0
        /// <summary>
        ///  Returns the object referenced by the doId or null if not found on this state server.
        /// </summary>
        /// <param name="doId"></param>
        /// <returns></returns>
        public IDistributedObject GetObject(DistributedObjectId doId)
        {
            IDistributedObject obj = null;

            mObjectIds.TryGetValue(doId, out obj);
            return(obj);
        }
예제 #3
0
 public void DeleteObjectMessage(bool broadcastMessage, DistributedObjectId distributedObjectId, List <object> data)
 {
     mBroadcast           = broadcastMessage;
     mDistributedObjectId = distributedObjectId;
     mData        = data;
     mMessageType = MessageType.Delete;
 }
예제 #4
0
 public void CreateObjectMessage(bool broadcastMessage, bool storeInRam, DistributedObjectId distributedObjectId, List <object> data)
 {
     mBroadcast           = broadcastMessage;
     mStoreInRam          = storeInRam;
     mDistributedObjectId = distributedObjectId;
     mData        = data;
     mMessageType = MessageType.Create;
 }
예제 #5
0
 //The first argument in List<object>data will contain all the serializable data we want
 //Eg: Data = new List<object> ( float x, float y, float z, float x, float y, float z, float w );
 public void UpdateObjectMessage(bool broadcastMessage, bool storeInRam, DistributedObjectId distributedObjectId, int callback, List <object> data)
 {
     mBroadcast           = broadcastMessage;
     mStoreInRam          = storeInRam;
     mDistributedObjectId = distributedObjectId;
     mCallback            = callback;
     mData        = data;
     mMessageType = MessageType.Update;
 }
예제 #6
0
 public Message(SerializationInfo info, StreamingContext ctxt) : this()
 {
     mBroadcast           = info.GetBoolean("broadcast");
     mStoreInRam          = info.GetBoolean("storeInRam");
     mDistributedObjectId = (DistributedObjectId)info.GetValue("objectId", typeof(DistributedObjectId));//info.GetUInt32("objectId");
     mCallback            = info.GetInt32("callback");
     mData        = (List <object>)info.GetValue("data", typeof(List <object>));
     mMessageType = (MessageType)info.GetValue("messageType", typeof(MessageType));
     mId          = info.GetInt32("id");
 }
예제 #7
0
        // Remove this DistributedObject from the repository.
        public virtual void RemoveObject(IDistributedObject obj)
        {
            // Remove from object id dict
            DistributedObjectId doId = obj.DistributedObjectId;

            if (!mObjectIds.Remove(doId))
            {
                Console.WriteLine("Warning!!! We don't have this object!");
                return;
            }
        }
예제 #8
0
 // Returns true if this state server currently is maintaining this object in memory.
 public bool ContainsObject(DistributedObjectId doId)
 {
     return(mObjectIds.ContainsKey(doId));
 }
예제 #9
0
 public DistributedObject(DistributedObjectId doId)
 {
     mDistributedObjectId = doId;
     RegisterMessageActions();
 }