Пример #1
0
        // PRAGMA MARK - Public Interface
        public void SetupWithIdQuantity <TEntity>(IdQuantity <TEntity> idQuantity) where TEntity : DTEntity
        {
            IViewIdQuantity viewIdQuantity = new ViewIdQuantity <TEntity>(idQuantity);

            DTEntity         entity           = viewIdQuantity.Entity;
            DisplayComponent displayComponent = entity.GetComponent <DisplayComponent>();

            if (displayComponent != null)
            {
                this._image.sprite = displayComponent.displaySprite;
            }

            if (viewIdQuantity.Quantity <= 0)
            {
                Debug.LogWarning("IdQuantityView - don't know how to show a quantity less than or equal to zero!");
            }

            if (viewIdQuantity.Quantity > 1)
            {
                this._textContainer.SetActive(true);
                this._text.SetText(string.Format("x{0}", viewIdQuantity.Quantity));
            }
            else
            {
                this._textContainer.SetActive(false);
            }
        }
Пример #2
0
        public static void PopulateSpriteRenderer(this DTEntity entity, SpriteRenderer spriteRenderer)
        {
            DisplayComponent displayComponent = entity.GetComponent <DisplayComponent>();

            if (displayComponent == null)
            {
                Debug.LogError("PopulateSpriteRenderer - failed to get display component!");
                return;
            }

            spriteRenderer.sprite = displayComponent.displaySprite;
        }
Пример #3
0
        public static void PopulateNameOutlet(this DTEntity entity, TextOutlet textOutlet)
        {
            DisplayComponent displayComponent = entity.GetComponent <DisplayComponent>();

            if (displayComponent == null)
            {
                Debug.LogError("PopulateNameOutlet - failed to get display component!");
                return;
            }

            textOutlet.Text = displayComponent.displayName;
        }
Пример #4
0
        public static void PopulateImage(this DTEntity entity, Image image)
        {
            DisplayComponent displayComponent = entity.GetComponent <DisplayComponent>();

            if (displayComponent == null)
            {
                Debug.LogError("PopulateImage - failed to get display component!");
                return;
            }

            image.sprite = displayComponent.displaySprite;
        }
        // PRAGMA MARK - Public Interface
        public void SetupWithViewIdQuantity(IViewIdQuantity viewIdQuantity)
        {
            this._viewIdQuantity = viewIdQuantity;

            DTEntity         entity           = this._viewIdQuantity.Entity;
            DisplayComponent displayComponent = entity.GetComponent <DisplayComponent>();

            if (displayComponent != null)
            {
                this._renderer.sprite = displayComponent.displaySprite;
            }

            this._autoTapCoroutine = CoroutineWrapper.StartCoroutine(this.AutoTapCoroutine());
        }
Пример #6
0
        private static int GetWeightForEntity(DTEntity entity)
        {
            if (entity == null)
            {
                return(0);
            }

            WeightComponent weightComponent = entity.GetComponent <WeightComponent>();

            if (weightComponent == null)
            {
                return(0);
            }

            return(weightComponent.weight);
        }
        // PRAGMA MARK - Public Interface
        public void SetupWithRequiredIdQuantity <TEntity>(IdQuantity <TEntity> requiredIdQuantity) where TEntity : DTEntity
        {
            IViewIdQuantity requiredViewIdQuantity = new ViewIdQuantity <TEntity>(requiredIdQuantity);

            this._requiredViewIdQuantity = requiredViewIdQuantity;
            this._requiredViewIdQuantity.OnUserInventoryUpdated += this.HandleInventoryUpdated;

            DTEntity         entity           = this._requiredViewIdQuantity.Entity;
            DisplayComponent displayComponent = entity.GetComponent <DisplayComponent>();

            if (displayComponent != null)
            {
                this._requiredImage.sprite = displayComponent.displaySprite;
            }

            this.UpdateUserCount();
        }
Пример #8
0
 public static Sprite DisplaySprite(this DTEntity entity)
 {
     return(entity.GetComponent <DisplayComponent>().displaySprite);
 }
Пример #9
0
 public static string DisplayName(this DTEntity entity)
 {
     return(entity.GetComponent <DisplayComponent>().displayName);
 }