Inheritance: MonoBehaviour
Example #1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         TogglePanel.onPanelToggle(_settingsPanelIndex);
     }
 }
Example #2
0
 public bool isPanelVisible()
 {
     if (ContainerPanel != null)
     {
         if (ContainerPanel.GetType() == typeof(SplitterPanel))
         {
             SplitContainer parent = (SplitContainer)ContainerPanel.Parent;
             if (parent.Panel1 == ContainerPanel)
             {
                 if (ArrowOrientation == Orientation.Horizontal)
                 {
                     return(parent.SplitterDistance != this.Width);
                 }
                 else
                 {
                     return(parent.SplitterDistance != this.Height);
                 }
             }
             else
             {
                 if (ArrowOrientation == Orientation.Horizontal)
                 {
                     return(parent.SplitterDistance != (parent.Width - this.Width));
                 }
                 else
                 {
                     return(parent.SplitterDistance != (parent.Height - this.Height));
                 }
             }
         }
         else
         {
             if (ArrowOrientation == Orientation.Horizontal)
             {
                 return(ContainerPanel.Width != this.Width);
             }
             else
             {
                 return(ContainerPanel.Height != this.Height);
             }
         }
     }
     else if (TogglePanel.GetType() == typeof(SplitterPanel))
     {
         SplitContainer parent = (SplitContainer)TogglePanel.Parent;
         if (parent.Panel1 == TogglePanel)
         {
             return(!parent.Panel1Collapsed);
         }
         else
         {
             return(!parent.Panel2Collapsed);
         }
     }
     else
     {
         return(TogglePanel.Visible);
     }
 }
Example #3
0
 void CheckForGameOver()
 {
     if (!GameState.IsGameOver)
     {
         TogglePanel.onPanelToggle(3);
         GameState.IsGameOver = true;
     }
 }
 void DungeonFinished()
 {
     if (!GameState.IsDungeonDone)
     {
         CheckFinishStats();
         if (TogglePanel.onPanelToggle != null)
         {
             TogglePanel.onPanelToggle(2);
         }
         GameState.IsDungeonDone = true;
         _saveData.SaveGame();
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonUp(0) && gameObject.activeSelf)
        {
            TogglePanel tpScript = GetComponentInChildren <TogglePanel>();

            if (tpScript)
            {
                tpScript.Toggle();
            }
            else
            {
                gameObject.SetActive(false);
            }
            if (dragonToWake)
            {
                dragonToWake.SetActive(true);
            }
            if (buttonToEnable)
            {
                buttonToEnable.interactable = true;
            }
        }
    }
 private void Awake()
 {
     panel = gameObject.GetComponent <TogglePanel>();
 }
Example #7
0
        public void toggle()
        {
            if (ContainerPanel != null)
            {
                if (ContainerPanelOriginalSize.Width == 0 || ContainerPanelOriginalSize.Height == 0)
                {
                    setContainerPanelOriginalSize();
                }

                if (ContainerPanel.GetType() == typeof(SplitterPanel))
                {
                    SplitContainer parent = (SplitContainer)ContainerPanel.Parent;
                    if (parent.Panel1 == ContainerPanel)
                    {
                        if (ArrowOrientation == Orientation.Horizontal)
                        {
                            if (isPanelOpen)
                            {
                                parent.SplitterDistance = this.Width;
                            }
                            else
                            {
                                parent.SplitterDistance = ContainerPanelOriginalSize.Width;
                            }
                        }
                        else
                        {
                            if (isPanelOpen)
                            {
                                parent.SplitterDistance = this.Height;
                            }
                            else
                            {
                                parent.SplitterDistance = ContainerPanelOriginalSize.Height;
                            }
                        }
                    }
                    else
                    {
                        if (ArrowOrientation == Orientation.Horizontal)
                        {
                            if (isPanelOpen)
                            {
                                parent.SplitterDistance = parent.Width - this.Width;
                            }
                            else
                            {
                                int splitterDistance = parent.Width - ContainerPanelOriginalSize.Width;
                                if (splitterDistance < 0)
                                {
                                    splitterDistance = MinimumSplitterDistance;
                                }
                                parent.SplitterDistance = splitterDistance;
                            }
                        }
                        else
                        {
                            if (isPanelOpen)
                            {
                                parent.SplitterDistance = parent.Height - this.Height;
                            }
                            else
                            {
                                int splitterDistance = parent.Height - ContainerPanelOriginalSize.Height;
                                if (splitterDistance < 0)
                                {
                                    splitterDistance = MinimumSplitterDistance;
                                }
                                parent.SplitterDistance = splitterDistance;
                            }
                        }
                    }
                }
                else
                {
                    if (ArrowOrientation == Orientation.Horizontal)
                    {
                        if (isPanelOpen)
                        {
                            ContainerPanel.Width = this.Width;
                        }
                        else
                        {
                            ContainerPanel.Width = ContainerPanelOriginalSize.Width;
                        }
                    }
                    else
                    {
                        if (isPanelOpen)
                        {
                            ContainerPanel.Height = this.Height;
                        }
                        else
                        {
                            ContainerPanel.Height = ContainerPanelOriginalSize.Height;
                        }
                    }
                }
            }
            else if (TogglePanel.GetType() == typeof(SplitterPanel))
            {
                SplitContainer parent = (SplitContainer)TogglePanel.Parent;
                if (parent.Panel1 == TogglePanel)
                {
                    parent.Panel1Collapsed = !parent.Panel1Collapsed;
                    setNewLocationBasedOnOrientation(parent.Panel1);
                }
                else
                {
                    parent.Panel2Collapsed = !parent.Panel2Collapsed;
                    setNewLocationBasedOnOrientation(parent.Panel2);
                }
            }
            else
            {
                TogglePanel.Visible = !TogglePanel.Visible;
                setNewLocationBasedOnOrientation(TogglePanel);
            }

            isPanelOpen = !isPanelOpen;

            //set arrow image
            if (pictureBox.BackgroundImage == _ArrowLeft)
            {
                setDirection(ArrowDirection.Right);
            }
            else if (pictureBox.BackgroundImage == _ArrowRight)
            {
                setDirection(ArrowDirection.Left);
            }
            else if (pictureBox.BackgroundImage == _ArrowUp)
            {
                setDirection(ArrowDirection.Down);
            }
            else
            {
                setDirection(ArrowDirection.Up);
            }
        }