Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - UndercoverDesigns

Pages: [1]
1
NGUI 3 Support / How to do a Tinder-Like swipe of a UISprite
« on: February 04, 2015, 10:15:00 AM »
I have a project where I am displaying images via a UISprite, with the user swiping them either right or left as input.

I have put a UIDragDropItem component on my UISprite, but I cannot click and drag the sprite.

What is the proper way to obtain this effect?

Gabe

2
NGUI 3 Support / How to update/ignore anchor when target is hidden?
« on: August 07, 2014, 10:22:25 AM »
I have a UIPanel and a UIButton on my UI.  The UIPanel has it's Bottom Anchor set to the UIButton.  I have the following code:

  1. NGUITools.SetActive (NextLevelButton, _LevelComplete);
  2. _Player.ToolsPanel.GetComponent<UIPanel> ().ResetAnchors ();
  3. _Player.ToolsPanel.GetComponent<UIPanel> ().UpdateAnchors ();

When this executes, the UIButton shows and hides as expected, but the UIPanel doesn't reposition the bottom to fill the space.

Is there a way to force this to occur?  Am I going about this the wrong way?

3
Is there no way to line items up to the top of a UIGrid without a UIScroll View?  My grid will never contain enough items to scroll.

4
I'm not sure how to set the origin point, though your explanation makes sense.

I don't see any sort of Origin property in the UIPanel component:



Gabe

5
NGUI 3 Support / Android Build requiring Full Network Access
« on: June 27, 2014, 01:26:09 PM »
I'm building an Android app with Unity/NGUI 3.6.5, and I'm finding that, due to some NGUI scripts, my app is requiring the Full Network Access permission.

I believe it's due to calls to Application.OpenURL in NGUIContextMenu.cs and NGUIHelp.cs, both in NGUI\Scripts\Editor\, which are part of the import of NGUI to my project.

Are these needed for the use of NGUI, because I'd really like to remove the need for network access permission.

Gabe

6
I have a UIPanel with an attached UIGrid script.  I can add children to the panel exactly as I would expect, except that the first item adds about halfway down the panel:


My code:
  1.  public void OnAddPlayer()
  2.     {
  3.         Debug.Log("Add Player");        
  4.  
  5.         if (Players.Count < 6)
  6.         {
  7.             GameObject PlayerObject = NGUITools.AddChild(ButtonHost as GameObject, ListItemPrefab);
  8.             PlayerObject.name = "Player" + Players.Count;
  9.             PlayerObject.transform.FindChild("PlayerName").GetComponent<UILabel>().text = PlayerObject.name;
  10.  
  11.             UISprite PlayerButtonSprite = PlayerObject.GetComponent<UISprite>();
  12.  
  13.             PlayerButtonSprite.leftAnchor.target = ButtonHost.transform;
  14.             PlayerButtonSprite.leftAnchor.absolute = 10;
  15.  
  16.             PlayerButtonSprite.rightAnchor.target = ButtonHost.transform;
  17.             PlayerButtonSprite.rightAnchor.absolute = -10;
  18.  
  19.             PlayerButtonSprite.ResetAnchors();
  20.             PlayerButtonSprite.UpdateAnchors();
  21.  
  22.             Player ThisPlayer = PlayerObject.GetComponent<Player>();            
  23.             Players.Add(ThisPlayer);
  24.                        
  25.             ButtonHost.GetComponent<UIGrid>().Reposition();
  26.         }
  27.     }

I would expect the player buttons to start showing up at the top of the UIPanel, which is anchored just under the "Players" label.  How do I make this be the case?

7
NGUI 3 Support / Anchor to Top/Left, ignore Right/Bottom
« on: June 14, 2014, 02:26:15 PM »
I'm creating some player buttons dynamically, and have that part down pat.  I've got a UISprite object that will host the buttons created.

I want the first button to align to 20px of the left and -20 px of the top of the ButtonHost object, but I want the button to keep it's width and height, so not anchor to the right/bottom of the parent.

Then, if this is a subsequent button, it needs to align to the previous one (which works correctly).

My code is:

  1. if (Players.Count == 0) {
  2.         // We have to set the anchor to the listGridRoot
  3.         PlayerButtonSprite.SetAnchor(ButtonHost, 20, 20, -20, -20);
  4. } else {
  5.         // we have to set the anchor to the previous player button
  6.         GameObject PreviousPlayerButton = Players [Players.Count - 1].Button;
  7.  
  8.         PlayerButtonSprite.SetAnchor(PreviousPlayerButton, 0, -50, 0, -50);
  9. }

As a follow-on, how would I expand the ButtonHost item to surround all of the created buttons?


Pages: [1]