#Tracking current player custom menu and its sub menus opened
1 messages · Page 1 of 1 (latest)
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
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
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
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();
}