Example #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);
            }
        }
Example #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;
        }
Example #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;
        }
Example #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());
        }
        // 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();
        }