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 - rookie_coder

Pages: [1]
1
NGUI 3 Support / Best Approach?
« on: March 21, 2014, 03:11:43 PM »
I understand 3d objects cannot be contained in a Panel. Here is what I am trying to do. What is the best approach?

Match 3 game made of CUBE prefabs. I want to use NGUI for the 2d panels, buttons, tabs etc on each level. This is easy. I want the remaining space to be used for the game with 3d objects. This space would have its own 3d camera. Writing the Match 3 game seems to be the easy part. The challenge is to have the 3d part resize for different screens - desktop, mobile. I can keep UIRoot fixed size, but that takes care of the 2d items - buttons etc. What about the remaining area with 3d objects? What container do I toss this into to get the resizing for different environments that I need. I don't want to have to hard-code any dimensions.

Thanks,
Syed

2
NGUI 3 Support / Re: Sizing and positioning within Clipped Panel
« on: March 20, 2014, 04:15:30 PM »
I tried this and it moved the first cube to the bottom left of the panel:

cube.position = nguiCamera.ViewportToWorldPoint(panel.transform.position);

Shouldn't it have moved to top left since that would be the Panel position?

Thanks

3
NGUI 3 Support / Re: Sizing and positioning within Clipped Panel
« on: March 20, 2014, 02:40:28 PM »
I now use NGUITools.AddChild. Couple of issues remaining.

1. The cubes within the Panel were too small. I copied the NGUITools.AddChild locally to debug. I ended up having to do this to get to a reasonable size:

cube.localScale = Vector3.one * 100;

2. The first cube is starting somewhere near the Center of the Clipped Panel. I need it to start at Left-Top. The Clipped Panel is fully anchored to the UIRoot on all sides with no gaps. I ran some debug statements.

Debug.Log("Panel x is: " + panel.transform.position.x) ... etc. They gave me (0, 0).

cube.localPosition = Vector3.zero; ..... also doesn't change the position. I would change the position manually as a last resort. I would prefer to go with the top-left corner of the anchored position of the Panel.

Thanks

4
NGUI 3 Support / Sizing and positioning within Clipped Panel
« on: March 20, 2014, 10:12:38 AM »
I am using a Clipped Panel, which for now is anchored to UIRoot, as a container for my cubes in my Match 3 game I am working on. I am having issues constraining my cubes to be within the Panel. I want them to be sort of anchored to the Clipped Panel container so that they can resize along with the Panel when I deploy to mobile. I attached a script - GameManager.cs - to the Panel. I have also set the transform for the cubes to the parent transform. Below is the relevant code. How do I get the grid of cubes to be anchored to the Panel and size according to the UI?

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameManager : MonoBehaviour
{
    public GameObject[] Cubes;
    public GameObject panel;

    void Start() {

    }
    void Update() {

        for (int i = 0; i < Cubes.Length + 1; i++) {
           
            for (int j = 0; j < Cubes.Length + 1; j++) {
               
                int index = Random.Range(0, Cubes.Length);

                GameObject myCube = Instantiate(Cubes[index], new Vector3(i, j, 0), Quaternion.identity) as GameObject;
                myCube.transform.parent = panel.transform;
            }
        }
    }
}

Thanks in advance

5
NGUI 3 Support / Panel Anchor
« on: March 17, 2014, 09:45:22 PM »
I am working on a Match-3 game. I dynamically create a grid of prefabs (the Grid gameobject) within a Panel. For now, I would like to do the following. Please advise as to the best practice.

1. Anchor the panel to the UIRoot, so that size of the panel changes proportionally for mobile.

2. Base the size of the Grid on the size of the Panel as determined in 1. Currently I am hard-coding the cell size as follows. I want it to be based on the Panel size dynamically.

instance.transform.localPosition = new Vector3(x * cellWidth, y * -cellHeight, 0f);

3. Position the Grid starting at the upper left hand corner of the Panel. Basically I want the grid to resize dynamically based on the panel size.

This is my hierarchy:

Main Camera
UIRoot
   Camera
   Panel
      Grid

Thanks in advance

6
NGUI 3 Support / Re: Scene view
« on: March 08, 2014, 09:10:21 PM »
Got it. I had to check the Layers drop-down in the Unity window since I had created a new layer.

Thanks

7
NGUI 3 Support / Re: Scene view
« on: March 08, 2014, 08:58:00 PM »
I tried that too. No difference.

8
NGUI 3 Support / Scene view
« on: March 08, 2014, 08:55:26 PM »
I downloaded NGUI 3.5.3. I started with a new scene and added a sprite. It is showing up in the camera view, but nothing in the Scene view. Am I missing something? Attached is the screen shot.  I even changed the Scene to 2D. Still nothing showing up. ???

Thanks

9
NGUI 3 Support / Anchoring Board Game Object to Panel
« on: February 18, 2014, 05:33:39 PM »
I have a 8*8 Game Board (GameObject). It is made up of Cubes. I want the Game Board to be contained and anchored to a Panel, so that when the Panel resizes based on the platform, Web or mobile, the GameBoard resizes accordingly. Is there a way to do this in NGUI? Any examples?

Thanks

10
NGUI 3 Support / Re: Never mind.
« on: February 12, 2014, 05:13:26 PM »
 I found it in the Readme.

11
NGUI 3 Support / Updating NGUI
« on: February 12, 2014, 03:05:09 PM »
I purchased the Professional version. How do I check for updates within the GUI? Is there something on the Menu?

Thanks

12
NGUI 3 Support / Re: Camera sprite too large
« on: February 09, 2014, 07:59:17 PM »
Thanks!! That worked.

13
NGUI 3 Support / Board Game - Best Practices
« on: February 09, 2014, 07:58:53 PM »
Please give me some feedback on best practices for a board game. Here is what I need input on:

1. Creating the actual grid itself. Should I just create a 8 * 8 grid and anchor the sprites to each cell. Or is the Table layout what I need?

2. Also, I need to rotate some of the pieces, some of them could be in different directions with different angles of rotation. In Unity, this can be quite tedious. Is there an easier way in NGUI for sprite rotation? Is it accomplished by tweening? Are there any examples?

Thanks in advance

14
NGUI 3 Support / Camera sprite too large
« on: February 09, 2014, 09:38:33 AM »
When creating a new Sprite or any other component, I get the default Scene View with the Camera in the center. However, the Camera is so large that a new button or label created goes behind the camera and then I have to manually change the coordinates to move it out from under the Camera. How can I reduce the size of the Camera sprite? Attached is the screen shot.

Thanks

Pages: [1]