Example #1
0
 public BitActionSwitchItemDrawer(BitActionSwitchWindowViewModel viewModel, GameObject targetAvatar, BitActionSwitchGroup bitActionSwitchGroup, BitActionSwitchItem bitActionSwitchItem)
 {
     this.viewModel            = viewModel;
     this.targetAvatar         = targetAvatar;
     this.bitActionSwitchGroup = bitActionSwitchGroup;
     this.bitActionSwitchItem  = bitActionSwitchItem;
     this.gameObjectRegisterUi = new GameObjectRegisterUi(viewModel, bitActionSwitchItem);
     this.customAnimRegisterUi = new CustomAnimRegisterUi(bitActionSwitchItem);
 }
Example #2
0
        public void AddItem(GameObject targetAvatar, BitActionSwitchGroup bitActionSwitchGroup)
        {
            var bitActionSwitchItem = new BitActionSwitchItem
            {
                name = ObjectNames.GetUniqueName(bitActionSwitchGroup.bitActionSwitchItems.Select(x => x.name).ToArray(),
                                                 "Object")
            };

            bitActionSwitchGroup.bitActionSwitchItems.Add(bitActionSwitchItem);
            this.bitActionSwitchItemDrawers.Add(new BitActionSwitchItemDrawer(this.viewModel, targetAvatar, this.bitActionSwitchGroup,
                                                                              bitActionSwitchItem));
        }
Example #3
0
 public bool AddExpressionMenuControl(BitActionSwitchItem bitActionSwitchItem, int objectNum)
 {
     if (this.expressionsMenu.controls.Count >= 8)
     {
         return(false);
     }
     this.expressionsMenu.controls.Add(new VRCExpressionsMenu.Control
     {
         type      = VRCExpressionsMenu.Control.ControlType.Toggle,
         icon      = bitActionSwitchItem.icon,
         name      = bitActionSwitchItem.name,
         style     = VRCExpressionsMenu.Control.Style.Style1,
         parameter = new VRCExpressionsMenu.Control.Parameter
         {
             name = ActionSwitchParameters.ObjectNumParameterName
         },
         value = objectNum
     });
     EditorUtility.SetDirty(this.expressionsMenu);
     AssetDatabase.SaveAssets();
     return(true);
 }
        public GameObjectRegisterUi(BitActionSwitchWindowViewModel viewModel, BitActionSwitchItem bitActionSwitchItem)
        {
            this.bitActionSwitchItem = bitActionSwitchItem;

            this.reorderableList = new ReorderableList(bitActionSwitchItem.gameObjects, typeof(GameObject), true, false,
                                                       true, true);

            this.reorderableList.drawHeaderCallback += rect =>
            {
                EditorGUI.LabelField(rect, L10n.Tr("Target Game Objects"));
            };

            this.reorderableList.drawElementCallback += (rect, index, active, focused) =>
            {
                var toggleFieldRect = rect;
                toggleFieldRect.width  = 16f;
                toggleFieldRect.height = EditorGUIUtility.singleLineHeight + 2;

                var objectFieldRect = rect;
                objectFieldRect.x     += toggleFieldRect.width + 2;
                objectFieldRect.y     += 1;
                objectFieldRect.width -= toggleFieldRect.width + 2;
                objectFieldRect.height = EditorGUIUtility.singleLineHeight;

                if (bitActionSwitchItem.gameObjects[index] != null)
                {
                    EditorCustomGUI.Toggle(toggleFieldRect, "", bitActionSwitchItem.gameObjects[index].activeSelf,
                                           x => bitActionSwitchItem.gameObjects[index].SetActive(x));
                }

                EditorCustomGUI.ObjectField(objectFieldRect, "", bitActionSwitchItem.gameObjects[index], true, true, x =>
                {
                    bitActionSwitchItem.gameObjects[index] = x;
                }, () => viewModel.IsErrorRegisterGameObject(bitActionSwitchItem.gameObjects[index]));
            };

            this.reorderableList.onAddCallback += list => bitActionSwitchItem.gameObjects.Add(null);
        }
 public CustomAnimRegisterUi(BitActionSwitchItem bitActionSwitchItem)
 {
     this.bitActionSwitchItem = bitActionSwitchItem;
 }