示例#1
0
        public Counter(CounterDefinition definition)
        {
            _definition = definition;
            _cachedDigits = new List<int>();

            Value = 0;
        }
示例#2
0
        public Counter(CounterDefinition definition, SpriteInfo spriteInfo)
            : base(spriteInfo)
        {
            _definition = definition;

            Value = 0;
        }
示例#3
0
        public CounterDefinition BuildDefinition(ContentManager contentManager)
        {
            CounterDefinition definition = new CounterDefinition();

            foreach (ISpriteElement sprite in Sprites.Sprites) {
                if (!CounterDefinition.DigitIndex.ContainsKey(sprite.Name))
                    continue;

                StaticSpriteDefinition spriteDef = new StaticSpriteDefinition();
                spriteDef.Load(contentManager, Sprites.Source, new Rectangle(
                    sprite.X, sprite.Y, sprite.Width, sprite.Height));
                spriteDef.Origin = new Vector2(sprite.OriginX, sprite.OriginY);

                definition.DigitFrames[CounterDefinition.DigitIndex[sprite.Name]] = spriteDef;
            }

            return definition;
        }