void ReleaseDesignerOutlets()
        {
            if (FeedCollectionView != null)
            {
                FeedCollectionView.Dispose();
                FeedCollectionView = null;
            }

            if (HomeButton != null)
            {
                HomeButton.Dispose();
                HomeButton = null;
            }

            if (FriendsButton != null)
            {
                FriendsButton.Dispose();
                FriendsButton = null;
            }

            if (AddPostButton != null)
            {
                AddPostButton.Dispose();
                AddPostButton = null;
            }

            if (ProfileButton != null)
            {
                ProfileButton.Dispose();
                ProfileButton = null;
            }
        }
Exemplo n.º 2
0
 public void Draw()
 {
     spriteBatch.Draw(Background, new Vector2(0, 0), null, Color.White, 0,
                      new Vector2(0, 0), 1f, SpriteEffects.None, 0);
     HomeButton.Draw();
     foreach (Block block in BlockList)
     {
         block.DrawBig();
     }
     foreach (Block block in HiddenList)
     {
         if (!block.IsSelected && !block.IsEmptyBlock)
         {
             block.DrawBig();
         }
     }
     CheckWin();
     if (DidWin)
     {
         spriteBatch.Draw(WinnerSplash, new Vector2(256, 144), null, Color.White, 0,
                          new Vector2(0, 0), 1f, SpriteEffects.None, 0);
         //NewButton = new MenuButton(new Vector2(480, 448), "NewButton", gameContent.arrorRight, spriteBatch, gameContent);
         NewButton.Draw();
     }
 }
Exemplo n.º 3
0
        void ReleaseDesignerOutlets()
        {
            if (CountryButton != null)
            {
                CountryButton.Dispose();
                CountryButton = null;
            }

            if (CountryLabel != null)
            {
                CountryLabel.Dispose();
                CountryLabel = null;
            }

            if (PostCodeCountainerView != null)
            {
                PostCodeCountainerView.Dispose();
                PostCodeCountainerView = null;
            }

            if (PostcodeTextField != null)
            {
                PostcodeTextField.Dispose();
                PostcodeTextField = null;
            }

            if (HomeButton != null)
            {
                HomeButton.Dispose();
                HomeButton = null;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Attempts to log out
 /// </summary>
 /// <returns>false if failed to logout, not if already logged out</returns>
 public bool LogOut()
 {
     Console.WriteLine("Logging out  if can");
     try
     {
         if (IsLoggedIn())
         {
             return(true);
         }
         WebDriverWait wait = TestingConfig.GetWaitDriver(Driver);
         UserDropDown.Click();
         wait.Until(dr => SignOutButton);
         SignOutButton.Click();
         wait.Until(dr => HomeButton);
         HomeButton.Click();
         wait.Until(dr => LoginButton);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         Console.WriteLine("Cannot log out");
         return(false);
     }
     return(true);
 }
Exemplo n.º 5
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
 void ReleaseDesignerOutlets()
 {
     if (ClearButton != null)
     {
         ClearButton.Dispose();
         ClearButton = null;
     }
     if (HomeButton != null)
     {
         HomeButton.Dispose();
         HomeButton = null;
     }
     if (MenYappuLabel != null)
     {
         MenYappuLabel.Dispose();
         MenYappuLabel = null;
     }
     if (PaaText != null)
     {
         PaaText.Dispose();
         PaaText = null;
     }
     if (ParseButton != null)
     {
         ParseButton.Dispose();
         ParseButton = null;
     }
 }
Exemplo n.º 7
0
        public void Draw()
        {
            spriteBatch.Draw(AllWords.WordsLists[CategoryIndex][CurrentWordIndex].Image, new Vector2(320, 64), null, Color.White, 0,
                             new Vector2(0, 0), 1f, SpriteEffects.None, 0);
            spriteBatch.Draw(BackGround, new Vector2(0, 0), null, Color.White, 0,
                             new Vector2(0, 0), 1f, SpriteEffects.None, 0);
            HomeButton.Draw();
            ArrowRight.Draw();
            if (!UsedHint)
            {
                HintButton.Draw();
            }
            else
            {
                HintButtonUsed.Draw();
            }

            foreach (Block block in BlockList)
            {
                block.Draw();
            }
            foreach (Block block in EmptyList)
            {
                block.Draw();
            }
        }
Exemplo n.º 8
0
        public string AddNewFolder(string folderName)
        {
            WaitUntilExist(MailFrame);

            Browser.SwitchTo().Frame(MailFrame);

            NavigateToConfiguration();

            WaitUntilExist(SettingsButtonFolderManagement);

            SettingsButtonFolderManagement.Click();

            WaitUntilExist(SettingsButtonAdd);

            SettingsButtonAdd.Click();

            WaitUntilExist(PreferencesFrame);

            Browser.SwitchTo().Frame(PreferencesFrame);

            FolderNameInput.SendKeys(folderName);

            ButtonSave.Click();

            Browser.SwitchTo().ParentFrame();

            HomeButton.Click();

            IsPageLoaded();

            return(FolderList.Text);
        }
Exemplo n.º 9
0
    /// <summary>
    ///
    /// </summary>
    public virtual void DeactivateAllSubmenus()
    {
        SelectorMenu.Instance.gameObject.SetActive(true);
        if (RenameDialog.Visible)
        {
            RenameDialog.Cancel();
        }
        TransformMenu.Instance.Hide();
        RobotSteppingMenu.Instance.Hide();

        MainSettingsMenu.Instance.Hide();
        ActionObjectMenu.Instance.Hide();

        FavoritesButtons.SetActive(false);
        HomeButtons.SetActive(false);
        UtilityButtons.SetActive(false);
        AddButtons.SetActive(false);
        RobotButtons.SetActive(false);

        FavoritesButton.GetComponent <Image>().enabled = false;
        RobotButton.GetComponent <Image>().enabled     = false;
        AddButton.GetComponent <Image>().enabled       = false;
        UtilityButton.GetComponent <Image>().enabled   = false;
        HomeButton.GetComponent <Image>().enabled      = false;

        MainSettingsButton.GetComponent <Image>().enabled  = false;
        MoveButton.GetComponent <Image>().enabled          = false;
        MoveButton2.GetComponent <Image>().enabled         = false;
        OpenMenuButton.GetComponent <Image>().enabled      = false;
        RobotSelectorButton.GetComponent <Image>().enabled = false;
        RobotSteppingButton.GetComponent <Image>().enabled = false;
        RobotSelector.Close(false);
    }
Exemplo n.º 10
0
    void Start()
    {
        instance = GetComponent <BoardManager> ();

        GetComponent <SpriteRenderer> ().sprite = normal_bg;

        TileController.speedScale = 1.0f;

        isPaused = false;
        white_bg.SetActive(false);
        ResumeButton.SetActive(false);
        HomeButton.SetActive(false);

        Time.timeScale = 1;

        init_bonus();

        init_bugs();

        init_punish();

        init_lines();

        init_time();

        init_score();

        init_timer();

        //init_score ();
        //ShowTime ();
        //init_bonus ();
        //init_effects ();
    }
Exemplo n.º 11
0
 private void WindowLoad(object sender, EventArgs e)
 {
     this.ContentPanel.Size = new Size(this.Size.Width - this.MenuPanel.Size.Width, this.Size.Height - this.InfoPanel.Size.Height - 40);
     this.MenuPanelSizeChanged(sender, e);
     this.SearchTextBox_Leave(sender, e);
     HomeButton.PerformClick();
 }
Exemplo n.º 12
0
 // Start is called before the first frame update
 void Start()
 {
     if (instance != this)
     {
         Destroy(instance);
     }
     instance = this;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Clicks the home navigation button.
        /// </summary>
        /// <returns>The expected <see cref="Homepage"/> that should result from this action.</returns>
        public Homepage ClickHome()
        {
            WaitForLoad();

            HomeButton.Click();

            return(new Homepage(Helper.Homepage.AbsoluteUri, Helper.HomepageTitle));
        }
Exemplo n.º 14
0
 public void resume_game()
 {
     isPaused       = false;
     Time.timeScale = 1;
     white_bg.SetActive(false);
     ResumeButton.SetActive(false);
     HomeButton.SetActive(false);
 }
Exemplo n.º 15
0
 public void pause_game()
 {
     isPaused       = true;
     Time.timeScale = 0;
     white_bg.SetActive(true);
     ResumeButton.SetActive(true);
     HomeButton.SetActive(true);
 }
Exemplo n.º 16
0
    /// <summary>
    /// Shows and hides the menu
    /// </summary>
    float Show(bool show, bool immediate = false)
    {
        if ((show && isVisible) || (!show && !isVisible))
        {
            if (show)
            {
                // refresh any children
                BroadcastMessage("OnRefresh", SendMessageOptions.DontRequireReceiver);
            }
            return(0.0f);
        }
        float delaySecs = 0.0f;

        if (show)
        {
            if (curser != null)
            {
                curser.renderCrosshair = true;
            }
            // orient and position in front of the player's view
            Vector3 offset = (cameraController.centerEyeAnchor.forward * distanceFromViewer);
            offset.y           = (transform.position.y - cameraController.centerEyeAnchor.position.y);
            transform.position = cameraController.centerEyeAnchor.position + offset;
            Vector3 dirToCamera = (cameraController.centerEyeAnchor.position - transform.position);
            dirToCamera.y     = 0.0f;
            transform.forward = dirToCamera.normalized;

            // refresh any children
            BroadcastMessage("OnRefresh", SendMessageOptions.DontRequireReceiver);
            // show the menu elements and play the animation
            ShowRenderers(true);
            delaySecs = PlayAnim((immediate) ? menuIdleAnim : menuShowAnim);
        }
        else
        {
            if (curser != null)
            {
                curser.renderCrosshair = false;
            }
            // hide the menu after the hide anim finishes
            delaySecs = (immediate) ? 0.0f : PlayAnim(menuHideAnim);
        }
        if (!immediate)
        {
            PlaySound(show ? menuShowSound : menuHideSound);
        }
        isVisible = show;
        // reset the menu state
        activeButton = null;
        //homeButtonPressed = false;
        homeButtonDownTime = 0.0f;
        // don't allow Show/Hide until this anim is done
        isShowingOrHiding = true;
        Invoke("OnMenuAnimFinished", delaySecs);

        return(delaySecs);
    }
        void ReleaseDesignerOutlets()
        {
            if (AddPictureButton != null)
            {
                AddPictureButton.Dispose();
                AddPictureButton = null;
            }

            if (AddPostButton != null)
            {
                AddPostButton.Dispose();
                AddPostButton = null;
            }

            if (CreatePostButton != null)
            {
                CreatePostButton.Dispose();
                CreatePostButton = null;
            }

            if (DescriptionTextField != null)
            {
                DescriptionTextField.Dispose();
                DescriptionTextField = null;
            }

            if (FriendsButton != null)
            {
                FriendsButton.Dispose();
                FriendsButton = null;
            }

            if (GalleryCollectionView != null)
            {
                GalleryCollectionView.Dispose();
                GalleryCollectionView = null;
            }

            if (HomeButton != null)
            {
                HomeButton.Dispose();
                HomeButton = null;
            }

            if (PostImageView != null)
            {
                PostImageView.Dispose();
                PostImageView = null;
            }

            if (ProfileButton != null)
            {
                ProfileButton.Dispose();
                ProfileButton = null;
            }
        }
Exemplo n.º 18
0
 private void hideComponents()
 {
     newPlayerButton.Hide();
     removePlayerButton.Hide();
     AddResultsButton.Hide();
     ViewCurrentButton.Hide();
     addPlayerButton.Hide();
     PlayerListBox.Hide();
     HomeButton.Show();
 }
Exemplo n.º 19
0
 public MainWindow()
 {
     MyKeys.MYDIRECTORY = AppDomain.CurrentDomain.BaseDirectory;
     InitializeComponent();
     init();
     icon();
     wsl = WindowState;
     HomeButton.Focus();
     requestMethod();
 }
Exemplo n.º 20
0
        public bool IsHomeTabActive()
        {
            string className = HomeButton.FindElement(By.XPath("..")).GetAttribute("class");

            if (className == "active")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 21
0
 public void SetTimeToResume(bool shouldWe)
 {
     timeToResume = shouldWe;
     if (timeToResume)                       // If we are resuming, we set the timer...
     {
         countDown            = 4;
         timeKeep             = (int)Time.realtimeSinceStartup;      // initialize time variable
         CanvasTitle.text     = "Get Ready in";
         CanvasTitle.fontSize = 20;
         CountDownLabel.text  = countDown.ToString();
         ResumeButton.SetActive(false);
         HomeButton.SetActive(false);
     }
 }
Exemplo n.º 22
0
        //battle over time set total of matches, oppopnentmmrs, losses, and wins to 0

        public mainForm()
        {
            InitializeComponent();
            nameLabel.Hide();
            nameTextBox.Hide();
            HomeButton.Hide();
            textBox1.Hide();
            PlayerListBox.Hide();
            PlayerListBox2.Hide();
            addPlayerButton.Hide();
            battleButton.Hide();
            deleteSinglePlayerButton.Hide();
            deleteAllPlayersButton.Hide();
        }
Exemplo n.º 23
0
 void ShowPrize()
 {
     Redeem.SetActive(true);
     MatchedText.text = "You have matched " + MatchedNumbers + " numbers";
     if (MatchedNumbers >= 3)
     {
         Prizes [MatchedNumbers - 3].SetActive(true);
         RedeemButton.SetActive(true);
     }
     else
     {
         HomeButton.SetActive(true);
     }
 }
Exemplo n.º 24
0
        void ReleaseDesignerOutlets()
        {
            if (AllUsersButton != null)
            {
                AllUsersButton.Dispose();
                AllUsersButton = null;
            }

            if (FollowersButton != null)
            {
                FollowersButton.Dispose();
                FollowersButton = null;
            }

            if (FollowingButton != null)
            {
                FollowingButton.Dispose();
                FollowingButton = null;
            }

            if (HomeButton != null)
            {
                HomeButton.Dispose();
                HomeButton = null;
            }

            if (FriendsButton != null)
            {
                FriendsButton.Dispose();
                FriendsButton = null;
            }

            if (AddPostButton != null)
            {
                AddPostButton.Dispose();
                AddPostButton = null;
            }

            if (ProfileButton != null)
            {
                ProfileButton.Dispose();
                ProfileButton = null;
            }

            if (UsersCollectionView != null)
            {
                UsersCollectionView.Dispose();
                UsersCollectionView = null;
            }
        }
Exemplo n.º 25
0
        public MainWindow(string arg)
        {
            MyKeys.MYDIRECTORY = AppDomain.CurrentDomain.BaseDirectory;
            InitializeComponent();
            init();
            icon();
            wsl = WindowState;
            HomeButton.Focus();
            requestMethod();

            MyKeys.FILE_PATH = arg;

            if (System.Windows.MessageBox.Show("确定要添加该项管理吗?",
                                               "e-lock", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                if (!ConfigAppSettings.GetValue("Account").Equals("") && !ConfigAppSettings.GetValue("Password").Equals(""))
                {
                    Post.HttpLogin(ConfigAppSettings.GetValue("Account"), ConfigAppSettings.GetValue("Password"));
                    SiginButton.Content = ConfigAppSettings.GetValue("Account");
                    isSigined           = true;

                    if (MainWindow.isSigined)
                    {
                        if (!MyKeys.FILE_PATH.Equals(""))
                        {
                            if (Post.SendAuthority(MyKeys.FILE_PATH.Replace("\\", "/"), "1"))
                            {
                                //ObservableCollection<Authority> mainlist = getFileName(Post.GetAuthorityList());
                                ObservableCollection <Authority> mainlist = Post.GetAuthorityList();
                                foreach (Authority item in mainlist)
                                {
                                    //item.File_Path.Replace("/", "\\");
                                    item.File_Path = item.File_Path.Replace("/", "\\");
                                    PageMain.thelist.Add(item);
                                }
                            }
                        }
                    }
                }
                else
                {
                    System.Windows.MessageBox.Show("您还未登录!",
                                                   "e-lock", MessageBoxButton.OK);
                }
            }
            else
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
Exemplo n.º 26
0
        private void pictureBox4_Click(object sender, EventArgs e)
        {
            GLViewerConfigForm dlg = new GLViewerConfigForm();
            Point p = HomeButton.PointToScreen(new Point(HomeButton.Width, 0));

            dlg.Location = p;
            dlg.Config   = this.ViewerConfig;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this.ViewerConfig = dlg.Config;
                this.ViewerConfig.SaveDefault();
                Refresh();
            }
        }
Exemplo n.º 27
0
        void ReleaseDesignerOutlets()
        {
            if (HomeButton != null)
            {
                HomeButton.Dispose();
                HomeButton = null;
            }

            if (SideBarButton != null)
            {
                SideBarButton.Dispose();
                SideBarButton = null;
            }
        }
Exemplo n.º 28
0
 private void ScanArduino_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     try
     {
         ArduinoMessage += ArduinoSerialPort.ReadExisting();
         ArduinoReadText.Invoke(new MethodInvoker(delegate
         {
             ArduinoReadText.Text += ArduinoMessage;
         }));
         if (ArduinoMessage.Contains("\n"))
         {
             measurementData.Add(Convert.ToInt32(ArduinoMessage));
             ArduinoMessage = "";
             ScanProgress.Invoke(new MethodInvoker(delegate
             {
                 ScanProgress.Value = 1 / scanLength;
             }));
             if (measurementData.Count < scanLength)
             {
                 SDMC1SerialPort.Write("+1\r");
             }
             else
             {
                 SDMC1SerialPort.DataReceived   -= ScanSDMC1_DataReceived;
                 SDMC1SerialPort.DataReceived   += SDMC1SerialPort_DataReceived;
                 ArduinoSerialPort.DataReceived -= ScanArduino_DataReceived;
                 ArduinoSerialPort.DataReceived += ArduinoSerialPort_DataReceived;
                 SDMC1SerialPort.Write("R" + scanStartPosition + "\r");
                 HomeButton.Invoke(new MethodInvoker(delegate
                 {
                     HomeButton.Enabled = true;
                 }));
                 ScanButton.Invoke(new MethodInvoker(delegate
                 {
                     ScanButton.Enabled = true;
                 }));
             }
             moves++;
         }
     }
     catch (Exception error)
     {
         MessageText.Invoke(new MethodInvoker(delegate
         {
             MessageText.Text = error.Message;
         }));
         ArduinoMessage = "";
     }
 }
        async void RevealBtn_Clicked(System.Object s, System.EventArgs e)
        {
            await ExpandButton.TranslateTo(deviceWidth + 10, 0, 1000, Easing.SpringOut);

            await Task.WhenAll(
                ExploreButton.FadeTo(100, 1000, Easing.CubicIn),
                HomeButton.FadeTo(100, 1000, Easing.CubicIn),
                SettingsButton.FadeTo(100, 1000, Easing.CubicIn)
                );

            await HideButton.FadeTo(100, 500, Easing.Linear);

            ExpandButton.Opacity = 0;
            await ExpandButton.TranslateTo(0, 0, 0);
        }
        async void HideBtn_Clicked(System.Object sender, System.EventArgs e)
        {
            await SettingsButton.FadeTo(0, 200, Easing.Linear);

            await HomeButton.FadeTo(0, 200, Easing.Linear);

            await ExploreButton.FadeTo(0, 200, Easing.Linear);

            await HideButton.TranslateTo(-deviceWidth - 10, 0, 1000, Easing.SpringOut);

            await ExpandButton.FadeTo(100, 500, Easing.Linear);

            HideButton.Opacity = 0;
            await HideButton.TranslateTo(0, 0, 0);
        }
Exemplo n.º 31
0
	/// <summary>
	/// Processes input and handles menu interaction
	/// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc
	/// </summary>
	void Update()
	{
		if (!isVisible)
		{
			if (Input.GetKeyDown(KeyCode.Escape))
			{
				CancelInvoke("DelayedShowMenu");
				if (Time.realtimeSinceStartup < (homeButtonDownTime + doubleTapDelay))
				{
					// reset so the menu doesn't pop up after resetting orientation
					homeButtonDownTime = 0f;
					// reset the HMT orientation
					//OVRManager.display.RecenterPose();
				}
				else
				{
					homeButtonDownTime = Time.realtimeSinceStartup;
				}
			}
			else if (Input.GetKey(KeyCode.Escape) && ((Time.realtimeSinceStartup - homeButtonDownTime) >= longPressDelay))
			{
				Debug.Log("[PlatformUI] Showing @ " + Time.time);
				// reset so something else doesn't trigger afterwards
				Input.ResetInputAxes();
				homeButtonDownTime = 0.0f;
				CancelInvoke("DelayedShowMenu");

				OVRManager.PlatformUIGlobalMenu();
			}
			else if (Input.GetKeyUp(KeyCode.Escape))
			{
				float elapsedTime = (Time.realtimeSinceStartup - homeButtonDownTime);
				if (elapsedTime < longPressDelay)
				{
					if (elapsedTime >= doubleTapDelay)
					{
						Show(true);
					}
					else
					{
						Invoke("DelayedShowMenu", (doubleTapDelay - elapsedTime));
					}
				}
			}
		}
		else if (!isShowingOrHiding)
		{
			// menu is visible, check input
			if (Input.GetKeyDown(KeyCode.Escape))
			{
				// back out of the menu
				Show(false);
			}
			else
			{
				// handle user gaze
				Ray ray = new Ray(cameraController.centerEyeAnchor.position, cameraController.centerEyeAnchor.forward);

				// find the active button
				HomeButton lastActiveButton = activeButton;
				activeButton = null;
				RaycastHit hit = new RaycastHit();
				for (int i = 0; i < buttons.Length; i++)
				{
					if (buttons[i].GetComponent<Collider>().Raycast(ray, out hit, 100.0f))
					{
						activeButton = buttons[i];
						if (activeButton != lastActiveButton)
						{
							// play highlight sound and anim
							PlaySound(menuHighlightSound);
							PlayAnim(buttons[i].name + highLightPrefix, true);
						}
						break;
					}
				}
				if ((activeButton == null) && (lastActiveButton != null))
				{
					// return to idle anim (in our case the default anim clip)
					PlayAnim(menuIdleAnim, true);
				}
				if (activeButton != null)
				{
					// check user tap on a button
					if (Input.GetButtonDown(selectButtonName))
					{
						PlaySound(menuClickSound);
						float delaySecs = PlayAnim(activeButton.name + selectPrefix) + 0.05f;
						selectedCommand = activeButton.commandId;
						// activate the menu item after the anim is done playing
						Invoke("OnMenuItemPressed", delaySecs);
					}
				}
			}
		}
	}
Exemplo n.º 32
0
	/// <summary>
	/// Processes input and handles menu interaction
	/// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc
	/// </summary>
	void Update () {
		if ( !isVisible ) {
			if ( Input.GetKeyDown( KeyCode.Escape ) ) {
				CancelInvoke( "DelayedShowMenu" );
				if ( Time.realtimeSinceStartup < ( homeButtonDownTime + doubleTapDelay ) ) {
					// reset so the menu doesn't pop up after resetting orientation
					homeButtonDownTime = 0f;
					// reset the HMT orientation
					//OVRDevice.ResetOrientation();
				} else {
					homeButtonDownTime = Time.realtimeSinceStartup;
				}
			} else if ( Input.GetKey( KeyCode.Escape ) && ( ( Time.realtimeSinceStartup - homeButtonDownTime ) >= longPressDelay) ) {
				Debug.Log( "[PlatformUI] Showing @ " + Time.time );
				// reset so something else doesn't trigger afterwards
				Input.ResetInputAxes();
				homeButtonDownTime = 0.0f;
				CancelInvoke( "DelayedShowMenu" );
#if UNITY_ANDROID && !UNITY_EDITOR
				// show the platform UI
				OVRPluginEvent.Issue( RenderEventType.PlatformUI );
#endif
			} else if ( Input.GetKeyUp( KeyCode.Escape ) ) {
				float elapsedTime = ( Time.realtimeSinceStartup - homeButtonDownTime );
				if ( elapsedTime < longPressDelay ) {
					if ( elapsedTime >= doubleTapDelay ) {
						Show( true );
					} else {
						Invoke( "DelayedShowMenu", ( doubleTapDelay - elapsedTime ) );
					}
				}
			}
		} else if ( !isShowingOrHiding ) {
			// menu is visible, check input
			if ( Input.GetKeyDown( KeyCode.Escape ) ) {
				// back out of the menu
				Show( false );
			} else {
				// handle user gaze
				Ray ray = new Ray();
#if (UNITY_ANDROID && !UNITY_EDITOR)
				if ( cameraController.GetCameraRay( ref ray ) ) {
#else
				if ( true ) {
					// in the editor use the mouse
					Camera currentCamera = null;
					cameraController.GetCamera( ref currentCamera );
					ray = currentCamera.ScreenPointToRay( Input.mousePosition );
#endif
					// find the active button
					HomeButton lastActiveButton = activeButton;
					activeButton = null;
					RaycastHit hit = new RaycastHit();
					for ( int i = 0; i < buttons.Length; i++ ) {
						if ( buttons[i].collider.Raycast( ray, out hit, 100.0f ) ) {
							activeButton = buttons[i];
							if ( activeButton != lastActiveButton ) {
								// play highlight sound and anim
								PlaySound( menuHighlightSound );
								PlayAnim( buttons[i].name + highLightPrefix, true );
							}
							break;
						}
					}
					if ( ( activeButton == null ) && ( lastActiveButton != null ) ) {
						// return to idle anim (in our case the default anim clip)
						PlayAnim( menuIdleAnim, true );
					}
					if ( activeButton != null ) {
						// check user tap on a button
						if ( Input.GetButtonDown( selectButtonName ) ) {
							PlaySound( menuClickSound );
							float delaySecs = PlayAnim( activeButton.name + selectPrefix ) + 0.05f;
							selectedCommand = activeButton.commandId;
							// activate the menu item after the anim is done playing
							Invoke( "OnMenuItemPressed", delaySecs );
						}
					}
				}
			}
		}
	}

	/*
	-----------------------
	DelayedShowMenu()
	-----------------------
	*/
	void DelayedShowMenu() {
		Show( true );
	}

	/// <summary>
	/// Handle a home menu button press
	/// </summary>
	void OnMenuItemPressed() {
		bool immediate = false;
		switch ( selectedCommand ) {
		case HomeCommand.NewGame:
			// TODO
			break;
		case HomeCommand.Continue:
			// TODO
			break;
		case HomeCommand.Quit:
			cameraController.ReturnToLauncher();
			break;
		case HomeCommand.None:
		default:
			Debug.LogError( "Unhandled home command: " + selectedCommand );
			break;
		}
		// hide the menu
		Show ( false, immediate );
	}

	/// <summary>
	/// Handle a single press to the back button
	/// </summary>
	void OnBackButtonPressed() {
		// TODO
		Show ( false );
	}

}
Exemplo n.º 33
0
    /// <summary>
    /// Shows and hides the menu
    /// </summary>
    float Show(bool show, bool immediate = false)
    {
        if ((show && isVisible) || (!show && !isVisible))
        {
            if (show)
            {
                // refresh any children
                BroadcastMessage("OnRefresh", SendMessageOptions.DontRequireReceiver);
            }
            return 0.0f;
        }
        float delaySecs = 0.0f;
        if (show)
        {
            // orient and position in front of the player's view
            Vector3 offset = (cameraController.centerEyeAnchor.forward * distanceFromViewer);
            offset.y = (transform.position.y - cameraController.centerEyeAnchor.position.y);
            transform.position = cameraController.centerEyeAnchor.position + offset;
            Vector3 dirToCamera = (cameraController.centerEyeAnchor.position - transform.position);
            dirToCamera.y = 0.0f;
            transform.forward = dirToCamera.normalized;

            // refresh any children
            BroadcastMessage("OnRefresh", SendMessageOptions.DontRequireReceiver);
            // show the menu elements and play the animation
            ShowRenderers(true);
            //delaySecs = PlayAnim((immediate) ? menuIdleAnim : menuShowAnim);
        }
        else
        {
            // hide the menu after the hide anim finishes
            //delaySecs = (immediate) ? 0.0f : PlayAnim(menuHideAnim);
        }
        if (!immediate)
        {
            PlaySound(show ? menuShowSound : menuHideSound);
        }
        isVisible = show;
        // reset the menu state
        activeButton = null;
        //homeButtonPressed = false;
        homeButtonDownTime = 0.0f;
        // don't allow Show/Hide until this anim is done
        isShowingOrHiding = true;
        Invoke("OnMenuAnimFinished", delaySecs);

        return delaySecs;
    }
Exemplo n.º 34
0
    /// <summary>
    /// Processes input and handles menu interaction
    /// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc
    /// </summary>
    void Update()
    {
        if (!isVisible)
        {
            //habilito el menu desde el momento de inicio.
            Show (true);

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Debug.Log ("ESCAPE");
                CancelInvoke("DelayedShowMenu");
                if (Time.realtimeSinceStartup < (homeButtonDownTime + doubleTapDelay))
                {
                    // reset so the menu doesn't pop up after resetting orientation
                    homeButtonDownTime = 0f;
                    // reset the HMT orientation
                    //OVRManager.display.RecenterPose();
                }
                else
                {
                    homeButtonDownTime = Time.realtimeSinceStartup;
                }
            }
            else if (Input.GetKey(KeyCode.Escape) && ((Time.realtimeSinceStartup - homeButtonDownTime) >= longPressDelay))
            {
                Debug.Log("[PlatformUI] Showing @ " + Time.time);
                // reset so something else doesn't trigger afterwards
                Input.ResetInputAxes();
                homeButtonDownTime = 0.0f;
                CancelInvoke("DelayedShowMenu");
                #if UNITY_ANDROID && !UNITY_EDITOR
                // show the platform UI
                OVRPluginEvent.Issue(RenderEventType.PlatformUI);
                #endif
            }
            else if (Input.GetKeyUp(KeyCode.Escape))
            {
                float elapsedTime = (Time.realtimeSinceStartup - homeButtonDownTime);
                if (elapsedTime < longPressDelay)
                {
                    if (elapsedTime >= doubleTapDelay)
                    {
                        Show(true);
                    }
                    else
                    {
                        Invoke("DelayedShowMenu", (doubleTapDelay - elapsedTime));
                    }
                }
            }
        }
        else if (!isShowingOrHiding)
        {
            // menu is visible, check input
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                // back out of the menu
                Show(false);
            }
            else
            {
                // handle user gaze
                Ray ray = new Ray(cameraController.centerEyeAnchor.position, cameraController.centerEyeAnchor.forward);

                // find the active button
                HomeButton lastActiveButton = activeButton;
                activeButton = null;
                RaycastHit hit = new RaycastHit();
                for (int i = 0; i < buttons.Length; i++)
                {
                    if (buttons[i].GetComponent<Collider>().Raycast(ray, out hit, 100.0f))
                    {
                        activeButton = buttons[i];
                        if (activeButton != lastActiveButton)
                        {
                            // play highlight sound and anim
                            PlaySound(menuHighlightSound);
                            //PlayAnim(buttons[i].name + highLightPrefix, true);
                            //GameObject.Find ("highlight_01");

                            Debug.Log("Click en  el boton" + buttons[i]);

                            if (activeButton == buttons[0]) {

                                //myObject.GetComponent<MyScript>().MyFunction();
                                Debug.Log ("le doy play al video");
                                videoscript = buttons[i].transform.FindChild("MovieSurface").gameObject;
                                videoscript.GetComponent<MoviePlayerSample>().DelayedStartVideo();
                            }
                        }
                        break;
                    }
                }
                if ((activeButton == null) && (lastActiveButton != null))
                {
                    // return to idle anim (in our case the default anim clip)
                    //PlayAnim(menuIdleAnim, true);
                    //dejo de hacer foco en el boton
                    Debug.Log("Pongo en pausa");
                    videoscript.GetComponent<MoviePlayerSample>().videoPause();
                }
                if (activeButton != null)
                {
                    // check user tap on a button
                    if (Input.GetButtonDown(selectButtonName))
                    {
                        PlaySound(menuClickSound);
                        float delaySecs = PlayAnim(activeButton.name + selectPrefix) + 0.05f;
                        selectedCommand = activeButton.commandId;
                        // activate the menu item after the anim is done playing
                        Invoke("OnMenuItemPressed", delaySecs);
                    }
                }
            }
        }
    }