You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
875 B
29 lines
875 B
using System; |
|
|
|
namespace ET |
|
{ |
|
public class C2M_GetMenuHandler: AMActorLocationRpcHandler<Unit, C2M_GetMenu, M2C_GetMenu> |
|
{ |
|
protected override async ETTask Run(Unit unit, C2M_GetMenu request, M2C_GetMenu response, Action reply) |
|
{ |
|
try |
|
{ |
|
var menuComponent = unit.GetOrAddComponent<MenuComponent>(); |
|
foreach (var v in menuComponent.Children.Values) |
|
{ |
|
response.MenuList.Add(((Menu)v).ToMessage()); |
|
} |
|
response.Error = ErrorCode.ERR_Success; |
|
reply(); |
|
} |
|
catch (Exception e) |
|
{ |
|
response.Message = e.ToString(); |
|
response.Error = ErrorCode.ERR_MenuError; |
|
reply(); |
|
} |
|
|
|
await ETTask.CompletedTask; |
|
} |
|
} |
|
} |