Exemple #1
0
    public void PopulateMenuAsync()
    {
        ColorController.ColoreSfondi   = hexToColor(menuSS.ColorTheme);
        ColorController.ColoreRiquadri = hexToColor(menuSS.ColorFrame);
        NomeLocaleLong = menuSS.Denominazione;
        if (menuSS.LogoBase64Img.Length > 10)
        {
            string b64_string = menuSS.LogoBase64Img;
            b64_string = Regex.Replace(b64_string, @"^data:image\/[a-zA-Z]+;base64,", string.Empty);
            byte[] b64_bytes = System.Convert.FromBase64String(b64_string);

            var tex = new Texture2D(1, 1);
            tex.LoadImage(b64_bytes);
            if (tex != null)
            {
                var rec = new Rect(0, 0, tex.width, tex.height);
                cellImage.sprite         = Sprite.Create(tex, rec, new Vector2(0, 1), 100);
                cellImage.preserveAspect = true;
            }
        }
        DataService ds = new DataService("DatiCliente.db");

        fidelity = ds.GetFidelity(Restaurant);
        if (fidelity == null)
        {
            fidelity = "";
        }
        if (fidelity.Length > 12)
        {
            fidelity.Remove(fidelity.Length - 1);
            QREncodeTest.QR.Encode(fidelity);
        }
        Locale locale = ClassConverter.localifromSS(menuSS);

        welcome.text = locale.s_Landing;
        if (locale.s_Landing.Length < 3 || locale.s_Landing == null)
        {
            WelcomePanel.gameObject.SetActive(false);
        }
        Key = locale.s_CID;
        if (locale.s_pinPag.Length > 3)
        {
            PinPagOn = true;
        }
        secret = locale.s_SKE;
        //Key = "AaK1Dsz3z2xqhYs2JaHOXQpxUxxdO3ZYihg0IuebKVxUwU2xh4vS0BThdSz4rG4uSi-QU6gMXFy_QsNE";// locale.s_CID;
        //secret = "EBjXni131N_Ci2795OXE2qc11ndEncytbujnbHTK2Ez4o9HszD0ra2Rw8F_O03pluGxYWiZ46jwwsYiY"; // locale.s_SKE;
        consInt = locale.s_consegnaInterna;
        pagaConsegnaAbilitata = locale.s_EnablePagaCons;
        Tky          = locale.s_TakeAway;
        Dlv          = locale.s_Delivery;
        Base         = locale.s_Base;
        limitePezzi  = locale.s_LimitPZ;
        limiteValore = locale.s_LimitVAL;
        minimoValore = locale.s_LimitMinVAL;
        PinPag       = locale.s_pinPag;
        registrazioneObbligatoria = locale.s_RichiediDatiAccesso;
        bool MD = locale.s_EnableMD;

        SelectionBtnRoot.transform.GetChild(0).gameObject.SetActive(MD);
        SelectionBtnRoot.transform.GetChild(1).gameObject.SetActive(Base); //Base
        SelectionBtnRoot.transform.GetChild(2).gameObject.SetActive(Tky);
        SelectionBtnRoot.transform.GetChild(3).gameObject.SetActive(Dlv);
        SelectionBtnRoot.transform.GetChild(4).gameObject.SetActive(consInt);
        SelectionBtnRoot.transform.GetChild(5).gameObject.SetActive(fidelity.Length >= 12);


        if (locale.s_RichiediDatiAccesso)
        {
            if (!ClienteRegMin || !ClienteRegistrato || fidelity.Length <= 11)
            {
                registrazioneObbligatoria = (true);
                PannelloRegistrazione.SetActive(true);
            }
        }
        SelectionPanel.SetActive(true);
        string menuSs = ClassConverter.menufromSS(menuSS);

        menu = Menu_Ristorante.LoadMenu(menuSs, Db);

        ColorController.CController.CambiaColori();
        Loader.gameObject.SetActive(false);
        if (!loadFromCache)
        {
            AggiungiLocale();
        }
    }
Exemple #2
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);
        }
    }