示例#1
0
        // Start is called before the first frame update
        private void Start()
        {
            status        = status ?? GetComponentInChildren <TextMeshProUGUI>();
            windowManager = windowManager ?? GetComponentInParent <DemoWindowManager>();
            var buttons = GetComponentsInChildren <Button>();

            buttons[0].onClick.AsObservable().Subscribe(x => OnClick(DemoUiOperation.Show)).AddTo(this);
            buttons[1].onClick.AsObservable().Subscribe(x => OnClick(DemoUiOperation.Hide)).AddTo(this);
            buttons[2].onClick.AsObservable().Subscribe(x => OnClick(DemoUiOperation.Close)).AddTo(this);
        }
        // Start is called before the first frame update
        private void Start()
        {
            buttonTrigger = buttonTrigger ?? GetComponent <Button>();
            text          = text ?? GetComponentInChildren <TextMeshProUGUI>();
            windowManager = windowManager ?? GetComponentInParent <DemoWindowManager>();

            buttonTrigger.onClick.
            AsObservable().
            Subscribe(x => OnClick()).
            AddTo(this);
        }