예제 #1
0
        public void AddFrame(CozyTexture texture)
        {
            var frame = CozyAnimationFrame.Create(texture, 1.0f);

            Frames.Add(frame);
            TotalDelayUnits++;
        }
예제 #2
0
 public void Modify(uint id, CozyTexture texture)
 {
     if(TextureDictionary.ContainsKey(id))
     {
         TextureDictionary[id] = texture;
     }
 }
예제 #3
0
        public static CozyAnimationFrame Create(CozyTexture texture, float delayUnits)
        {
            var animate = new CozyAnimationFrame();

            animate.InitWithTexture(texture, delayUnits);
            return(animate);
        }
예제 #4
0
 public virtual bool InitWithTexture(CozyTexture texture)
 {
     if (texture == null)
     {
         return(false);
     }
     Texture = texture;
     return(true);
 }
예제 #5
0
파일: TileButton.cs 프로젝트: xxy1991/cozy
 public TileButton(CozyTexture texture, Rectangle SourceRect)
 {
     PreferredHeight     = 32;
     PreferredWidth      = 32;
     Margin              = new Starbound.UI.Thickness(3, 3, 0, 0);
     Content             = new XNAImageResource(texture.Get());
     SourcePosition      = new Starbound.UI.Vector2(SourceRect.X, SourceRect.Y);
     SourceSize          = new Starbound.UI.Vector2(SourceRect.Width, SourceRect.Height);
 }
예제 #6
0
 public static new CozyTileSprite Create(CozyTexture texture)
 {
     var sp = new CozyTileSprite();
     if(!sp.InitWithTexture(texture))
     {
         return null;
     }
     return sp;
 }
예제 #7
0
        public static CozySprite Create(CozyTexture texture)
        {
            var sp = new CozySprite();

            if (!sp.InitWithTexture(texture))
            {
                return(null);
            }
            return(sp);
        }
예제 #8
0
 public CozyTexture AddImage(string path)
 {
     CozyTexture result = null;
     if(Textures.ContainsKey(path))
     {
         result = Textures[path];
     }
     else
     {
         result = new CozyTexture(path);
         Textures[path] = result;
     }
     return result;
 }
예제 #9
0
        public CozyTexture AddImage(string path)
        {
            CozyTexture result = null;

            if (Textures.ContainsKey(path))
            {
                result = Textures[path];
            }
            else
            {
                result         = new CozyTexture(path);
                Textures[path] = result;
            }
            return(result);
        }
예제 #10
0
        public override void Update(float dt)
        {
            if (dt < 1.0f)
            {
                dt *= Animaction.Loops;

                uint LoopNum = (uint)dt;
                if (LoopNum > ExecutedLoops)
                {
                    NextFrame = 0;
                    ExecutedLoops++;
                }

                dt = dt % 1.0f;
            }

            var         frames         = Animaction.Frames;
            int         numberOfFrames = frames.Count;
            CozyTexture frameToDisplay = null;

            for (int i = NextFrame; i < numberOfFrames; ++i)
            {
                float splitTime = SplitTimes[i];

                if (splitTime <= dt)
                {
                    CozyAnimationFrame frame = frames[i];
                    frameToDisplay = frame.Texture;
                    (Target as CozySprite).Texture = frameToDisplay;
                    NextFrame = i + 1;
                }
                else
                {
                    break;
                }
            }
        }
예제 #11
0
 public override bool InitWithTexture(CozyTexture texture)
 {
     if(!base.InitWithTexture(texture))
     {
         return false;
     }
     return true;
 }
예제 #12
0
        public object Clone()
        {
            var text = new CozyTexture(this._Texutre);

            return(text);
        }
예제 #13
0
 public virtual bool InitWithTexture(CozyTexture texture, float delayUnits)
 {
     Texture = texture;
     DelayUnits = delayUnits;
     return true;
 }
예제 #14
0
 public static CozyAnimationFrame Create(CozyTexture texture, float delayUnits)
 {
     var animate = new CozyAnimationFrame();
     animate.InitWithTexture(texture, delayUnits);
     return animate;
 }
예제 #15
0
 private Tuple<uint, CozyTiledNode> CreateTiledNodeTuple(uint id, CozyTexture texture, Rectangle rect)
 {
     return Tuple.Create<uint, CozyTiledNode>(id, CozySpriteTiled.Create(texture, rect));
 }
예제 #16
0
 public void Add(uint id, CozyTexture texture)
 {
     TextureDictionary[id] = texture;
 }
예제 #17
0
 public void AddFrame(CozyTexture texture)
 {
     var frame = CozyAnimationFrame.Create(texture, 1.0f);
     Frames.Add(frame);
     TotalDelayUnits ++;
 }
예제 #18
0
파일: CozyTexture.cs 프로젝트: xxy1991/cozy
 public object Clone()
 {
     var text = new CozyTexture(this._Texutre);
     return text; 
 }
예제 #19
0
 public virtual bool InitWithTexture(CozyTexture texture, float delayUnits)
 {
     Texture    = texture;
     DelayUnits = delayUnits;
     return(true);
 }
예제 #20
0
파일: CozySprite.cs 프로젝트: xxy1991/cozy
 public virtual bool InitWithTexture(CozyTexture texture)
 {
     if (texture == null) return false;
     Texture = texture;
     return true;
 }