Ngui learning notes practice-create a mall

Source: Internet
Author: User

Unity3d ugui has heard that 4.6 is coming soon, but currently ngui and other UI plug-ins are very popular and mature, so let's take a look.

I. Implementation ideas

The mall features are available in many games. Click an interface button to bring up a form.

Then, the products in the mall can be dragged, either by hand or by slide, etc. As for clicking to buy, it is not just about the UI Layer. Wait until ndate is implemented.

Ii. Background

1. ngui-> open-> prefab tool bar, drag a black widget

2. The layout is as follows. There should be no difficulty in setting the anchor and setting the depth.

    

Uitexture-> BG (sprite)-> daimond (uitexture) Diamond Bar-> creatediamond (uitexture) + button-> num (uilable) Quantity: Gold (uitexture) Hp (uitexture)

3. It looks like this.

3. Click to bring up the mall

1. In order to demonstrate this, we can create a mall interface. The other battles are similar. I generally recommend that you use a new panel to create a new one.

2, add art to the background and so on, the layout is as follows, more troublesome scroll view, this I will not go into details, you can view my blog, ngui Study Notes tutorial 4 http://www.cnblogs.com/chongxin/p/3821118.html

Shoproot-"BG (sprite)-> Control-simple vertical scroll bar-> name (lable)-> return (sprite button)-> scroll view-> grid (vertical List) -> grid (horizontal list)-> sprite0 (product image)-> buy-> currentkind-> num-> sprite1-> sprite2-> grid-> Grid

The interface is as follows:

3. After completing the mall interface, we need to make a click pop-up effect, which is implemented by using tween scale. I have to say that ngui plug-ins are really good, and a lot of code is saved for us.

First:

Then attach the Tween scale in shoproot and set active to false.

  

Finally, if we want to return, we need the mall's own return to return, the same idea

  

Note: There is a problem here. When I mount the Tween scale on the root node, sometimes the UI disappears and does not disappear. I don't know why, but I don't know why, hope you can give me some advice.

Iv. function implementation

Pop-up:

  

  

Basically, with the UI plug-in, the UI is still very pleasant. you can concentrate on the UI effect instead of constructing it and wish everyone a happy life.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.