Ejemplo n.º 1
0
 public AreaZoneNode(AreaService svc, CreateZoneNodeRequest create, MapTemplateData map_temp)
 {
     Alloc.RecordConstructor(GetType().ToVisibleName() + ":" + map_temp.id);
     this.log      = LoggerFactory.GetLogger(string.Format("{0}-{1}", GetType().Name, create.managerZoneUUID));
     this.service  = svc;
     this.create   = create;
     this.map_temp = map_temp;
     this.uuid     = create.managerZoneUUID;
     this.node     = CreateZoneNode(create);
 }
Ejemplo 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,
                });
            }
        }
Ejemplo n.º 3
0
 protected virtual AreaZoneNode CreateZoneNode(CreateZoneNodeRequest create, MapTemplateData map)
 {
     return(new AreaZoneNode(this, create, map));
 }
Ejemplo n.º 4
0
 protected virtual ZoneNode CreateZoneNode(CreateZoneNodeRequest input)
 {
     return(RPGServerBattleManager.ZoneFactory.CreateServerZoneNode(this, RPGServerBattleManager.DataRoot, RPGServerBattleManager.NodeConfig));
 }
Ejemplo n.º 5
0
 protected virtual SceneData LoadSceneData(CreateZoneNodeRequest input)
 {
     return(RPGServerBattleManager.Instance.GetSceneAsCache(this.ZoneTemplateID));
 }