Exemple #1
0
        /// <summary> Updates the sprite info depending on if the Location is remote or local </summary>
        protected void UpdateSpriteInfo()
        {
            if (this._Location == LocationMode.Remote)
            {
                if (this.SpriteInfo == null)
                {
                    this.SpriteInfo = ServerManager.Remote.GetRemoteSprite(this.UniqueSpriteIdentifier);
                }

                //Copy the entire remote SpriteInfo object into a local clone.
                // It should be faster to transmit this one request
                // rather than getting each property individually.
                SpriteInformation CloneInfo = (SpriteInformation)this.SpriteInfo.Clone();
                this.X        = CloneInfo.X;
                this.Y        = CloneInfo.Y;
                this.Z        = CloneInfo.Z;
                this.Frame    = CloneInfo.Frame;
                this.FaceLeft = CloneInfo.FaceLeft;
            }
            else if (this._Location == LocationMode.Local)
            {
                this.SpriteInfo.X        = this.X;
                this.SpriteInfo.Y        = this.Y;
                this.SpriteInfo.Z        = this.Z;
                this.SpriteInfo.FaceLeft = this._FaceLeft;
                this.SpriteInfo.Frame    = this.Frame;
            }
            else
            {
                throw new Exception("The sprite Location has not been set to Local or Remote.");
            }
        }
 public static void Add(uint UniqueId, SpriteInformation SpriteToAdd)
 {
     if (SpriteInfo == null)
     {
         SpriteInfo = new SpriteInfoManager();
     }
     SpriteInfo.Add(UniqueId, SpriteToAdd);
 }
        public object Clone()
        {
            SpriteInformation NewSpriteInfo = new SpriteInformation();

            NewSpriteInfo._X        = this._X;
            NewSpriteInfo._Y        = this._Y;
            NewSpriteInfo._Z        = this._Z;
            NewSpriteInfo._Frame    = this._Frame;
            NewSpriteInfo._FaceLeft = this._FaceLeft;

            return(NewSpriteInfo);
        }
        public SpriteInformation GetInfoFromId(uint UniqueId)
        {
            SpriteInformation RetVal = null;

            if (Contains(UniqueId) == false)
            {
                throw new Exception(string.Format("The sprite id {0} was not found on the remote machine", UniqueId));
            }

            System.Collections.IDictionaryEnumerator SpriteEnum = this._RemoteSpriteInfo.GetEnumerator();
            while (SpriteEnum.MoveNext())
            {
                if ((uint)SpriteEnum.Key == UniqueId)
                {
                    RetVal = (SpriteInformation)SpriteEnum.Value;
                    break;
                }
            }

            return(RetVal);
        }
            public static SpriteInformation GetRemoteSprite(uint UniqueId)
            {
                Remote.RequireOn();
                SpriteInformation RetVal = null;

                if (RemoteSpriteManager == null)
                {
                    RemoteSpriteManager = (SpriteInfoManager)Activator.GetObject(typeof(SpriteInfoManager), Remote.RemoteMachineUri);
                }

//				try
//				{
                RetVal = RemoteSpriteManager.GetInfoFromId(UniqueId);
//				}
//				catch(Exception err)
//				{
//
//				}

                return(RetVal);
            }
 public void Add(uint UniqueId, SpriteInformation SpriteToAdd)
 {
     this._RemoteSpriteInfo.Add(UniqueId, SpriteToAdd);
 }