示例#1
0
        public static PicRef GetOrCreate(string name)
        {
            PicRef pr = PicRef.Get(name);

            if (pr != null)
            {
                return(pr);
            }
            return(PicRef.Create(name));
        }
示例#2
0
        //public Endogine.BitmapHelpers.PixelManipulatorBase PixelManipulator
        //{
        //    get {return this.Member.PixelManipulator;}
        //    set {this.Member.PixelManipulator = null;}
        //}
        //public Endogine.BitmapHelpers.Canvas Canvas
        //{
        //    get {return this.Member.C
        //}

        /// <summary>
        /// Look for a resource in this order: Animation, FrameSet, PicRef, Member.
        /// </summary>
        /// <param name="name"></param>
        public void SetGraphics(string name)
        {
            //EH.Instance.CastLib.Animations[name];

            Endogine.Animation.BhAnimator an = (Endogine.Animation.BhAnimator) this["_anim"];

            List <string> fs = EH.Instance.CastLib.FrameSets[name];

            if (fs != null)
            {
                if (an != null)
                {
                    an.FrameSet = name;
                }
                else
                {
                    an = new Endogine.Animation.BhAnimator(this, name);
                }
                return;
            }

            PicRef pr = PicRef.Get(name);

            if (pr != null)
            {
                if (an != null)
                {
                    an.Dispose();
                }
                this.PicRef = pr;
                return;
            }

            MemberBase mb = EH.Instance.CastLib.GetByName(name);

            if (mb != null && mb is MemberSpriteBitmap)
            {
                this.Member = (MemberSpriteBitmap)mb;
                return;
            }

            this.MemberName = name;
        }