Beispiel #1
0
        public static Dsl.DslFile LoadStory(string file)
        {
            if (!string.IsNullOrEmpty(file))
            {
                Dsl.DslFile dataFile = new Dsl.DslFile();
#if DEBUG
                try {
                    if (dataFile.Load(file, LogSystem.Log))
                    {
                        return(dataFile);
                    }
                    else
                    {
                        LogSystem.Error("LoadStory file:{0} failed", file);
                    }
                } catch (Exception ex) {
                    LogSystem.Error("LoadStory file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
                }
#else
                try {
                    dataFile.LoadBinaryFile(file, GlobalVariables.Instance.DecodeTable);
                    return(dataFile);
                } catch {
                }
#endif
            }
            return(null);
        }
        private void Load(Dsl.DslFile dataFile)
        {
            lock (m_Lock) {
                for (int i = 0; i < dataFile.DslInfos.Count; i++)
                {
                    if (dataFile.DslInfos[i].GetId() == "skill")
                    {
                        Dsl.FunctionData funcData = dataFile.DslInfos[i].First;
                        if (null != funcData)
                        {
                            Dsl.CallData callData = funcData.Call;
                            if (null != callData && callData.HaveParam())
                            {
                                int id = int.Parse(callData.GetParamId(0));
                                if (!m_SkillInstances.ContainsKey(id))
                                {
                                    SkillInstance instance = new SkillInstance();
                                    instance.Init(dataFile.DslInfos[i]);
                                    m_SkillInstances.Add(id, instance);

                                    LogSystem.Debug("ParseSkill {0}", id);
                                }
                                //else
                                //{
                                //repeated skill config.
                                //}
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
    private static void ShowSkillDslTemplateMenu(int dslSkillId, string filePath, float x, float y)
    {
        KeyValuePair <int, string> userData = new KeyValuePair <int, string>(dslSkillId, filePath);
        string path = GameFramework.HomePath.GetAbsolutePath("../../../Resource/DslTemplate/SkillTemplates.dsl");
        string txt  = File.ReadAllText(path, Encoding.GetEncoding(936));

        Dsl.DslFile file = new Dsl.DslFile();
        if (file.LoadFromString(txt, path, GameFramework.LogSystem.Log))
        {
            List <GUIContent> menus = new List <GUIContent>();
            menus.Add(new GUIContent("取消创建"));
            s_SkillDslTemplates.Clear();
            foreach (Dsl.DslInfo info in file.DslInfos)
            {
                Dsl.FunctionData funcData = info.First;
                if (funcData.GetId() == "skilltemplate")
                {
                    string key     = funcData.Call.GetParamId(0);
                    string content = funcData.GetExternScript();
                    if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(content))
                    {
                        s_SkillDslTemplates.Add(key, content);
                        menus.Add(new GUIContent(key));
                    }
                }
            }
            UnityEditor.EditorUtility.DisplayCustomMenu(new Rect(x, y, c_LabelWidth, c_FieldHeight * menus.Count), menus.ToArray(), 0, OnCustomMenu, userData);
        }
        else
        {
            UnityEditor.EditorUtility.DisplayDialog("错误", "技能dsl模板文件存在语法错误!", "ok");
        }
    }
Beispiel #4
0
 public static Dsl.DslFile LoadStoryText(string file, byte[] bytes)
 {
     if (Dsl.DslFile.IsBinaryDsl(bytes, 0))
     {
         try {
             Dsl.DslFile dataFile = new Dsl.DslFile();
             dataFile.LoadBinaryCode(bytes);
             return(dataFile);
         } catch {
             return(null);
         }
     }
     else
     {
         string text = Converter.FileContent2Utf8String(bytes);
         try {
             Dsl.DslFile dataFile = new Dsl.DslFile();
             if (dataFile.LoadFromString(text, file, LogSystem.Log))
             {
                 return(dataFile);
             }
             else
             {
                 LogSystem.Error("LoadStoryText text:{0} failed", file);
             }
         } catch (Exception ex) {
             LogSystem.Error("LoadStoryText text:{0} Exception:{1}\n{2}", text, ex.Message, ex.StackTrace);
         }
         return(null);
     }
 }
        public void LoadStory(string file, int sceneId, string _namespace)
        {
            if (!string.IsNullOrEmpty(file))
            {
                Dsl.DslFile dataFile = new Dsl.DslFile();
#if DEBUG
                try {
                    if (dataFile.Load(file, LogSystem.Log))
                    {
                        Load(dataFile, sceneId, _namespace, file);
                    }
                    else
                    {
                        LogSystem.Error("LoadStory file:{0} scene:{1} failed", file, sceneId);
                    }
                } catch (Exception ex) {
                    LogSystem.Error("LoadStory file:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
                }
#else
                try {
                    dataFile.LoadBinaryFile(file, GlobalVariables.Instance.DecodeTable);
                    Load(dataFile, sceneId, _namespace, file);
                } catch {
                }
#endif
            }
        }
        public void LoadSkill(int id, string file)
        {
            if (!string.IsNullOrEmpty(file))
            {
                Dsl.DslFile dataFile = new Dsl.DslFile();
#if DEBUG
                try {
                    if (dataFile.Load(file, LogSystem.Log))
                    {
                        Load(id, dataFile);
                    }
                    else
                    {
                        LogSystem.Error("LoadSkill file:{0} failed", file);
                    }
                } catch (Exception ex) {
                    LogSystem.Error("LoadSkill file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
                }
#else
                try {
                    dataFile.LoadBinaryFile(file, GlobalVariables.Instance.DecodeTable);
                    Load(id, dataFile);
                } catch {
                }
#endif
            }
        }
        private void Load(int id, Dsl.DslFile dataFile)
        {
            lock (m_Lock) {
                for (int i = 0; i < dataFile.DslInfos.Count; i++)
                {
                    if (dataFile.DslInfos[i].GetId() == "skill")
                    {
                        Dsl.FunctionData funcData = dataFile.DslInfos[i].First;
                        if (null != funcData)
                        {
                            Dsl.CallData callData = funcData.Call;
                            if (null != callData)
                            {
                                int dslId = id;
                                if (callData.HaveParam())
                                {
                                    dslId = int.Parse(callData.GetParamId(0));
                                }
                                if (!m_SkillInstances.ContainsKey(dslId))
                                {
                                    SkillInstance instance = new SkillInstance();
                                    instance.Init(dataFile.DslInfos[i]);
                                    instance.OuterDslSkillId = dslId;
                                    m_SkillInstances.Add(dslId, instance);

                                    LogSystem.Debug("ParseSkill {0}", dslId);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #8
0
    private static bool ExecuteUpdate(string dslFile)
    {
        try {
            if (!File.Exists(dslFile))
            {
                return(false);
            }
            bool        ret  = false;
            string      txt  = File.ReadAllText(dslFile);
            Dsl.DslFile file = new Dsl.DslFile();
            if (file.Load(dslFile, (string msg) => { Debug.LogError(msg); }))
            {
                s_Calculator = new DslExpression.DslCalculator();
                s_Calculator.Init();
                s_Calculator.SetGlobalVariable("@@processkey", s_ProcessKey);
                s_Calculator.SetGlobalVariable("@@haskey", s_HasKey);
                s_Calculator.SetGlobalVariable("global", DslExpression.CalculatorValue.FromObject(GlobalVariables.Instance));
                s_Calculator.Register("verifycacheserver", new DslExpression.ExpressionFactoryHelper <VerifyCacheServerExp>());

                foreach (var info in file.DslInfos)
                {
                    s_Calculator.LoadDsl(info);
                }
                object retObj = s_Calculator.Calc("main");
                if (null != retObj)
                {
                    ret = (bool)System.Convert.ChangeType(retObj, typeof(bool));
                }
            }
            return(ret);
        }
        catch {
            return(false);
        }
    }
    private void SelectDsl()
    {
        string path = EditorUtility.OpenFilePanel("请选择要执行的dsl文件", string.Empty, "dsl");

        if (!string.IsNullOrEmpty(path) && File.Exists(path))
        {
            Dsl.DslFile file = new Dsl.DslFile();
            if (file.Load(path, (string msg) => { Debug.Log(msg); }))
            {
                m_DslFile = file;

                m_Samplers.Clear();
                foreach (var info in m_DslFile.DslInfos)
                {
                    var dslInfo = info as Dsl.StatementData;
                    if (null == dslInfo)
                    {
                        continue;
                    }
                    var func = dslInfo.First;
                    foreach (var comp in func.Params)
                    {
                        var    callData = comp as Dsl.FunctionData;
                        string id       = callData.GetId();
                        if (id == "sampler")
                        {
                            string key = callData.GetParamId(0);
                            string val = callData.GetParamId(1);

                            if (File.Exists(val))
                            {
                                m_Samplers[key] = val;
                            }
                            else
                            {
                                m_Samplers[key] = string.Empty;
                            }
                        }
                        else if (id == "cache")
                        {
                            string key = callData.GetParamId(0);
                            int    w   = int.Parse(callData.GetParamId(1));
                            int    h   = int.Parse(callData.GetParamId(2));
                            m_Caches.Add(key, new Size(w, h));
                        }
                        else if (id == "list")
                        {
                            m_ListFile = callData.GetParamId(0);
                        }
                    }
                }
            }
            else
            {
                m_DslFile = null;
                m_Samplers.Clear();
            }
        }
    }
 public static void FirstParse(params Dsl.DslFile[] dataFiles)
 {
     for (int ix = 0; ix < dataFiles.Length; ++ix)
     {
         Dsl.DslFile dataFile = dataFiles[ix];
         FirstParse(dataFile.DslInfos);
     }
 }
 public void LoadStoryCode(string code, int sceneId, string _namespace)
 {
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         dataFile.LoadBinaryCode(code, GlobalVariables.Instance.DecodeTable);
         Load(dataFile, sceneId, _namespace, "storycode");
     } catch {
     }
 }
 private void Load(int id, Dsl.DslFile dataFile)
 {
     lock (m_Lock) {
         for (int i = 0; i < dataFile.DslInfos.Count; i++)
         {
             Dsl.FunctionData funcData = dataFile.DslInfos[i].First;
             Load(id, funcData);
         }
     }
 }
Beispiel #13
0
 public static Dsl.DslFile LoadStoryCode(string code)
 {
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         dataFile.LoadBinaryCode(code, GlobalVariables.Instance.DecodeTable);
         return(dataFile);
     } catch {
         return(null);
     }
 }
Beispiel #14
0
        private static void LoadCustomCommandsAndValues()
        {
            string cmdFile = HomePath.GetAbsolutePath(FilePathDefine_Server.C_DslPath + "Story/Common/CustomCommands.dsl");
            string valFile = HomePath.GetAbsolutePath(FilePathDefine_Server.C_DslPath + "Story/Common/CustomValues.dsl");

            Dsl.DslFile file1 = CustomCommandValueParser.LoadStory(cmdFile);
            Dsl.DslFile file2 = CustomCommandValueParser.LoadStory(valFile);
            CustomCommandValueParser.FirstParse(file1, file2);
            CustomCommandValueParser.FinalParse(file1, file2);
        }
Beispiel #15
0
 internal static void Import(string path, GameObject root)
 {
     Dsl.DslFile file = new Dsl.DslFile();
     if (file.Load(path, (string msg) => { Debug.Log(msg); }))
     {
         foreach (var info in file.DslInfos)
         {
             ReadObject(info.First, root.transform);
         }
     }
 }
 static public int get_DslInfos(IntPtr l)
 {
     try {
         Dsl.DslFile self = (Dsl.DslFile)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.DslInfos);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #17
0
 public static void FinalParse(params Dsl.DslFile[] dataFiles)
 {
     for (int ix = 0; ix < dataFiles.Length; ++ix)
     {
         Dsl.DslFile dataFile = dataFiles[ix];
         for (int i = 0; i < dataFile.DslInfos.Count; i++)
         {
             Dsl.DslInfo dslInfo = dataFile.DslInfos[i];
             FinalParse(dslInfo);
         }
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         Dsl.DslFile o;
         o = new Dsl.DslFile();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #19
0
        public void Load(string dslFile)
        {
            Dsl.DslFile file = new Dsl.DslFile();
            string      path = dslFile;

            if (file.Load(path, (string s) => { Console.WriteLine(s); }))
            {
                foreach (Dsl.DslInfo info in file.DslInfos)
                {
                    Load(info);
                }
            }
        }
        public void Load(string dslFile)
        {
            Dsl.DslFile file = new Dsl.DslFile();
            string      path = HomePath.GetAbsolutePath(dslFile);

            if (file.Load(path, LogSystem.Log))
            {
                foreach (Dsl.DslInfo info in file.DslInfos)
                {
                    Load(info);
                }
            }
        }
Beispiel #21
0
        internal static void Generate(string csprojPath, string outPath, string ext)
        {
            if (string.IsNullOrEmpty(outPath))
            {
                outPath = Path.Combine(csprojPath, "dsl");
            }
            else if (!Path.IsPathRooted(outPath))
            {
                outPath = Path.Combine(csprojPath, outPath);
            }

            s_ExePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            s_SrcPath = Path.Combine(csprojPath, "dsl");
            s_LogPath = Path.Combine(csprojPath, "log");
            s_OutPath = outPath;
            s_Ext     = ext;
            if (!Directory.Exists(s_OutPath))
            {
                Directory.CreateDirectory(s_OutPath);
            }
            var files = Directory.GetFiles(s_SrcPath, "*.dsl", SearchOption.TopDirectoryOnly);

            foreach (string file in files)
            {
                try {
                    string fileName = Path.GetFileNameWithoutExtension(file);

                    Dsl.DslFile dslFile = new Dsl.DslFile();
                    dslFile.Load(file, s => Log(file, s));
                    GenerateJs(dslFile, Path.Combine(s_OutPath, Path.ChangeExtension(fileName.Replace("cs2dsl__", "cs2js__"), s_Ext)));
                }
                catch (Exception ex) {
                    string id   = string.Empty;
                    int    line = 0;
                    if (null != s_CurSyntax)
                    {
                        id = s_CurSyntax.GetId();
                        if (null == id)
                        {
                            id = string.Empty;
                        }
                        line = s_CurSyntax.GetLine();
                    }
                    Log(file, string.Format("[{0}:{1}]:exception:{2}\n{3}", id, line, ex.Message, ex.StackTrace));
                    File.WriteAllText(Path.Combine(s_LogPath, "Generator.log"), s_LogBuilder.ToString());
                    System.Environment.Exit(-1);
                }
            }
            File.WriteAllText(Path.Combine(s_LogPath, "Generator.log"), s_LogBuilder.ToString());
            System.Environment.Exit(0);
        }
 static public int Save(IntPtr l)
 {
     try {
         Dsl.DslFile   self = (Dsl.DslFile)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         self.Save(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int AddDslInfo(IntPtr l)
 {
     try {
         Dsl.DslFile self = (Dsl.DslFile)checkSelf(l);
         Dsl.DslInfo a1;
         checkType(l, 2, out a1);
         self.AddDslInfo(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static Dsl.DslFile LoadStory(string file)
 {
     if (!string.IsNullOrEmpty(file))
     {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         var         bytes    = new byte[Dsl.DslFile.c_BinaryIdentity.Length];
         using (var fs = File.OpenRead(file)) {
             fs.Read(bytes, 0, bytes.Length);
             fs.Close();
         }
         var id = System.Text.Encoding.ASCII.GetString(bytes);
         if (id == Dsl.DslFile.c_BinaryIdentity)
         {
             try {
                 dataFile.LoadBinaryFile(file, StoryConfigManager.ReuseKeyBuffer, StoryConfigManager.ReuseIdBuffer);
                 return(dataFile);
             }
             catch (Exception ex) {
                 var sb = new System.Text.StringBuilder();
                 sb.AppendFormat("[LoadStory] LoadStory file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
                 sb.AppendLine();
                 Helper.LogInnerException(ex, sb);
                 LogSystem.Error("{0}", sb.ToString());
             }
         }
         else
         {
             try {
                 if (dataFile.Load(file, LogSystem.Log))
                 {
                     return(dataFile);
                 }
                 else
                 {
                     LogSystem.Error("LoadStory file:{0} failed", file);
                 }
             }
             catch (Exception ex) {
                 var sb = new System.Text.StringBuilder();
                 sb.AppendFormat("[LoadStory] LoadStory file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
                 sb.AppendLine();
                 Helper.LogInnerException(ex, sb);
                 LogSystem.Error("{0}", sb.ToString());
             }
         }
     }
     return(null);
 }
 static public int LoadBinaryCode(IntPtr l)
 {
     try {
         Dsl.DslFile   self = (Dsl.DslFile)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.Dictionary <System.String, System.String> a2;
         checkType(l, 3, out a2);
         self.LoadBinaryCode(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public void LoadStory(string file, int sceneId, string _namespace)
 {
     if (!string.IsNullOrEmpty(file))
     {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         var         bytes    = new byte[Dsl.DslFile.c_BinaryIdentity.Length];
         using (var fs = File.OpenRead(file)) {
             fs.Read(bytes, 0, bytes.Length);
             fs.Close();
         }
         var id = System.Text.Encoding.ASCII.GetString(bytes);
         if (id == Dsl.DslFile.c_BinaryIdentity)
         {
             try {
                 dataFile.LoadBinaryFile(file);
                 Load(dataFile, sceneId, _namespace, file);
             }
             catch (Exception ex) {
                 var sb = new System.Text.StringBuilder();
                 sb.AppendFormat("[LoadStory] LoadStory file:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
                 sb.AppendLine();
                 Helper.LogInnerException(ex, sb);
                 LogSystem.Error("{0}", sb.ToString());
             }
         }
         else
         {
             try {
                 if (dataFile.Load(file, LogSystem.Log))
                 {
                     Load(dataFile, sceneId, _namespace, file);
                 }
                 else
                 {
                     LogSystem.Error("[LoadStory] LoadStory file:{0} scene:{1} failed", file, sceneId);
                 }
             }
             catch (Exception ex) {
                 var sb = new System.Text.StringBuilder();
                 sb.AppendFormat("[LoadStory] LoadStory file:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
                 sb.AppendLine();
                 Helper.LogInnerException(ex, sb);
                 LogSystem.Error("{0}", sb.ToString());
             }
         }
     }
 }
 static public int Load(IntPtr l)
 {
     try {
         Dsl.DslFile   self = (Dsl.DslFile)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         Dsl.DslLogDelegation a2;
         LuaDelegation.checkDelegate(l, 3, out a2);
         var ret = self.Load(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public void LoadStory(string file, int sceneId, string _namespace)
 {
     if (!string.IsNullOrEmpty(file))
     {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         var         bytes    = new byte[Dsl.DslFile.c_BinaryIdentity.Length];
         using (var fs = File.OpenRead(file)) {
             fs.Read(bytes, 0, bytes.Length);
             fs.Close();
         }
         var id = System.Text.Encoding.ASCII.GetString(bytes);
         if (id == Dsl.DslFile.c_BinaryIdentity)
         {
             try {
                 dataFile.LoadBinaryFile(file);
                 Load(dataFile, sceneId, _namespace, file);
             } catch (Exception ex) {
                 while (null != ex.InnerException)
                 {
                     ex = ex.InnerException;
                 }
                 LogSystem.Error("[LoadStory] LoadStoryText text:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
             }
         }
         else
         {
             try {
                 if (dataFile.Load(file, LogSystem.Log))
                 {
                     Load(dataFile, sceneId, _namespace, file);
                 }
                 else
                 {
                     LogSystem.Error("[LoadStory] LoadStory file:{0} scene:{1} failed", file, sceneId);
                 }
             } catch (Exception ex) {
                 while (null != ex.InnerException)
                 {
                     ex = ex.InnerException;
                 }
                 LogSystem.Error("[LoadStory] LoadStoryText text:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
             }
         }
     }
 }
Beispiel #29
0
 private void OnExecCommand(string cmd)
 {
     Dsl.DslFile file = new Dsl.DslFile();
     if (file.LoadFromString(string.Format("script(){{{0};}};", cmd), "cmd", msg => Debug.LogWarning(msg)))
     {
         var func = file.DslInfos[0] as Dsl.FunctionData;
         m_Calculator.LoadDsl("main", func);
         var r = m_Calculator.Calc("main");
         if (!r.IsNullObject)
         {
             DebugConsole.Log(string.Format("result:{0}", r.ToString()));
         }
         else
         {
             DebugConsole.Log("result:null");
         }
     }
 }
 static public int GenerateBinaryCode(IntPtr l)
 {
     try {
         Dsl.DslFile   self = (Dsl.DslFile)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.Dictionary <System.String, System.String> a2;
         checkType(l, 3, out a2);
         Dsl.DslLogDelegation a3;
         LuaDelegation.checkDelegate(l, 4, out a3);
         var ret = self.GenerateBinaryCode(a1, a2, a3);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public void LoadSkillText(string text)
 {
     Dsl.DslFile dataFile = new Dsl.DslFile();
     #if DEBUG
     try {
         if (dataFile.LoadFromString(text, "skill", LogSystem.Log)) {
             Load(dataFile);
         } else {
             LogSystem.Error("LoadSkillText text:{0} failed", text);
         }
     } catch (Exception ex) {
         LogSystem.Error("LoadSkillText text:{0} Exception:{1}\n{2}", text, ex.Message, ex.StackTrace);
     }
     #else
       try {
     dataFile.LoadBinaryCode(text, GlobalVariables.Instance.DecodeTable);
     Load(dataFile);
       } catch {
       }
     #endif
 }
 public void LoadStory(string file, int sceneId, string _namespace)
 {
     if (!string.IsNullOrEmpty(file)) {
         Dsl.DslFile dataFile = new Dsl.DslFile();
     #if DEBUG
         try {
             if (dataFile.Load(file, LogSystem.Log)) {
                 Load(dataFile, sceneId, _namespace, file);
             } else {
                 LogSystem.Error("LoadStory file:{0} scene:{1} failed", file, sceneId);
             }
         } catch (Exception ex) {
             LogSystem.Error("LoadStory file:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
         }
     #else
     try {
       dataFile.LoadBinaryFile(file, GlobalVariables.Instance.DecodeTable);
       Load(dataFile, sceneId, _namespace, file);
     } catch {
     }
     #endif
     }
 }
 public static Dsl.DslFile LoadStory(string file)
 {
     if (!string.IsNullOrEmpty(file)) {
         Dsl.DslFile dataFile = new Dsl.DslFile();
     #if DEBUG
         try {
             if (dataFile.Load(file, LogSystem.Log)) {
                 return dataFile;
             } else {
                 LogSystem.Error("LoadStory file:{0} failed", file);
             }
         } catch (Exception ex) {
             LogSystem.Error("LoadStory file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
         }
     #else
         try {
             dataFile.LoadBinaryFile(file, GlobalVariables.Instance.DecodeTable);
             return dataFile;
         } catch {
         }
     #endif
     }
     return null;
 }
 public static Dsl.DslFile LoadStoryCode(string code)
 {
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         dataFile.LoadBinaryCode(code, GlobalVariables.Instance.DecodeTable);
         return dataFile;
     } catch {
         return null;
     }
 }
 public void LoadStoryText(string text, int sceneId, string _namespace)
 {
     #if DEBUG
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         if (dataFile.LoadFromString(text, "storytext", LogSystem.Log)) {
             Load(dataFile, sceneId, _namespace, "storytext");
         } else {
             LogSystem.Error("LoadStoryText text:{0} scene:{1} failed", text, sceneId);
         }
     } catch (Exception ex) {
         LogSystem.Error("LoadStoryText text:{0} scene:{1} Exception:{2}\n{3}", text, sceneId, ex.Message, ex.StackTrace);
     }
     #else
       LoadStoryCode(text, sceneId, _namespace);
     #endif
 }
 public static Dsl.DslFile LoadStoryText(string text)
 {
     #if DEBUG
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         if (dataFile.LoadFromString(text, "storytext", LogSystem.Log)) {
             return dataFile;
         } else {
             LogSystem.Error("LoadStoryText text:{0} failed", text);
         }
     } catch (Exception ex) {
         LogSystem.Error("LoadStoryText text:{0} Exception:{1}\n{2}", text, ex.Message, ex.StackTrace);
     }
     return null;
     #else
     return LoadStoryCode(text);
     #endif
 }
 public void LoadStoryCode(string code, int sceneId, string _namespace)
 {
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         dataFile.LoadBinaryCode(code, GlobalVariables.Instance.DecodeTable);
         Load(dataFile, sceneId, _namespace, "storycode");
     } catch {
     }
 }