Example #1
0
 public override void Start()
 {
     m_Instance = this;
     Debug.Log("HotFix Start Ok");
     GameMain.DispatcherEvent(CommonEvents.UpdateCheckVersionProgress, 1f, GameMain.Instance.GetText(6));
     GameMain.Instance.GetFSM().ChangeState(MainState_Running.Instance);
 }
    private void OnResDownloadSuccess(byte[] pBytes)
    {
        GameMain.DispatcherEvent(CommonEvents.UpdateCheckVersionProgress, 0f, GameMain.Instance.GetText(5));
        string zipPath = AppConst.GetTmpPath("tmp.zip");

        File.WriteAllBytes(zipPath, pBytes);
        m_TotalProgressHandler += OnTotalProgressHandler;
        m_TotalFinishHandler   += OnTotalFinishHandler;
        FZipUtil.UnzipAsync(zipPath, AppConst.LOCAL_DOWNLOAD_PATH, m_TotalProgressHandler, m_TotalFinishHandler);
    }
    public override void Enter(GameMain pEntity)
    {
        base.Enter(pEntity);
        pEntity.ShowCheckVersionUI();

        //下载本地Main配置
        string path = AppConst.GetStreemingAssetURL("Main.json");

        DownloadManager.Instance.DownloadFileAsync(path, OnMainFileDownloadSuccess);

        GameMain.DispatcherEvent(CommonEvents.UpdateCheckVersionProgress, 1f, GameMain.Instance.GetText(1));
    }
 private void OnVersionFileDowloadProgress(float pProgress)
 {
     GameMain.DispatcherEvent(CommonEvents.UpdateCheckVersionProgress, pProgress, GameMain.Instance.GetText(1));
 }
 private void OnTotalProgressHandler(object sender, long done, long total)
 {
     GameMain.DispatcherEvent(CommonEvents.UpdateCheckVersionProgress, (float)(done / total), GameMain.Instance.GetText(5));
 }