Beispiel #1
0
        // Update is called once per frame
        public void  ReadUpdate()
        {
            LipSyncReading     = AutoExperimentInstruction.Reading;
            LipSyncAudioSource = GetComponent <AudioSource>();
            LipSyncAudioData   = GetComponent <LipSync>();
            AutoEnable         = GetComponent <EnableLipsync>();
            infoClip           = LipSyncAudio;
            infoData           = LipSyncAudioDataSpeaker;
            AutoEnable.enabled = false;

            LipSyncReading = AutoExperimentInstruction.Reading;
            if (LipSyncReading)
            {
                LipSyncAudioData.defaultClip = infoData;
                LipSyncAudioSource.clip      = infoClip;
                LipSyncAudioData.Play(infoData);
                LipSyncAudioSource.Play();
            }
            else
            {
                LipSyncAudio       = null;
                LipSyncAudioData   = null;
                AutoEnable.enabled = false;
            }
        }
 // Update is called once per frame
 void Update()
 {
     if (!ls)
     {
         ls = GameObject.Find("remy").GetComponent <LipSync>();
     }
 }
        public void Start()
        {
            var lipSyncAssetName = GetParameter(0);
            var lipSyncData      = DialogueManager.LoadAsset(lipSyncAssetName, typeof(LipSyncData)) as LipSyncData;
            var subject          = GetSubject(1, Sequencer.Speaker);

            lipSync = (subject == null) ? null : subject.GetComponentInChildren <LipSync>();
            nowait  = string.Equals(GetParameter(2), "nowait", System.StringComparison.OrdinalIgnoreCase);
            if (lipSync == null)
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.LogWarning("Dialogue System: Sequencer: LipSync(" + GetParameters() + "): LipSync subject not found");
                }
            }
            else if (lipSyncData == null)
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.LogWarning("Dialogue System: Sequencer: LipSync(" + GetParameters() + "): LipSync Data not found");
                }
            }
            else
            {
                if (DialogueDebug.LogInfo)
                {
                    Debug.Log("Dialogue System: Sequencer: LipSync(" + lipSyncData + ", " + lipSync + (nowait ? ", nowait" : string.Empty) + ")");
                }
                lipSync.Play(lipSyncData);
            }
            if (nowait)
            {
                Stop();
            }
        }
Beispiel #4
0
        protected void GUIVowel(LipSync sync)
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("fftWindow"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("recognizeText"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("recognizerLanguage"));
            string[] selectedVowels = null;
            switch (sync.recognizerLanguage)
            {
            case ERecognizerLanguage.Japanese:
                selectedVowels = LipSync.vowelsJP;
                break;

            case ERecognizerLanguage.Chinese:
                selectedVowels = LipSync.vowelsCN;
                break;
            }

            EditorGUILayout.LabelField("Vowel Animations");
            EditorGUILayout.BeginVertical(EditorStyles.textField);
            {
                SerializedProperty lipAnims = serializedObject.FindProperty("lipAnims");
                for (int i = 0; i < selectedVowels.Length; ++i)
                {
                    EditorGUILayout.PropertyField(lipAnims.GetArrayElementAtIndex(i), new GUIContent(selectedVowels[i]));
                }
            }
            EditorGUILayout.EndVertical();
        }
Beispiel #5
0
        public LipSyncEditor(LipSync lipSync)
        {
            InitializeComponent();
            _lipSync        = lipSync;
            this.AutoScroll = true;

            int x = TEXT_BOX_START_X, y = TEXT_BOX_START_Y;

            for (int i = 0; i < _lipSync.CharactersPerFrame.Length; i++)
            {
                Label label = new Label();
                label.Left     = x;
                label.Top      = y + 2;
                label.AutoSize = true;
                label.Text     = i.ToString();
                this.Controls.Add(label);

                TextBox textBox = new TextBox();
                textBox.Left         = x + 20;
                textBox.Top          = y;
                textBox.Size         = new Size(150, 23);
                textBox.Tag          = i;
                textBox.Text         = _lipSync.CharactersPerFrame[i];
                textBox.TextChanged += new EventHandler(textBox_TextChanged);

                this.Controls.Add(textBox);
                y += 25;
                if (i % 10 == 9)
                {
                    x += 200;
                    y  = TEXT_BOX_START_Y;
                }
            }
            UpdateControlsEnabled();
        }
Beispiel #6
0
 // Use this for initialization
 void Start()
 {
     MarylandshowOptions = false;
     LipSyncAudioSource  = GetComponent <AudioSource>();
     LipSyncAudioData    = GetComponent <LipSync>();
     enableWOZ           = false;
 }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     LipSyncAudioSource  = GetComponent <AudioSource>();
     LipSyncAudioData    = GetComponent <LipSync>();
     AutoReading         = GetComponent <AutoAssignLipSync>();
     AutoReading.enabled = false;
 }
        public static AudioSource Play(Char speaker, int lineID, string language)
        {
            if (speaker == null)
            {
                return(null);
            }

                        #if RogoLipSyncIsPresent
            if (lineID > -1 && speaker != null && KickStarter.speechManager.searchAudioFiles)
            {
                LipSyncData lipSyncData = (LipSyncData)KickStarter.runtimeLanguages.GetSpeechLipsyncFile <LipSyncData> (lineID, speaker);

                if (lipSyncData != null)
                {
                    LipSync lipSync = speaker.GetComponent <LipSync>();
                    if (lipSync != null && lipSync.enabled)
                    {
                        lipSync.Play(lipSyncData);
                        return((lipSyncData.clip) ? lipSync.audioSource : null);
                    }
                    else
                    {
                        ACDebug.LogWarning("No LipSync component found on " + speaker.gameObject.name + " gameobject.");
                    }
                }
            }
                        #else
            ACDebug.LogError("The 'RogoLipSyncIsPresent' preprocessor define must be declared in the Player Settings.");
                        #endif

            return(null);
        }
Beispiel #9
0
    private void Start()
    {
        ThreadStart ts = new ThreadStart(GetInfo);

        mThread = new Thread(ts);
        mThread.Start();
        lipSync = GameObject.Find("LipController").GetComponent <LipSync>();
    }
Beispiel #10
0
 // Start is called before the first frame update
 void Start()
 {
     LipSyncReading     = AutoExperimentInstruction.Reading;
     LipSyncAudioSource = GetComponent <AudioSource>();
     LipSyncAudioData   = GetComponent <LipSync>();
     AutoEnable         = GetComponent <EnableLipsync>();
     infoClip           = LipSyncAudio;
     infoData           = LipSyncAudioDataSpeaker;
     //   AutoEnable.enabled = false;
 }
Beispiel #11
0
    public void StartLipSync()
    {
        if (lipsyncOn)
        {
            lipsync = ParentAvatar.AddComponent <LipSync>();

            lipsync.realtimeMoCap = false;
            lipsync.StartAfterConfig(audioClip, RootPosition);

            // lipsync.avatar_scale = ParentAvatar.transform.localScale.x;
        }
    }
Beispiel #12
0
        public EmotionShape GetShape(LipSync character)
        {
            EmotionShape shape = new EmotionShape("Mixed");

            // Cache Emotions for more performant cross-checking
            Dictionary <string, EmotionShape> emotionCache = new Dictionary <string, EmotionShape>();

            foreach (EmotionShape emotionShape in character.emotions)
            {
                emotionCache.Add(emotionShape.emotion, emotionShape);
            }

            for (int i = 0; i < emotions.Count; i++)
            {
                if (emotionCache.ContainsKey(emotions[i].emotion))
                {
                    EmotionShape subShape = emotionCache[emotions[i].emotion];

                    // Blendables
                    for (int b = 0; b < subShape.blendShapes.Count; b++)
                    {
                        if (shape.blendShapes.Contains(subShape.blendShapes[b]))
                        {
                            shape.weights[shape.blendShapes.IndexOf(subShape.blendShapes[b])] += subShape.weights[b] * emotions[i].weight;
                        }
                        else
                        {
                            shape.blendShapes.Add(subShape.blendShapes[b]);
                            shape.weights.Add(subShape.weights[b] * emotions[i].weight);
                        }
                    }

                    // Bones
                    for (int b = 0; b < subShape.bones.Count; b++)
                    {
                        BoneShape bone = subShape.bones[b];

                        if (shape.HasBone(bone.bone))
                        {
                            shape.bones[shape.IndexOfBone(bone.bone)].endPosition += bone.endPosition * emotions[i].weight;
                            shape.bones[shape.IndexOfBone(bone.bone)].endRotation += bone.endRotation * emotions[i].weight;
                        }
                        else
                        {
                            shape.bones.Add(new BoneShape(bone.bone, bone.endPosition * emotions[i].weight, bone.endRotation * emotions[i].weight));
                        }
                    }
                }
            }

            return(shape);
        }
Beispiel #13
0
    public static void ShowWindow(LipSync component, AnimatorController controller)
    {
        GestureSetupWizard window = EditorWindow.GetWindow <GestureSetupWizard>(true);

        window.component  = component;
        window.controller = controller;
        window.topMessage = "Setting up Gestures for " + controller.name + ".";
        window.totalSteps = 2;
        window.Focus();
        window.titleContent = new GUIContent("Gesture Setup Wizard");

        window.settings = LipSyncEditorExtensions.GetProjectFile();
    }
    void OnDisable()
    {
        if (previewTarget != null)
        {
            UpdatePreview(0);
            previewTarget = null;
        }

        if (lsdTarget.clip && isPlaying)
        {
            AudioUtility.StopClip(lsdTarget.clip);
        }
    }
        public static void Stop(Char speaker)
        {
            if (speaker == null)
            {
                return;
            }

                        #if RogoLipSyncIsPresent
            LipSync lipSync = speaker.GetComponentInChildren <LipSync>();
            if (lipSync != null && lipSync.enabled)
            {
                lipSync.Stop(true);
            }
                        #endif
        }
Beispiel #16
0
    // Update is called once per frame
    void Update()
    {
        if (!ls)
        {
            ls = GameObject.Find("remy").GetComponent <LipSync>();

            // ls.Play(lsAudio[1]);
        }
        timer += Time.deltaTime;
        if (timer > 24 && played == false)
        {
            ls.Play(lsAudio[2]);
            played = true;
        }
    }
    void TargetChosen(object data)
    {
        if (data != null)
        {
            visualPreview = true;
            previewTarget = (LipSync)data;

            previewTarget.TempLoad(lsdTarget.phonemeData, lsdTarget.emotionData, lsdTarget.clip, lsdTarget.length);
            previewTarget.ProcessData();
        }
        else
        {
            visualPreview = false;
        }
    }
Beispiel #18
0
 public static void startSpeaking()
 {
     //EditorUtility.DisplayProgressBar("Simple Progress Bar", "Shows a progress bar for the given seconds",0.5f);
     qs_no++;
     if (qs_no <= 5)
     {
         string path = "Lipsync/Custom/" + qs[qs_no];
         clip      = Resources.Load <LipSyncData>(path);
         component = GameObject.Find("lincoln").GetComponent <LipSync>();
         component.Play(clip);
     }
     else
     {
         SceneManager.LoadScene("result");
     }
 }
    public override void OnInteractivePreviewGUI(Rect r, GUIStyle background)
    {
        if (lsdTarget.length == 0)
        {
            lsdTarget.length = lsdTarget.clip.length;
        }
#if UNITY_5_3_6 || UNITY_5_4_OR_NEWER
        if (lsdTarget.clip != null)
        {
            AudioUtility.DrawWaveForm(lsdTarget.clip, 0, new Rect(0, r.y + 3, EditorGUIUtility.currentViewWidth, r.height));
        }
#else
        if (waveform == null && lsdTarget.clip != null)
        {
            waveform = AudioUtility.GetWaveForm(lsdTarget.clip, 0, EditorGUIUtility.currentViewWidth, 128);
        }
        if (lsdTarget.clip != null && waveform != null)
        {
            GUI.DrawTexture(new Rect(0, r.y + 3, EditorGUIUtility.currentViewWidth, r.height), waveform);
        }
#endif
        //Playhead
        if (Event.current.button != 1)
        {
            seekPosition = GUI.HorizontalSlider(new Rect(0, r.y + 3, EditorGUIUtility.currentViewWidth, r.height), seekPosition, 0, 1, GUIStyle.none, GUIStyle.none);
        }

        GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 3, r.y, 7, r.height), playhead_line);
        GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 7, r.y, 15, 15), playhead_top);
        GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 7, r.y + r.height - 16, 15, 15), playhead_bottom);

        if (Event.current.type == EventType.Repaint)
        {
            LipSyncEditorExtensions.DrawTimeline(r.y, 0, lsdTarget.length, r.width);
        }

        if (visualPreview && previewTarget != null)
        {
            EditorGUI.HelpBox(new Rect(20, r.y + r.height - 45, r.width - 40, 25), "Preview mode active. Note: only Phonemes and Emotions will be shown in the preview.", MessageType.Info);
        }
        else if (previewTarget != null)
        {
            UpdatePreview(0);
            previewTarget = null;
        }
    }
Beispiel #20
0
    public static void ShowWindow(LipSync component, AnimatorController controller)
    {
        GestureSetupWizard window = EditorWindow.GetWindow <GestureSetupWizard>(true);

        window.component  = component;
        window.controller = controller;
        window.topMessage = "Setting up Gestures for " + controller.name + ".";
        window.totalSteps = 2;
        window.Focus();
        window.titleContent = new GUIContent("Gesture Setup Wizard");

        //Get Settings File
        string[] guids = AssetDatabase.FindAssets("ProjectSettings t:LipSyncProject");
        string   path  = "";

        if (guids.Length > 0)
        {
            path = AssetDatabase.GUIDToAssetPath(guids[0]);

            if (guids.Length > 1)
            {
                Debug.LogWarning("LipSync: Multiple LipSyncProject files found. Only one will be used.");
            }
        }

        window.settings = (LipSyncProject)AssetDatabase.LoadAssetAtPath(path, typeof(LipSyncProject));

        if (window.settings == null)
        {
            window.settings = ScriptableObject.CreateInstance <LipSyncProject>();

            LipSyncProject newSettings = ScriptableObject.CreateInstance <LipSyncProject>();
            newSettings.emotions      = new string[] { "default" };
            newSettings.emotionColors = new Color[] { new Color(1f, 0.7f, 0.1f) };

            EditorUtility.CopySerialized(newSettings, window.settings);
            AssetDatabase.CreateAsset(window.settings, "Assets/Rogo Digital/LipSync/ProjectSettings.asset");
            AssetDatabase.Refresh();
            DestroyImmediate(newSettings);
        }
    }
Beispiel #21
0
        protected void GUIAdvanceOptions(LipSync sync)
        {
            EditorGUILayout.Space();
            isAdvancedOptionsFoldOut = EditorGUILayout.Foldout(isAdvancedOptionsFoldOut, "Advanced Options");
            if (isAdvancedOptionsFoldOut)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("windowSize"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("amplitudeThreshold"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("mouthSwitchInterval"));
            }
            EditorGUILayout.Space();

            if (Application.isPlaying)
            {
                EditorGUILayout.HelpBox("Changes of settings at runtime must be applied manually using the button below.", MessageType.Warning);
                if (GUILayout.Button("Apply runtime changes"))
                {
                    sync.InitializeRecognizer();
                }
            }
        }
    public override void OnInteractivePreviewGUI(Rect r, GUIStyle background)
    {
        if (waveform == null && lsdTarget.clip != null)
        {
            waveform = AudioUtility.GetWaveForm(lsdTarget.clip, 0, EditorGUIUtility.currentViewWidth, 128);
        }

        if (lsdTarget.clip != null && waveform != null)
        {
            GUI.DrawTexture(new Rect(0, r.y + 3, EditorGUIUtility.currentViewWidth, r.height), waveform);
        }

        //Playhead
        if (Event.current.button != 1)
        {
            seekPosition = GUI.HorizontalSlider(new Rect(0, r.y + 3, EditorGUIUtility.currentViewWidth, r.height), seekPosition, 0, 1, GUIStyle.none, GUIStyle.none);
        }

        GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 3, r.y, 7, r.height), playhead_line);
        GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 7, r.y, 15, 15), playhead_top);
        GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 7, r.y + r.height - 16, 15, 15), playhead_bottom);

        float pixelsPerSecond = r.width / lsdTarget.length;

        for (int a = 0; a < lsdTarget.length + 1; a++)
        {
            GUI.DrawTexture(new Rect((a * pixelsPerSecond), r.y + 1, 1, 12), marker_line);
            GUI.Box(new Rect((a * pixelsPerSecond) + 5, r.y, 30, 20), (a % 60).ToString().PadLeft(2, '0') + "s", EditorStyles.whiteMiniLabel);
        }

        if (visualPreview && previewTarget != null)
        {
            EditorGUI.HelpBox(new Rect(20, r.y + r.height - 45, r.width - 40, 25), "Preview mode active. Note: only Phonemes and Emotions will be shown in the preview.", MessageType.Info);
        }
        else if (previewTarget != null)
        {
            UpdatePreview(0);
            previewTarget = null;
        }
    }
    public void StartAfterConfig()
    {
        configOn   = false;
        configured = true;

        if (ParentAvatar.TryGetComponent <MoveBoxPlayback>(out PlayBack))
        {
            PlayBack.standalone = false;
            PlayBack.enabled    = false;
        }


        // START AVATAR
        RootPosition = ParentAvatar.transform.Find("Bip01").Find("Bip01 Pelvis").gameObject;

        originalAvatarAbsoluteRotations = new Dictionary <string, Quaternion>();
        Retrieve_OriginalAvatarRotations(RootPosition);

        GameObject rockethead = GetRocketboxBone(JointId.Head, RootPosition);
        GameObject rocketfoot = GetRocketboxBone(JointId.FootLeft, RootPosition);

        rocketboxHeight = rockethead.transform.position.y - rocketfoot.transform.position.y;

        Offset = RootPosition.transform.position;



        // START MOCAP

        StartMoCap();


        // Start Playback
        PlayBack              = gameObject.AddComponent <MoveBoxPlayback>();
        PlayBack.standalone   = false;
        PlayBack.ParentAvatar = ParentAvatar;
        PlayBack.RootPosition = RootPosition;
        PlayBack.animationOn  = animationOn;
        PlayBack.eyeBlinkOn   = eyeBlinkOn;
        PlayBack.lipsyncOn    = lipsyncOn;

        //START EYEBLINK

        if (eyeBlinkOn)
        {
            PlayBack.StartEyeBlinks();
        }


        // START LIPSYNC

        if (lipsyncOn)
        {
            if (lipsyncMicOn)
            {
                PlayBack.lipsyncOn = false;
                if (!ParentAvatar.TryGetComponent <LipSync>(out lipsync))
                {
                    lipsync = ParentAvatar.AddComponent <LipSync>();
                }
                lipsync.nameOfMicrophone = nameMic;
                lipsync.realtimeMoCap    = true;
                lipsync.StartAfterConfig(null, RootPosition);
            }
            else
            {
                PlayBack.audioClip = audioClip;
                PlayBack.StartLipSync();
            }
        }


        // ANIMATION PLAYBACK
        if (animationOn & !isRealTime)
        {
            PlayBack.animationClip = animationClip;
            PlayBack.loopingOn     = loopingOn;
            PlayBack.StartAnimationPlayback();
        }
        else
        {
            PlayBack.animationOn = false;
        }
    }
 // Sta[rt is called before the first frame update
 void Start()
 {
     ls = GameObject.Find("remy").GetComponent <LipSync>();
 }
Beispiel #25
0
 void Start()
 {
     anim = GetComponentInChildren <Animator>();
     LS   = GetComponent <LipSync>();
 }
Beispiel #26
0
 // Sta[rt is called before the first frame update
 void Start()
 {
     ls             = GameObject.Find("remy").GetComponent <LipSync>();
     ls.defaultClip = lsAudio[1];
 }
Beispiel #27
0
    void Start()
    {
        start.onClick.AddListener(() => startClicked());
        lipSync = gameObject.GetComponent <LipSync>();

        //FaceState = new AndroidJavaClass("eu.kudan.ar.FaceState");


        phonemesMap = new Hashtable();
        phonemesMap.Add("AA", Phoneme.AI);
        phonemesMap.Add("AE", Phoneme.E);
        phonemesMap.Add("AH", Phoneme.E);
        phonemesMap.Add("AO", Phoneme.U);
        phonemesMap.Add("AW", Phoneme.O);
        phonemesMap.Add("AY", Phoneme.AI);
        phonemesMap.Add("B", Phoneme.MBP);
        phonemesMap.Add("M", Phoneme.MBP);
        phonemesMap.Add("P", Phoneme.MBP);
        phonemesMap.Add("CH", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("SH", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("JH", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("ZH", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("D", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("N", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("T", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("DH", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("TH", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("UH", Phoneme.U);
        phonemesMap.Add("EH", Phoneme.E);
        phonemesMap.Add("ER", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("EY", Phoneme.E);
        phonemesMap.Add("F", Phoneme.FV);
        phonemesMap.Add("V", Phoneme.FV);
        phonemesMap.Add("G", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("K", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("NG", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("HH", Phoneme.AI);
        phonemesMap.Add("IH", Phoneme.AI);
        phonemesMap.Add("IY", Phoneme.AI);
        phonemesMap.Add("Y", Phoneme.AI);
        phonemesMap.Add("L", Phoneme.L);
        phonemesMap.Add("OW", Phoneme.O);
        phonemesMap.Add("OY", Phoneme.O);
        phonemesMap.Add("R", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("S", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("Z", Phoneme.CDGKNRSThYZ);
        phonemesMap.Add("UW", Phoneme.WQ);
        phonemesMap.Add("W", Phoneme.WQ);

        phonemesDuration = new Hashtable();
        phonemesDuration.Add("AA", 4);
        phonemesDuration.Add("AE", 4);
        phonemesDuration.Add("AH", 3);
        phonemesDuration.Add("AO", 3);
        phonemesDuration.Add("AW", 5);
        phonemesDuration.Add("AY", 6);
        phonemesDuration.Add("B", 2);
        phonemesDuration.Add("M", 3);
        phonemesDuration.Add("P", 5);
        phonemesDuration.Add("CH", 4);
        phonemesDuration.Add("SH", 4);
        phonemesDuration.Add("JH", 4);
        phonemesDuration.Add("ZH", 4);
        phonemesDuration.Add("D", 3);
        phonemesDuration.Add("N", 3);
        phonemesDuration.Add("T", 3);
        phonemesDuration.Add("DH", 2);
        phonemesDuration.Add("TH", 3);
        phonemesDuration.Add("EH", 4);
        phonemesDuration.Add("UH", 3);
        phonemesDuration.Add("ER", 4);
        phonemesDuration.Add("EY", 5);
        phonemesDuration.Add("F", 3);
        phonemesDuration.Add("V", 3);
        phonemesDuration.Add("G", 4);
        phonemesDuration.Add("K", 2);
        phonemesDuration.Add("NG", 3);
        phonemesDuration.Add("HH", 3);
        phonemesDuration.Add("IH", 6);
        phonemesDuration.Add("IY", 6);
        phonemesDuration.Add("Y", 6);
        phonemesDuration.Add("L", 3);
        phonemesDuration.Add("OW", 8);
        phonemesDuration.Add("OY", 11);
        phonemesDuration.Add("R", 4);
        phonemesDuration.Add("S", 4);
        phonemesDuration.Add("Z", 4);
        phonemesDuration.Add("UW", 10);
        phonemesDuration.Add("W", 4);

        //FaceState.CallStatic("setFaceAlive", true);
    }
Beispiel #28
0
    void OnEnable()
    {
        logo = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Dark/logo_component.png");

        guideAI  = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/AI.png");
        guideE   = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/E.png");
        guideEtc = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/etc.png");
        guideFV  = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/FV.png");
        guideL   = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/L.png");
        guideMBP = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/MBP.png");
        guideO   = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/O.png");
        guideU   = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/U.png");
        guideWQ  = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Guides/WQ.png");

        presetsIcon = (Texture2D)EditorGUIUtility.Load("Rogo Digital/LipSync/Dark/presets.png");

        if (!EditorGUIUtility.isProSkin)
        {
            logo        = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Light/logo_component.png");
            presetsIcon = (Texture2D)EditorGUIUtility.Load("Rogo Digital/LipSync/Light/presets.png");
        }

        guides = new List <Texture2D>()
        {
            guideAI,
            guideE,
            guideU,
            guideO,
            guideEtc,
            guideFV,
            guideL,
            guideMBP,
            guideWQ,
            Texture2D.blackTexture
        };

        Undo.undoRedoPerformed += OnUndoRedoPerformed;

        lsTarget = (LipSync)target;
        lsTarget.reset.AddListener(OnEnable);
        if (lsTarget.blendSystem == null)
        {
            lsTarget.blendSystem = lsTarget.GetComponent <BlendSystem>();
        }

        if (lsTarget.lastUsedVersion < versionNumber)
        {
            AutoUpdate(lsTarget.lastUsedVersion);
            lsTarget.lastUsedVersion = versionNumber;
        }

        serializedTarget = new SerializedObject(target);
        FindBlendSystems();

        audioSource  = serializedTarget.FindProperty("audioSource");
        restTime     = serializedTarget.FindProperty("restTime");
        restHoldTime = serializedTarget.FindProperty("restHoldTime");
        phonemeCurveGenerationMode = serializedTarget.FindProperty("phonemeCurveGenerationMode");
        playOnAwake         = serializedTarget.FindProperty("playOnAwake");
        loop                = serializedTarget.FindProperty("loop");
        defaultClip         = serializedTarget.FindProperty("defaultClip");
        defaultDelay        = serializedTarget.FindProperty("defaultDelay");
        scaleAudioSpeed     = serializedTarget.FindProperty("scaleAudioSpeed");
        animationTimingMode = serializedTarget.FindProperty("animationTimingMode");
        frameRate           = serializedTarget.FindProperty("frameRate");
        useBones            = serializedTarget.FindProperty("useBones");
        boneUpdateAnimation = serializedTarget.FindProperty("boneUpdateAnimation");
        onFinishedPlaying   = serializedTarget.FindProperty("onFinishedPlaying");

        showBoneOptions    = new AnimBool(lsTarget.useBones, Repaint);
        showPlayOnAwake    = new AnimBool(lsTarget.playOnAwake, Repaint);
        showFixedFrameRate = new AnimBool(lsTarget.animationTimingMode == LipSync.AnimationTimingMode.FixedFrameRate, Repaint);

        CreateBlendSystemEditor();

        if (lsTarget.blendSystem != null)
        {
            if (lsTarget.blendSystem.isReady)
            {
                GetBlendShapes();
                blendSystemButtons = GetBlendSystemButtons();
            }
        }

        if (lsTarget.phonemes == null || lsTarget.phonemes.Count < 9)
        {
            lsTarget.phonemes = new List <PhonemeShape>();

            for (int A = 0; A < 10; A++)
            {
                lsTarget.phonemes.Add(new PhonemeShape((Phoneme)A));
            }

            EditorUtility.SetDirty(lsTarget);
            serializedTarget.SetIsDifferentCacheDirty();
        }
        else if (lsTarget.phonemes.Count == 9)
        {
            //Update pre 0.4 characters with the new Rest phoneme
            lsTarget.phonemes.Add(new PhonemeShape(Phoneme.Rest));
        }
    }
Beispiel #29
0
        static void PlayOptionOne(Booger booger)
        {
            booger.Nerve += 200;
            bool exit           = false;
            byte heatherCounter = 0;

            do
            {
                Heather heather    = Heather.GenerateHeather();
                Heather heatherTwo = Heather.GenerateHeather();
                while (heather.Name == heatherTwo.Name)
                {
                    heatherTwo = Heather.GenerateHeather();
                }
                Song singleSong = new Song(Song.SelectASong());
                Console.WriteLine($"You are in the bottom 3 with {heather.Name} and {heatherTwo.Name}");
                for (int i = 0; i < 50; i++)
                {
                    Console.Write('-');
                    Thread.Sleep(75);
                }
                int draw = new Random().Next(0, 2);
                if (draw == 0)
                {
                    heather = heatherTwo;
                }
                Console.WriteLine($"\nRuPaul: {booger.Name}, {heather.Name}...  I'm sorry my dears but you are both up for elimination"); Thread.Sleep(4000);
                Console.WriteLine($"\tEach of you has been asked to prepare a lip sync to \"{singleSong.Name}\" by {singleSong.Artist}"); Thread.Sleep(4000);
                Console.WriteLine("\tTwo queens stand before me, ladies this is your last chance to impress me and save yourself from elimination."); Thread.Sleep(4000);
                Console.Write("\tThe time has come for you to lipsync");
                for (int i = 0; i < 3; i++)
                {
                    Console.Write('.');
                    Thread.Sleep(900);
                }
                Console.Write("FOR"); Thread.Sleep(1000);
                Console.Write(" YOUR"); Thread.Sleep(1000);
                Console.WriteLine(" LIFE!"); Thread.Sleep(1000);
                //Lightning.LightningFlashes();
                Console.Write("RuPaul: Good Luck"); Thread.Sleep(1000);
                Console.WriteLine(" and don't *&#! it up!"); Thread.Sleep(2000);
                Song.PlaySong(singleSong);
                Console.Clear();
                LipSync.RandomRules(booger, heather, singleSong);
                Random rand  = new Random();
                bool   exit2 = false;
                do
                {
                    Console.WriteLine("\nPlease Choose and action:\nL) Lipsync for Your Life\nT) Try to get Away with Lip Syncing with a Mask on\nP) Player Info\nO) Opponent Info\nR) Rules\nX) Exit");
                    ConsoleKey userChoice = Console.ReadKey(true).Key;
                    Console.Clear();
                    switch (userChoice)
                    {
                    case ConsoleKey.L:
                        LipSync.ForYourLife(booger, heather);
                        if (heather.Nerve <= 0)
                        {
                            Console.WriteLine("\n{0} You're a Winner Baby", booger.Name);
                            Console.WriteLine("\n{0} Now Sashay Away....\n", heather.Name);
                            LipSync.Loot(booger, heather, rand);
                            heatherCounter++;
                            Console.WriteLine("You defeated {0} Queen{1}", heatherCounter, heatherCounter == 0 ? "" : "s");
                            exit2 = true;
                        }
                        else
                        {
                            LipSync.ForYourLife(heather, booger);
                        }
                        break;

                    case ConsoleKey.T:
                        Console.WriteLine("You Ask RuPaul To Keep the Mask On");
                        Console.WriteLine($"{heather.Name} knows You Don't Know the Words and Throws Shade on Twitter!");
                        LipSync.ThrowShade(heather, booger);
                        exit2 = true;
                        Console.WriteLine("You've defeated {0} Queen{1}", heatherCounter, heatherCounter == 0 ? "" : "s");
                        break;

                    case ConsoleKey.P:
                        Console.WriteLine("Player Info");
                        Console.WriteLine(booger);
                        break;

                    case ConsoleKey.O:
                        Console.WriteLine("Opponent Info");
                        Console.WriteLine(heather);
                        break;

                    case ConsoleKey.R:
                        DisplayRules();
                        break;

                    case ConsoleKey.X:
                    case ConsoleKey.E:
                        booger.Nerve = 0;
                        exit2        = true;
                        exit         = true;
                        break;

                    default:
                        Console.WriteLine("Roxxy Andrews Made it Clear... That Was Not a Valid Selection...");
                        break;
                    }

                    if (booger.Nerve <= 0)
                    {
                        Console.WriteLine("\n{0} You're a Winner Baby", heather.Name);
                        Console.WriteLine("{0} Now Sashay Away....\n", booger.Name);
                        Console.WriteLine("You defeated {0} Queen{1}", heatherCounter, heatherCounter == 1 ? "" : "s");
                        exit2 = true;
                        exit  = true;
                    }
                } while (!exit2);
            } while (!exit);
        }
Beispiel #30
0
        static void PlayOptionTwo(Booger player)
        {
            Console.WriteLine("Would you like to battle against:\n1) 4 Queens\n2) 8 Queens\n3) 16 Queens\n");
            byte userSelection = Convert.ToByte(Console.ReadLine());
            byte heatherNumber = 2;

            switch (userSelection)
            {
            case 1:
                heatherNumber = 4;
                break;

            case 2:
                heatherNumber = 8;
                break;

            case 3:
                heatherNumber = 16;
                break;
            }
            Heather[] heathers = new Heather[heatherNumber];
            Random    rand     = new Random();

            for (int i = 0; i < heatherNumber - 1; i++)
            {
                Random     rand2          = new Random();
                string     heatherName    = DragNames.GetHeatherDragName(false, (byte)rand.Next(0, 45));
                Speciality heatherSpecial = new Speciality(Heather.GenerateHeatherSpecial(heatherName));
                heathers[i] = (new Heather(heatherName, rand2.Next(0, 21), rand2.Next(5, 21),
                                           rand2.Next(60, 201), rand2.Next(21, 40), heatherSpecial, rand2.Next(10, 31)));
            }
            Speciality ruSpecial = new Speciality(Heather.GenerateHeatherSpecial("RuPaul"));

            heathers[heatherNumber - 1] = (new Heather("RuPaul", rand.Next(0, 21), rand.Next(5, 21),
                                                       rand.Next(60, 401), rand.Next(21, 40), ruSpecial, rand.Next(10, 31)));
            bool exit           = false;
            int  heatherCounter = 0;

            do
            {
                Song singleSong = new Song(Song.SelectASong());
                if (heatherCounter != heatherNumber - 1)
                {
                    Console.WriteLine($"You are up against {heathers[heatherCounter].Name}");
                    Console.WriteLine($"\nRuPaul: {player.Name}, {heathers[heatherCounter].Name}...  I'm sorry my dears but you are both up for elimination"); Thread.Sleep(4000);
                    Console.WriteLine($"\tEach of you has been asked to prepare a lip sync to \"{singleSong.Name}\" by {singleSong.Artist}"); Thread.Sleep(4000);
                    Console.WriteLine("\tTwo queens stand before me, ladies this is your last chance to impress me and save yourself from elimination."); Thread.Sleep(4000);
                }
                else
                {
                    Console.WriteLine("RuPaul: That is it, you are coming for my crown and I can't have it...");
                    Console.Write("You will now battle against the true Queen... Me! Now truly....");
                }
                Console.Write("\tThe time has come for you to lipsync");
                for (int j = 0; j < 3; j++)
                {
                    Console.Write('.');
                    Thread.Sleep(900);
                }
                Console.Write("FOR"); Thread.Sleep(1000);
                Console.Write(" YOUR"); Thread.Sleep(1000);
                Console.WriteLine(" LIFE!"); Thread.Sleep(1000);
                //Lightning.LightningFlashes();
                if (heatherCounter != heatherNumber - 1)
                {
                    Console.Write("RuPaul: Good Luck"); Thread.Sleep(1000);
                    Console.WriteLine(" and don't *&#! it up!"); Thread.Sleep(2000);
                }
                else
                {
                    Console.WriteLine("RuPaul: Good Luck...."); Thread.Sleep(1000);
                    Console.WriteLine("RuPaul Laughs"); Thread.Sleep(2000);
                }
                LipSync.RandomRules(player, heathers[heatherCounter], singleSong);
                Song.PlaySong(singleSong);
                bool exit2 = false;
                do
                {
                    Console.WriteLine("\nPlease Choose and action:\nL) Lipsync for Your Life\nP) Player Info\nR) Rules\nO) Opponent Info\nX) Exit");
                    ConsoleKey userChoice = Console.ReadKey(true).Key;
                    Console.Clear();
                    switch (userChoice)
                    {
                    case ConsoleKey.L:
                        LipSync.ForYourLife(player, heathers[heatherCounter]);
                        if (heathers[heatherCounter].Nerve <= 0)
                        {
                            Console.WriteLine("\n{0} You're a Winner Baby", player.Name);
                            Console.WriteLine("\n{0} Now Sashay Away....\n", heathers[heatherCounter].Name);
                            LipSync.Loot(player, heathers[heatherCounter], rand);
                            exit2 = true;
                            heatherCounter++;
                            Console.WriteLine("You've defeated {0} Queen{1}", heatherCounter, heatherCounter == 0 ? "" : "s");
                        }
                        else
                        {
                            LipSync.ForYourLife(heathers[heatherCounter], player);
                        }
                        break;

                    case ConsoleKey.P:
                        Console.WriteLine("Player Info");
                        Console.WriteLine(player);
                        break;

                    case ConsoleKey.O:
                        Console.WriteLine("Opponent Info");
                        Console.WriteLine(heathers[heatherCounter]);
                        break;

                    case ConsoleKey.R:
                        DisplayRules();
                        break;

                    case ConsoleKey.X:
                    case ConsoleKey.E:
                        player.Nerve = 0;
                        exit2        = true;
                        exit         = true;
                        break;

                    default:
                        Console.WriteLine("Roxxy Andrews Made it Clear... That Was Not a Valid Selection...");
                        break;
                    }

                    if (player.Nerve <= 0)
                    {
                        Console.WriteLine("\n{0} You're a Winner Baby", heathers[heatherCounter].Name);
                        Console.WriteLine("{0} Now Sashay Away....\n", player.Name);
                        Console.WriteLine("You defeated {0} Queen{1}", heatherCounter, heatherCounter == 0 ? "" : "s");
                        exit2 = true;
                        exit  = true;
                    }
                } while (!exit2);
            } while (!exit);
        }