Page 1 of 1

Decoration Display Window

PostPosted: Thu Jun 28, 12 11:26 am
by SimonDenton
Hi All,

How can I make a window pop up when I frob a decoration item? The code for my custom decoration is:

Code: Select all
class QuizPaper extends SummerDecoration;

var QuizWindow quizwindow;
var SummerPlayer player;


/// ----------------------------------------------------------------------
// Frob()
// ----------------------------------------------------------------------

function Frob(Actor Frobber, Inventory frobWith)
{
local SummerPlayer player;

   

   Super.Frob(Frobber, frobWith);

   player = SummerPlayer(Frobber);

   if (player != None)
   {
      if (quizwindow == None)
      {
         
         CreateQuizWindow();
   
      }
      
   }
   
   
   
   
}

// ----------------------------------------------------------------------
// CreateQuizWindow()
// ----------------------------------------------------------------------

function CreateQuizWindow()
{
quizwindow.InitWindow();
}


defaultproperties
{
ItemName="Quiz Paper"
Mesh=LodMesh'DeusExItems.Credits' //Draft for now
}


And my window code is just simply:

class QuizWindow expands MenuUIScreenWindow;

var MenuUIHeaderWindow winHeader;

Code: Select all
// ----------------------------------------------------------------------
// CreateHeaderWindow()
// ----------------------------------------------------------------------

function CreateHeaderWindow()
{
   winHeader = MenuUIHeaderWindow(winClient.NewChild(Class'MenuUIHeaderWindow'));
   winHeader.SetPos(11, 6);
   winHeader.SetSize(300, 12);
   winHeader.SetTextAlignments(HALIGN_Center, VALIGN_Top);
   winHeader.SetText("Quiz");
}


for the sake of testing it out.

When I frob the QuizPaper it just grabs the decoration and doesn't invoke the window. Help would be appreciated.

PostPosted: Thu Jun 28, 12 1:02 pm
by Andrievskaya Veronika
Try to remove this:

Code: Select all

   Super.Frob(Frobber, frobWith);


PostPosted: Thu Jun 28, 12 1:19 pm
by Cozmo
If removing the Super.Frob call doesn't work (not sure, but it might make it un-frobbable), try setting bPushable to false; that should stop it from being picked up and will hopefully call the window.

PostPosted: Sat Jun 30, 12 6:42 am
by SimonDenton
Thank you both! It worked out! Now...to do the real GUI part, Quiz Window :D
Heading: *SubjectStringStoredInQuizPaperObject* + "Quiz"
Single window in the middle
Within this window:
- Question string
- 4 multiple choice, 4 checklist or one password input depending on question type
- Arrow and horizontal scroll bar at the bottom for going through questions
- A "Help" button which adds a window showing a note kind of thing suitting the exam we're doing.
- A finish button to submit results in the bottom right corner.
- Time limit shown on the top right hand corner, if this is 0 then the function for submit is done.

Is it wise to store things like the number of questions, possible question strings/answers/correct answers, marks obtained and marks possible within the QuizPaper decoration object? This data will be carried over to the test scoreboards which instantly compare the player's marks to those of others.

PostPosted: Tue Jul 10, 12 12:00 pm
by SimonDenton
Below is a graphical representation of my idea.

Image
So we have a randomised bank of questions which can be stored in the Quiz Paper decoration object.

e.g If we do math quiz 1:
- Question Text: Solve the inequality;
- Question Diagram:

Image
- Question enum: Q_MultipleChoice
-MC1Text: -4 < x < 3
-MC2Text: -8 <= x <3
-MC3 Text -8 <= x <= 3
-MC4Text: -8 < x <3
- Correct Answer: MC2

Something like that.[/img]