/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="entries"></param>
 /// <param name="container"></param>
 public PortraitEditorWindow(ScrObjLibraryVariable entries, PortraitEntry container, SpriteListVariable poses)
 {
     entryLibrary = entries;
     entryValues  = container;
     poseLibrary  = poses;
     LoadLibrary();
 }
    protected override void DrawContentWindow()
    {
        PortraitEntry portraitValues = (PortraitEntry)entryValues;

        portraitValues.small = (Sprite)EditorGUILayout.ObjectField("Small character portrait", portraitValues.small, typeof(Sprite), false);

        GUILayout.Space(20);

        if (portraitValues.poses.Length < (int)PortraitEntry.Pose.kCount)
        {
            System.Array.Resize(ref portraitValues.poses, (int)PortraitEntry.Pose.kCount);
        }

        // Poses
        GUILayout.Label("Poses", EditorStyles.boldLabel);
        for (int i = 0; i < portraitValues.poses.Length; i++)
        {
            if (portraitValues.poses[i] == null)
            {
                portraitValues.poses[i] = (Sprite)EditorGUILayout.ObjectField(poseLibrary.values[i].name, poseLibrary.values[i], typeof(Sprite), false);
            }
            else
            {
                portraitValues.poses[i] = (Sprite)EditorGUILayout.ObjectField(poseLibrary.values[i].name, portraitValues.poses[i], typeof(Sprite), false);
            }
        }
    }
Пример #3
0
    public override void CopyValues(ScrObjLibraryEntry other)
    {
        base.CopyValues(other);
        CharEntry cd = (CharEntry)other;

        portraitSet      = cd.portraitSet;
        startClass       = cd.startClass;
        startClassLevels = cd.startClassLevels;

        hp  = cd.hp;
        dmg = cd.dmg;
        mnd = cd.mnd;
        skl = cd.skl;
        spd = cd.spd;
        def = cd.def;

        gHp  = cd.gHp;
        gDmg = cd.gDmg;
        gMnd = cd.gMnd;
        gSkl = cd.gSkl;
        gSpd = cd.gSpd;
        gDef = cd.gDef;

        supports = new List <SupportTuple>();
        for (int i = 0; i < cd.supports.Count; i++)
        {
            supports.Add(cd.supports[i]);
        }

        faction     = cd.faction;
        mustSurvive = cd.mustSurvive;
        deathQuote  = cd.deathQuote;
    }
Пример #4
0
    public override void ResetValues()
    {
        base.ResetValues();

        portraitSet      = null;
        startClass       = null;
        startClassLevels = new int[ClassWheel.CLASS_COUNT];

        hp  = 0;
        dmg = 0;
        mnd = 0;
        skl = 0;
        spd = 0;
        def = 0;

        gHp  = 0;
        gDmg = 0;
        gMnd = 0;
        gSkl = 0;
        gSpd = 0;
        gDef = 0;

        supports = new List <SupportTuple>();

        faction     = Faction.NONE;
        mustSurvive = false;
        deathQuote  = null;
    }
Пример #5
0
    public override void CopyValues(ScrObjLibraryEntry other)
    {
        base.CopyValues(other);
        PortraitEntry ce = (PortraitEntry)other;

        small = ce.small;
        poses = new Sprite[ce.poses.Length];
        for (int i = 0; i < ce.poses.Length; i++)
        {
            poses[i] = ce.poses[i];
        }
    }
Пример #6
0
 public void UpdateCharacter()
 {
     if (character.value == null)
     {
         characterSprite.enabled = false;
     }
     else
     {
         characterSprite.enabled = true;
         PortraitEntry ce = (PortraitEntry)character.value;
         characterSprite.sprite = ce.poses[poseIndex.value];
     }
 }
Пример #7
0
    /// <summary>
    /// Renders the dialogue text area.
    /// </summary>
    void DialogueTextStuff()
    {
        EditorGUIUtility.labelWidth = 200;
        int talkingIndex = hub.dialogueValues.actions[hub.selAction].values[0];

        if (hub.dialogueValues.actions[hub.selAction].values[0] == 4)
        {
            talkName = hub.dialogueValues.actions[hub.selAction].text[0];
        }

        GUILayout.BeginArea(editRect);

        hub.dialogueValues.actions[hub.selAction].boolValue = GUILayout.Toggle(hub.dialogueValues.actions[hub.selAction].boolValue, "Clear prev. text");

        //Text box
        EditorStyles.textField.wordWrap = true;
        GUILayout.Label("Set Dialogue Text", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        hub.dialogueValues.actions[hub.selAction].text[1] = EditorGUILayout.TextArea(hub.dialogueValues.actions[hub.selAction].text[1], GUILayout.Width(300), GUILayout.Height(48));
        EditorGUI.BeginDisabledGroup(true);
        string str = (!hub.dialogueValues.actions[hub.selAction].boolValue) ? hub.previousText : hub.dialogueValues.actions[hub.selAction].text[1];

        EditorGUILayout.TextArea(str, GUILayout.Width(300), GUILayout.Height(48));
        EditorGUI.EndDisabledGroup();
        GUILayout.EndHorizontal();

        //Speaker name
        GUILayout.Label("Speaker's Name: " + hub.dialogueValues.actions[hub.selAction].values[0], EditorStyles.boldLabel);
        GUILayout.Label((hub.dialogueValues.actions[hub.selAction].text[0] != "###") ?
                        hub.dialogueValues.actions[hub.selAction].text[0] :
                        hub.currentState.characters[hub.dialogueValues.actions[hub.selAction].values[0]].value.entryName,
                        EditorStyles.boldLabel, GUILayout.Width(80)
                        );

        GUILayout.Space(65);

        //Talking stuff

        GUIContent[] filteredList = new GUIContent[5];
        GUIContent   content;

        for (int i = 0; i < Utility.DIALOGUE_PLAYERS_COUNT; i++)
        {
            content         = new GUIContent();
            filteredList[i] = content;
            content.text    = "Talking";
            PortraitEntry ce = (PortraitEntry)hub.currentState.characters[i].value;
            if (ce == null)
            {
                continue;
            }

            Texture tex = ce.GenerateRepresentation().image;
            content.image = tex;
        }
        content         = new GUIContent();
        content.text    = "??? is Talking";
        filteredList[4] = content;

        talkingIndex = GUILayout.SelectionGrid(hub.dialogueValues.actions[hub.selAction].values[0], filteredList, 5, GUILayout.Height(30));
        if (GUILayout.Button("No one is talking"))
        {
            talkingIndex = -1;
        }

        if (talkingIndex == -1)
        {
            hub.dialogueValues.actions[hub.selAction].text[0] = "";
        }
        else if (talkingIndex == 4)
        {
            talkName = EditorGUILayout.TextField("Other talking person", talkName);
            hub.dialogueValues.actions[hub.selAction].text[0] = talkName;
        }
        else if (hub.currentState.characters[talkingIndex].value != null)
        {
            hub.dialogueValues.actions[hub.selAction].text[0] = "###";
        }
        else
        {
            talkingIndex = -1;
            hub.dialogueValues.actions[hub.selAction].text[0] = "";
        }

        hub.dialogueValues.actions[hub.selAction].values[0] = talkingIndex;

        GUILayout.Space(25);

        //Other options
        GUILayout.Label("Other text options", EditorStyles.boldLabel);
        hub.dialogueValues.actions[hub.selAction].autoContinue = EditorGUILayout.Toggle("Auto Continue", hub.dialogueValues.actions[hub.selAction].autoContinue);

        EditorGUIUtility.labelWidth = 100;
        GUILayout.EndArea();
    }