#Tracking current player custom menu and its sub menus opened

1 messages · Page 1 of 1 (latest)

lyric cipher
#

Im wondering to get recommendations about tracking the player current custom menu and also the sub menus opened by him. Sp then i can go back, to sub menu by sub menu

#

Tracking current player custom menu and its sub menus opened

steady cedar
#

Well like i said if only the menu the current one is opened from is important, just keep a reference to the menu opened before. the code snipped should work if you adjust it

lyric cipher
#

Right

#

So far i written the current code

steady cedar
#

yea and you append/pop to the LinkedList the menus youre opening

#

actually

#

if youre using a list you can just look at the last and second to last menu

#

since youre not doing any operations in the middle of the list

#

you can use stack actually

lyric cipher
#

right, i just need to be able to be go from a sub menu, them if it has a child, be able to go the child

steady cedar
#
Stack<Menu> menus = new Stack()<>;
openMenu(Menu newMenu){
  current.close();
  menus.put(current);
  current = newMenu;
  current.open();
}
closeMenu(){
  current.close();
  current = menus.pop();
  current.open();
}
lyric cipher
#

ohh right

#

really thanks

#

I will try adapt it to what i need

#

I woudl be really great full if you dont left the thread, in case i have any other questions