Exemplo n.º 1
0
    public void Init()
    {
        state = STATE.INIT;
        hotUI.HOT_InitUI();

        // 服务器上files url
        serverUrl = AppConst.WebUrl;

        // 加载配置
        hotConfig = HotConfig.Load(CONFIG_PATH);

        if (!OpenHotUpdate)
        {
            // 没有开启热更新
            if (CheckUnpackStreaming())
            {
                EnterGame();
            }
            else
            {
                UnpackStreaming();
            }
        }
        else
        {
            // 检查是否需要解压 streaming upk 资源
            if (CheckUnpackStreaming())
            {
                // 进行首包检查
                CheckFirst();
            }
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// Update TCP cache settings that includes updated list of TCP members
        /// </summary>
        /// <param name="cacheId"></param>
        /// <exception cref="ArgumentNullException">cacheId is a null reference (Nothing in Visual Basic).</exception>
        public void ApplyHotConfiguration(string cacheId, HotConfig hotConfig)
        {
            ManagementCommand command = GetManagementCommand(ManagementUtil.MethodName.HotApplyConfiguration);

            command.Parameters.AddParameter(cacheId);
            command.Parameters.AddParameter(hotConfig);
            ExecuteCommandOnCacehServer(command);
        }
Exemplo n.º 3
0
    public static HotConfig Create(string path)
    {
        HotConfig hotConfig = new HotConfig();

        hotConfig.first_upk_download   = HOT_STATE.FAIL;
        hotConfig.first_upk_unpack     = HOT_STATE.FAIL;
        hotConfig.streaming_upk_unpack = HOT_STATE.FAIL;

        hotConfig.configPath = path;
        return(hotConfig);
    }
Exemplo n.º 4
0
 /// <summary>
 /// This function is called by ConfigurationModified callback
 /// </summary>
 /// <param name="hotConfig"></param>
 private void OnConfigModified(HotConfig hotConfig)
 {
     lock (ConnectionManager.CallbackQueue)
     {
         if (_client != null)
         {
             ConnectionManager.CallbackQueue.Enqueue(new ConfigModifiedEvent(hotConfig, _cacheId, _client.ClientID));
             Monitor.Pulse(ConnectionManager.CallbackQueue);
         }
     }
 }
Exemplo n.º 5
0
 public override void ApplyHotConfiguration(string cacheId, HotConfig hotConfig)
 {
     if (cacheInfo != null)
     {
         InstrumentCache cache = cacheInfo.Cache;
         if (cache != null)
         {
             cache.ApplyHotConfiguration(hotConfig);
         }
     }
 }
Exemplo n.º 6
0
    public static void BuildeDeveloper()
    {
        var filesPath = Path.Combine(Application.streamingAssetsPath, "files.txt");
        var fileData  = File.ReadAllText(filesPath);
        var vFiles    = ReadFileInfo(fileData);


        var versionPath = GetVersionBundlePath();

        var outPathFix = Util.DataPath;

        if (Directory.Exists(outPathFix))
        {
            Directory.Delete(outPathFix, true);
        }

        //copy
        for (int i = 0; i < vFiles.Length; i++)
        {
            var vfData     = vFiles[i];
            var targetPath = Path.Combine(Application.streamingAssetsPath, vfData.Path).Replace("\\", "/");
            var outPath    = Path.Combine(outPathFix, vfData.Path).Replace("\\", "/");

            var path = Path.GetDirectoryName(outPath);
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            File.Copy(targetPath, outPath);
        }

        var outFilesPath = Path.Combine(outPathFix, "file.txt").Replace("\\", "/");

        File.Copy(filesPath, outFilesPath);

        // 生成hotCofig
        var       hotConfigPath = Path.Combine(Util.DataPath, "hot_config.json");
        HotConfig hot           = HotConfig.Create(hotConfigPath);

        hot.SaveDevelop();

        Debug.Log("构建开发人员使用资源完成 ");
    }
Exemplo n.º 7
0
 internal ConfigModifiedEvent(HotConfig config, string cacheId, string clientid)
 {
     _config   = config;
     _cacheId  = cacheId;
     _clientid = clientid;
 }