Пример #1
0
    /// <summary>
    /// 每个流程开始时调用
    /// </summary>
    /// <param name="obj"></param>
    private void onFlowBeginCallback(object obj)
    {
        refreshProgress();

        string appVers = "";
        string resVers = "";

        UpdateManager.Instance.GetVersionInfo(out appVers, out resVers);
        //     _AppVer.text = appVers;
        //    _ResVer.text = resVers;

        if (UpdateManager.Instance.CurrentFlow == null)
        {
            return;
        }

        string   labelText = "";
        FlowEnum flowType  = UpdateManager.Instance.GetCurFlowType();

        UnityEngine.Debug.LogWarning("Cur flow : " + flowType);
        switch (flowType)
        {
        case FlowEnum.Flow1TransResource:
            labelText = "转移资源(不消耗流量)";
            break;

        case FlowEnum.Flow2LocalXml:
        case FlowEnum.Flow3RemoteXml:
            labelText = "资源初始化";
            break;

        case FlowEnum.Flow4DownloadClient:
            string newVer = UpdateManager.Instance.CurrentFlow.CurrentRemoteData.AppVersion;
            labelText = "更新客户端版本" + "(AppVer:" + newVer + ")";
            break;

        case FlowEnum.Flow5DownloadBaseRes:
            labelText = "更新分段资源";
            break;

        case FlowEnum.Flow6ReleaseBaseRes:
            labelText = "释放资源(不消耗流量)";
            break;

        case FlowEnum.Flow7ExDownloadMapFile:
        case FlowEnum.Flow8CheckResource:
        case FlowEnum.Flow8ExCheckResource:
            labelText = "资源检查";
            break;

        case FlowEnum.Flow9RepairResource:
            labelText = "资源更新";
            break;

        default:
            labelText = "资源加载中";
            break;
        }
        setFlowLabel(labelText);
    }
Пример #2
0
 protected RequestBase(string fromCurrency, string toCurrency, string fromNetwork, string toNetwork, FlowEnum flow)
 {
     FromCurrency = fromCurrency;
     ToCurrency   = toCurrency;
     FromNetwork  = fromNetwork;
     ToNetwork    = toNetwork;
     Flow         = flow;
 }
 public static string ToString(FlowEnum flow)
 {
     if (flow == FlowEnum.FixedRate)
     {
         return("fixed-rate");
     }
     else
     {
         return("standard");
     }
 }
Пример #4
0
 protected RequestBase(string fromCurrency, string toCurrency, decimal fromAmount, decimal toAmount, string fromNetwork, string toNetwork, FlowEnum flow, DirectionEnum type)
 {
     FromCurrency = fromCurrency;
     ToCurrency   = toCurrency;
     FromAmount   = fromAmount;
     ToAmount     = toAmount;
     FromNetwork  = fromNetwork;
     ToNetwork    = toNetwork;
     Flow         = flow;
     Type         = type;
 }
Пример #5
0
        public void GetExchangeRangeTest(string fromCurrency, string toCurrency, FlowEnum flow, string fromNetwork, string toNetwork)
        {
            var request = new ExchangeRangeRequest(fromCurrency, toCurrency, flow, fromNetwork, toNetwork);

            var result = _client.GetExchangeRange(request);

            Assert.NotNull(result);
            Assert.NotNull(result.FromCurrency);
            Assert.NotNull(result.FromNetwork);
            Assert.NotNull(result.ToCurrency);
            Assert.NotNull(result.ToNetwork);
            Assert.NotNull(result.Flow);
            Assert.NotNull(result.MinAmount);
        }
Пример #6
0
 public TransactionRequest(string fromCurrency, string toCurrency, decimal fromAmount, string address, FlowEnum flow)
     : base(fromCurrency, toCurrency, fromAmount, 0, string.Empty, string.Empty, flow, DirectionEnum.Direct)
 {
     Address = address;
 }
Пример #7
0
 public TransactionRequest(string fromCurrency, string toCurrency, decimal fromAmount, string address, FlowEnum flow, DirectionEnum type,
                           decimal toAmount, string extraID, string refundAddress, string refundExtraId, string userId, string payLoad,
                           string contactEmail, string rateID, string fromNetwork, string toNetwork)
     : base(fromCurrency, toCurrency, fromAmount, toAmount, fromNetwork, toNetwork, flow, type)
 {
     Address       = address;
     ExtraId       = extraID;
     RefundAddress = refundAddress;
     RefundExtraId = refundExtraId;
     UserId        = userId;
     PayLoad       = payLoad;
     ConactEmail   = contactEmail;
     RateID        = rateID;
 }
Пример #8
0
        public async Task GetMinimalExchangeAmountAsyncTest(string fromCurrency, string toCurrency, FlowEnum flow, string fromNetwork, string toNetwork)
        {
            var request = new MinimalExchangeRequest(fromCurrency, toCurrency, flow, fromNetwork, toNetwork);

            var result = await _client.GetMinimalExchangeAmountAsync(request);

            Assert.NotNull(result);
            Assert.NotNull(result.FromCurrency);
            Assert.NotNull(result.FromNetwork);
            Assert.NotNull(result.ToCurrency);
            Assert.NotNull(result.ToNetwork);
            Assert.NotNull(result.Flow);
            Assert.NotNull(result.MinAmount);
        }
Пример #9
0
        public void GetListOfAvailableCurrenciesTest(bool sell, bool buy, bool active, FlowEnum flow)
        {
            var request = new CurrencyRequest(active, buy, sell, flow);

            var result = _client.GetListOfAvailableCurrencies(request);

            Assert.NotNull(result);
            Assert.True(result.Count > 0);
        }
Пример #10
0
        public void GetEstimatedExchangeAmountTest(string fromCurrency, string toCurrency, decimal fromAmount, decimal toAmount, FlowEnum flow, DirectionEnum type, bool useRateId, string fromNetwork, string toNetwork)
        {
            var request = new EstimatedExchangeAmountRequest(fromCurrency, toCurrency, fromAmount, toAmount, flow, type, useRateId, fromNetwork, toNetwork);

            var result = _client.GetEstimatedExchangeAmount(request);

            Assert.NotNull(result);


            if (useRateId)
            {
                Assert.NotNull(result.FromCurrency);
                Assert.NotNull(result.FromNetwork);
                Assert.NotNull(result.ToCurrency);
                Assert.NotNull(result.ToNetwork);
                Assert.NotNull(result.Flow);
                Assert.NotNull(result.Type);
                Assert.NotNull(result.RateId);
                Assert.NotNull(result.ValidUntil);
                Assert.Null(result.TransactionSpeedForecast);
                Assert.Null(result.warningMessage);
                Assert.NotNull(result.fromAmount);
                Assert.NotNull(result.ToAmount);
            }
            else
            {
                Assert.NotNull(result.FromCurrency);
                Assert.NotNull(result.FromNetwork);
                Assert.NotNull(result.ToCurrency);
                Assert.NotNull(result.ToNetwork);
                Assert.NotNull(result.Flow);
                Assert.NotNull(result.Type);
                Assert.Null(result.RateId);
                Assert.Null(result.ValidUntil);
                Assert.NotNull(result.TransactionSpeedForecast);
                Assert.Null(result.warningMessage);
                Assert.NotNull(result.fromAmount);
                Assert.NotNull(result.ToAmount);
            }
        }
 public MinimalExchangeRequest(string fromCurrency, string toCurrency, FlowEnum flow = FlowEnum.Standard, string fromNetwork = "", string toNetwork = "")
     : base(fromCurrency, toCurrency, fromNetwork, toNetwork, flow)
 {
 }
 public CurrencyRequest(bool active, bool buy, bool sell, FlowEnum flow) : base(flow)
 {
     Active = active;
     Buy    = buy;
     Sell   = sell;
 }
Пример #13
0
 protected RequestBase(FlowEnum flow)
 {
     Flow = flow;
 }
Пример #14
0
 public EstimatedExchangeAmountRequest(string fromCurrency, string toCurrency, decimal fromAmount, bool useRateId, FlowEnum flow = FlowEnum.FixedRate)
     : base(fromCurrency, toCurrency, fromAmount, 0, string.Empty, string.Empty, flow, DirectionEnum.Direct)
 {
     UseRateId = useRateId;
 }
Пример #15
0
 public EstimatedExchangeAmountRequest(string fromCurrency, string toCurrency, decimal fromAmount, FlowEnum flow = FlowEnum.Standard)
     : base(fromCurrency, toCurrency, fromAmount, 0, string.Empty, string.Empty, flow, DirectionEnum.Direct)
 {
     UseRateId = false;
 }
Пример #16
0
 public EstimatedExchangeAmountRequest(string fromCurrency, string toCurrency, decimal fromAmount, decimal toAmount = 0, FlowEnum flow = FlowEnum.Standard, DirectionEnum type = DirectionEnum.Direct, bool useRateId = false, string fromNetwork = "", string toNetwork = "")
     : base(fromCurrency, toCurrency, fromAmount, toAmount, fromNetwork, toNetwork, flow, type)
 {
     UseRateId = useRateId;
 }