Пример #1
0
 public ActorConfigEditor(string path, ActorConfig cfg = null)
 {
     _path     = path;
     _actorCfg = cfg != null ? cfg : new ActorConfig();
     if (File.Exists(path))
     {
         _actorCfg.LoadAConfig(path);
     }
     if (CfgManager.Model.ContainsKey(_actorCfg.ModelName))
     {
         _model = CfgManager.Model[_actorCfg.ModelName];
     }
     if (_actorCfg != null)
     {
         foreach (var item in _actorCfg.GeneralActions)
         {
             var action = new ModelActionEditor(this, item.Value, false);
             action.ActState = ModelActionEditor.ActionState.New;
             GeneralActions.Add(action);
         }
         foreach (var item in _actorCfg.SkillActions)
         {
             var action = new ModelActionEditor(this, item.Value, true);
             action.ActState = ModelActionEditor.ActionState.New;
             SkillActions.Add(action);
         }
     }
 }
Пример #2
0
        private string GetActorConfigJson(DeployArg arg)
        {
            var config = new ActorConfig
            {
                IsCluster        = arg.LighthouseArg.IsCluster,
                HostName         = "127.0.0.1",
                Port             = 0,
                ActorCount       = arg.WorkArg.ActorCount,
                ConcurrencyLevel = arg.WorkArg.ConcurrencyLevel,
                Seeds            = new List <SeedNode> {
                    new SeedNode {
                        HostName = "set-lighthouse-0.service-lighthouse", Port = 4053
                    }
                },
                SingleHoconFile     = "single.hocon",
                MasterHoconFile     = "master.hocon",
                WorkerHoconFile     = "worker.hocon",
                LighthouseHoconFile = "lighthouse.hocon",
                MonitorHoconFile    = "monitor.hocon"
            };

            var result = JsonSerializer.Instance.Serialize(config);

            return(result);
        }
Пример #3
0
    public BuilderBuildHoverState(IObstacleInfo targetInfo, IMapData mapData, TilePosition targetPosition, NewAI aiBehavior)
        : base(mapData, targetPosition, aiBehavior, targetInfo)
    {
        ActorConfig config = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();

        this.WalkVelocity = config.BuilderMoveVelocity;
    }
Пример #4
0
 public VillagerWalkState(IMapData mapData, TilePosition targetPosition, NewAI aiBehavior, IBuildingInfo targetInfo) :
     base(mapData, targetPosition, aiBehavior, targetInfo)
 {
     this.m_ActorConfig = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();
     this.WalkVelocity  = this.m_ActorConfig.VillagerMoveVelocity;
     this.m_Offset      = targetPosition - targetInfo.ActorPosition;
 }
Пример #5
0
    public ArmyIdleState(NewAI aiBehavior, IBuildingInfo campInfo) : base(aiBehavior)
    {
        this.m_CampInfo = campInfo;
        ActorConfig config = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();

        this.m_CurrentFrame = Random.Range(config.ArmyIdleMinFrame, config.ArmyIdleMaxFrame + 1);
        this.m_CampPosition = this.m_CampInfo.BuildingPosition;
    }
Пример #6
0
    public int CreateActor(ActorInfo info, ActorConfig config, OnFinish finish)
    {
        //int id = PlayScript.Instance.director.entityManager.CreateID();
        int id = director.entityManager.CreateID();
        Actor actor = new Actor(info, config, id, director);


        return id;
    }
Пример #7
0
 /// <summary>
 /// CameraActorConfig の CameraActor をそのまま返します。
 /// </summary>
 /// <param name="config">CameraActorConfig。</param>
 /// <returns>CameraActorConfig の CameraActor。</returns>
 protected override Actor CreateActorInstance(ActorConfig config)
 {
     var actualActorConfig = config as ActualActorConfig;
     if (actualActorConfig == null)
     {
         throw new ArgumentException("config is not ActualActorConfig.");
     }
     return actualActorConfig.Actor;
 }
Пример #8
0
    public VillagerDisappearState(NewAI aiBehavior) : base(aiBehavior)
    {
        this.m_ActorConfig = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();

        this.m_AppearBuildings = new HashSet <BuildingType>();
        foreach (BuildingType building in this.m_ActorConfig.VillagerAppearBuildingTypes)
        {
            this.m_AppearBuildings.Add(building);
        }
    }
Пример #9
0
    // Update is called once per frame
    public void Update()
    {
        float deltaTime = Time.deltaTime;

        if (remaining > 0 && spawnTimer != null && spawnTimer.Tick(deltaTime))
        {
            ActorConfig acfg = ConfigManager.Instance.FindActorConfig(this.aspecies);
            World.Instance.Spawn(this, acfg, GetSpawnPosition(), transform.forward).GetComponent <Actor>();
        }
    }
Пример #10
0
    public void Configure()
    {
        ActorConfig cfg = actor.acfg;

        this.forceAccel      = cfg.forceAccel;
        this.speedMaximum    = cfg.speedMaximum;
        this.frictionDecel   = cfg.frictionDecel;
        this.rotationAccel   = cfg.rotationAccel;
        this.rotationMaximum = 0.7f;//cfg.rotationMaximum;
    }
Пример #11
0
    public static void DefaultConfig(out RuleConfig cfg)
    {
        cfg = new RuleConfig();

        cfg.gameCfg = new GameConfig();

        cfg.levelCfgs = new LevelConfig[3];


        cfg.gameCfg.energyScale = 1f;
        cfg.gameCfg.speedScale  = 1f;


        cfg.levelCfgs[0] = new LevelConfig();
        cfg.levelCfgs[1] = new LevelConfig();
        cfg.levelCfgs[2] = new LevelConfig();

        List <ActorConfig> actorCfgList = new List <ActorConfig>();
        var speciesVals = System.Enum.GetValues(typeof(ActorSpecies));

        foreach (var species in speciesVals)
        {
            ActorConfig acfg = new ActorConfig();
            acfg.aspecies = (ActorSpecies)species;
            string speciesName = acfg.aspecies.ToString().ToLower();
            if (speciesName.StartsWith("fish"))
            {
                acfg.atype = ActorType.FISH;
            }
            else if (speciesName.StartsWith("hook"))
            {
                acfg.atype = ActorType.HOOK;
            }
            if (speciesName.StartsWith("boat"))
            {
                acfg.atype = ActorType.BOAT;
            }
            actorCfgList.Add(acfg);
        }

        ActorConfig hookCfg = actorCfgList.Find(x => x.aspecies == ActorSpecies.HookNormal);

        hookCfg.atype = ActorType.HOOK;
        hookCfg.hp    = 20;

        ActorConfig boatCfg = actorCfgList.Find(x => x.aspecies == ActorSpecies.BoatNormal);

        boatCfg.atype = ActorType.BOAT;
        boatCfg.hp    = 2000;

        cfg.actorCfgs = actorCfgList.ToArray();
    }
        /// <summary>
        /// プロトタイプのクローンを生成して返します。
        /// </summary>
        /// <param name="config">ActorConfig。</param>
        /// <returns>プロトタイプのクローン。</returns>
        protected override Actor CreateActorInstance(ActorConfig config)
        {
            var assetActorConfig = config as AssetActorConfig;

            // アセット名からプロトタイプを取得します。
            Actor prototype;
            if (!prototypes.TryGetValue(assetActorConfig.AssetName, out prototype))
            {
                // プロトタイプが存在しないならばそれを生成して登録します。
                prototype = CreatePrototypeActor(assetActorConfig);
                prototypes.Add(assetActorConfig.AssetName, prototype);
            }

            // プロトタイプのクローンを生成して返します。
            return prototype.Clone() as Actor;
        }
Пример #13
0
        /// <summary>
        /// 创建角色动作行为配置文本
        /// 每个角色只能有一套配置
        /// </summary>
        /// <returns></returns>
        private void Create()
        {
            ActorConfigEditor model = null;
            var models = CfgManager.Model.Keys;

            SimplePopupCreator.ShowDialog(new List <string>(models), (name) =>
            {
                var config = new ActorConfig()
                {
                    ModelName = name
                };
                string path = string.Format("{0}/{1}.xml", ActionHomeConfig.Instance.ActionConfigPath, name);
                model       = new ActorConfigEditor(path, config);
                model.Save();
            });
        }
Пример #14
0
    // Prepare sth.
    public void DirectorPrepare(OnFinish onfinish)
    {
        for (int i = 0; i < director.lstRD.Count; ++i)
        {
            RoleData rd = director.lstRD[i];



            ActorConfig config = new ActorConfig();
            ActorInfo info = new ActorInfo();
            director.helper.CreateActor(info, config, delegate(bool finish)
            {

            });
        }

        director.helper.CreateCamera();
    }
Пример #15
0
    public void GenerateActors()
    {
        this.m_Villagers   = new List <GameObject>();
        this.m_Builders    = new Dictionary <int, GameObject>();
        this.m_Armies      = new Dictionary <ArmyType, List <GameObject> >();
        this.m_Mercenaries = new Dictionary <MercenaryType, List <GameObject> >();

        ActorConfig config        = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();
        int         cityHallLevel = this.CityHallLevel;
        int         villagerCount = config.CityHallLimit[cityHallLevel - 1];

        this.Initialize();

        for (int i = 0; i < villagerCount; i++)
        {
            this.m_Villagers.Add(this.GenerateVillager(cityHallLevel));
        }
    }
Пример #16
0
    private GameObject GenerateArmy(ArmyType armyType, int level)
    {
        string     prefabPath = ActorPrefabConfig.Instance.GetArmyActorPrefab(armyType, level);
        GameObject armyPrefab = Resources.Load(prefabPath) as GameObject;
        GameObject army       = GameObject.Instantiate(armyPrefab) as GameObject;

        if (!this.m_Armies.ContainsKey(armyType))
        {
            this.m_Armies.Add(armyType, new List <GameObject>());
        }
        this.m_Armies[armyType].Add(army);

        ActorConfig config = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();

        ArmyAI armyAI = army.GetComponent <ArmyAI>();

        armyAI.WalkVelocity = config.ArmyMoveVelocity[armyType];
        armyAI.MapData      = this.m_MapData;
        return(army);
    }
Пример #17
0
    private GameObject GenerateMercenary(MercenaryType mercenaryType)
    {
        string     prefabPath      = ActorPrefabConfig.Instance.GetMercenaryActorPrefab(mercenaryType);
        GameObject mercenaryPrefab = Resources.Load(prefabPath) as GameObject;
        GameObject mercenary       = GameObject.Instantiate(mercenaryPrefab) as GameObject;

        if (!this.m_Mercenaries.ContainsKey(mercenaryType))
        {
            this.m_Mercenaries.Add(mercenaryType, new List <GameObject>());
        }
        this.m_Mercenaries[mercenaryType].Add(mercenary);

        ActorConfig config = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();

        ArmyAI armyAI = mercenary.GetComponent <ArmyAI>();

        armyAI.WalkVelocity = config.MercenaryMoveVelocity[mercenaryType];
        armyAI.MapData      = this.m_MapData;
        return(mercenary);
    }
Пример #18
0
    public GameObject Spawn(Spawner spawner, ActorConfig acfg, Vector3 pos, Vector3 forward)
    {
        Quaternion rot = Quaternion.LookRotation(forward, Vector3.up);
        GameObject go  = GameObject.Instantiate(spawner.actorPrefab, pos, rot) as GameObject;

        spawner.ModifyRemaining(-1);
        Actor actor = go.GetComponent <Actor>();

        actor.liveableArea = spawner.liveableArea;
        PawnController pawnController = go.GetComponent <PawnController>();

        if (pawnController != null)
        {
            pawnController.binding = spawner.Binding;
        }
        activeActors.Add(actor);
        actor.acfg = acfg;
        ActorEvent ae = new ActorEvent(actor, null, ActorEventType.SPAWNED);

        Rules.ProcessEvent(ref ae);
        return(go);
    }
Пример #19
0
    public override void Initial()
    {
        ActorConfig config = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();

        this.m_CurrentFrame = config.BuildAnimationFrame;

        if (SceneManager.Instance != null)
        {
            GameObject go = SceneManager.Instance.GetBuildingObjectFromBuildingObstacleMap(this.m_TargetInfo.BuildingPosition.Row,
                                                                                           this.m_TargetInfo.BuildingPosition.Column);
            if (go != null)
            {
                Transform anchorPosition = go.transform.FindChild(ClientStringConstants.BUILDING_ANCHOR_OBJECT_NAME);
                if (anchorPosition != null)
                {
                    this.m_AnimationController.PlayBuildAnimation(anchorPosition.position);
                }
                else
                {
                    this.m_AnimationController.PlayBuildAnimation(PositionConvertor.GetWorldPositionFromActorTileIndex(this.m_TargetInfo.ActorPosition));
                }
            }
        }
        else
        {
            BuildingBasePropertyBehavior property = this.m_TargetInfo as BuildingBasePropertyBehavior;
            if (property != null)
            {
                this.m_AnimationController.PlayBuildAnimation(property.AnchorTransform.position);
            }
            else
            {
                this.m_AnimationController.PlayBuildAnimation(PositionConvertor.GetWorldPositionFromActorTileIndex(this.m_TargetInfo.ActorPosition));
            }
        }
    }
Пример #20
0
 public static ActorSetup CreateActorSetup(this ActorConfig actorConfig) =>
 ActorSystemSetupAnalyzer.CreateActorSetup(actorConfig);
Пример #21
0
    void OnGUI()
    {
        RuleConfigCategory nextCategory = (RuleConfigCategory)EditorGUILayout.EnumPopup("Cfg Category:", category);

        if (GUILayout.Button("Refresh " + category))
        {
            string configFilePath = ConfigUtils.GetFilePath(category);
            ConfigUtils.LoadConfig(configFilePath, out workingConfig);
            lastLoaded = category.ToString();
        }
        Boss boss = Boss.Instance;

        if (boss != null)
        {
            if (GUILayout.Button("Game Apply " + category))
            {
                boss.ReloadConfig();
            }
        }
        if (nextCategory != category)
        {
            category = nextCategory;
            string configFilePath = ConfigUtils.GetFilePath(category);
            ConfigUtils.LoadConfig(configFilePath, out workingConfig);
            lastLoaded = category.ToString();
        }
        if (resetConfirm)
        {
            if (GUILayout.Button("Yes Reset " + category))
            {
                ConfigUtils.DefaultConfig(out workingConfig);
                string configFilePath = Application.streamingAssetsPath + "/Config" + category.ToString() + ".bytes";
                ConfigUtils.SaveConfig(configFilePath, workingConfig);
                lastLoaded   = category.ToString();
                resetConfirm = false;
            }
            if (GUILayout.Button("No dont " + category))
            {
                resetConfirm = false;
            }
        }
        else
        {
            if (GUILayout.Button("Reset " + category))
            {
                resetConfirm = true;
            }
        }
        if (workingConfig != null)
        {
            if (actorFoldOut == null || actorFoldOut.Length != workingConfig.actorCfgs.Length)
            {
                actorFoldOut = new bool[workingConfig.actorCfgs.Length];
            }
            if (GUILayout.Button("Save " + category))
            {
                string configFilePath = Application.streamingAssetsPath + "/Config" + category.ToString() + ".bytes";
                ConfigUtils.SaveConfig(configFilePath, workingConfig);
                lastLoaded = category.ToString();
            }

            for (int i = 0; i < workingConfig.actorCfgs.Length; ++i)
            {
                ActorConfig cfg = workingConfig.actorCfgs[i];
                actorFoldOut[i] = EditorGUILayout.Foldout(actorFoldOut[i], "Actor " + cfg.aspecies);
                if (actorFoldOut[i])
                {
                    //cfg.name = EditorGUILayout.TextField("Actor:",cfg.name);
                    cfg.atype = (ActorType)EditorGUILayout.EnumPopup("AType:", cfg.atype);
                    //cfg.aspecies = (ActorSpecies)EditorGUILayout.EnumPopup("ActorSpecies:", cfg.aspecies);
                    cfg.scale           = EditorGUILayout.Slider("Scale:", cfg.scale, 0.01f, 6f);
                    cfg.hp              = EditorGUILayout.IntField("HP:", cfg.hp);
                    cfg.minSize         = EditorGUILayout.IntField("MinSize:", cfg.minSize);
                    cfg.maxSize         = EditorGUILayout.IntField("MaxSize:", cfg.maxSize);
                    cfg.protein         = EditorGUILayout.IntField("Protein:", cfg.protein);
                    cfg.stomachCapacity = EditorGUILayout.IntField("StomachCapacity", cfg.stomachCapacity);
                    cfg.stomachPeriod   = EditorGUILayout.FloatField("StomachPeriod", cfg.stomachPeriod);
                    cfg.forceAccel      = EditorGUILayout.FloatField("ForceAccel", cfg.forceAccel);
                    cfg.frictionDecel   = EditorGUILayout.FloatField("FrictionDecel", cfg.frictionDecel);
                    cfg.rotationAccel   = EditorGUILayout.FloatField("RotationAccel", cfg.rotationAccel);
                    cfg.speedMaximum    = EditorGUILayout.FloatField("SpeedMaximum", cfg.speedMaximum);
                }
            }
        }
        else
        {
        }
    }
Пример #22
0
 public VillagerIdleState(NewAI aiBehavior, IBuildingInfo targetInfo, bool isTargetHover) : base(aiBehavior)
 {
     this.m_TargetInfo    = targetInfo;
     this.m_ActorConfig   = ActorPrefabConfig.Instance.GetComponent <ActorConfig>();
     this.m_IsTargetHover = isTargetHover;
 }
Пример #23
0
 public ActorService(ActorConfig config, IServerContainer serverContainer)
     : base(config)
 {
     ServerContainer = serverContainer;
 }
Пример #24
0
        /// <summary>
        /// Load the Actor Configuration into the Integration Profile.
        /// </summary>
        /// <param name="configurationFilename">Configuration Filename</param>
        public void Load(System.String configurationFilename)
        {
            _actorConfigCollection      = new ActorConfigCollection();
            _peerToPeerConfigCollection = new BasePeerToPeerConfigCollection();

            try
            {
                XmlTextReader reader = new XmlTextReader(configurationFilename);
                while (reader.EOF == false)
                {
                    reader.ReadStartElement("IheIntegrationProfile");
                    _profileName = reader.ReadElementString("IntegrationProfileName");
                    _commonConfig.RootedBaseDirectory = reader.ReadElementString("RootedBaseDirectory");
                    _commonConfig.ResultsDirectory    = reader.ReadElementString("ResultsDirectory");

                    // read OverwriteResults - added later - some config files may not contain this parameter
                    reader.ReadString();
                    if (reader.Name == "OverwriteResults")
                    {
                        System.String overwriteResults = reader.ReadElementString("OverwriteResults");
                        if (overwriteResults == "True")
                        {
                            _commonConfig.OverwriteResults = true;
                        }
                        else
                        {
                            _commonConfig.OverwriteResults = false;
                        }
                    }

                    _commonConfig.CredentialsFilename          = reader.ReadElementString("CredentialsFilename");
                    _commonConfig.CertificateFilename          = reader.ReadElementString("CertificateFilename");
                    _commonConfig.NistWebServiceUrl            = reader.ReadElementString("NistWebServiceUrl");
                    _commonConfig.Hl7ProfileDirectory          = reader.ReadElementString("Hl7ProfileDirectory");
                    _commonConfig.Hl7ProfileStoreName          = reader.ReadElementString("Hl7ProfileStoreName");
                    _commonConfig.Hl7ValidationContextFilename = reader.ReadElementString("Hl7ValidationContextFilename");
                    System.String interactive = reader.ReadElementString("Interactive");
                    if (interactive == "True")
                    {
                        _commonConfig.Interactive = true;
                    }
                    else
                    {
                        _commonConfig.Interactive = false;
                    }

                    while ((reader.IsStartElement()) &&
                           (reader.Name == "ActorConfiguration"))
                    {
                        reader.ReadStartElement("ActorConfiguration");
                        reader.ReadStartElement("ActorName");
                        ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                        System.String id        = reader.ReadElementString("ActorId");
                        ActorName     actorName = new ActorName(actorType, id);
                        reader.ReadEndElement();
                        ActorConfigStateEnum configState = ActorConfigState.ConfigStateEnum(reader.ReadElementString("ConfigState"));
                        ActorConfig          actorConfig = new ActorConfig(actorName, configState);
                        _actorConfigCollection.Add(actorConfig);
                        reader.ReadEndElement();
                    }

                    while ((reader.IsStartElement()) &&
                           ((reader.Name == "DicomPeerToPeerConfiguration") ||
                            (reader.Name == "Hl7PeerToPeerConfiguration")))
                    {
                        if (reader.Name == "DicomPeerToPeerConfiguration")
                        {
                            DicomPeerToPeerConfig dicomPeerToPeerConfig = new DicomPeerToPeerConfig();

                            reader.ReadStartElement("DicomPeerToPeerConfiguration");
                            reader.ReadStartElement("FromActor");
                            reader.ReadStartElement("ActorName");
                            ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            System.String id        = reader.ReadElementString("ActorId");
                            ActorName     actorName = new ActorName(actorType, id);
                            dicomPeerToPeerConfig.FromActorName = actorName;
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.FromActorAeTitle = reader.ReadElementString("AeTitle");
                            reader.ReadEndElement();
                            reader.ReadStartElement("ToActor");
                            reader.ReadStartElement("ActorName");
                            actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            id        = reader.ReadElementString("ActorId");
                            actorName = new ActorName(actorType, id);
                            dicomPeerToPeerConfig.ToActorName = actorName;
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.ToActorAeTitle   = reader.ReadElementString("AeTitle");
                            dicomPeerToPeerConfig.ToActorIpAddress = reader.ReadElementString("IpAddress");
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.PortNumber = UInt16.Parse(reader.ReadElementString("PortNumber"));
                            System.String secureConnection = reader.ReadElementString("SecureConnection");
                            if (secureConnection == "True")
                            {
                                dicomPeerToPeerConfig.SecureConnection = true;
                            }
                            else
                            {
                                dicomPeerToPeerConfig.SecureConnection = false;
                            }

                            // read AutoValidate - added later - some config files may not contain this parameter
                            reader.ReadString();
                            if (reader.Name == "AutoValidate")
                            {
                                System.String autoValidate = reader.ReadElementString("AutoValidate");
                                if (autoValidate == "True")
                                {
                                    dicomPeerToPeerConfig.AutoValidate = true;
                                }
                                else
                                {
                                    dicomPeerToPeerConfig.AutoValidate = false;
                                }
                            }

                            dicomPeerToPeerConfig.ActorOption1        = reader.ReadElementString("ActorOption1");
                            dicomPeerToPeerConfig.ActorOption2        = reader.ReadElementString("ActorOption2");
                            dicomPeerToPeerConfig.ActorOption3        = reader.ReadElementString("ActorOption3");
                            dicomPeerToPeerConfig.SessionId           = UInt16.Parse(reader.ReadElementString("SessionId"));
                            dicomPeerToPeerConfig.SourceDataDirectory = reader.ReadElementString("SourceDataDirectory");
                            dicomPeerToPeerConfig.StoreDataDirectory  = reader.ReadElementString("StoreDataDirectory");
                            System.String storeData = reader.ReadElementString("StoreData");
                            if (storeData == "True")
                            {
                                dicomPeerToPeerConfig.StoreData = true;
                            }
                            else
                            {
                                dicomPeerToPeerConfig.StoreData = false;
                            }

                            reader.ReadStartElement("DefinitionFiles");

                            bool readingDefinitionFiles = true;
                            while (readingDefinitionFiles == true)
                            {
                                dicomPeerToPeerConfig.AddDefinitionFile(reader.ReadElementString("DefinitionFile"));
                                reader.Read();
                                if ((reader.NodeType == XmlNodeType.EndElement) &&
                                    (reader.Name == "DefinitionFiles"))
                                {
                                    reader.Read();
                                    readingDefinitionFiles = false;
                                }
                            }

                            _peerToPeerConfigCollection.Add(dicomPeerToPeerConfig);

                            reader.ReadEndElement();
                        }
                        else
                        {
                            Hl7PeerToPeerConfig hl7PeerToPeerConfig = new Hl7PeerToPeerConfig();

                            reader.ReadStartElement("Hl7PeerToPeerConfiguration");
                            reader.ReadStartElement("FromActor");
                            reader.ReadStartElement("ActorName");
                            ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            System.String id        = reader.ReadElementString("ActorId");
                            ActorName     actorName = new ActorName(actorType, id);
                            hl7PeerToPeerConfig.FromActorName = actorName;
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.FromActorAeTitle = reader.ReadElementString("AeTitle");
                            reader.ReadEndElement();
                            reader.ReadStartElement("ToActor");
                            reader.ReadStartElement("ActorName");
                            actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            id        = reader.ReadElementString("ActorId");
                            actorName = new ActorName(actorType, id);
                            hl7PeerToPeerConfig.ToActorName = actorName;
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.ToActorAeTitle   = reader.ReadElementString("AeTitle");
                            hl7PeerToPeerConfig.ToActorIpAddress = reader.ReadElementString("IpAddress");
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.PortNumber = UInt16.Parse(reader.ReadElementString("PortNumber"));
                            hl7PeerToPeerConfig.MessageDelimiters.FromString(reader.ReadElementString("MessageDelimiters"));
                            System.String secureConnection = reader.ReadElementString("SecureConnection");
                            if (secureConnection == "True")
                            {
                                hl7PeerToPeerConfig.SecureConnection = true;
                            }
                            else
                            {
                                hl7PeerToPeerConfig.SecureConnection = false;
                            }

                            // read AutoValidate - added later - some config files may not contain this parameter
                            reader.ReadString();
                            if (reader.Name == "AutoValidate")
                            {
                                System.String autoValidate = reader.ReadElementString("AutoValidate");
                                if (autoValidate == "True")
                                {
                                    hl7PeerToPeerConfig.AutoValidate = true;
                                }
                                else
                                {
                                    hl7PeerToPeerConfig.AutoValidate = false;
                                }
                            }

                            hl7PeerToPeerConfig.ActorOption1 = reader.ReadElementString("ActorOption1");
                            hl7PeerToPeerConfig.ActorOption2 = reader.ReadElementString("ActorOption2");
                            hl7PeerToPeerConfig.ActorOption3 = reader.ReadElementString("ActorOption3");
                            hl7PeerToPeerConfig.SessionId    = UInt16.Parse(reader.ReadElementString("SessionId"));

                            _peerToPeerConfigCollection.Add(hl7PeerToPeerConfig);

                            reader.ReadEndElement();
                        }
                    }

                    reader.ReadEndElement();
                }

                reader.Close();
            }
            catch (System.Exception e)
            {
                System.String message = System.String.Format("Failed to read configuration file: \"{0}\". Error: \"{1}\"", configurationFilename, e.Message);
                throw new System.SystemException(message, e);
            }
        }
Пример #25
0
 /// <summary>
 /// ContentManager から TerrainActor をロードして返します。
 /// </summary>
 /// <param name="config">AssetActorConfig。</param>
 /// <returns>ContentManager からロードされた TerrainActor。</returns>
 protected override Actor CreateActorInstance(ActorConfig config)
 {
     var assetActorConfig = config as AssetActorConfig;
     return ActorFactoryContext.Content.Load<TerrainActor>(assetActorConfig.AssetName);
 }
Пример #26
0
 public TestActorService(ActorConfig config, IDistrictContainer serverContainer) : base(serverContainer)
 {
 }
Пример #27
0
        public void LoadAll()
        {
            ClearAll();

            _config = ActionHomeConfig.Instance;
            CfgManager.ConfigDir = ConfigDir;
            CfgManager.LoadAll();

            //--初始化资源路径
            EUtil.GetAssetsInSubFolderRecursively(_config.CharacterRelativeDir, "*.prefab", ref AllCharacters);
            EUtil.GetAssetsInSubFolderRecursively(_config.AvatarRelativeDir, "*.prefab", ref AllAvatars);
            EUtil.GetAssetsInSubFolderRecursively(_config.EffectRelativeDir, "*.prefab", ref AllEffects);
            foreach (var item in AllCharacters)
            {
                string searchDir = item.Value.Substring(0, item.Value.LastIndexOf(@"/prefab")) + "/clips";
                var    selfClips = new Dictionary <string, string>();
                EUtil.GetAssetsInSubFolderRecursively(searchDir, "*.anim", ref selfClips);
                AllCharacterClips[item.Key] = selfClips;
            }

            //--初始化资源
            SequenceRoot     = ActorHelper.CreateGameObject("---行为序列---");
            RuntimeAssetRoot = ActorHelper.CreateGameObject("---运行时资源---");

            CharacterDir = ActorHelper.CreateGameObject("Characters", "/---运行时资源---/");
            EffectDir    = ActorHelper.CreateGameObject("Effects", "/---运行时资源---/");
            OtherDir     = ActorHelper.CreateGameObject("Others", "/---运行时资源---/");

            //--加载行为配置
            foreach (var model in CfgManager.Model)
            {
                var    modelName = model.Key;
                string path      = string.Format("{0}/{1}.xml", ActionConfigPath, modelName);
                if (!File.Exists(path))
                {
                    var config = new ActorConfig()
                    {
                        ModelName = modelName
                    };
                    string savePath = string.Format("{0}/{1}.xml", ActionHomeConfig.Instance.ActionConfigPath, modelName);
                    var    actor    = new ActorConfigEditor(savePath, config);
                    actor.Save(true);
                    Debug.LogFormat("<color=orange>新建Actor - {0}</color>", modelName);
                }
            }

            string[] files = Directory.GetFiles(ActionConfigPath, "*.xml", SearchOption.TopDirectoryOnly);
            foreach (var path in files)
            {
                var actor = new ActorConfigEditor(path);
                AddActor(actor);
            }
            foreach (var item in _modelDict)
            {
                item.Value.InitBaseModelAction();
            }

            var window = ActorCfgWindow.GetWindow <ActorCfgWindow>();

            window.RefreshTree();
            IsInit = true;
            Debug.Log("加载所有动作 完毕!");
        }
Пример #28
0
 public BackendNetService(IActorService actorService, ActorConfig config)
 {
     this._actorService            = actorService;
     _actorService.ActorNetService = this;
     this.config = config;
 }
Пример #29
0
 public ActorNetService(IActorService actorService, ActorConfig config)
 {
     this._actorService = actorService;
     this.config        = config;
 }