public VariableStoreControl(VariableStore store, string name, string tooltip, bool allowAdd, bool allowRemove, UnityAction <Rect, int> customDraw = null)
        {
            _store = store;

            var list = _list.Setup(_store.Variables, name, tooltip, false, false, false, allowAdd, allowRemove, customDraw ?? DrawStoreEntry, RemoveStoreEntry);

            list.onAddDropdownCallback += CustomAdd;
        }
Exemple #2
0
        private void OnEnable()
        {
            var encounter = target as Encounter;

            if (encounter.Ecosystem)
            {
                SetupAddMenu(encounter.Ecosystem);

                foreach (var e in encounter.Encounters.Values)
                {
                    Definitions.Instance.EncounterTraits.Apply(e.Variables, false);
                }
            }

            _ecosystem              = serializedObject.FindProperty("Ecosystem");
            _instructions           = serializedObject.FindProperty("Instructions");
            _generationInstructions = serializedObject.FindProperty("GenerationInstructions");
            _encounterChance        = serializedObject.FindProperty("EncounterChance");

            var encounters = _encounterList.Setup(encounter.Encounters.Values, "Encounters", "The encounters that will be triggered for this area.", false, false, false, true, true, DrawEncounter, RemoveEncounter);

            encounters.onAddDropdownCallback += AddEncounterDropdown;
            encounters.elementHeightCallback += EncounterHeight;

            _encounterControls.Clear();
            foreach (var encounterType in encounter.Encounters.Values)
            {
                _encounterControls.Add(new VariableStoreControl(encounterType.Variables, "Variables", "", false, false));
            }
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            var instructions = _instructions.Setup((target as BranchOnRange <T>).Instructions, "Instructions", "The list of instructions to run based on the range state.", false, false, false, true, true, DrawRange, RemoveRange);

            instructions.onAddDropdownCallback += AddRangeDropdown;
        }
Exemple #4
0
 private void OnEnable()
 {
     _category = serializedObject.FindProperty("Category");
     _message  = serializedObject.FindProperty("Message");
     _variable = serializedObject.FindProperty("Variable");
     _cancel   = serializedObject.FindProperty("CancelInstruction");
     _instructions.Setup(serializedObject.FindProperty("StringOptions"), null, null, false, true, false, true, true, DrawOption);
 }
Exemple #5
0
        public override void Setup(SerializedProperty property, FieldInfo fieldInfo)
        {
            Schema = GetObject <VariableSchema>(property);
            Values = new EditableList <VariableValue>();

            var values = Values.Setup(Schema.Definitions, Schema.Name, EditorHelper.GetTooltip(fieldInfo), true, true, false, true, true, DrawValue, RemoveValue);

            values.onAddDropdownCallback += AddValueDropdown;
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            var instructions = _instructions.Setup(_branchKeys, "Instructions", "The instructions to run based on the variable.", false, false, false, true, true, DrawInstruction, RemoveInstruction);

            instructions.onAddDropdownCallback += AddBranchDropdown;

            UpdateBranchKeys(target as BranchOnString);
        }
        private static EditableList <string> GetCategories()
        {
            if (_categories == null)
            {
                _categories = new EditableList <string>();
                var categories = _categories.Setup(UiPreferences.Instance.ListenerCategories, "Listener Categories", "The list of categories of listeners that Promt Instructions can trigger.", false, true, false, true, true, DrawCategory);
                categories.onAddCallback += AddCategory;
            }

            return(_categories);
        }
Exemple #8
0
        private void OnEnable()
        {
            _backgroundMusic = serializedObject.FindProperty("BackgroundMusic");
            _uiScenes.Setup(serializedObject.FindProperty("UIScenes"), null, null, false, true, false, true, true);
            _mapLayers.Setup(serializedObject.FindProperty("MapLayers"), null, null, true, true, false, true, true, DrawMapLayer);

            var zones = _zones.Setup(serializedObject.FindProperty("Zones"), null, null, true, true, false, true, true, DrawZone, RemoveZone);

            zones.onAddDropdownCallback += AddDropdown;

            _showLayer.image = EditorGUIUtility.IconContent("ViewToolOrbit On").image;
            _hideLayer.image = EditorGUIUtility.IconContent("ViewToolOrbit").image;
        }
Exemple #9
0
        public override void Setup(SerializedProperty property, FieldInfo fieldInfo)
        {
            Caller = GetObject <InstructionCaller>(property);
            InstructionProperty = property.FindPropertyRelative("Instruction");
            InputsProperty      = property.FindPropertyRelative("Inputs");
            OutputsProperty     = property.FindPropertyRelative("Outputs");
            InputsList          = new EditableList <InstructionVariable>();
            OutputsList         = new EditableList <InstructionVariable>();

            var inputsList = InputsList.Setup(InputsProperty, null, null, false, true, false, true, true);

            OutputsList.Setup(OutputsProperty, null, null, false, true, false, true, true);

            inputsList.drawHeaderCallback += DrawRefreshButton;
        }
        private void OnEnable()
        {
            InstructionBreadcrumbs.Reset();

            var instructions = _instructions.Setup(serializedObject.FindProperty("Instructions"), null, null, false, true, false, true, true, DrawInstruction, RemoveInstruction);

            instructions.onAddDropdownCallback += AddInstructionDropdown;

            _instructionTypes = TypeFinder.GetDerivedTypes <Instruction>("");

            foreach (var type in _instructionTypes.Types)
            {
                _addMenu.AddItem(new GUIContent(type.Name, "The type of instruction to create."), false, AddInstruction, type);
            }
        }
Exemple #11
0
        private void OnEnable()
        {
            var roster = target as Roster;

            if (roster.Ecosystem)
            {
                SetupAddMenu(roster.Ecosystem);
            }

            _ecosystem = serializedObject.FindProperty("Ecosystem");
            _creatures = serializedObject.FindProperty("Creatures");

            var creatures = _creatureList.Setup(_creatures, null, null, true, true, false, true, true, null, RemoveCreature);

            creatures.onAddDropdownCallback += AddCreatureDropdown;
        }
Exemple #12
0
        public SkillsControl(Species species)
        {
            _species = species;
            _skills  = new EditableList <Skill>();
            var list = _skills.Setup(species.Skills, "Skills", "", false, true, false, true, true, DrawSkill);

            list.onAddDropdownCallback += AddSkill;
            list.elementHeightCallback += GetSkillHeight;

            for (var i = 0; i < species.Skills.Count; i++)
            {
                var skill = species.Skills[i];
                SkillAdded(skill);
                RefreshInputs(_inputLists[i], skill.Instruction);
            }
        }
Exemple #13
0
        public MovesControl(List <Ability> abilities, List <Move> moves)
        {
            _abilities   = abilities;
            _moves       = moves;
            _traitStores = new List <VariableStoreControl>();

            var list = _list.Setup(moves, "Moves", "", false, true, false, true, true, DrawMove, RemoveMove);

            list.onAddDropdownCallback += AddMove;
            list.elementHeightCallback += GetHeight;

            foreach (var move in moves)
            {
                MoveAdded(move);
            }

            _abilityNames = _abilities.Select(ability => ability.name).ToArray();
        }
Exemple #14
0
        private void OnEnable()
        {
            var ecosystem = target as Ecosystem;

            _generationInstructions = serializedObject.FindProperty("CreatureGenerationInstructions");

            var species = _species.Setup(serializedObject.FindProperty("Species"), null, null, true, true, false, true, true, DrawSpecies, RemoveSpecies);

            species.onAddDropdownCallback += AddSpeciesDropdown;

            var abilities = _abilities.Setup(serializedObject.FindProperty("Abilities"), null, null, true, true, false, true, true, DrawAbility, RemoveAbility);

            abilities.onAddDropdownCallback += AddAbilityDropdown;

            UpdateInstructionKeys(ecosystem);

            var instructions = _updateInstructions.Setup(_updateInstructionKeys, "Creature Update Instructions", "The instructions to run when a creature trait is changed.", true, false, false, true, true, DrawInstruction, RemoveInstruction);

            instructions.onAddDropdownCallback += AddInstructionDropdown;
        }
Exemple #15
0
        private void OnEnable()
        {
            var creature = target as Creature;

            Definitions.Instance.CreatureTraits.Apply(creature.Traits, true);
            creature.CleanUpSkills();

            _speciesProperty = serializedObject.FindProperty("Species");

            _context = new EcosystemInstructionContext(creature, "Edit Creature", null);
            _traits  = new VariableStoreControl(creature.Traits, "Traits", null, false, false, DrawTrait);
            var moves = _moves.Setup(creature.Moves, "Moves", "", false, true, false, true, true, DrawMove);

            _skills.Setup(creature.Species.Skills, "Skills", "", false, false, false, false, false, DrawSkill);

            moves.elementHeightCallback += GetMoveHeight;
            moves.onAddDropdownCallback += AddMove;

            _regenerate.image = EditorGUIUtility.IconContent("d_preAudioLoopOff").image;
            _apply.image      = EditorGUIUtility.IconContent("d_preAudioLoopOff").image;
        }
Exemple #16
0
        protected override void OnEnable()
        {
            base.OnEnable();

            _instructions.Setup(serializedObject.FindProperty("Instructions"), null, null, false, true, false, true, true, DrawInstruction);
        }
        private void OnEnable()
        {
            var instructions = _instructions.Setup(serializedObject.FindProperty("Instructions"), null, null, false, true, false, true, true, DrawElement);

            instructions.onAddCallback += AddInstruction;
        }
        private void OnEnable()
        {
            var expressions = target as ExpressionInstruction;

            _expressions.Setup(expressions.Statements, "Statements", null, false, true, false, true, true, DrawStatement);
        }