Ejemplo n.º 1
0
        private void RebuildDetails()
        {
            CustomDetailRoot.Clear();
            DefaultLabel.Clear();

            var bifurcationsProp = CommandItem.CommandProperty.GetChildProperty("bifurcations");

            var count = bifurcationsProp.GetProperty().arraySize;

            for (int i = 0; i < count; i++)
            {
                var bifurcationBox = new VisualElement();

                var item      = bifurcationsProp.GetArrayElementAt(i);
                var labelProp = item.GetChildProperty("label").GetProperty();

                var a = new Foldout();
                a.text = $"「{labelProp.stringValue}」"; // new Label($"「{labelProp.stringValue}」");
                var toggle = a.Q <Toggle>();
                toggle.style.marginBottom    = 0f;
                a.style.marginTop            = 10f;
                toggle.style.backgroundColor = new Color(0, 0, 0, 0.5f);
                bifurcationBox.Add(a);
                DefaultLabel.Add(a);

                var l = new CommandListView(CommandItem.ParentList, item.GetChildProperty("commandList.commands"));
                a.Add(l);

                CustomDetailRoot.Add(bifurcationBox);
            }
        }
Ejemplo n.º 2
0
        private void BuildNestedCommandList()
        {
            var commandProp       = CommandItem.CommandProperty;
            var nestedCommandProp = commandProp.GetChildProperty("commandList.commands");

            CustomDetailRoot.Clear();
            var commandListView = new CommandListView(CommandItem.ParentList, nestedCommandProp);

            CustomDetailRoot.Add(commandListView);
        }
Ejemplo n.º 3
0
        public override void OnCreated()
        {
            CustomDetailRoot.Clear();

            var commandProp = CommandItem.CommandProperty;

            var containerProp     = commandProp.GetChildProperty("container.commands");
            var containerListView = new CommandListView(CommandItem.ParentList, containerProp);

            CustomDetailRoot.Add(containerListView);
        }
Ejemplo n.º 4
0
        public override void OnCreated()
        {
            CustomDetailRoot.Clear();

            var l0 = new Label("ルーチン");

            CustomDetailRoot.Add(l0);

            var commandProp = CommandItem.CommandProperty;

            var trueProp     = commandProp.GetChildProperty("routine.commands");
            var trueListView = new CommandListView(CommandItem.ParentList, trueProp);

            CustomDetailRoot.Add(trueListView);
        }
Ejemplo n.º 5
0
        private void RemoveBifurcation(int index)
        {
            //データの更新
            var bifurcationsProp = CommandItem.CommandProperty.GetChildProperty("bifurcations");

            bifurcationsProp.DeleteArrayElementAt(index);
            bifurcationsProp.SerializedObject.ApplyModifiedProperties();

            //UIの更新
            //リストの追加
            CustomDetailRoot.RemoveAt(index);
            DefaultLabel.RemoveAt(index);

            //CommandEditorの更新
            RebuildCommandEditor();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// EventCommandEditorが作成されたときに呼び出されます。
        /// </summary>
        public virtual void OnCreated()
        {
            //ShowListViewInCustomDetailAttributeがついてるEventCommandListをDetailに追加する
            var commandProp = CommandItem.CommandProperty.GetProperty();
            var typeDesc    = commandProp.managedReferenceFullTypename.Split(' ');

            var assemblyName = typeDesc[0];
            var typeName     = typeDesc[1];

            var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == assemblyName);

            if (assembly == default)
            {
                return;
            }

            var type = assembly.DefinedTypes.FirstOrDefault(t => t.FullName == typeName);

            if (type == default)
            {
                return;
            }

            var fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
            var field  = fields.FirstOrDefault(f => Enumerable.Any <CustomAttributeData>(f.CustomAttributes,
                                                                                         a => a.AttributeType == typeof(ShowListViewInCustomDetailAttribute)));

            if (field == default)
            {
                return;
            }
            if (field.FieldType != typeof(EventCommandList))
            {
                return;
            }

            var listProp = CommandItem.CommandProperty.GetChildProperty(field.Name);

            if (listProp.GetProperty() == null)
            {
                return;
            }

            var list = new CommandListView(CommandItem.ParentList, listProp.GetChildProperty("commands"));

            CustomDetailRoot.Add(list);
        }
Ejemplo n.º 7
0
        private void AddBifurcation(int index)
        {
            //データの更新
            var bifurcationsProp = CommandItem.CommandProperty.GetChildProperty("bifurcations");

            bifurcationsProp.InsertArrayElementAt(index);
            bifurcationsProp.SerializedObject.ApplyModifiedProperties();

            //UIの更新
            //リストの追加
            var bifurcationBox = new VisualElement();

            var item      = bifurcationsProp.GetArrayElementAt(index);
            var labelProp = item.GetChildProperty("label").GetProperty();

            var a = new Foldout();

            a.text = $"「{labelProp.stringValue}」";
            var toggle = a.Q <Toggle>();

            toggle.style.marginBottom    = 0f;
            a.style.marginTop            = 10f;
            toggle.style.backgroundColor = new Color(0, 0, 0, 0.5f);
            bifurcationBox.Add(a);
            DefaultLabel.Insert(index, a);

            item.GetProperty().FindPropertyRelative("commandList.commands").arraySize = 0;
            bifurcationsProp.SerializedObject.ApplyModifiedProperties();
            var commandArrayProp = item.GetChildProperty("commandList.commands");

            var l = new CommandListView(CommandItem.ParentList, commandArrayProp);

            a.Add(l);

            CustomDetailRoot.Insert(index, bifurcationBox);

            bifurcationsProp.SerializedObject.ApplyModifiedProperties();

            //CommandEditorの更新
            RebuildCommandEditor();
        }
Ejemplo n.º 8
0
        public override void OnCreated()
        {
            CustomDetailRoot.Clear();

            var l0 = new Label("真の場合");

            CustomDetailRoot.Add(l0);

            var commandProp = CommandItem.CommandProperty;

            var trueProp     = commandProp.GetChildProperty("ifTrue.commands");
            var trueListView = new CommandListView(CommandItem.ParentList, trueProp);

            CustomDetailRoot.Add(trueListView);

            var l1 = new Label("偽の場合");

            CustomDetailRoot.Add(l1);

            var falseProp     = commandProp.GetChildProperty("ifFalse.commands");
            var falseListView = new CommandListView(CommandItem.ParentList, falseProp);

            CustomDetailRoot.Add(falseListView);
        }