Exemplo n.º 1
0
    private IEnumerator LoginAsynk(UGS.Auth_PIN auth)
    {
        yield return(Context.StartCoroutine(auth.Process()));

        if (!auth.HasError)
        {
            Debug.Log(auth.Result);
            JsonData response = LitJsonSrc.JsonMapper.ToObject(auth.Result);
            if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 1)
            {
                StateController.Instance.Canvas.SetActive(true);
                StateController.Instance.PIN_text.text = "PIN Ok!";
                StateController.Instance.ChangeState(Mark.GetSchedule);
            }
            if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 0 && response.ContainsKey("code"))
            {
                StateController.Instance.Canvas.SetActive(true);
                string label = null;
                foreach (char c in response["code"].AsInt().ToString())
                {
                    label += c + " ";
                }
                //StateController.Instance.PIN_text.text = response["code"].AsInt().ToString();
                StateController.Instance.PIN_text.text = label;
                Context.StartCoroutine(RepeatRequest());
            }
        }
        else
        {
        }
    }
Exemplo n.º 2
0
    private IEnumerator LoginAsynk(UGS.Auth_PIN auth)
    {
        yield return(StartCoroutine(auth.Process()));

        if (!auth.HasError)
        {
            Debug.Log(auth.Result);
            JsonData response = LitJsonSrc.JsonMapper.ToObject(auth.Result);
            if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 1)
            {
                splash.SetActive(false);
                pin_overlay.SetActive(true);
                PIN_text.text = "PIN Ok!";
                SceneManager.LoadScene("DA_player");
            }
            if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 0 && response.ContainsKey("code"))
            {
                splash.SetActive(false);
                pin_overlay.SetActive(true);
                string label = null;
                foreach (char c in response["code"].AsInt().ToString())
                {
                    label += c + " ";
                }
                //StateController.Instance.PIN_text.text = response["code"].AsInt().ToString();
                PIN_text.text = label;
                StartCoroutine(RepeatRequest());
            }
        }
        else
        {
            LoadLogin();
        }
    }
Exemplo n.º 3
0
    private IEnumerator LoginAsynk(UGS.Auth_PIN auth)
    {
        yield return(StartCoroutine(auth.Process()));

        if (!auth.HasError)
        {
            Debug.Log(auth.Result);
            JsonData response = LitJsonSrc.JsonMapper.ToObject(auth.Result);
            if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 1)
            {
                LoadShedule();
            }
        }
        else
        {
        }
    }
Exemplo n.º 4
0
    private IEnumerator LoadASheduleAsynk(UGS.Auth_PIN shedule)
    {
        yield return(StartCoroutine(shedule.Process()));

        if (!shedule.HasError)
        {
            Debug.Log("Shedule");


            JsonData response = LitJsonSrc.JsonMapper.ToObject(shedule.Result);
            if (response.ContainsKey("data"))
            {
                IDictionary tdMediasIdList = response["data"]["schedule"]["mediasIdList"] as IDictionary;
                IDictionary tdMedias       = response["data"]["medias"] as IDictionary;
                Debug.Log(response["data"]["schedule"]["mediasIdList"].Count);

                int i = 0;
                foreach (string VARIABLE in tdMediasIdList.Keys)
                {
                    IDictionary      ItemClip        = tdMedias[tdMediasIdList[VARIABLE].ToString()] as IDictionary;
                    ItemDataschedule newDataschedule = new ItemDataschedule
                    {
                        number    = i,
                        TimeStart = VARIABLE,
                        id        = tdMediasIdList[VARIABLE].ToString(),
                        duration  = ItemClip["duration"].ToString(),
                        PathLoad  = ItemClip["path"].ToString(),
                        PathLocal = null,
                    };
                    DataSchedule.Instance.addItemDataSchedule(newDataschedule);
                    i++;
                    // Debug.Log(VARIABLE + "   " + tdMediasIdList[VARIABLE] + "   " + ItemClip["path"]);
                }
                DataSchedule.Instance.PrintDataSchedule();
            }
            else
            {
                Debug.Log("No");
            }
        }
        else
        {
        }
    }
Exemplo n.º 5
0
    private IEnumerator LoadASheduleAsynk(UGS.Auth_PIN shedule)
    {
        yield return(StartCoroutine(shedule.Process()));

        if (!shedule.HasError)
        {
            Debug.Log("Shedule=" + shedule.Result);
            StateController.Instance.StopSelectNumberClip();
            StateController.Instance.SetstopDowloadMovie(true);
            // StateController.Instance.StopDeleteClip();
            //StateController.Instance.StoptDowloadMoive();
            DataSchedule.Instance.ClearDataschedules();


            JsonData response = LitJsonSrc.JsonMapper.ToObject(shedule.Result);
            if (response.ContainsKey("data"))
            {
                if (response["data"]["schedule"].ContainsKey("mediasIdList"))
                {
                    IDictionary tdMediasIdList = response["data"]["schedule"]["mediasIdList"] as IDictionary;
                    IDictionary tdMedias       = response["data"]["medias"] as IDictionary;
                    StateController.Instance.GetMediasSchedule().Clear();
                    foreach (var item in tdMedias.Keys)
                    {
                        IDictionary I_Clip = tdMedias[item] as IDictionary;
                        StateController.Instance.GetMediasSchedule().Add(I_Clip["id"].ToString());
                    }
                    //    Debug.Log(response["data"]["schedule"]["mediasIdList"].Count);

                    int i = 0;
                    foreach (string VARIABLE in tdMediasIdList.Keys)
                    {
                        IDictionary      ItemClip        = tdMedias[tdMediasIdList[VARIABLE].ToString()] as IDictionary;
                        ItemDataschedule newDataschedule = new ItemDataschedule
                        {
                            number    = i,
                            TimeStart = VARIABLE,
                            id        = tdMediasIdList[VARIABLE].ToString(),
                            duration  = ItemClip["duration"].ToString(),
                            PathLoad  = ItemClip["path"].ToString(),
                            PathLocal = null,
                            isLocal   = false,
                        };
                        DataSchedule.Instance.addItemDataSchedule(newDataschedule);
                        i++;
                        // Debug.Log(VARIABLE + "   " + tdMediasIdList[VARIABLE] + "   " + ItemClip["path"]);
                    }
                    //  foreach (ItemDataschedule itemDataschedule in DataSchedule.Instance.GetDataschedules())
                    //  {
                    //      string path = Application.persistentDataPath + "/" + itemDataschedule.id.ToString() + ".mp4";
                    //      if (File.Exists(path))
                    //      {
                    //          itemDataschedule.PathLocal = path;
                    //      }
                    //  }

                    // DataSchedule.Instance.PrintDataSchedule();

                    StateController.Instance.SetAction();

                    StateController.Instance.Canvas.SetActive(false);
                    StateController.Instance.SetCurrentClip(-1);
                    StateController.Instance.SetIsFirstDowload(true);
                    //StateController.Instance.PrepareMediasList();

                    StateController.Instance.StartSelectNumberClip();
                    // StateController.Instance.SetSelectedClip(true);
                    //  StateController.Instance.StartDowloadMoive();
                }
                else
                {
                    StateController.Instance.StopPlayer();
                    StateController.Instance.SetAction();
                    StateController.Instance.Canvas.SetActive(false);
                }
            }
            else
            {
                Debug.Log("No");
            }
        }
        else
        {
        }
    }
Exemplo n.º 6
0
 private void LoadShedule()
 {
     UGS.UgsClient m_client_shedule = new UgsClient("https://beta.dropadverts.com/player/get-schedule");
     UGS.Auth_PIN  shedule          = m_client_shedule.Auth_pin(ShowNetworkInterfaces());
     StartCoroutine(LoadASheduleAsynk(shedule));
 }
Exemplo n.º 7
0
 private void LoadLogin()
 {
     UGS.UgsClient m_client_auth = new UgsClient("https://beta.dropadverts.com/player/auth");
     UGS.Auth_PIN  aut           = m_client_auth.Auth_pin(ShowNetworkInterfaces());
     Context.StartCoroutine(LoginAsynk(aut));
 }