当前位置: 首页>>代码示例>>C#>>正文


C# StoryInstance.Init方法代码示例

本文整理汇总了C#中StorySystem.StoryInstance.Init方法的典型用法代码示例。如果您正苦于以下问题:C# StoryInstance.Init方法的具体用法?C# StoryInstance.Init怎么用?C# StoryInstance.Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StorySystem.StoryInstance的用法示例。


在下文中一共展示了StoryInstance.Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

 private void Load(Dsl.DslFile dataFile, int sceneId, string _namespace, string resourceName)
 {
     lock (m_Lock) {
         Dictionary<string, StoryInstance> existStoryInstances;
         if (!m_StoryInstancePool.TryGetValue(resourceName, out existStoryInstances)) {
             existStoryInstances = new Dictionary<string, StoryInstance>();
             m_StoryInstancePool.Add(resourceName, existStoryInstances);
             for (int i = 0; i < dataFile.DslInfos.Count; i++) {
                 Dsl.DslInfo dslInfo = dataFile.DslInfos[i];
                 string id = dslInfo.GetId();
                 if (id == "story" || id == "script") {
                     Dsl.FunctionData funcData = dslInfo.First;
                     if (null != funcData) {
                         Dsl.CallData callData = funcData.Call;
                         if (null != callData && callData.HaveParam()) {
                             StoryInstance instance = new StoryInstance();
                             if (!string.IsNullOrEmpty(_namespace)) {
                                 instance.Namespace = _namespace;
                             }
                             instance.Init(dslInfo);
                             string storyId;
                             if (string.IsNullOrEmpty(_namespace)) {
                                 storyId = instance.StoryId;
                             } else {
                                 storyId = string.Format("{0}:{1}", _namespace, instance.StoryId);
                                 instance.StoryId = storyId;
                             }
                             if (!existStoryInstances.ContainsKey(storyId)) {
                                 existStoryInstances.Add(storyId, instance);
                             } else {
                                 existStoryInstances[storyId] = instance;
                             }
                             LogSystem.Info("ParseStory {0} {1}", storyId, sceneId);
                         }
                     }
                 } else if (id == "command" || id == "value") {
                     CustomCommandValueParser.FirstParse(dslInfo);
                     CustomCommandValueParser.FinalParse(dslInfo);
                 } else {
                     LogSystem.Error("Unknown story keyword '{0}'", id);
                 }
             }
         }
         Dictionary<string, StoryInstance> storyInstances;
         if (!m_StoryInstances.TryGetValue(sceneId, out storyInstances)) {
             storyInstances = new Dictionary<string, StoryInstance>(existStoryInstances);
             m_StoryInstances.Add(sceneId, storyInstances);
         } else {
             foreach (var pair in existStoryInstances) {
                 if (!storyInstances.ContainsKey(pair.Key)) {
                     storyInstances.Add(pair.Key, pair.Value);
                 } else {
                     storyInstances[pair.Key] = pair.Value;
                 }
             }
         }
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:58,代码来源:StoryConfigManager.cs


注:本文中的StorySystem.StoryInstance.Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。