Exemplo n.º 1
0
 public AreaZonePlayer(AreaService svc, AreaZoneNode node, RoleEnterZoneRequest enter)
 {
     Alloc.RecordConstructor(this.GetType());
     this.log                = LoggerFactory.GetLogger(GetType().Name);
     this.service            = svc;
     this.node               = node;
     this.enter              = enter;
     this.client_event_route = TypeCodec.GetAttributeRoute(typeof(ClientBattleEvent));
 }
Exemplo n.º 2
0
        public async Task <CreateZoneNodeResponse> area_manager_rpc_CreateZone(CreateZoneNodeRequest create)
        {
            try
            {
                var maptemp = RPGServerTemplateManager.Instance.GetMapTemplate(create.mapTemplateID);
                if (maptemp == null)
                {
                    throw new Exception("No MapTemplate : " + create.mapTemplateID);
                }
                var zoneUUID = create.managerZoneUUID;
                if (zoneNodes.ContainsKey(zoneUUID))
                {
                    throw new Exception(string.Format("node instance id ({0}) already exist!", zoneUUID));
                }
                AreaZoneNode node = this.CreateZoneNode(create, maptemp);
                zoneNodes.TryAdd(zoneUUID, node);
                var z = await node.DoStartAsync();

                // log.InfoFormat("Scene Started : {0} : {1}", z.UUID, z.Data);
                return(new CreateZoneNodeResponse()
                {
                    areaName = SelfAddress.ServiceName,
                    areaNode = SelfAddress.ServiceNode,
                    zoneUUID = zoneUUID,
                    TemplateID = maptemp.zone_template_id,
                });
            }
            catch (Exception e)
            {
                log.Error("CreateZone failed, error: " + e.Message, e);
                return(new CreateZoneNodeResponse()
                {
                    s2c_code = CreateZoneNodeResponse.CODE_ERROR,
                    s2c_msg = e.Message,
                });
            }
        }
Exemplo n.º 3
0
 //-----------------------------------------------------------------------------------------------------------------------------
 #region __CreateObject__
 //--------------------------------------------------------------------------------------------------------------------------------
 protected virtual AreaZonePlayer CreateZonePlayer(AreaZoneNode node, RoleEnterZoneRequest enter)
 {
     return(new AreaZonePlayer(this, node, enter));
 }