本文整理汇总了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;
}
}
}
}
}