GameFramework.ServerStorySystem.NewStoryInstance C# (CSharp) Method

NewStoryInstance() private method

private NewStoryInstance ( string storyId, string _namespace, bool logIfNotFound ) : StoryInstance
storyId string
_namespace string
logIfNotFound bool
return StorySystem.StoryInstance
        private StoryInstance NewStoryInstance(string storyId, string _namespace, bool logIfNotFound, params string[] overloadFiles)
        {
            if (!string.IsNullOrEmpty(_namespace)) {
                storyId = string.Format("{0}:{1}", _namespace, storyId);
            }
            StoryInstance instance = GetStoryInstance(storyId);
            if (null == instance) {
                string[] filePath;
                if (overloadFiles.Length <= 0) {
                    TableConfig.UserScript cfg = TableConfig.UserScriptProvider.Instance.GetUserScript(storyId);
                    if (null != cfg) {
                        filePath = new string[1];
                        filePath[0] = HomePath.GetAbsolutePath(FilePathDefine_Server.C_DslPath + cfg.DslFile);
                    } else {
                        if (logIfNotFound)
                            LogSystem.Error("Can't find story config, story:{0} !", storyId);
                        return null;
                    }
                } else {
                    int ct = overloadFiles.Length;
                    filePath = new string[ct];
                    for (int i = 0; i < ct; i++) {
                        filePath[i] = HomePath.GetAbsolutePath(FilePathDefine_Server.C_DslPath + overloadFiles[i]);
                    }
                }
                StoryConfigManager.Instance.LoadStories(0, _namespace, filePath);
                instance = StoryConfigManager.Instance.NewStoryInstance(storyId, 0);
                if (instance == null) {
                    if (logIfNotFound)
                        LogSystem.Error("Can't load story config, story:{0} !", storyId);
                    return null;
                }
                for (int ix = 0; ix < filePath.Length; ++ix) {
                    Dictionary<string, StoryInstance> stories = StoryConfigManager.Instance.GetStories(filePath[ix]);
                    if (null != stories) {
                        foreach (KeyValuePair<string, StoryInstance> pair in stories) {
                            if (pair.Key != storyId)
                                AddStoryInstance(pair.Key, pair.Value.Clone());
                        }
                    }
                }
                AddStoryInstance(storyId, instance);
                return instance;
            } else {
                return instance;
            }
        }