public BlockingCutEditorViewModel(Cut cut) { ValueChanged.Subscribe(d => { OnPropertyChanged("Value"); }); Value = cut; if (cut == null) return; if (cut.BlockingCuts[0] != null) { BlockingCut1 = cut.BlockingCuts[0]; BlockingStaff1 = cut.BlockingCuts[0].ParentActor; } if (cut.BlockingCuts[1] != null) { BlockingCut2 = cut.BlockingCuts[1]; BlockingStaff2 = cut.BlockingCuts[1].ParentActor; } if (cut.BlockingCuts[2] != null) { BlockingCut3 = cut.BlockingCuts[2]; BlockingStaff3 = cut.BlockingCuts[2].ParentActor; } }
/// <inheritdoc /> protected override GameObject OnCreateControl(Transform child) { child.name = "Toggle custom PHAPI"; Object.DestroyImmediate(child.GetComponent <MoveableToggleButton>()); Object.DestroyImmediate(child.GetComponent <OverlapSwitch>()); var tgl = child.GetComponent <ToggleButton>(); tgl.SetText(Text, Text); foreach (var image in tgl.GetComponentsInChildren <Image>()) { image.raycastTarget = true; } tgl.action.ActuallyRemoveAllListeners(); ValueChanged.Subscribe(b => tgl.Value = b); tgl.action.AddListener(SetValue); return(child.gameObject); }