コード例 #1
0
 public Strategy(StartBehaviour st, EndBehaviour en, IsChildBehaviour isc, GetLeveler gl)
 {
     DoStart = st;
     DoEnd = en;
     DoIsChild = isc;
     DoGetLevel = gl;
 }
 /// <summary> Creates the animated sprite </summary>
 /// <param name="canvas"></param>
 /// <param name="zOrder"></param>
 /// <param name="texture"></param>
 public AnimatedSprite(Canvas canvas, Int32 zOrder, Texture texture, Int32 imageWidth, Int32 imageHeight, Int32 numFrames, Single fps)
     : base(canvas, zOrder, texture)
 {
     _Width  = imageWidth;
     _Height = imageHeight;
     _Uvs    = new Vector4[numFrames];
     CreateUvs(numFrames);
     _VerticesShouldUpdate = true;
     Fps           = fps;
     _EndBehaviour = EndBehaviour.LOOP;
     UpdateManager.Instance.AddUpdatable(this);
 }
        /// <summary> Creates the animated sprite from CSV data </summary>
        /// <param name="canvas"></param>
        /// <param name="data"></param>
        public AnimatedSprite(Canvas canvas, String[] data)
            : base(canvas, data)
        {
            Int32 numFrames = -1;

            foreach (String stringData in data)
            {
                String[] splitData = stringData.Split('|');
                switch (splitData[0])
                {
                case "ImageSize":
                    _Width  = Single.Parse(splitData[1], CultureInfo.InvariantCulture);
                    _Height = Single.Parse(splitData[2], CultureInfo.InvariantCulture);
                    break;

                case "Fps":
                    Fps = Single.Parse(splitData[1], CultureInfo.InvariantCulture);
                    break;

                case "NumberOfFrames":
                    numFrames = Int32.Parse(splitData[1]);
                    break;

                case "EndBehaviour":
                    _EndBehaviour = (EndBehaviour)Enum.Parse(typeof(EndBehaviour), splitData[1]);
                    break;

                case "Playing":
                    Playing = Boolean.Parse(splitData[1]);
                    break;

                case "CurrentFrame":
                    CurrentFrame = Int32.Parse(splitData[1]);
                    break;
                }
            }
            if (numFrames == -1)
            {
                throw new ArgumentOutOfRangeException(nameof(numFrames), "The AnimatedSprite needs to define the number of frames");
            }
            _Uvs = new Vector4[numFrames];
            CreateUvs(numFrames);
            _VerticesShouldUpdate = true;
            UpdateManager.Instance.AddUpdatable(this);
        }
コード例 #4
0
 public EasingControl SetEndBehavior(EndBehaviour e)
 {
     this.endBehaviour = e;
     return(this);
 }
コード例 #5
0
 static public string EnumToString(EndBehaviour a)
 {
     return(EndBehaviourLbl[(int)a]);
 }