Пример #1
0
        //获得实体配置
        private string GetEntityCnf(int entityConfId)
        {
            if (entityCnf.ContainsKey(entityConfId))
            {
                return(entityCnf[entityConfId]);
            }
            string jsonStr = LoadHelper.LoadString(ECSDefPath.GetEntityCnfName(entityConfId));

            entityCnf.Add(entityConfId, jsonStr);
            return(jsonStr);
        }
Пример #2
0
        /// <summary>
        /// 加载行为树
        /// </summary>
        /// <returns></returns>
        private BehaviorTree LoadBehavior(RequestId treeId)
        {
            string       jsonStr  = LCLoad.LoadHelper.LoadString(ECSDefPath.GetBevTreeCnfName(treeId));
            BehaviorTree behavior = JsonMapper.ToObject <BehaviorTree>(jsonStr);

            if (behavior == null)
            {
                return(null);
            }
            return(behavior);
        }
Пример #3
0
        public override void ExportGraph(List <InternalBaseGraphAsset> assets)
        {
            for (int i = 0; i < assets.Count; i++)
            {
                DecisionAsset decisionAsset = assets[i] as DecisionAsset;
                BaseGraph     graphData     = decisionAsset.DeserializeGraph();

                //运行时数据结构
                DecisionTree model = new DecisionTree(decisionAsset.TreeId, SerializeHelp.SerializeToTree(graphData));

                string filePath = ECSDefPath.GetDecTreePath(decisionAsset.TreeId);
                IOHelper.WriteText(JsonMapper.ToJson(model), filePath);
                Debug.Log($"决策树生成成功>>>>{filePath}");
            }
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Пример #4
0
        public override void ExportGraph(List <InternalBaseGraphAsset> assets)
        {
            for (int i = 0; i < assets.Count; i++)
            {
                EntityGraphAsset entityAsset = assets[i] as EntityGraphAsset;
                BaseGraph        graphData   = entityAsset.DeserializeGraph();

                //运行时数据结构
                Entity model = SerializeToEntityModel(graphData, entityAsset);

                string filePath = ECSDefPath.GetEntityPath(entityAsset.entityId);
                IOHelper.WriteText(JsonMapper.ToJson(model), filePath);
                Debug.Log($"实体配置生成成功>>>>{filePath}");
            }
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Пример #5
0
        public override void ExportGraph(List <InternalBaseGraphAsset> assets)
        {
            for (int i = 0; i < assets.Count; i++)
            {
                BehaviorAsset behaviorAsset = assets[i] as BehaviorAsset;
                BaseGraph     graphData     = behaviorAsset.DeserializeGraph();

                //运行时数据结构
                BehaviorTree model = new BehaviorTree(behaviorAsset.ReqId, SerializeHelp.SerializeToTree(graphData));

                string filePath = ECSDefPath.GetBevTreePath(behaviorAsset.ReqId);
                IOHelper.WriteText(JsonMapper.ToJson(model), filePath);
                Debug.Log($"行为树生成成功>>>>{filePath}");
            }

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }