public BitActionSwitchCreator(VRCAvatarDescriptor avatarDescriptor, AnimatorController animatorController, VRCExpressionParameters expressionParameters, Scripts.BitActionSwitch bitActionSwitch, string workingDirectory) { this.animatorController = animatorController; this.expressionParameters = expressionParameters; this.bitActionSwitch = bitActionSwitch; this.avatarDescriptor = avatarDescriptor; this.workingDirectory = workingDirectory; }
private void OnEnable() { this.viewModel = new BitActionSwitchWindowViewModel(); this.bitActionSwitch = (Scripts.BitActionSwitch) this.target; this.viewModel.BitActionSwitch = this.bitActionSwitch; this.reorderableList = new ReorderableList(this.bitActionSwitch.bitActionSwitchGroups, typeof(BitActionSwitchGroup), false, true, true, true) { elementHeight = 54, drawElementCallback = this.DrawElement, drawHeaderCallback = DrawHeader, }; this.bitActionSwitchGroupDrawers = this.bitActionSwitch.bitActionSwitchGroups.Select(x => new BitActionSwitchGroupDrawer(this.viewModel, this.viewModel.AvatarDescriptor == null ? null : this.viewModel.AvatarDescriptor.gameObject, x)).ToList(); this.reorderableList.onAddCallback += list => { this.Add(); }; this.reorderableList.onRemoveCallback += list => { this.bitActionSwitch.bitActionSwitchGroups.RemoveAt(list.index); this.bitActionSwitchGroupDrawers.RemoveAt(list.index); if (list.index >= list.list.Count - 1) { list.index = list.list.Count - 1; } }; this.reorderableList.elementHeightCallback += index => this.bitActionSwitchGroupDrawers[index].GetElementHeight(); if (this.viewModel.BitActionSwitch.bitActionSwitchGroups.Count == 0) { this.Add(); } this.reorderableList.onCanRemoveCallback = list => list.count > 1; }