Exemple #1
0
    private void LoadFile(string path)
    {
        string content = FileUtils.ReadStringFile(path);
        RunnerTrunkElementConfig config = XmlConfigBase.DeSerialize <RunnerTrunkElementConfig>(content);

        m_TmpConfigList.Add(config);
    }
Exemple #2
0
        private void BeginPackPackageResource(PackageResourceCompressType compressType, string sourceDirectory, string targetDirectory)
        {
            m_ReportConfig = new PackageResourceConfig();

            m_ReportConfig.compressType = (int)compressType;
            m_ReportConfig.fileList     = new List <string>();

            // get compressor
            var compressor = PackageResourceCompressHelper.GetCompress(compressType);

            if (null == compressor)
            {
                Debug.LogError("Unsupport compress type " + compressType);
                return;
            }
            // sign list
            StringBuilder allFileCRC32Code = new StringBuilder();

            // create file list
            var fileList = GetFileList(sourceDirectory, targetDirectory);

            for (int i = 0; i < fileList.Count; ++i)
            {
                var elem = fileList[i];

                // load file to memory
                byte[] content = File.ReadAllBytes(elem.GetSourcePath());

                // compess file with compress type
                content = CompressFile(content, compressor);

                // get crc32
                allFileCRC32Code.Append(CRC32.GetCRC32byte(content));

                // get output path
                string outputPath = elem.GetOutputPath();

                // ensure folder
                PackageResourceTool.EnsureFolder(outputPath);

                // write file to target directory
                File.WriteAllBytes(outputPath, content);

                // update  report
                m_ReportConfig.fileList.Add(elem.GetSubpath());
            }

            // update report version
            m_ReportConfig.version = CRC32.GetCRC32Str(allFileCRC32Code.ToString()).ToString();

            // save report file
            var reportFile = XmlConfigBase.Serialize(m_ReportConfig);

            File.WriteAllText(targetDirectory + m_strPackageResourceConfigName, reportFile);
        }
    public RunnerTrunkTableConfig GetTrunkConfigTable()
    {
        TrunkConfigTable config = TryGetConfig <TrunkConfigTable>(ConfigPath_LimitFuncSceneConfig);

        if (null == config || string.IsNullOrEmpty(config.TrunkConfigXml))
        {
            return(null);
        }
        RunnerTrunkTableConfig res = XmlConfigBase.DeSerialize <RunnerTrunkTableConfig>(config.TrunkConfigXml);

        return(res);
    }
Exemple #4
0
 private void LoadSystemConfig()
 {
     try
     {
         var content = File.ReadAllText(SystemConst.settingConfigPath);
         SystemConst.Config = XmlConfigBase.DeSerialize <PathConfig>(content);
     }
     catch (Exception e)
     {
         SystemConst.Config = new PathConfig();
     }
 }
        private void OnLoadPackedConfigInfoDone(string content, Exception e)
        {
            var tmpLoader = m_Root.GetComponent <PackageResourceLoader>();

            if (null != tmpLoader)
            {
                GameObject.Destroy(tmpLoader);
            }

            if (null != e)
            {
                Debug.LogException(e);

                OnComplate();
                return;
            }
            if (string.IsNullOrEmpty(content))
            {
                Debug.LogError("cant' load streaming asset info config");

                OnComplate();
                return;
            }

            try
            {
                var config = XmlConfigBase.DeSerialize <PackageResourceConfig>(content);
                if (null == config)
                {
                    Debug.LogError("cant' load streaming asset info config");
                    OnComplate();
                    return;
                }

                DoUnpack(config);
            }
            catch (Exception exception)
            {
                Debug.LogException(exception);
                OnComplate();
            }
        }
Exemple #6
0
    private void CombineData()
    {
        if (m_TmpConfigList.Count <= 0)
        {
            Tip("没找到 " + PrefixName + " 文件");
            return;
        }

        RunnerTrunkTableConfig table = new RunnerTrunkTableConfig();

        table.TrunkList = new List <RunnerTrunkConfig>();

        for (int i = 0; i < m_TmpConfigList.Count; ++i)
        {
            RunnerTrunkConfig elem = RunnerTrunkElementConfig.ConvertToConfig(m_TmpConfigList[i]);
            table.TrunkList.Add(elem);
        }

        string xmlData = XmlConfigBase.Serialize(table);

        FileUtils.WriteStringFile(xmlData, m_strDataOutputPath + "/" + m_strXmlName);
    }
Exemple #7
0
    private void Test()
    {
        if (Application.platform == RuntimePlatform.Android && (Input.GetKeyDown(KeyCode.Escape)))
        {
            TipManager.Instance.Alert("", "你确定要退出游戏吗?", "确定", "取消", (res) =>
            {
                if (res)
                {
                    Application.Quit();
                }
            });
        }
        if (Input.GetKeyDown(KeyCode.F1))
        {
            WindowBase window = WindowManager.Instance.GetWindow(WindowID.MissionDebugAttach);
            if (null == window)
            {
                WindowManager.Instance.OpenWindow(WindowID.MissionDebugAttach);
            }
            else
            {
                if (window.IsOpen())
                {
                    window.Close();
                }
                else
                {
                    WindowManager.Instance.OpenWindow(WindowID.MissionDebugAttach);
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.C) || Input.touchCount == 3)
        {
            string filepath = ResourceManager.Instance.GetStreamAssetPath() + "/config.xml";

            ResourceManager.Instance.LoadStreamingAssetsData(filepath, (www) =>
            {
                SysConfig tmp = XmlConfigBase.DeSerialize <SysConfig>(www.text);
                Debuger.LogError("system config decode result : " + tmp == null);
                if (tmp != null)
                {
                    Debuger.LogError(tmp.ServerConfigPath);
                    Debuger.LogError(tmp.ClientConfigPath);
                    Debuger.LogError(tmp.ExcelPath);
                    Debuger.LogError(tmp.ConfigCenterUrl);
                    Debuger.LogError(tmp.UploadUrl);

                    Debuger.LogError("begin encode resoult");
                    string res = XmlConfigBase.Serialize(tmp);
                    Debuger.LogError("encode result:" + res);
                    FileUtils.WriteStringFile(Application.persistentDataPath + "/tesw.xml", res);

                    tmp = XmlConfigBase.DeSerialize <SysConfig>(res);
                    Debuger.LogError("xxx system config decode result : " + tmp == null);
                    if (tmp != null)
                    {
                        Debuger.LogError(tmp.ServerConfigPath);
                        Debuger.LogError(tmp.ClientConfigPath);
                        Debuger.LogError(tmp.ExcelPath);
                        Debuger.LogError(tmp.ConfigCenterUrl);
                        Debuger.LogError(tmp.UploadUrl);

                        Debuger.LogError("begin encode resoult");
                        res = XmlConfigBase.Serialize(tmp);
                        Debuger.LogError("encode result:" + res);
                        FileUtils.WriteStringFile(Application.persistentDataPath + "/tesw1.xml", res);
                    }
                }
            });
        }
    }
Exemple #8
0
        private void SaveSystemConfig()
        {
            var content = XmlConfigBase.Serialize(SystemConst.Config);

            File.WriteAllText(SystemConst.settingConfigPath, content);
        }