-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
306 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#if defined _em_menu_included | ||
#endinput | ||
#endif | ||
#define _em_menu_included | ||
|
||
#define MENU_TEXT_MAX_SIZE (32 * 4) | ||
|
||
#define ENTITY_MANAGEMENT "Entity management" | ||
|
||
#define ITEM_ENTITY_FREEZE "Freeze entity" | ||
#define ITEM_ENTITY_UNFREEZE "Unfreeze entity" | ||
#define ITEM_ENTITY_DELETE "Delete entity" | ||
#define ITEM_ENTITY_RESTORE "Restore entity" | ||
#define ITEM_ENTITIES_SAVE "Save entities" | ||
#define ITEM_ENTITIES_LOAD "Load entities" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
void Menu_EntityManager(int client) { | ||
Menu menu = new Menu(MenuHandler_EntityManager); | ||
|
||
menu.SetTitle("%T", ENTITY_MANAGEMENT, client); | ||
|
||
Menu_AddItem(menu, ITEM_ENTITY_FREEZE, client); | ||
Menu_AddItem(menu, ITEM_ENTITY_UNFREEZE, client); | ||
Menu_AddItem(menu, ITEM_ENTITY_DELETE, client); | ||
Menu_AddItem(menu, ITEM_ENTITY_RESTORE, client); | ||
Menu_AddItem(menu, ITEM_ENTITIES_SAVE, client); | ||
Menu_AddItem(menu, ITEM_ENTITIES_LOAD, client); | ||
|
||
menu.Display(client, MENU_TIME_FOREVER); | ||
} | ||
|
||
public int MenuHandler_EntityManager(Menu menu, MenuAction action, int param1, int param2) { | ||
if (action == MenuAction_Select) { | ||
char info[MENU_TEXT_MAX_SIZE]; | ||
int entity; | ||
|
||
menu.GetItem(param2, info, sizeof(info)); | ||
|
||
if (strcmp(info, ITEM_ENTITY_FREEZE) == 0) { | ||
UseCase_FreezeEntity(param1, entity); | ||
} else if (strcmp(info, ITEM_ENTITY_UNFREEZE) == 0) { | ||
UseCase_UnfreezeEntity(param1, entity); | ||
} else if (strcmp(info, ITEM_ENTITY_DELETE) == 0) { | ||
UseCase_DeleteEntity(param1, entity); | ||
} else if (strcmp(info, ITEM_ENTITY_RESTORE) == 0) { | ||
UseCase_RestoreEntity(param1, entity); | ||
} else if (strcmp(info, ITEM_ENTITIES_SAVE) == 0) { | ||
UseCase_SaveEntities(param1); | ||
} else if (strcmp(info, ITEM_ENTITIES_LOAD) == 0) { | ||
UseCase_LoadEntities(param1); | ||
} | ||
|
||
Menu_EntityManager(param1); | ||
} else if (action == MenuAction_End) { | ||
delete menu; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
void Menu_AddItem(Menu menu, char[] phrase, int client) { | ||
char item[MENU_TEXT_MAX_SIZE]; | ||
|
||
Format(item, sizeof(item), "%T", phrase, client); | ||
|
||
menu.AddItem(phrase, item); | ||
} |
Oops, something went wrong.