using System; using Model; namespace Hotfix { [MessageHandler(AppType.Map)] public class G2M_CreateUnitHandler : AMRpcHandler { protected override void Run(Session session, G2M_CreateUnit message, Action reply) { M2G_CreateUnit response = new M2G_CreateUnit(); try { Unit unit = EntityFactory.Create(UnitType.Hero); unit.AddComponent(new CommonEntityActorHandler()); unit.AddComponent(message.GateSessionId); Game.Scene.GetComponent().Add(unit); response.UnitId = unit.Id; reply(response); } catch (Exception e) { ReplyError(response, e, reply); } } } }