コード例 #1
0
        protected override void Start()
        {
            base.Start();

            var souvenirBar     = transform.FindChild(Constants.SouvenirBar);
            var confirmationBar = transform.FindChild(Constants.ConfirmationBar);

            // Gets the holobar buttons
            adjustButton  = souvenirBar.FindChild(Constants.AdjustButton).gameObject.GetComponent <HoloBarButton>();
            cancelButton  = confirmationBar.FindChild(Constants.CancelButton).gameObject.GetComponent <HoloBarButton>();
            confirmButton = confirmationBar.FindChild(Constants.ConfirmButton).gameObject.GetComponent <HoloBarButton>();

            // Attaches the clicked events to the buttons
            adjustButton.Clicked  += () => { RaiseIfNotInConfirmationState(AdjustClicked); };
            cancelButton.Clicked  += () => { CancelClicked.RaiseEvent(); };
            confirmButton.Clicked += () => { ConfirmClicked.RaiseEvent(); };

            // Sets up the voice commands
            keywords.Add(VoiceCommandsManager.AdjustKeyword, () => { RaiseIfNotInConfirmationState(AdjustClicked); });
            keywords.Add(VoiceCommandsManager.CancelKeyword, () => { CancelClicked.RaiseEvent(); });
            keywords.Add(VoiceCommandsManager.ConfirmKeyword, () => { ConfirmClicked.RaiseEvent(); });

            // Attaches the holobar flow methods to the buttons
            AdjustClicked  += () => { ChangeBar(Constants.ConfirmationBar); };
            CancelClicked  += () => { ChangeBar(Constants.SouvenirBar); };
            ConfirmClicked += () => { ChangeBar(Constants.SouvenirBar); };
        }
コード例 #2
0
        protected override void Start()
        {
            base.Start();

            var souvenirBar           = transform.FindChild(Constants.SouvenirBar);
            var adjustConfirmationBar = transform.FindChild(Constants.AdjustConfirmationBar);
            var removeConfirmationBar = transform.FindChild(Constants.RemoveConfirmationBar);
            var hiddenBar             = transform.FindChild(Constants.HiddenBar);

            // Gets the holobar buttons
            adjustButton        = souvenirBar.FindChild(Constants.AdjustButton).gameObject.GetComponent <HoloBarButton>();
            adjustCancelButton  = adjustConfirmationBar.FindChild(Constants.CancelButton).gameObject.GetComponent <HoloBarButton>();
            adjustConfirmButton = adjustConfirmationBar.FindChild(Constants.ConfirmButton).gameObject.GetComponent <HoloBarButton>();
            removeButton        = souvenirBar.FindChild(Constants.RemoveButton).gameObject.GetComponent <HoloBarButton>();
            removeCancelButton  = removeConfirmationBar.FindChild(Constants.CancelButton).gameObject.GetComponent <HoloBarButton>();
            removeConfirmButton = removeConfirmationBar.FindChild(Constants.ConfirmButton).gameObject.GetComponent <HoloBarButton>();
            hideHoloBarButton   = souvenirBar.FindChild(Constants.HideHoloBarButton).gameObject.GetComponent <HoloBarButton>();
            showHoloBarButton   = hiddenBar.FindChild(Constants.ShowHoloBarButton).gameObject.GetComponent <HoloBarButton>();

            // Attaches the clicked events to the buttons
            showHoloBarButton.Clicked += () => { RaiseIfNotInConfirmationState(ShowHoloBarClicked); };

            adjustButton.Clicked        += () => { RaiseIfNotInConfirmationState(AdjustClicked); };
            adjustCancelButton.Clicked  += () => { AdjustCancelClicked.RaiseEvent(); };
            adjustConfirmButton.Clicked += () => { AdjustConfirmClicked.RaiseEvent(); };

            removeButton.Clicked        += () => { RaiseIfNotInConfirmationState(RemoveClicked); };
            removeCancelButton.Clicked  += () => { RemoveCancelClicked.RaiseEvent(); };
            removeConfirmButton.Clicked += () => { RemoveConfirmClicked.RaiseEvent(); };

            hideHoloBarButton.Clicked += () => { RaiseIfNotInConfirmationState(HideHoloBarClicked); };

            // Sets up the voice commands
            keywords.Add(VoiceCommandsManager.ShowHoloBarKeyword, () => { RaiseIfNotInConfirmationState(ShowHoloBarClicked); });
            keywords.Add(VoiceCommandsManager.AdjustKeyword, () => { RaiseIfNotInConfirmationState(AdjustClicked); });
            keywords.Add(VoiceCommandsManager.RemoveKeyword, () => { RaiseIfNotInConfirmationState(RemoveClicked); });
            keywords.Add(VoiceCommandsManager.HideHoloBarKeyword, () => { RaiseIfNotInConfirmationState(HideHoloBarClicked); });
            keywords.Add(VoiceCommandsManager.CancelKeyword, () =>
            {
                AdjustCancelClicked.RaiseEvent();
                RemoveCancelClicked.RaiseEvent();
            });
            keywords.Add(VoiceCommandsManager.ConfirmKeyword, () =>
            {
                AdjustConfirmClicked.RaiseEvent();
                RemoveConfirmClicked.RaiseEvent();
            });

            // Attaches the holobar flow methods to the buttons
            AdjustClicked        += () => { ChangeBar(Constants.AdjustConfirmationBar); };
            AdjustCancelClicked  += () => { ChangeBar(Constants.SouvenirBar); };
            AdjustConfirmClicked += () => { ChangeBar(Constants.SouvenirBar); };
            RemoveCancelClicked  += () => { ChangeBar(Constants.SouvenirBar); };
            RemoveClicked        += () => { ChangeBar(Constants.RemoveConfirmationBar); };
            RemoveConfirmClicked += () => { ChangeBar(Constants.SouvenirBar); };
            ShowHoloBarClicked   += () => { ChangeBar(Constants.SouvenirBar); };
            HideHoloBarClicked   += () => { ChangeBar(Constants.HiddenBar); };
        }