Pro UI Add on - how do I make individual buy buttons correspond to their UID?

0 favourites
  • 4 posts
From the Asset Store
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • This community has helped me before and I am relying on it once again as I am struggling immensely.

    I am using the scrollview and gridview and gridviewdatabind to make my items and shop menu.

    as you can see, on layout, only one of each sprite exists but playing it uses JSON, AJAX and the gridviewdatabind to show an array.

    Each button has its individual UID but I don't know how to use that information to make sure that when I press a 'toycar' buy button, I am only 'buying' that and the item gets grayed out and available in the items menu.

    The UID for the buttons seem to be going up in 4s. so the button for the teaset is 64, toy car is 68, then next is 72, 76, 80.

    How do I use this knowledge that each shop buy button has a different UID to change:

    JSON code so once item bought, item cannot be bought again and is greyed out

    add the item to the item menu now (which looks exactly the same as shop menu)

    I tried to contact the creator of the addon but no use and I tried asking on discord construct3 and currently waiting if anyone will help

  • Because the list is generated dynamically, I don't recommend referencing buttons by UID. And definitely don't hard-code UIDs in events, because they may change.

    Every object in the grid is linked to a record in JSON through the DataBind plugin. For example, when a button is pressed, you should be able to access the name of the product and its price using these expressions:

    Button.GridViewDataBind.get("title")

    Button.GridViewDataBind.get("price")

    Or using the JSON object:

    JSON.Get(Button.GridViewDataBind.index & ".title")

    JSON.Get(Button.GridViewDataBind.index & ".price")

  • Thank you so much dop for replying! I was going to completely give up on using the Pro UI because of my lack of understanding and dumb brain, but you've given me hope to try use it again!

    Is it possible if you could - to show me a screenshot of what actions i need to use to use this?

    I kinda tried but it says gridviewdatabind isn't an expression in buttons.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry, I didn't mean the "Button" object, I meant your button sprite. If the name of the button sprite is BuyB, then the expression will be:

    BuyB.GridViewDataBind.get("price")

    Make sure to add GameObject and Gridviewdatabind behaviors to the button sprite.

    Please see the demo project included with the addons, it's pretty good.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)