Jump to content

GuiSystem (Dialogs,MainMenu)


aiaf
 Share

Recommended Posts

I added a gui system, work in progress but i commited it so you can see i make good progress.

 

I tried to keep it simple and flexible ,this is how its used:

local guimanager = GuiManager:new(nil, gui, gstate)

guimanager:loadDialogData(TestDialogs)

Under the hood the GuiManager takes care of main menu, dialogs and in future also inventory.

 

The dialog text is loaded from a file:

TestDialogs = {
                {id=1, speaker = "Minsc", text = "Welcome to Forth!", navButtonType = "Continue", choices={}},
                {id=2, speaker = "Minsc", text = "Welcome to Forth! Second", navButtonType = "Continue", choices={}},
                {id=2, speaker = "Minsc", text = "Welcome to Forth! Third", navButtonType = "Continue", choices={}},
                {id=3, speaker = "Minsc", text = "Welcome to Forth! Fourth", navButtonType = "End Dialog", choices={}
			}

 

You can see it in action on game main menu, can click continue when last dialog panel will be closed.

Also a game state class , may be too simple but for now is ok.

 

Next i will implement the dialog choices.

  • Like 2

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

More progress with this , now i have a tree like structure for the dialogs.

If you pull the changes can see the dialog in game made from this description file:

TestOneChoice = {
    ["1_1"] = { speaker = "Minsc", text = "Who are you ?", navButtonType = "None", choices = {"Minsc", "Rom (Lie)", "I dont know", "What What"}},
        ["1_1_11"] = { speaker = "Guardian", text = "Ok Minsc, now show me the money", navButtonType = "None", choices = {"I dont have any money", "Say what ? die", "Banzaaii"}},
            ["1_2_11"] = { speaker = "Minsc", text = "Then give me some bread. Now!", navButtonType = "End Dialog", choices = {}},
            ["2_2_11"] = { speaker = "Minsc", text = "You will regret this. Defend yourself!", navButtonType = "End Dialog", choices = {}},
            ["3_2_11"] = { speaker = "Minsc", text = "Die!", navButtonType = "End Dialog", choices = {}},
        ["2_1_11"] = { speaker = "Guardian", text = "Ok Rom nice to meet you", navButtonType = "None", choices = {"I need food", "Lets rob a bank", "Whatever"}},
            ["1_2_21"] = { speaker = "Guardian", text = "1", navButtonType = "End Dialog", choices = {}},
            ["2_2_21"] = { speaker = "Guardian", text = "2", navButtonType = "End Dialog", choices = {}},
            ["3_2_21"] = { speaker = "Guardian", text = "Test3", navButtonType = "None", choices = {"Test3"}},
                ["1_3_32"] = { speaker = "Guardian", text = "Ok", navButtonType = "None", choices = {"Test1", "Test2"}},
                    ["1_4_13"] = { speaker = "Guardian", text = "Ok1", navButtonType = "End Dialog", choices = {}},
                    ["2_4_13"] = { speaker = "Guardian", text = "Ok2", navButtonType = "End Dialog", choices = {}},
        ["3_1_11"] = { speaker = "Guardian", text = "What", navButtonType = "None", choices = {"Test"}},
            ["1_2_31"] = { speaker = "Guardian", text = "Test", navButtonType = "End Dialog", choices = {}},
        ["4_1_11"] = { speaker = "Guardian", text = "What What", navButtonType = "None", choices = {"What1"}},
            ["1_2_41"] = { speaker = "Guardian", text = "What1", navButtonType = "End Dialog", choices = {}}
}

I need to do more testing, and think of a way to store player choices.

 

What that key index means:

(index)_(depth)_(parent index depth joined as number)

They are actually easy to do once you figure it out.

 

I think i have a problem with duplicate entires, ill come back with an update.

 

  • Like 2

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

I had to change the indexing.Now is done and working perfectly bonus the code is simpler.

TestOneChoice = {
    ["11"] = { speaker = "Minsc", text = "Who are you ?", navButtonType = "None", choices = {"Minsc", "Rom (Lie)", "I dont know", "What What"}},
        ["1111"] = { speaker = "Guardian", text = "Ok Minsc, now show me the money", navButtonType = "None", choices = {"I dont have any money", "Say what ? die", "Banzaaii"}},
            ["121111"] = { speaker = "Minsc", text = "Then give me some bread. Now!", navButtonType = "End Dialog", choices = {}},
            ["221111"] = { speaker = "Minsc", text = "You will regret this. Defend yourself!", navButtonType = "End Dialog", choices = {}},
            ["321111"] = { speaker = "Minsc", text = "Die!", navButtonType = "End Dialog", choices = {}},
        ["2111"] = { speaker = "Guardian", text = "Ok Rom nice to meet you", navButtonType = "None", choices = {"I need food", "Lets rob a bank", "Whatever"}},
            ["122111"] = { speaker = "Guardian", text = "1", navButtonType = "End Dialog", choices = {}},
            ["222111"] = { speaker = "Guardian", text = "2", navButtonType = "End Dialog", choices = {}},
            ["322111"] = { speaker = "Guardian", text = "Test3", navButtonType = "None", choices = {"Test3"}},
                ["13322111"] = { speaker = "Guardian", text = "Ok", navButtonType = "None", choices = {"Test1", "Test2"}},
                    ["1413322111"] = { speaker = "Guardian", text = "Ok1", navButtonType = "End Dialog", choices = {}},
                    ["2413322111"] = { speaker = "Guardian", text = "Ok2", navButtonType = "End Dialog", choices = {}},
        ["3111"] = { speaker = "Guardian", text = "What", navButtonType = "None", choices = {"Test"}},
            ["123111"] = { speaker = "Guardian", text = "Test", navButtonType = "End Dialog", choices = {}},
        ["4111"] = { speaker = "Guardian", text = "What What", navButtonType = "None", choices = {"What1"}},
            ["124111"] = { speaker = "Guardian", text = "What1", navButtonType = "End Dialog", choices = {}}
}

 

13322111 - means:

1 - the menu selection index

3 - depth

22111 - the parent id

You can figure it out by looking at the example.

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...