static public int get_id(IntPtr l)
 {
     try {
         TableConfig.UserScript self = (TableConfig.UserScript)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.id);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         TableConfig.UserScript o;
         o = new TableConfig.UserScript();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int GetId(IntPtr l)
 {
     try {
         TableConfig.UserScript self = (TableConfig.UserScript)checkSelf(l);
         var ret = self.GetId();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_id(IntPtr l)
 {
     try {
         TableConfig.UserScript self = (TableConfig.UserScript)checkSelf(l);
         System.String          v;
         checkType(l, 2, out v);
         self.id = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int WriteToBinary(IntPtr l)
 {
     try {
         TableConfig.UserScript    self = (TableConfig.UserScript)checkSelf(l);
         GameFramework.BinaryTable a1;
         checkType(l, 2, out a1);
         self.WriteToBinary(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int ReadFromBinary(IntPtr l)
 {
     try {
         TableConfig.UserScript    self = (TableConfig.UserScript)checkSelf(l);
         GameFramework.BinaryTable a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         var ret = self.ReadFromBinary(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 7
0
        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);
            }
        }