private void Load(ScriptableData.ScriptableDataFile dataFile, int sceneId)
 {
     lock (m_oLock)
     {
         foreach (var info in dataFile.ScriptableDatas)
         {
             if (info.GetId() == "story" || info.GetId() == "script")
             {
                 ScriptableData.FunctionData funcData = info.First;
                 if (funcData != null)
                 {
                     ScriptableData.CallData callData = funcData.Call;
                     if (callData != null && callData.HaveParam())
                     {
                         int storyId = int.Parse(callData.GetParamId(0));
                         int id      = GetId(storyId, sceneId);
                         if (!m_dicStoryInstance.ContainsKey(id))
                         {
                             StoryInstance instance = new StoryInstance();
                             instance.Init(info);
                             m_dicStoryInstance.Add(id, instance);
                             m_log.Debug("加载剧情" + id + "成功");
                         }
                         else
                         {
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
        public static void Main(string[] args)
        {
            Dictionary <string, string> encodeTable = new Dictionary <string, string>();
            Dictionary <string, string> decodeTable = new Dictionary <string, string>();

            AddCrypto("skill", "@1", encodeTable, decodeTable);
            AddCrypto("section", "@2", encodeTable, decodeTable);
            AddCrypto("effect", "@3", encodeTable, decodeTable);
            AddCrypto("sound", "@4", encodeTable, decodeTable);
            AddCrypto("triger", "@5", encodeTable, decodeTable);
            AddCrypto("duration", "@6", encodeTable, decodeTable);
            AddCrypto("grap", "@7", encodeTable, decodeTable);
            AddCrypto("range", "@8", encodeTable, decodeTable);
            AddCrypto("animation", "@9", encodeTable, decodeTable);
            AddCrypto("impact", "@10", encodeTable, decodeTable);
            AddCrypto("hittarget", "@11", encodeTable, decodeTable);
            AddCrypto("throw", "@12", encodeTable, decodeTable);


            ScriptableDataFile file = new ScriptableDataFile();

            file.Load("test.txt");
#if FULL_VERSION
            file.Save("copy.txt");
            string code0 = file.GenerateObfuscatedCode(File.ReadAllText("test.txt"), encodeTable);
            File.WriteAllText("obfuscation.txt", code0);
#endif
            file.ScriptableDatas.Clear();
            string code = File.ReadAllText("obfuscation.txt");
            file.LoadObfuscatedCode(code, decodeTable);
#if FULL_VERSION
            file.Save("unobfuscation.txt");
#endif
        }
 /// <summary>
 /// 加载剧情,根据配置文件
 /// </summary>
 /// <param name="file"></param>
 /// <param name="sceneId"></param>
 public void LoadStory(string file, int sceneId)
 {
     if (!string.IsNullOrEmpty(file))
     {
         ScriptableData.ScriptableDataFile dataFile = new ScriptableData.ScriptableDataFile();
         if (dataFile.Load(file))
         {
             Load(dataFile, sceneId);
         }
         else
         {
             Debug.Log("不能读取DSL文件");
         }
     }
 }