Ejemplo n.º 1
0
 protected void SaveWindowPosition()
 {
     if (popupDialog)
     {
         RectTransform rectTransform = popupDialog.GetComponent <RectTransform>();
         Vector3       position      = rectTransform.position / GameSettings.UI_SCALE;
         dialogRect.x = position.x / Screen.width + 0.5f;
         dialogRect.y = position.y / Screen.height + 0.5f;
     }
 }
Ejemplo n.º 2
0
 private void ButtonOnFalse()
 {
     if (showgui && drewgui)
     {
         position   = gui.GetComponent <RectTransform>().position;
         position.x = (position.x + posInitOffset.x) / Screen.width + 0.5f;
         position.y = (position.y + posInitOffset.y) / Screen.height + 0.5f;
         Util.Log("Save GUI pos: " + position.ToString());
     }
     showgui = false;
     gui.Dismiss();
 }
Ejemplo n.º 3
0
        /// <summary>
        ///   Called when [application launcher false].
        /// </summary>
        private void OnAppLauncherFalse()
        {
            DebugLog(m: "OnAppLauncherFalse()");
            if (_dialog == null)
            {
                return;
            }
            var rt = _dialog.GetComponent <RectTransform>().position;

            Settings.Instance.PosX = rt.x / GameSettings.UI_SCALE / Screen.width + 0.5f;
            Settings.Instance.PosY = rt.y / GameSettings.UI_SCALE / Screen.height + 0.5f;

            _dialog.Dismiss();
            _dialog = null;
            _button.SetFalse(makeCall: false); // this is needed in case the "close" button was clicked instead of the app button.
        }
        private void FixedUpdate()
        {
            if (!this.IsRelevant)
            {
                if (this.dialog != null)
                {
                    this.dialog.Dismiss();
                    this.dialog = null;
                    // But leave isVisible set, as that's the persistent view.
                }
                this.toolbarButton.Disable();
                return;
            }

            this.toolbarButton.Enable();

            // Shenanigans!  This gets around the apparent fact that you can't tell the toolbar what state to start in.
            if (!this.toolbarStateMatchedToIsVisible)
            {
                this.toolbarButton.toggleButton.Value = this.isVisible;
                this.toolbarStateMatchedToIsVisible   = true;
            }

            this.OnFixedUpdate();

            if (this.isVisible && this.dialog != null)
            {
                Vector3 rt = dialog.GetComponent <RectTransform>().position;
                this.xPosition = rt.x / GameSettings.UI_SCALE / Screen.width + 0.5f;
                this.yPosition = rt.y / GameSettings.UI_SCALE / Screen.height + 0.5f;
            }

            if (this.isVisible && this.dialog == null)
            {
                this.ShowDialog();
            }
        }