using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

public class HttpDownloadBasic
{
    public int maxCount = 2;
    public DownloadHander DownloadHander;

    protected DownloadFileData downloadFileData;
    public bool isFinish;
    protected int timeOut = 120;

    public void Init(DownloadFileData downloadFileData, DownloadHander downloadHander)
    {
        DownloadHander = downloadHander;
        if (downloadFileData.maxCount > 0)
        {
            maxCount = downloadFileData.maxCount;
        }

        if (downloadFileData.timeOut > 0)
        {
            timeOut = downloadFileData.timeOut;
        }

        this.downloadFileData = downloadFileData;
    }

    public void StartDown()
    {
        ProStartDown();
    }

    protected virtual void ProStartDown()
    {
    }

    public bool IsFinish()
    {
        return ProFinish();
    }

    public virtual bool AllFinish()
    {
        return true;
    }

    public virtual UnityWebRequest.Result Result()
    {
        return UnityWebRequest.Result.InProgress;
    }

    protected virtual bool ProFinish()
    {
        return true;
    }

    public virtual void Update()
    {
    }
}