Exemple #1
0
 public void StoreEmotion()
 {
     if (m_isWeb)
     {
         // store the current emotion in Local Storage so the next time the player
         // enters the game, we'll assure another emotion will be shown
         // tanks: https://docs.unity3d.com/560/Documentation/Manual/webgl-interactingwithbrowserscripting.html
         StoreEmotion(m_emotion.GetHashCode());
     }
 }
        /// <summary>
        /// Changes the emotion of the selected CaptionWord or words.
        /// </summary>
        /// <param name="e">The Emotion to set the Caption with.</param>
        public void ChangeEmotion(Emotion e)
        {
            //Determine MarkupType
            switch (CaptionTextBox.SelectionMode)
            {
            case CaptionTextBoxSelectionMode.NoSelection:
                throw new Exception("No selected caption to markup.");     //Should not happen.

            case CaptionTextBoxSelectionMode.SingleWordSelection:
                SelectedCaptionWord.Emotion = e;
                if (e == Emotion.None || e == Emotion.Unknown)
                {
                    ClearGB_Intensity();
                    GB_Intensity.Enabled = false;
                }
                else
                {
                    SetGB_Intensity(SelectedCaptionWord.Intensity);
                }
                break;

            case CaptionTextBoxSelectionMode.MultiWordSelection:
                foreach (CaptionWord cw in SelectedCaption.Words)
                {
                    if (cw.IsSelected)
                    {
                        cw.Emotion = e;
                    }                                           //Set emotion only if selected
                }

                //Clear the Intensity GB and enable/disable it based on emotion
                ClearGB_Intensity();
                if (e == Emotion.None || e == Emotion.Unknown)
                {
                    GB_Intensity.Enabled = false;
                }
                else
                {
                    GB_Intensity.Enabled = true;
                }
                break;

            default: throw new InvalidEnumArgumentException("e", e.GetHashCode(), typeof(Emotion));
            }
        }
        /// <summary>
        /// Sets a radiobutton in GB_Emotiontype to checked based on which Emotion is given and
        /// enables the GroupBox.
        /// </summary>
        /// <param name="e">The Emotion to set.</param>
        private void SetGB_EmotionType(Emotion e)
        {
            switch (e)
            {
            case Emotion.None:  RB_None.Checked = true; break;

            case Emotion.Happy: RB_Happy.Checked = true; break;

            case Emotion.Sad:   RB_Sad.Checked = true; break;

            case Emotion.Fear:  RB_Fear.Checked = true; break;

            case Emotion.Anger: RB_Anger.Checked = true; break;

            default: throw new InvalidEnumArgumentException("e", e.GetHashCode(), typeof(Emotion));
            }

            //Enable Emotion Radio Buttons
            GB_EmotionType.Enabled = true;
        }
Exemple #4
0
 internal override int GetDataHashCode()
 {
     return(Emotion.GetHashCode());
 }
 /// <summary>
 /// The hash code of the echo option is the hash code of the option type xored with the hash code info.
 /// </summary>
 public override int GetHashCode()
 {
     return(base.GetHashCode() ^ Emotion.GetHashCode());
 }
Exemple #6
0
        /// <summary>
        /// Gets the Color of a CaptionWord given the specified Emotion type and Intensity.
        /// </summary>
        /// <param name="e">The emotion of the colour.</param>
        /// <param name="i">The intensity of the colour.</param>
        /// <returns></returns>
        public static CaptionStyle GetStyleOf(Emotion e, Intensity i)
        {
            switch (e)
            {
            case Emotion.Happy:
                switch (i)
                {
                case Intensity.Low:     return(Happy_Low);

                case Intensity.Medium:  return(Happy_Medium);

                case Intensity.High:    return(Happy_High);

                case Intensity.None:    return(None_Style);

                default: throw new InvalidEnumArgumentException("i", i.GetHashCode(), typeof(Intensity));
                }

            case Emotion.Sad:
                switch (i)
                {
                case Intensity.Low:     return(Sad_Low);

                case Intensity.Medium:  return(Sad_Medium);

                case Intensity.High:    return(Sad_High);

                case Intensity.None:    return(None_Style);

                default: throw new InvalidEnumArgumentException("i", i.GetHashCode(), typeof(Intensity));
                }

            case Emotion.Fear:
                switch (i)
                {
                case Intensity.Low:     return(Fear_Low);

                case Intensity.Medium:  return(Fear_Medium);

                case Intensity.High:    return(Fear_High);

                case Intensity.None:    return(None_Style);

                default: throw new InvalidEnumArgumentException("i", i.GetHashCode(), typeof(Intensity));
                }

            case Emotion.Anger:
                switch (i)
                {
                case Intensity.Low:     return(Anger_Low);

                case Intensity.Medium:  return(Anger_Medium);

                case Intensity.High:    return(Anger_High);

                case Intensity.None:    return(None_Style);

                default: throw new InvalidEnumArgumentException("i", i.GetHashCode(), typeof(Intensity));
                }

            case Emotion.None:
                return(None_Style);

            default: throw new InvalidEnumArgumentException("e", e.GetHashCode(), typeof(Emotion));
            }
        }