示例#1
0
        public Emo getMax()
        {
            Emo max = Emo.Angry;

            if (getEmotion(Emo.Fear) > getEmotion(max))
            {
                max = Emo.Fear;
            }
            if (getEmotion(Emo.Happy) > getEmotion(max))
            {
                max = Emo.Happy;
            }
            if (getEmotion(Emo.Neutral) > getEmotion(max))
            {
                max = Emo.Neutral;
            }

            if (getEmotion(Emo.Sad) > getEmotion(max))
            {
                max = Emo.Sad;
            }

            if (getEmotion(Emo.Surprise) > getEmotion(max))
            {
                max = Emo.Surprise;
            }
            return(max);
        }
示例#2
0
    void alterLandscape(EmotionJson emotionJson)
    {
        Emo emotion = emotionJson.getMax();

        switch (emotion)
        {
        case Emo.Angry:
            setAngryLandscape();
            break;

        case Emo.Fear:
            setFearLandscape();
            break;

        case Emo.Happy:
            setHappyLandscape();
            break;

        case Emo.Neutral:
            setNeutralLandscape();
            break;

        case Emo.Sad:
            setSadLandscape();
            break;

        case Emo.Surprise:
            setSurpriseLandscape();
            break;

        default:
            break;
        }
    }
示例#3
0
        public float getEmotion(Emo emo)
        {
            switch (emo)
            {
            case Emo.Angry:
                return(angry);

            case Emo.Fear:
                return(fear);

            case Emo.Happy:
                return(happy);

            case Emo.Neutral:
                return(neutral);

            case Emo.Sad:
                return(sad);

            case Emo.Surprise:
                return(surprise);

            default:
                return(neutral);
            }
        }
示例#4
0
    void playMusic(Emo emotion)
    {
        resetMusic();
        switch (emotion)
        {
        case Emo.Angry:
            angryClip.volume = 1.0F;
            break;

        case Emo.Fear:
            fearClip.volume = 1.0F;
            break;

        case Emo.Happy:
            happyClip.volume = 1.0F;
            break;

        case Emo.Neutral:
            neutralClip.volume = 1.0F;
            break;

        case Emo.Sad:
            sadClip.volume = 1.0F;
            break;

        case Emo.Surprise:
            surprisedClip.volume = 1.0F;
            break;

        default:
            break;
        }
    }
示例#5
0
        public async void analisisEmociones(List <Emociones> emocion)
        {
            Emo se = new Emo();

            foreach (var lista in emocion)
            {
                felicidad = lista.faceAttributes.emotion.happiness;
                enojo     = lista.faceAttributes.emotion.anger;
                desprecio = lista.faceAttributes.emotion.contempt;
                asco      = lista.faceAttributes.emotion.disgust;
                miedo     = lista.faceAttributes.emotion.fear;
                neutral   = lista.faceAttributes.emotion.neutral;
                tristeza  = lista.faceAttributes.emotion.sadness;
                sorpresa  = lista.faceAttributes.emotion.surprise;
            }

            if (felicidad > 0.5)
            {
                se.idEmocionReal = 1;
                mensaje          = "Muy bien, estas feliz!!";
            }

            if (enojo > 0.5)
            {
                mensaje = "¿Porque estas enojado?";
            }

            if (desprecio > 0.5)
            {
                mensaje = "No se te ve muy contento!!";
            }

            if (asco > 0.5)
            {
                mensaje = "¿No te gusta algo?";
            }

            if (miedo > 0.5)
            {
                mensaje = "¿Que te asusta?";
            }

            if (neutral > 0.5)
            {
                mensaje = "Estas Normal";
            }

            if (tristeza > 0.5)
            {
                mensaje = "¿Porque estas triste?";
            }

            if (sorpresa > 0.5)
            {
                mensaje = "Te veo muy soprendido!";
            }

            HttpClient client = new HttpClient();
            string     url    = "https://apiapperger.azurewebsites.net/api/Emociones?idEmocion=" + se.idEmocionReal;
            var        uri    = new Uri(url);

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage response;
            var json2   = JsonConvert.SerializeObject(se);
            var content = new StringContent(json2, Encoding.UTF8, "application/json");

            response = await client.GetAsync(uri);

            if (response.StatusCode == System.Net.HttpStatusCode.Accepted)
            {
                await DisplayAlert("Msj", mensaje, "Ok");
            }
            else
            {
                await DisplayAlert("Msj", "No se pudo insertar emocion", "Ok");
            }
        }