コード例 #1
0
ファイル: DetailEditor.cs プロジェクト: martinezpierre/Emma
    void init()
    {
        transition = SentenceObject.Transitions.Simple;

        index = 0;

        fadeDuration = 1f;

        posGroupEnabled = false;

        LoadModifs();
    }
コード例 #2
0
ファイル: DetailEditor.cs プロジェクト: martinezpierre/Emma
    void LoadModifs()
    {
        TextManager.LoadText(fileName);

        characters = TextManager.texts.characters;

        int i = 0;

        options = new string[characters.Count];

        foreach (CharacterObject cO in characters)
        {
            options [i] = cO.name;
            i++;
        }

        for (i = 0; i < options.Length; i++)
        {
            if (options[i] == sentence.characterName && sentence.characterName != null)
            {
                index = i;
            }
        }

        posGroupEnabled = !sentence.keepPreviousImages;

        transition = sentence.transitionType;

        fadeDuration = sentence.fadeDuration == 0f ? 1f : sentence.fadeDuration;

        fadeDurationIn = sentence.fadeInDuration == 0f ? 1f : sentence.fadeInDuration;

        fadeColor = sentence.fadeColor;

        delayBeforeAppear = sentence.delayBeforeAppear;

        isSMS = sentence.isSMS;

        if (sentence.themes.Count > 0)
        {
            theme                = sentence.themes[0];
            themeDelay           = theme.delayBeforeAppear;
            themeFadeInDuration  = theme.fadeInDuration;
            themeFadeOutDuration = theme.fadeOutDuration;
        }

        if (sentence.themes.Count > 1)
        {
            soundscape                = sentence.themes[1];
            soundscapeDelay           = soundscape.delayBeforeAppear;
            soundscapeFadeInDuration  = soundscape.fadeInDuration;
            soundscapeFadeOutDuration = soundscape.fadeOutDuration;
        }

        stopMusic = sentence.stopTheme;

        foreach (ImageObject iM in sentence.images)
        {
            nbImg++;
            imgList [nbImg - 1] = iM;

            animDuration [nbImg - 1] = iM.animDuration;

            beginPos[nbImg - 1].x = iM.beginPosX;
            beginPos[nbImg - 1].y = iM.beginPosY;

            beginRot[nbImg - 1] = iM.beginRot;

            bool mustChange = iM.beginScaleX == 0 && iM.beginScaleY == 0 && iM.endScaleX == 0 && iM.endScaleY == 0;

            beginScale[nbImg - 1].x  = mustChange ? 1 : iM.beginScaleX;
            beginScale [nbImg - 1].y = mustChange ? 1 : iM.beginScaleY;

            endPos[nbImg - 1].x = iM.endPosX;
            endPos[nbImg - 1].y = iM.endPosY;

            endRot[nbImg - 1] = iM.endRot;

            endScale[nbImg - 1].x = mustChange ? 1 : iM.endScaleX;
            endScale[nbImg - 1].y = mustChange ? 1 : iM.endScaleY;

            appearAfterSentence [nbImg - 1] = iM.appearAfterSentence;

            ease [nbImg - 1]   = iM.ease;
            easeOut[nbImg - 1] = iM.easeOut;
        }

        foreach (SoundObject sM in sentence.sounds)
        {
            nbSound++;
            soundList [nbSound - 1] = sM;

            soundFadeInDuration[nbSound - 1]  = sM.fadeInDuration;
            soundFadeOutDuration[nbSound - 1] = sM.fadeOutDuration;
            soundDelay[nbSound - 1]           = sM.delayBeforeAppear;
            soundLoop[nbSound - 1]            = sM.loop;
        }

        foreach (ChoiceObject cM in sentence.choices)
        {
            nbChoice++;
            choiceList [nbChoice - 1] = cM;

            stringIndex[nbChoice - 1]    = (cM.nextSentenceIndex / 1000) + "." + (cM.nextSentenceIndex % 1000);
            stringIndexEnd[nbChoice - 1] = (cM.endSequenceIndex / 1000) + "." + (cM.endSequenceIndex % 1000);
        }
    }
コード例 #3
0
ファイル: DetailEditor.cs プロジェクト: martinezpierre/Emma
    void GUIImages()
    {
        GUILayout.Label("Images", EditorStyles.boldLabel);

        posGroupEnabled = EditorGUILayout.Toggle("Change images", posGroupEnabled);

        /*posGroupEnabled = EditorGUILayout.BeginToggleGroup("Change images", posGroupEnabled);
         * if (!posGroupEnabled)
         * {
         *  transition = SentenceObject.Transitions.Simple;
         * }*/

        GUILayout.BeginHorizontal();
        transition = (SentenceObject.Transitions)EditorGUILayout.EnumPopup("Transition type", transition);
        if (transition == SentenceObject.Transitions.Crossfade)
        {
            fadeDuration = EditorGUILayout.FloatField("Duration :", fadeDuration);
        }
        else if (transition == SentenceObject.Transitions.Fade)
        {
            GUILayout.BeginVertical();
            fadeColor      = EditorGUILayout.ColorField("Color :", fadeColor);
            fadeDuration   = EditorGUILayout.FloatField("Fade Out Duration :", fadeDuration);
            fadeDurationIn = EditorGUILayout.FloatField("Fade In Duration :", fadeDurationIn);
            GUILayout.EndVertical();
        }

        GUILayout.EndHorizontal();

        for (int i = 0; i < nbImg; i++)
        {
            if (imgList [i].isImage)
            {
                imgList [i].image = EditorGUILayout.ObjectField(imgList [i].image, typeof(Sprite), true, GUILayout.Height(75), GUILayout.Width(75)) as Sprite;
            }
            else
            {
                imgList [i].gameObject = EditorGUILayout.ObjectField(imgList [i].gameObject, typeof(GameObject), true, GUILayout.Height(20), GUILayout.Width(100)) as GameObject;
            }

            GUILayout.BeginHorizontal();
            m_ShowExtraFields [i].target = EditorGUILayout.ToggleLeft("Edit anim", m_ShowExtraFields [i].target);

            appearAfterSentence[i] = EditorGUILayout.ToggleLeft("Appear after sentence", appearAfterSentence[i]);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            //Extra block that can be toggled on and off.
            if (EditorGUILayout.BeginFadeGroup(m_ShowExtraFields [i].faded))
            {
                EditorGUI.indentLevel++;

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Force height fill"))
                {
                    float ratio = 16f / 9f;

                    float imgWidth  = imgList[i].image.rect.width;
                    float imgHeight = imgList[i].image.rect.height;

                    float imgNewHeight = imgHeight * ratio;

                    float newRatio = imgWidth / imgNewHeight;

                    beginScale[i] = Vector2.one * newRatio;
                    endScale[i]   = Vector2.one * newRatio;
                }
                if (GUILayout.Button("Force width fill"))
                {
                    float ratio = 9f / 16f;

                    float imgWidth  = imgList[i].image.rect.width;
                    float imgHeight = imgList[i].image.rect.height;

                    float imgNewWidth = imgWidth * ratio;

                    float newRatio = imgHeight / imgNewWidth;

                    beginScale[i] = Vector2.one * newRatio;
                    endScale[i]   = Vector2.one * newRatio;
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                ease [i]   = EditorGUILayout.ToggleLeft("EaseIn", ease [i]);
                easeOut[i] = EditorGUILayout.ToggleLeft("EaseOut", easeOut[i]);
                GUILayout.EndHorizontal();

                GUILayout.Label("Duration (seconds)", EditorStyles.boldLabel);
                animDuration[i] = EditorGUILayout.FloatField(animDuration[i]);
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical();
                GUILayout.Label("Begin", EditorStyles.boldLabel);
                beginPos[i] = EditorGUILayout.Vector2Field("Position (pixels)", beginPos[i]);
                GUILayout.Label("Rotation (degrees)");
                beginRot[i]   = EditorGUILayout.FloatField(beginRot[i]);
                beginScale[i] = EditorGUILayout.Vector2Field("Scale (1=100%)", beginScale[i]);
                GUILayout.EndVertical();
                GUILayout.BeginVertical();
                GUILayout.Label("End", EditorStyles.boldLabel);
                endPos[i] = EditorGUILayout.Vector2Field("Position (pixels)", endPos[i]);
                GUILayout.Label("Rotation (degrees)");
                endRot[i]   = EditorGUILayout.FloatField(endRot[i]);
                endScale[i] = EditorGUILayout.Vector2Field("Scale (1=100%)", endScale[i]);
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.EndFadeGroup();
        }

        //EditorGUILayout.EndToggleGroup();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("New image"))
        {
            if (!isSMS)
            {
                nbImg++;
                imgList [nbImg - 1]         = new ImageObject();
                imgList [nbImg - 1].isImage = true;
            }
        }
        if (GUILayout.Button("New game object"))
        {
            nbImg++;
            imgList [nbImg - 1]         = new ImageObject();
            imgList [nbImg - 1].isImage = false;
        }
        GUILayout.EndHorizontal();
    }