Inheritance: UnityEngine.ScriptableObject
        public void AddRecipient()
        {
            // try to select an existing blank cell
            _selectedRecipient = CollectionUtils.SelectFirst(_recipients.Items, i => i.Item.Recipient == null);

            // if none, then add one
            if (_selectedRecipient == null)
            {
                _selectedRecipient = _recipients.AddNew(true);
            }

            // inform view to select the cell
            OnSelectedRecipientChanged();

            // inform view to begin editing the cell
            EventsHelper.Fire(_newRecipientAdded, this, EventArgs.Empty);
        }
Exemple #2
0
        public void MakePrimary()
        {
            // Swap the current primary item with the selected candidate item. Update both tables and selections
            var originalSelectedCandidate = _selectedCandidate.Item;
            var isChecked = _selectedCandidate.IsChecked;

            var index = _candidateTable.Items.IndexOf(_selectedCandidate);

            _candidateTable.Items.RemoveAt(index);
            _selectedCandidate = new Checkable <ReportingWorklistItemSummary>(_primaryItem, isChecked);
            _candidateTable.Items.Insert(index, _selectedCandidate);

            _primaryItem = originalSelectedCandidate;
            _sourceTable.Items.Clear();
            _sourceTable.Items.Add(_primaryItem);

            NotifyPropertyChanged("CandidateTableSelection");
        }
Exemple #3
0
 private void UpdateCheckableItemSelectStatus(Checkable <DicomPrinter> item, bool flag)
 {
     if (flag)
     {
         IEnumerator <Checkable <DicomPrinter> > enumerator1 = base.Items.GetEnumerator();
         using (IEnumerator <Checkable <DicomPrinter> > enumerator = enumerator1)
         {
             while (enumerator.MoveNext())
             {
                 Checkable <DicomPrinter> current = enumerator.Current;
                 current.IsChecked = false;
                 base.Items.NotifyItemUpdated(current);
             }
         }
     }
     item.IsChecked = flag;
     base.Items.NotifyItemUpdated(item);
     EventsHelper.Fire(this._propertyChanged, this, EventArgs.Empty);
 }
Exemple #4
0
    public override int ForkEditorIndex(Checkable fork)
    {
        /*if (defaultForkEditor.manages(fork))
         *      return 0;*/

        int i = 1;

        foreach (ForkEditor forkEditor in forkEditors)
        {
            if (forkEditor.manages(fork))
            {
                return(i);
            }
            else
            {
                i++;
            }
        }

        return(0);
    }
Exemple #5
0
    public void draw()
    {
        Checkable c = (Checkable)myNode.Content;

        string[] editors        = ForkEditorFactory.Intance.CurrentForkEditors;
        int      editorSelected = EditorGUILayout.Popup(
            ForkEditorFactory.Intance.ForkEditorIndex(c),
            ForkEditorFactory.Intance.CurrentForkEditors
            );

        ForkEditor editor = ForkEditorFactory.Intance.createForkEditorFor(editors[editorSelected]);

        editor.useFork(c);

        editor.draw();

        myNode.Content = editor.Result;

        if (Event.current.type != EventType.Layout)
        {
            int l = myNode.Childs.Length;
            if (l != 2)
            {
                while (l < 2)
                {
                    myNode.addNewChild();
                    l++;
                }
                while (l > 2)
                {
                    myNode.removeChild(l);
                    l--;
                }
                myNode.Childs[0].Name = "Case fork True";
                myNode.Childs[1].Name = "Case fork False";
                //this.Repaint ();
            }
        }
    }
Exemple #6
0
        public static void AddHint(ZoneType zone, Checkable item)
        {
            if (item is Ability abil)
            {
                SkillLocs[abil.type] = zone;
            }
            else if (item is QuestEvent q && q.type == QuestEventType.Water)
            {
                CleanWaterZone = zone;
            }

            if (HintObjects.ContainsKey(zone))
            {
                HintObjects[zone].Add(item);
            }
            else
            {
                HintObjects[zone] = new List <Checkable>()
                {
                    item
                }
            };
        }
        public void InitDicomPrinterConfig()
        {
            if (_dicomPrinterConfigurationEditorComponent != null)
            {
                _dicomPrinterConfigurationEditorComponent.PropertyChanged -= LocalPropertyChanged;
            }

            _dicomPrinter = null;

            _dicomPrinterTable = new DicomPrinterTable(true);
            _dicomPrinterConfigurationEditorComponent = new DicomPrinterConfigurationEditorComponent();
            _dicomPrinterConfigurationEditorComponent.PropertyChanged += LocalPropertyChanged;
            if (Convert == null)
            {
                Convert = WrapperDicomPrinterToCheckable;
            }
            _dicomPrinterTable.Items.AddRange(CollectionUtils.Map(DicomPrintSettings.LocalDicomPrinterCollection, Convert));
            _dicomPrinter = _dicomPrinterTable.SelectDicomPrinter(DicomPrintSettings.LocalDefaultPrinterName);

            if (_dicomPrinterTable.Items.Count > 0)
            {
                if (_dicomPrinterTable.SelectFirstCheckedCheckableDicomPrinter == null)
                {
                    _dicomPrinter = _dicomPrinterTable.Items[0];
                }
            }

            if (_dicomPrinter == null)
            {
                _dicomPrinterConfigurationEditorComponent.Configuration = new DicomPrinter.Configuration();
            }
            else
            {
                _dicomPrinterConfigurationEditorComponent.Configuration = this._dicomPrinter.Item.Config;
            }
        }
Exemple #8
0
    internal static void createOptionsNode(Sequence seq, JSONObject jsonObj, IState variables, string nodeId, string key)
    {
        JSONObject node = jsonObj.GetField(nodeId);

        if (!node.HasField(OPTIONS_FIELD))
        {
            throw new Exception("The node " + key + "->" + nodeId + " need a " + OPTIONS_FIELD + " field");
        }

        List <JSONObject> optionsList = node.GetField(OPTIONS_FIELD).list;

        List <Option> options = new List <Option>();

        foreach (JSONObject j in optionsList)
        {
            if (j.HasField(MESSAGE_FIELD))
            {
                Checkable check = null;
                if (j.HasField(CONDITION_FIELD))
                {
                    check = FormulaFork.Create(j.GetField(CONDITION_FIELD).ToString().Replace("\"", ""));
                }
                options.Add(new Option(j.GetField(MESSAGE_FIELD).ToString().Replace("\"", ""), string.Empty, check));
            }
            else
            {
                throw new Exception("The node " + key + "->" + nodeId + " need a " + MESSAGE_FIELD + " field");
            }
        }

        SequenceNode newNode    = seq[nodeId];
        Options      optionsObj = Options.Create(options);

        if (node.HasField(OPTIONS_QUESTION_ID))
        {
            optionsObj.QuestionID = node.GetField(OPTIONS_QUESTION_ID).ToString().Replace("\"", "");
        }

        newNode.Content = optionsObj;

        if (nodeId == "root")
        {
            seq.Root = newNode;
        }

        int child = 0;

        foreach (JSONObject j in optionsList)
        {
            if (j.HasField(NEXT_FIELD) && j.HasField(MESSAGE_FIELD))
            {
                string nextNodeId = j.GetField(NEXT_FIELD).ToString().Replace("\"", "");
                if (nodeId == "root")
                {
                    seq.Root.Childs[child] = seq[nextNodeId];
                }
                else
                {
                    seq[nodeId][child] = seq[nextNodeId];
                }
                createNode(seq, jsonObj, variables, nextNodeId, key);
            }
            child++;
        }
    }
Exemple #9
0
        private static int Port(Checkable <DicomPrinter> printer)
        {
            DicomPrinter item = printer.Item;

            return(item.Port);
        }
Exemple #10
0
        private static string Name(Checkable <DicomPrinter> printer)
        {
            DicomPrinter item = printer.Item;

            return(item.Name);
        }
Exemple #11
0
 private static DicomPrinter GetDicomPrinter(Checkable <DicomPrinter> checkableDicomPrinter)
 {
     return(checkableDicomPrinter.Item);
 }
Exemple #12
0
 private static bool IsChecked(Checkable <DicomPrinter> checkableDicomPrinter)
 {
     return(checkableDicomPrinter.IsChecked);
 }
Exemple #13
0
 public abstract int ForkEditorIndex(Checkable fork);
 public abstract int ForkEditorIndex(Checkable fork);
Exemple #15
0
 public abstract Editor createForkEditorFor(Checkable forkName);
Exemple #16
0
 public override Editor createForkEditorFor(Checkable forkName)
 {
     return(Editor.CreateEditor(forkName));
 }
 public void useFork(Checkable c)
 {
     if(c is ISwitchFork)
         isf = c as ISwitchFork;
 }
Exemple #18
0
 public bool manages(Checkable c)
 {
     return(c != null && c is ItemFork);
 }
Exemple #19
0
        private static string AETitle(Checkable <DicomPrinter> printer)
        {
            DicomPrinter item = printer.Item;

            return(item.AETitle);
        }
    public override int ForkEditorIndex(Checkable fork)
    {
        /*if (defaultForkEditor.manages(fork))
            return 0;*/

        int i = 1;
        foreach (ForkEditor forkEditor in forkEditors)
            if(forkEditor.manages(fork))	return i;
            else 							i++;

        return 0;
    }
 public bool manages(Checkable c)
 {
     return c!=null &&c is ItemFork;
 }
    //int selectedTexture;
    public override void OnInspectorGUI()
    {
        EditorGUI.BeginChangeCheck();

        serializedObject.Update();

        SerializedProperty cell       = serializedObject.FindProperty("destination");
        SerializedProperty modep      = serializedObject.FindProperty("mode");
        SerializedProperty gep        = serializedObject.FindProperty("sge");
        SerializedProperty checkablep = serializedObject.FindProperty("checkable");

        EditorGUILayout.PropertyField(cell);

        modep.intValue = GUILayout.Toolbar(modep.intValue, new string[] { "Always", "Event trigger", "Checkable" });

        switch (modep.intValue)
        {
        case 1: {
            SerializableGameEvent ge = gep.objectReferenceValue as SerializableGameEvent;

            if (ge == null)
            {
                ge = ScriptableObject.CreateInstance <SerializableGameEvent> ();
            }

            string[] editors        = EventEditorFactory.Intance.CurrentEventEditors;
            int      editorSelected = 0;
            if (ge.Name == null)
            {
                ge.Name = "";
            }
            for (int i = 1; i < editors.Length; i++)
            {
                if (editors [i].ToLower() == ge.Name.ToLower())
                {
                    editorSelected = i;
                }
            }
            int was = editorSelected;

            editorSelected = EditorGUILayout.Popup(editorSelected, EventEditorFactory.Intance.CurrentEventEditors);
            if (was != editorSelected && editorSelected == 0)
            {
                ge.Name = "";
            }
            EventEditor editor = EventEditorFactory.Intance.createEventEditorFor(editors[editorSelected]);
            editor.useEvent(ge);

            editor.draw();
            ge = editor.Result;

            gep.objectReferenceValue = ge;
        }
        break;

        case 2: {
            Checkable c              = (Checkable)checkablep.objectReferenceValue;
            string[]  editors        = ForkEditorFactory.Intance.CurrentForkEditors;
            int       editorSelected = EditorGUILayout.Popup(
                ForkEditorFactory.Intance.ForkEditorIndex(c),
                ForkEditorFactory.Intance.CurrentForkEditors
                );

            ForkEditor editor = ForkEditorFactory.Intance.createForkEditorFor(editors[editorSelected]);

            editor.useFork(c);

            editor.draw();

            checkablep.objectReferenceValue = editor.Result;
        } break;
        }


        if (EditorGUI.EndChangeCheck())
        {
        }

        serializedObject.ApplyModifiedProperties();
    }
 public void useFork(Checkable c)
 {
     if(c is ItemFork)
         isf = c as ItemFork;
 }
Exemple #24
0
 private static string Host(Checkable <DicomPrinter> printer)
 {
     return(printer.Item.Host);
 }
 public bool manages(Checkable c)
 {
     return c!=null && c is ISwitchFork;
 }