Author Topic: Multiple choice question with NGUI  (Read 4340 times)

aldin

  • Guest
Multiple choice question with NGUI
« on: November 25, 2012, 01:00:49 PM »
Hello all,

i just have purchased NGUI.

I want to create a multiple choice question with NGUI in game.  I have 2 Cameras.

One is pointing at the interface where all the questions will be asked, the questions will trigger time and a gauge that is/ display the state of the game play.
the second camera is pointing at a 3D level. The camera has animation attached to it, so if the player answers questions it will be triggered depending how well the player does.

My question is how do I create a Display with NGUI, where I will have a area where my question come in, and 2 buttons. if i click on the 1st button it will navigate or bring up my question, and the second button when clicking on it, it will bring up my answers. so i can switch back and forth.

once i answer it will bring up another question with answers ???


HELP NEEDED

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Multiple choice question with NGUI
« Reply #1 on: November 25, 2012, 04:51:49 PM »
I think you're asking too broad questions. It's just too big of a mouthful to quickly help with.

To get your 2d menu stuff on top of the 3D game, just set the depth of the 2d camera to be higher than the 3d camera. Then the 2d camera will draw last.

Making buttons is trivial, see the examples.


aldin

  • Guest
Re: Multiple choice question with NGUI
« Reply #2 on: November 25, 2012, 04:54:40 PM »
i have bought the 95 dollar NGUI which came with a hole lot of Scripts. Can I use any of them to construct what I need and want to achive.. >???

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple choice question with NGUI
« Reply #3 on: November 26, 2012, 12:14:46 AM »
You bought a UI system, not a quiz maker. You can do the visual stuff with NGUI: window with multiple choice questions (checkboxes), buttons, answers (labels). You can show/hide things easily, but tying all of it together will require you to code the logic for it -- what happens when a button gets pressed? How do you determine what the right answer is? How do you calculate the score? When do you want to transition between things? All of this is application logic, and is up to you.

aldin

  • Guest
Re: Multiple choice question with NGUI
« Reply #4 on: November 26, 2012, 09:49:07 AM »
i understand that, and i am aware of what you have brought up. But how would you do such thing.
I was thinking to pre select my right answers.  But  I am unsure where I need to attach the logic code. Lets say I have the code written, do i have to create a empty game object drag it in to the scene and just attach it.  or will it be more complex where I have to target each individual object or function.

?

lets say I have build all my questions and with the label, and group them all together with buttons that will navigate back and forth between question and answeres . Once an answer is selected right or wrong it will bring up the next question. if its wrong, it will deduct the score, and it will bring up the next question. if its right it will add points and bring up the next set of questions.
if the player has answered at least 5 questions wrong it will trigger a different set of questions.
If the player continues answering questions wrong it will deduct the time. Also change the texture on an game object, trigger animations as well. When time is at 00:00:00 the game is over.

if player continues answering questions right a different set of question is brought up, different from the questions  if the player answered questions incorrectly which will be a different set of questions.

So with the NGUI, i can create my questions set, in a set there can be up 2 10 questions. I hope this makes sense.

So all of this can be controlled with one line of code >???
 or >??? 

I am learning, I am actually an artist, and trying to learn coding. Its difficult to trying to figure it out on my own.

Thank you in advance

Aldin
www.AiiBee.com

If player continues t


Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Multiple choice question with NGUI
« Reply #5 on: November 26, 2012, 05:08:13 PM »
It seems like you need a more basic tutorial in how to code in unity, rather than specifically NGUI.

To keep it concise: Yes, you can totally achieve what you want with Unity and NGUI, it's very doable. And it will take more than 1 line of code to do it.

I would create a single prefab that held the basic outline, then fill in the questions from code. Clicking could be handled be a central script with a void OnClick method, which got input from colliders that covered the different answers - 1 for each answer. Each collider would correspond to an answer.Then when you receive the click, you can add/deduct points in your controller  script and reload the prefab with a new set of questions.

I hope this helps you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple choice question with NGUI
« Reply #6 on: November 26, 2012, 05:46:46 PM »
NGUI has tutorials. One of those tutorials is for checkboxes. 3 of those checkboxes are set up in an option group, where you can only select one at a time. Each one changes the visibility of some game object.

Learn how it works, and you will be one giant step closer to what you want to achieve.