Exemple #1
0
    public IEnumerator LoadRemoteImage(c_Data data)
    {
        string path = data.imageUrl;

        Texture2D texture = null;

        // Get the remote texture

#if UNITY_2017_4_OR_NEWER
        var webRequest = UnityWebRequestTexture.GetTexture(path);
        WWW w          = new WWW(path);

        yield return(webRequest.SendWebRequest());

        string str   = "";
        var    merda = webRequest.GetType();
        var    dd    = webRequest.GetResponseHeader(str);
        if (webRequest.isNetworkError || webRequest.isHttpError)
        {
            Debug.LogError("Failed to download image [" + path + "]: " + webRequest.error);
        }
        else
        {
            texture = ((DownloadHandlerTexture)webRequest.downloadHandler).texture;
        }
#else
        WWW www = new WWW(path);
        yield return(www);

        texture = www.texture;
#endif

        if (texture != null)
        {
            var rec = new Rect(0, 0, texture.width, texture.height);
            cellImage.sprite = Sprite.Create(texture, rec, new Vector2(0, 1), 100);
            //cellImage.sprite = Sprite.Create(texture, new Rect(0, 0, data.imageDimensions.x, data.imageDimensions.y), new Vector2(0, 0));
            cellImage.preserveAspect = true;
        }

        /* else
         * {
         *   ClearImage();
         * }*/
    }
Exemple #2
0
 public void SetData(c_Data data)
 {
     _loadImageCoroutine = StartCoroutine(LoadRemoteImage(data));
 }
Exemple #3
0
    void Start()
    {
        DataService C = new DataService("DatiCliente.db");

        if (false)
        {
            ContentCreator.ClienteRegistrato = C.CheckDatiCliente();
            if (ContentCreator.ClienteRegistrato)
            {
                ContentCreator.ClienteTKy    = C.GetTipoDati();
                ContentCreator.ClienteRegMin = C.GetRegMin();
                IEnumerable <DatiCliente> Dci = C.GetDatiCliente();
                foreach (DatiCliente D in Dci)
                {
                    if (D.Id == 1)
                    {
                        ContentCreator.datiCliente.Nome      = D.Nome;
                        ContentCreator.datiCliente.Cognome   = D.Cognome;
                        ContentCreator.datiCliente.Tel       = D.Tel;
                        ContentCreator.datiCliente.Email     = D.Email;
                        ContentCreator.datiCliente.Indirizzo = D.Indirizzo;
                        ContentCreator.datiCliente.Citta     = D.Citta;
                        ContentCreator.datiCliente.CAP       = D.CAP;
                    }
                }
            }
        }



        //Update();
        if ((seat == "" && sala == "") || (seat == "X" || sala == "X") || (seat == null && sala == null))
        {
            SelectionPanel.gameObject.SetActive(true);
        }
        if (Db == 0)
        {
            //loadtext.text = ("Db= " + Db + "Utenza =" + Utenza + "Restaurant =" + Restaurant);
            if (urlLocali == null)
            {
                urlLocali  = "https://safemenu.altervista.org/wp-content/MolRa/Locale.xml";
                Restaurant = "MolRa";
                seat       = "T0";
                Db         = 0;
            }
            Locali lc = Locali.Load(urlLocali);
            foreach (Locale locale in lc.CollezioneLocali)
            {
                NomeLocaleLong = locale.s_nomeLocale;
                hideTotal      = locale.s_HideTotal;
                if (hideTotal)
                {
                    Color col = new Color(0, 0, 0, 0);
                    Comanda.C5.Totale.color      = col;
                    Comanda.C5.text_Totale.color = col;
                }
                else
                {
                    Color col = new Color(0, 0, 0, 1);
                    Comanda.C5.Totale.color      = col;
                    Comanda.C5.text_Totale.color = col;
                }
                ColorController.ColoreSfondi   = hexToColor(locale.s_ColorTheme);
                ColorController.ColoreRiquadri = hexToColor(locale.s_ColorFrame);
                print(locale.s_Landing);
                print(locale.s_ShortName);
                print(locale.s_Base);
                if (locale.s_ShortName == Restaurant)
                {
                    welcome.text = locale.s_Landing;
                    //Key = "AaK1Dsz3z2xqhYs2JaHOXQpxUxxdO3ZYihg0IuebKVxUwU2xh4vS0BThdSz4rG4uSi-QU6gMXFy_QsNE";// locale.s_CID;
                    //secret = "EBjXni131N_Ci2795OXE2qc11ndEncytbujnbHTK2Ez4o9HszD0ra2Rw8F_O03pluGxYWiZ46jwwsYiY"; // locale.s_SKE;
                    Key     = locale.s_CID;
                    secret  = locale.s_SKE;
                    consInt = locale.s_consegnaInterna;
                    Tky     = locale.s_TakeAway;
                    Dlv     = locale.s_Delivery;
                    Base    = locale.s_Base;
                    bool MD = locale.s_EnableMD;
                    SelectionBtnRoot.transform.GetChild(0).gameObject.SetActive(MD);
                    SelectionBtnRoot.transform.GetChild(1).gameObject.SetActive(Base);
                    SelectionBtnRoot.transform.GetChild(2).gameObject.SetActive(Tky);
                    SelectionBtnRoot.transform.GetChild(3).gameObject.SetActive(Dlv);
                    SelectionBtnRoot.transform.GetChild(4).gameObject.SetActive(consInt);
                    if (seat == "Tky" || seat == "Dlv")
                    {
                        welcome.text  = locale.s_LandingGen;
                        CodeUniversal = true;
                        Comanda.C5.Invia_Button_Text.text = "Vai al pagamento";
                        Comanda.C5.ComandaText.text       = "procedere con il pagamento?";
                        Comanda.Pay = true;
                        currentMode = seat;
                    }
                }
            }



            const string glyphs     = "abcdefghijklmnopqrstuvwxyz0123456789"; //add the characters you want
            int          charAmount = UnityEngine.Random.Range(8, 12);        //set those to the minimum and maximum length of your string
            for (int i = 0; i < charAmount; i++)
            {
                myString += glyphs[UnityEngine.Random.Range(0, glyphs.Length)];
            }
            token     = myString;
            myString += "GKtsh!hdisa's^nlaoek";
            md5       = GetHash(myString);
            if (Restaurant != null)
            {
                urlMenu = preUrl1 + Restaurant + "/Menu4.json";
                //urlMenu = preUrl + Restaurant + "&token="+token+"&md5="+md5;
                LogoData = new c_Data()
                {
                    imageUrl        = preUrl1 + Restaurant + "/Logo.png",
                    imageDimensions = new Vector2(643f, 227f)
                };
            }
            else
            {
                urlMenu  = "https://aruba.streetshot.it/pinapp/get.php?item=MolRa.menu.json&token=k6dduaqb1&md5=039e8a640a0d15b99641b7e3a2e08340";
                LogoData = new c_Data()
                {
                    imageUrl        = "https://aruba.streetshot.it/pinapp/get.php?item=MolRa.Logo.png&token=k6dduaqb1&md5=039e8a640a0d15b99641b7e3a2e08340",
                    imageDimensions = new Vector2(643f, 227f)
                };
            }
            SetData(LogoData);
            //ColorController.CController.CambiaColori();
            menu = Menu_Ristorante.LoadMenu(urlMenu, Db);
            Loader.gameObject.SetActive(false);
            if (!loadFromCache)
            {
                AggiungiLocale();
            }
        }
        else if (Db == 1)
        {
            //menuSS = CallWebService.LoadSSMenu(Utenza, Restaurant);
            CallWebService.LoadSSMenu(Restaurant, Utenza);
        }
    }