當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。