Esempio n. 1
0
        /// <summary>
        /// Populates the editor with editing object's values.
        /// </summary>
        void PopulateObject()
        {
            if (editingObject == null)
            {
                return;
            }

            sidednessSwitch.toggle.isOn = !editingObject.singleSided;

            DestroyEditors();

            for (int i = 0; i < editingObject.callNumberRanges.Count; i++)
            {
                CallNumberRange       range  = editingObject.callNumberRanges[i];
                CallNumberRangeEditor editor = Instantiate(callNumberRangeEditorPrefab, transform);

                editor.onDelete = () => {
                    editingObject.callNumberRanges.Remove(range);
                    editor.Delete();
                };

                rangeEditors.Add(editor);
                editor.SetEditingObject(range);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a new range to this object.
        /// </summary>
        public void AddCallNumberRange()
        {
            if (editingObject == null)
            {
                return;
            }

            CallNumberRange range = new CallNumberRange();

            editingObject.callNumberRanges.Add(range);
            CallNumberRangeEditor editor = Instantiate(callNumberRangeEditorPrefab, transform);

            rangeEditors.Add(editor);

            editor.onDelete = () => {
                editingObject.callNumberRanges.Remove(range);
                editor.Delete();
                ActionManager.shared.Push();
            };

            editor.Show(false, false);
            editor.Show(true, true);
            editor.SetEditingObject(range);

            ActionManager.shared.Push();
        }