예제 #1
0
        private void DrawActor(RPGDatabaseManager database)
        {
            var entry = (ActorData)entrySelected;

            var classNames = database.FetchEntry <ActorClassDataList>().entries.Select(l => l.name).ToArray();
            var classIds   = database.FetchEntry <ActorClassDataList>().entries.Select(l => l.Id).ToArray();

            var actorClass = database.FetchEntry <ActorClassDataList>().entries.FirstOrDefault(l => l.Id == entry.classId);

            if (actorClass == null)
            {
                actorClass = new ActorClassData(entry.classId);
            }

            var weaponNames = database.FetchEntry <WeaponDataList>().entries.Where(l => l.typeId == actorClass.weaponTypeId).Select(l => l.name).ToArray();
            var weaponIds   = database.FetchEntry <WeaponDataList>().entries.Where(l => l.typeId == actorClass.weaponTypeId).Select(l => l.Id).ToArray();

            var attrList = database.FetchEntry <AttributeSpecDataList>();
            var level    = attrList.entries.First(x => x.name == Constants.Attributes.LEVEL);

            EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(400));
            DrawTitle();

            entry.name         = EditorGUILayout.TextField("Name", entry.name);
            entry.classId      = EditorGUILayout.IntPopup("Class", entry.classId, classNames, classIds);
            entry.initialLevel = EditorGUILayout.IntSlider("Initial Level", entry.initialLevel, level.start, level.end);

            EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(350));
            BrightEditorGUILayout.LabelFieldBold("Graphics");
            entry.graphics.face = SpriteField("Face", entry.graphics.face);
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(350));
            BrightEditorGUILayout.LabelFieldBold("Initial Equipment");
            entry.initialWeapon = EditorGUILayout.IntPopup("Weapon", entry.initialWeapon, weaponNames, weaponIds);
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();
        }
예제 #2
0
        private void DrawClass(RPGDatabaseManager database)
        {
            var weaponTypeIds   = database.FetchEntry <WeaponTypeDataList>().entries.Select(l => l.Id).ToArray();
            var weaponTypeNames = database.FetchEntry <WeaponTypeDataList>().entries.Select(l => l.name).ToArray();
            var skillIds        = database.FetchEntry <SkillDataList>().entries.Select(l => l.Id).ToArray();
            var skillNames      = database.FetchEntry <SkillDataList>().entries.Select(l => l.name).ToArray();

            var entry = (ActorClassData)entrySelected;

            EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(400));
            classAreaVect = EditorGUILayout.BeginScrollView(classAreaVect, GUILayout.Width(400));

            DrawTitle();
            entry.name = EditorGUILayout.TextField("Name", entry.name);


            #region Growth
            BrightEditorGUILayout.LabelFieldBold("Growth");
            entry.expCurve = EditorGUILayout.CurveField(Constants.Attributes.EXP, entry.expCurve, GUILayout.Height(25f));
            entry.hpCurve  = EditorGUILayout.CurveField(Constants.Attributes.HP, entry.hpCurve, GUILayout.Height(25f));
            entry.mpCurve  = EditorGUILayout.CurveField(Constants.Attributes.MP, entry.mpCurve, GUILayout.Height(25f));

            entry.strCurve = EditorGUILayout.CurveField(Constants.Attributes.STR, entry.strCurve, GUILayout.Height(25f));
            entry.intCurve = EditorGUILayout.CurveField(Constants.Attributes.INT, entry.intCurve, GUILayout.Height(25f));

            entry.dexCurve = EditorGUILayout.CurveField(Constants.Attributes.DEX, entry.dexCurve, GUILayout.Height(25f));
            entry.agiCurve = EditorGUILayout.CurveField(Constants.Attributes.AGI, entry.agiCurve, GUILayout.Height(25f));
            entry.lckCurve = EditorGUILayout.CurveField(Constants.Attributes.LCK, entry.lckCurve, GUILayout.Height(25f));

            entry.defCurve = EditorGUILayout.CurveField(Constants.Attributes.DEF, entry.defCurve, GUILayout.Height(25f));
            entry.resCurve = EditorGUILayout.CurveField(Constants.Attributes.RES, entry.resCurve, GUILayout.Height(25f));
            #endregion

            #region Preview
            EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(350));
            var list  = database.FetchEntry <AttributeSpecDataList>();
            var level = list.entries.First(x => x.name == Constants.Attributes.LEVEL);
            var exp   = list.entries.First(x => x.name == Constants.Attributes.EXP);

            var hp   = list.entries.First(x => x.name == Constants.Attributes.HP);
            var mp   = list.entries.First(x => x.name == Constants.Attributes.MP);
            var attr = list.entries.First(x => x.name == Constants.Attributes.COMMON);

            BrightEditorGUILayout.LabelFieldBold("Preview");
            previewLv = EditorGUILayout.IntSlider(Constants.Attributes.LEVEL_SHORT, previewLv, level.start, level.end);

            float normalizedValue  = Mathf.InverseLerp(level.start, level.end, previewLv);
            float targetCurveValue = 0f;

            targetCurveValue = entry.expCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.EXP}:\t{exp.FetchAtCurvePoint(targetCurveValue)}");

            targetCurveValue = entry.hpCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.HP}:\t{hp.FetchAtCurvePoint(targetCurveValue)}");
            targetCurveValue = entry.mpCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.MP}:\t{mp.FetchAtCurvePoint(targetCurveValue)}");

            targetCurveValue = entry.strCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.STR_SHORT}:\t{attr.FetchAtCurvePoint(targetCurveValue)}");
            targetCurveValue = entry.intCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.INT_SHORT}:\t{attr.FetchAtCurvePoint(targetCurveValue)}");

            targetCurveValue = entry.dexCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.DEX_SHORT}:\t{attr.FetchAtCurvePoint(targetCurveValue)}");
            targetCurveValue = entry.agiCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.AGI_SHORT}:\t{attr.FetchAtCurvePoint(targetCurveValue)}");

            targetCurveValue = entry.lckCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.LCK_SHORT}:\t{attr.FetchAtCurvePoint(targetCurveValue)}");

            targetCurveValue = entry.defCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.DEF_SHORT}:\t{attr.FetchAtCurvePoint(targetCurveValue)}");
            targetCurveValue = entry.resCurve.Evaluate(normalizedValue);
            EditorGUILayout.LabelField($"{Constants.Attributes.RES_SHORT}:\t{attr.FetchAtCurvePoint(targetCurveValue)}");

            EditorGUILayout.EndVertical();
            #endregion

            #region Weapons
            EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(350));
            BrightEditorGUILayout.LabelFieldBold("Weapon Type");
            entry.weaponTypeId = EditorGUILayout.IntPopup(entry.weaponTypeId, weaponTypeNames, weaponTypeIds);
            EditorGUILayout.EndVertical();
            #endregion

            #region Skills
            EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(350));
            skillUnlockVect = EditorGUILayout.BeginScrollView(skillUnlockVect, GUILayout.MinHeight(90));
            BrightEditorGUILayout.LabelFieldBold(Constants.SKILLS);
            if (entry.skills == null)
            {
                entry.skills = new System.Collections.Generic.List <SkillUnlockArgs>();
            }

            for (int i = 0; i < entry.skills.Count; i++)
            {
                var skillUnlockArgs = entry.skills[i];

                EditorGUI.indentLevel++;
                EditorGUILayout.BeginHorizontal();
                skillUnlockArgs.level   = EditorGUILayout.IntField(Constants.Attributes.LEVEL_SHORT, skillUnlockArgs.level);
                skillUnlockArgs.skillId = EditorGUILayout.IntPopup(skillUnlockArgs.skillId, skillNames, skillIds);
                if (GUILayout.Button("-", GUILayout.Width(20f)))
                {
                    entry.skills.RemoveAt(i);
                    break;
                }
                EditorGUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("+", GUILayout.Width(40f)))
            {
                entry.skills.Add(new SkillUnlockArgs());
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
            #endregion

            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
        }