Пример #1
0
        public RootObjectResponse GetStocks(string country, string language, List <string> symbolList)
        {
            var url           = @"https://api.tme.eu/Products/GetStocks.json";
            var prefixRequest = "POST" + "&" + WebUtility.UrlEncode(@url) + "&";
            var suffixRequest = "";
            var values        = new List <KeyValuePair <string, string> >();

            values.Add(new KeyValuePair <string, string>("Language", language));

            for (int i = 0; i < symbolList.Count; i++)
            {
                values.Add(new KeyValuePair <string, string>("SymbolList[" + i + "]", symbolList[i]));
            }
            values.Add(new KeyValuePair <string, string>("Token", _token));
            values.Add(new KeyValuePair <string, string>("Country", country));



            foreach (var el in values.OrderBy(x => x.Key))
            {
                suffixRequest += suffixRequest.Length > 1 ? WebUtility.UrlEncode("&" + WebUtility.UrlEncode(el.Key) + "=" + WebUtility.UrlEncode(el.Value)) : WebUtility.UrlEncode(WebUtility.UrlEncode(el.Key) + "=" + WebUtility.UrlEncode(el.Value));
            }


            var reply = this.SendPostRequest(url, values, Utlis.CreateToken(prefixRequest + suffixRequest, _secret));

            return(JsonConvert.DeserializeObject <RootObjectResponse>(reply));
        }
Пример #2
0
 public void playBGM(string fileName, bool loop = true)
 {
     if (TmpData.Instanace.CurrentBGM == fileName && BGMAudioSource.isPlaying)
     {
         return;
     }
     if (string.IsNullOrEmpty(fileName))
     {
         StartCoroutine("FadeBgm", null);
         return;
     }
     else
     {
         var clip = Utlis.LoadAudioSource(AudioSourceType.BGM, fileName);
         StartCoroutine("FadeBgm", clip);
         TmpData.Instanace.CurrentBGM = fileName;
     }
 }
        public static void Main(string[] args)
        {
            Utlis.DrawMenssaje("Ingrese 3 los lados de su triangulo");
            int l1 = Convert.ToInt32(
                Console.ReadLine()
                );
            int l2 = Convert.ToInt32(
                Console.ReadLine()
                );
            int l3 = Convert.ToInt32(
                Console.ReadLine()
                );
            int p = l1 + l2 + l3;

            Utlis.DrawMenssaje($"El perimetro de su triangulo es: {p}");
            if (l1 == l2 && l2 == l3)
            {
                Utlis.DrawMenssaje("Y el triangulo es equilatero");
            }
            else if (l1 != l2 && l1 == l3 || l2 != l1 && l2 == l3 || l3 != l2 && l2 == l1)
            {
                Utlis.DrawMenssaje("Y su triangulo es isosceles");
            }
            else
            {
                Utlis.DrawMenssaje("Y su triangulo es escaleno");
            }
            Utlis.DrawMenssaje("Ingrese primero la base y luego la altura");
            int b = Convert.ToInt32(
                Console.ReadLine()
                );
            int h = Convert.ToInt32(
                Console.ReadLine()
                );
            int x = b * h;
            int a = x / 2;

            Utlis.DrawMenssaje($"El area de su triangulo es: {a}");
            Console.ReadKey();
        }
        public static void Main(string[] args)
        {
            var    aletorio = new Random();
            string maquina  = " ";
            int    numeroA  = aletorio.Next(1, 3);
            int    gu       = 0;
            int    gm       = 0;
            int    i        = 0;

            while (gu < 3 || gm < 3)
            {
                i++;
                if (i == 1)
                {
                    Utlis.DrawMenssaje("Bienvenido a piedra papel o tijeras");
                }

                Utlis.DrawMenssaje("Ingrese 1 para piedra 2 para papel y 3 para tijeras");
                int u = Int32.Parse(Console.ReadLine());
                switch (numeroA)
                {
                case 1:
                    maquina = "piedra";
                    break;

                case 2:
                    maquina = "papel";
                    break;

                case 3:
                    maquina = "tijeras";
                    break;
                }

                if (u == 1 && maquina == "tijeras" || u == 2 && maquina == "piedra" || u == 3 && maquina == "papel")
                {
                    Utlis.DrawMenssaje($"Ronda n°{i} ganada");
                    gu++;
                    if (gu == 3)
                    {
                        Utlis.DrawMenssaje("ganaste 3 veces, quieres salir");
                        string salir = Console.ReadLine();
                        if (salir == "si")
                        {
                            Utlis.DrawMenssaje("GANADOR!");
                            return;
                        }
                    }
                }
                else if (u == 1 && maquina == "papel" || u == 2 && maquina == "tijeras" ||
                         u == 3 && maquina == "piedra")
                {
                    Utlis.DrawMenssaje($"Ronda n°{i} perdida");
                    gm++;
                    if (gm == 3)
                    {
                        Utlis.DrawMenssaje("perdiste");
                        return;
                    }
                }
                else
                {
                    Utlis.DrawMenssaje($"Ronda n°{i} empatada");
                }
            }
            Console.ReadKey();
        }