Наследование: UnityEngine.ScriptableObject
Пример #1
0
        public void LoadSettings(View view = View.Default)
        {
            spreadsheetPath = GDESettings.Instance.ExportedGoogleSpreadsheetPath;

            currentView = view;
            nextView = view;

            minSize = new Vector2(420, 250);
            maxSize = minSize;
        }
 internal static void InitPlaymodeLayout()
 {
   EditorApplicationLayout.m_GameView = WindowLayout.ShowAppropriateViewOnEnterExitPlaymode(true) as GameView;
   if ((Object) EditorApplicationLayout.m_GameView == (Object) null)
     return;
   if (EditorApplicationLayout.m_GameView.maximizeOnPlay)
   {
     DockArea parent = EditorApplicationLayout.m_GameView.m_Parent as DockArea;
     if ((Object) parent != (Object) null && !parent.actualView.m_Parent.window.maximized)
       EditorApplicationLayout.m_RootSplit = WindowLayout.MaximizePrepare(parent.actualView);
   }
   EditorApplicationLayout.m_GameView.m_Parent.SetAsStartView();
   Toolbar.RepaintToolbar();
 }
 internal static void InitPlaymodeLayout()
 {
     m_GameView = WindowLayout.ShowAppropriateViewOnEnterExitPlaymode(true) as GameView;
     if (m_GameView != null)
     {
         if (m_GameView.maximizeOnPlay)
         {
             DockArea parent = m_GameView.m_Parent as DockArea;
             if ((parent != null) && !parent.actualView.m_Parent.window.maximized)
             {
                 m_RootSplit = WindowLayout.MaximizePrepare(parent.actualView);
             }
         }
         m_GameView.m_Parent.SetAsStartView();
         Toolbar.RepaintToolbar();
     }
 }
		internal static void InitPlaymodeLayout()
		{
			EditorApplicationLayout.m_GameView = (WindowLayout.ShowAppropriateViewOnEnterExitPlaymode(true) as GameView);
			if (EditorApplicationLayout.m_GameView == null)
			{
				return;
			}
			if (EditorApplicationLayout.m_GameView.maximizeOnPlay)
			{
				DockArea dockArea = EditorApplicationLayout.m_GameView.m_Parent as DockArea;
				if (dockArea != null)
				{
					ContainerWindow window = dockArea.actualView.m_Parent.window;
					if (!window.maximized)
					{
						EditorApplicationLayout.m_RootSplit = WindowLayout.MaximizePrepare(dockArea.actualView);
					}
				}
			}
			EditorApplicationLayout.m_GameView.m_Parent.SetAsStartView();
			Toolbar.RepaintToolbar();
		}
Пример #5
0
        void DrawAuthenticateView()
        {
            content.text = GDEConstants.AuthWithGoogleLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeAuthWithGoogleLblKey, content, headerStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, headerStyle);

            drawHelper.NewLine(2);

            content.text = GDEConstants.EnterAccessCodeLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeEnterAccessCodeLblKey, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            drawHelper.NewLine(1.1f);

            accessCode = EditorGUI.TextField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), drawHelper.FullSeparatorWidth(), size.y), accessCode, textFieldStyle);

            // Draw Back & Set Code Buttons
            content.text = GDEConstants.BackBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeBackBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
                nextView = View.LaunchAuthURL;

            content.text = GDEConstants.SetCodeLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeSetCodeLblKey, content, buttonStyle, out size);
            if (!string.IsNullOrEmpty(accessCode) && GUI.Button(new Rect(position.width-size.x-drawHelper.LeftBuffer, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
            {
                GDEDriveHelper.Instance.SetAccessCode(accessCode);
                GDEDriveHelper.Instance.GetSpreadsheetList();

                if (!viewAfterAuth.Equals(View.None))
                {
                    nextView = viewAfterAuth;
                    viewAfterAuth = View.None;
                }
                else
                {
                    nextView = View.Default;
                }

                GUI.FocusControl(string.Empty);
            }
        }
Пример #6
0
		private void DragTab(Rect pos, GUIStyle tabStyle)
		{
			int controlID = GUIUtility.GetControlID(FocusType.Passive);
			float tabWidth = this.GetTabWidth(pos.width);
			Event current = Event.current;
			if (DockArea.s_DragMode != 0 && GUIUtility.hotControl == 0)
			{
				PaneDragTab.get.Close();
				DockArea.ResetDragVars();
			}
			EventType typeForControl = current.GetTypeForControl(controlID);
			switch (typeForControl)
			{
			case EventType.MouseDown:
				if (pos.Contains(current.mousePosition) && GUIUtility.hotControl == 0)
				{
					int tabAtMousePos = this.GetTabAtMousePos(current.mousePosition, pos);
					if (tabAtMousePos < this.m_Panes.Count)
					{
						switch (current.button)
						{
						case 0:
							if (tabAtMousePos != this.selected)
							{
								this.selected = tabAtMousePos;
							}
							GUIUtility.hotControl = controlID;
							DockArea.s_StartDragPosition = current.mousePosition;
							DockArea.s_DragMode = 0;
							current.Use();
							break;
						case 2:
							this.m_Panes[tabAtMousePos].Close();
							current.Use();
							break;
						}
					}
				}
				goto IL_6B9;
			case EventType.MouseUp:
				if (GUIUtility.hotControl == controlID)
				{
					Vector2 vector = GUIUtility.GUIToScreenPoint(current.mousePosition);
					if (DockArea.s_DragMode != 0)
					{
						DockArea.s_DragMode = 0;
						PaneDragTab.get.Close();
						EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(DockArea.CheckDragWindowExists));
						if (DockArea.s_DropInfo != null && DockArea.s_DropInfo.dropArea != null)
						{
							DockArea.s_DropInfo.dropArea.PerformDrop(DockArea.s_DragPane, DockArea.s_DropInfo, vector);
						}
						else
						{
							EditorWindow editorWindow = DockArea.s_DragPane;
							DockArea.ResetDragVars();
							this.RemoveTab(editorWindow);
							Rect position = editorWindow.position;
							position.x = vector.x - position.width * 0.5f;
							position.y = vector.y - position.height * 0.5f;
							if (Application.platform == RuntimePlatform.WindowsEditor)
							{
								position.y = Mathf.Max(InternalEditorUtility.GetBoundsOfDesktopAtPoint(vector).y, position.y);
							}
							EditorWindow.CreateNewWindowForEditorWindow(editorWindow, false, false);
							editorWindow.position = editorWindow.m_Parent.window.FitWindowRectToScreen(position, true, true);
							GUIUtility.hotControl = 0;
							GUIUtility.ExitGUI();
						}
						DockArea.ResetDragVars();
					}
					GUIUtility.hotControl = 0;
					current.Use();
				}
				goto IL_6B9;
			case EventType.MouseMove:
			case EventType.KeyDown:
			case EventType.KeyUp:
			case EventType.ScrollWheel:
				IL_6E:
				if (typeForControl != EventType.ContextClick)
				{
					goto IL_6B9;
				}
				if (pos.Contains(current.mousePosition) && GUIUtility.hotControl == 0)
				{
					int tabAtMousePos2 = this.GetTabAtMousePos(current.mousePosition, pos);
					if (tabAtMousePos2 < this.m_Panes.Count)
					{
						base.PopupGenericMenu(this.m_Panes[tabAtMousePos2], new Rect(current.mousePosition.x, current.mousePosition.y, 0f, 0f));
					}
				}
				goto IL_6B9;
			case EventType.MouseDrag:
				if (GUIUtility.hotControl == controlID)
				{
					Vector2 vector2 = current.mousePosition - DockArea.s_StartDragPosition;
					current.Use();
					Rect screenPosition = base.screenPosition;
					if (DockArea.s_DragMode == 0 && vector2.sqrMagnitude > 99f)
					{
						DockArea.s_DragMode = 1;
						DockArea.s_PlaceholderPos = this.selected;
						DockArea.s_DragPane = this.m_Panes[this.selected];
						if (this.m_Panes.Count == 1)
						{
							DockArea.s_IgnoreDockingForView = this;
						}
						else
						{
							DockArea.s_IgnoreDockingForView = null;
						}
						DockArea.s_OriginalDragSource = this;
						PaneDragTab.get.content = DockArea.s_DragPane.cachedTitleContent;
						base.Internal_SetAsActiveWindow();
						PaneDragTab.get.GrabThumbnail();
						PaneDragTab.get.Show(new Rect(pos.x + screenPosition.x + tabWidth * (float)this.selected, pos.y + screenPosition.y, tabWidth, pos.height), GUIUtility.GUIToScreenPoint(current.mousePosition));
						EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, new EditorApplication.CallbackFunction(DockArea.CheckDragWindowExists));
						GUIUtility.ExitGUI();
					}
					if (DockArea.s_DragMode == 1)
					{
						DropInfo dropInfo = null;
						ContainerWindow[] windows = ContainerWindow.windows;
						Vector2 vector3 = GUIUtility.GUIToScreenPoint(current.mousePosition);
						ContainerWindow inFrontOf = null;
						ContainerWindow[] array = windows;
						for (int i = 0; i < array.Length; i++)
						{
							ContainerWindow containerWindow = array[i];
							View[] allChildren = containerWindow.mainView.allChildren;
							for (int j = 0; j < allChildren.Length; j++)
							{
								View view = allChildren[j];
								IDropArea dropArea = view as IDropArea;
								if (dropArea != null)
								{
									dropInfo = dropArea.DragOver(DockArea.s_DragPane, vector3);
								}
								if (dropInfo != null)
								{
									break;
								}
							}
							if (dropInfo != null)
							{
								inFrontOf = containerWindow;
								break;
							}
						}
						if (dropInfo == null)
						{
							dropInfo = new DropInfo(null);
						}
						if (dropInfo.type != DropInfo.Type.Tab)
						{
							DockArea.s_PlaceholderPos = -1;
						}
						DockArea.s_DropInfo = dropInfo;
						if (PaneDragTab.get.m_Window)
						{
							PaneDragTab.get.SetDropInfo(dropInfo, vector3, inFrontOf);
						}
					}
				}
				goto IL_6B9;
			case EventType.Repaint:
			{
				float num = pos.xMin;
				int num2 = 0;
				if (base.actualView)
				{
					for (int k = 0; k < this.m_Panes.Count; k++)
					{
						if (!(DockArea.s_DragPane == this.m_Panes[k]))
						{
							if (DockArea.s_DropInfo != null && object.ReferenceEquals(DockArea.s_DropInfo.dropArea, this) && DockArea.s_PlaceholderPos == num2)
							{
								num += tabWidth;
							}
							Rect rect = new Rect(num, pos.yMin, tabWidth, pos.height);
							float num3 = Mathf.Round(rect.x);
							Rect position2 = new Rect(num3, rect.y, Mathf.Round(rect.x + rect.width) - num3, rect.height);
							tabStyle.Draw(position2, this.m_Panes[k].cachedTitleContent, false, false, k == this.selected, base.hasFocus);
							num += tabWidth;
							num2++;
						}
					}
				}
				else
				{
					Rect rect2 = new Rect(num, pos.yMin, tabWidth, pos.height);
					float num4 = Mathf.Round(rect2.x);
					Rect position3 = new Rect(num4, rect2.y, Mathf.Round(rect2.x + rect2.width) - num4, rect2.height);
					tabStyle.Draw(position3, "Failed to load", false, false, true, false);
				}
				goto IL_6B9;
			}
			}
			goto IL_6E;
			IL_6B9:
			this.selected = Mathf.Clamp(this.selected, 0, this.m_Panes.Count - 1);
		}
Пример #7
0
 public virtual void AddChild(View child, int idx)
 {
   Array.Resize<View>(ref this.m_Children, this.m_Children.Length + 1);
   if (idx != this.m_Children.Length - 1)
     Array.Copy((Array) this.m_Children, idx, (Array) this.m_Children, idx + 1, this.m_Children.Length - idx - 1);
   this.m_Children[idx] = child;
   if ((bool) ((UnityEngine.Object) child.m_Parent))
     child.m_Parent.RemoveChild(child);
   child.m_Parent = this;
   child.SetWindowRecurse(this.window);
   this.ChildrenMinMaxChanged();
 }
Пример #8
0
 public void RemoveChildNice(View child)
 {
   if (this.children.Length != 1)
   {
     int num1 = this.IndexOfChild(child);
     float t = num1 != 0 ? (num1 != this.children.Length - 1 ? 0.5f : 1f) : 0.0f;
     float num2 = !this.vertical ? Mathf.Lerp(child.position.xMin, child.position.xMax, t) : Mathf.Lerp(child.position.yMin, child.position.yMax, t);
     if (num1 > 0)
     {
       View child1 = this.children[num1 - 1];
       Rect position = child1.position;
       if (this.vertical)
         position.yMax = num2;
       else
         position.xMax = num2;
       child1.position = position;
       if (child1 is SplitView)
         ((SplitView) child1).Reflow();
     }
     if (num1 < this.children.Length - 1)
     {
       View child1 = this.children[num1 + 1];
       Rect position = child1.position;
       child1.position = !this.vertical ? new Rect(num2, position.y, position.xMax - num2, position.height) : new Rect(position.x, num2, position.width, position.yMax - num2);
       if (child1 is SplitView)
         ((SplitView) child1).Reflow();
     }
   }
   this.RemoveChild(child);
 }
Пример #9
0
        private void DragTab(Rect pos, GUIStyle tabStyle)
        {
            int controlID = GUIUtility.GetControlID(FocusType.Passive);
            float tabWidth = this.GetTabWidth(pos.width);
            Event current = Event.current;
            if ((s_DragMode != 0) && (GUIUtility.hotControl == 0))
            {
                PaneDragTab.get.Close();
                ResetDragVars();
            }
            EventType typeForControl = current.GetTypeForControl(controlID);
            switch (typeForControl)
            {
                case EventType.MouseDown:
                    if (pos.Contains(current.mousePosition) && (GUIUtility.hotControl == 0))
                    {
                        int tabAtMousePos = this.GetTabAtMousePos(current.mousePosition, pos);
                        if (tabAtMousePos < this.m_Panes.Count)
                        {
                            switch (current.button)
                            {
                                case 0:
                                    if (tabAtMousePos != this.selected)
                                    {
                                        this.selected = tabAtMousePos;
                                    }
                                    GUIUtility.hotControl = controlID;
                                    s_StartDragPosition = current.mousePosition;
                                    s_DragMode = 0;
                                    current.Use();
                                    break;

                                case 2:
                                    this.m_Panes[tabAtMousePos].Close();
                                    current.Use();
                                    break;
                            }
                        }
                    }
                    goto Label_06B9;

                case EventType.MouseUp:
                    if (GUIUtility.hotControl == controlID)
                    {
                        Vector2 vector3 = GUIUtility.GUIToScreenPoint(current.mousePosition);
                        if (s_DragMode != 0)
                        {
                            s_DragMode = 0;
                            PaneDragTab.get.Close();
                            EditorApplication.update = (EditorApplication.CallbackFunction) Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(DockArea.CheckDragWindowExists));
                            if ((s_DropInfo == null) || (s_DropInfo.dropArea == null))
                            {
                                EditorWindow pane = s_DragPane;
                                ResetDragVars();
                                this.RemoveTab(pane);
                                Rect position = pane.position;
                                position.x = vector3.x - (position.width * 0.5f);
                                position.y = vector3.y - (position.height * 0.5f);
                                if (Application.platform == RuntimePlatform.WindowsEditor)
                                {
                                    position.y = Mathf.Max(InternalEditorUtility.GetBoundsOfDesktopAtPoint(vector3).y, position.y);
                                }
                                EditorWindow.CreateNewWindowForEditorWindow(pane, false, false);
                                pane.position = pane.m_Parent.window.FitWindowRectToScreen(position, true, true);
                                GUIUtility.hotControl = 0;
                                GUIUtility.ExitGUI();
                            }
                            else
                            {
                                s_DropInfo.dropArea.PerformDrop(s_DragPane, s_DropInfo, vector3);
                            }
                            ResetDragVars();
                        }
                        GUIUtility.hotControl = 0;
                        current.Use();
                    }
                    goto Label_06B9;

                case EventType.MouseDrag:
                    if (GUIUtility.hotControl == controlID)
                    {
                        Vector2 vector = current.mousePosition - s_StartDragPosition;
                        current.Use();
                        Rect screenPosition = base.screenPosition;
                        if ((s_DragMode == 0) && (vector.sqrMagnitude > 99f))
                        {
                            s_DragMode = 1;
                            s_PlaceholderPos = this.selected;
                            s_DragPane = this.m_Panes[this.selected];
                            if (this.m_Panes.Count != 1)
                            {
                                s_IgnoreDockingForView = null;
                            }
                            else
                            {
                                s_IgnoreDockingForView = this;
                            }
                            s_OriginalDragSource = this;
                            PaneDragTab.get.content = s_DragPane.titleContent;
                            base.Internal_SetAsActiveWindow();
                            PaneDragTab.get.GrabThumbnail();
                            PaneDragTab.get.Show(new Rect((pos.x + screenPosition.x) + (tabWidth * this.selected), pos.y + screenPosition.y, tabWidth, pos.height), GUIUtility.GUIToScreenPoint(current.mousePosition));
                            EditorApplication.update = (EditorApplication.CallbackFunction) Delegate.Combine(EditorApplication.update, new EditorApplication.CallbackFunction(DockArea.CheckDragWindowExists));
                            GUIUtility.ExitGUI();
                        }
                        if (s_DragMode == 1)
                        {
                            DropInfo di = null;
                            ContainerWindow[] windows = ContainerWindow.windows;
                            Vector2 screenPos = GUIUtility.GUIToScreenPoint(current.mousePosition);
                            ContainerWindow inFrontOf = null;
                            foreach (ContainerWindow window2 in windows)
                            {
                                foreach (View view in window2.mainView.allChildren)
                                {
                                    IDropArea area = view as IDropArea;
                                    if (area != null)
                                    {
                                        di = area.DragOver(s_DragPane, screenPos);
                                    }
                                    if (di != null)
                                    {
                                        break;
                                    }
                                }
                                if (di != null)
                                {
                                    inFrontOf = window2;
                                    break;
                                }
                            }
                            if (di == null)
                            {
                                di = new DropInfo(null);
                            }
                            if (di.type != DropInfo.Type.Tab)
                            {
                                s_PlaceholderPos = -1;
                            }
                            s_DropInfo = di;
                            if (PaneDragTab.get.m_Window != null)
                            {
                                PaneDragTab.get.SetDropInfo(di, screenPos, inFrontOf);
                            }
                        }
                    }
                    goto Label_06B9;

                case EventType.Repaint:
                {
                    float xMin = pos.xMin;
                    int num8 = 0;
                    if (base.actualView == null)
                    {
                        Rect rect5 = new Rect(xMin, pos.yMin, tabWidth, pos.height);
                        float x = Mathf.Round(rect5.x);
                        Rect rect6 = new Rect(x, rect5.y, Mathf.Round(rect5.x + rect5.width) - x, rect5.height);
                        tabStyle.Draw(rect6, "Failed to load", false, false, true, false);
                    }
                    else
                    {
                        for (int i = 0; i < this.m_Panes.Count; i++)
                        {
                            if (s_DragPane != this.m_Panes[i])
                            {
                                if (((s_DropInfo != null) && object.ReferenceEquals(s_DropInfo.dropArea, this)) && (s_PlaceholderPos == num8))
                                {
                                    xMin += tabWidth;
                                }
                                Rect rect3 = new Rect(xMin, pos.yMin, tabWidth, pos.height);
                                float num10 = Mathf.Round(rect3.x);
                                Rect rect4 = new Rect(num10, rect3.y, Mathf.Round(rect3.x + rect3.width) - num10, rect3.height);
                                tabStyle.Draw(rect4, this.m_Panes[i].titleContent, false, false, i == this.selected, base.hasFocus);
                                xMin += tabWidth;
                                num8++;
                            }
                        }
                    }
                    goto Label_06B9;
                }
            }
            if ((typeForControl == EventType.ContextClick) && (pos.Contains(current.mousePosition) && (GUIUtility.hotControl == 0)))
            {
                int num4 = this.GetTabAtMousePos(current.mousePosition, pos);
                if (num4 < this.m_Panes.Count)
                {
                    base.PopupGenericMenu(this.m_Panes[num4], new Rect(current.mousePosition.x, current.mousePosition.y, 0f, 0f));
                }
            }
        Label_06B9:
            this.selected = Mathf.Clamp(this.selected, 0, this.m_Panes.Count - 1);
        }
Пример #10
0
 public void RemoveChildNice(View child)
 {
     if (base.children.Length != 1)
     {
         int num = base.IndexOfChild(child);
         float t = 0f;
         if (num == 0)
         {
             t = 0f;
         }
         else if (num == (base.children.Length - 1))
         {
             t = 1f;
         }
         else
         {
             t = 0.5f;
         }
         t = !this.vertical ? Mathf.Lerp(child.position.xMin, child.position.xMax, t) : Mathf.Lerp(child.position.yMin, child.position.yMax, t);
         if (num > 0)
         {
             View view = base.children[num - 1];
             Rect position = view.position;
             if (this.vertical)
             {
                 position.yMax = t;
             }
             else
             {
                 position.xMax = t;
             }
             view.position = position;
             if (view is SplitView)
             {
                 ((SplitView) view).Reflow();
             }
         }
         if (num < (base.children.Length - 1))
         {
             View view2 = base.children[num + 1];
             Rect rect6 = view2.position;
             if (this.vertical)
             {
                 view2.position = new Rect(rect6.x, t, rect6.width, rect6.yMax - t);
             }
             else
             {
                 view2.position = new Rect(t, rect6.y, rect6.xMax - t, rect6.height);
             }
             if (view2 is SplitView)
             {
                 ((SplitView) view2).Reflow();
             }
         }
     }
     this.RemoveChild(child);
 }
Пример #11
0
        void DrawImportCompleteView()
        {
            content.text = GDEConstants.ExportCompleteLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportCompleteLblKey, content, headerStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, headerStyle);

            drawHelper.NewLine(2);

            content.text = GDEConstants.ExportMsg1;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportMsg1Key, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            drawHelper.NewLine(1.1f);

            content.text = GDEConstants.ExportMsg2;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportMsg2Key, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            // Draw rate box
            float heightOfBox = 50f;
            float topOfBox = this.position.height * .5f + 5f;
            float bottomOfBox = topOfBox + heightOfBox;

            content.text = GDEConstants.ForumLinkText;
            drawHelper.TryGetCachedSize(GDEConstants.SizeForumLinkTextKey, content, linkStyle, out size);

            float widthOfBox = size.x + 10f;
            float leftOfBox = (this.position.width - widthOfBox) / 2f;

            if (GUI.Button(new Rect(leftOfBox + 6f, bottomOfBox - size.y - 2f, size.x, size.y), content, linkStyle))
            {
                Application.OpenURL(GDEConstants.ForumURL);
            }

            content.text = GDEConstants.RateMeText;
            if (GUI.Button(new Rect(leftOfBox + 6f, topOfBox + 3f, size.x, size.y), content, linkStyle))
            {
                Application.OpenURL(GDEConstants.RateMeURL);
            }

            // Draw Export Again & Close Buttons
            content.text = GDEConstants.ExportAgainBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportAgainBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
                nextView = View.Default;

            content.text = GDEConstants.CloseBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeCloseBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(position.width-size.x-drawHelper.LeftBuffer, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
            {
                Close();
            }
        }
Пример #12
0
		public override void RemoveChild(View child)
		{
			this.splitState = null;
			base.RemoveChild(child);
		}
Пример #13
0
        void DrawDefaultView()
        {
            content.text = GDEConstants.ExportDlgTitleLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportDlgTitleLblKey, content, headerStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, headerStyle);

            drawHelper.NewLine(2);

            content.text = GDEConstants.ExportToLocalFileBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportToLocalFileBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, buttonStyle))
                nextView = View.LocalFile;

            drawHelper.NewLine(2.5f);

            content.text = GDEConstants.ExportToSheetsBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportToSheetsBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, buttonStyle))
            {
                if (HasAuthenticated())
                {
                    nextView = View.UploadExisting;
                    GDEDriveHelper.Instance.GetSpreadsheetList();
                }
                else
                {
                    nextView = View.LaunchAuthURL;
                    viewAfterAuth = View.UploadExisting;
                }
            }

            drawHelper.NewLine(2.5f);

            content.text = GDEConstants.ExportToNewSheetBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportToNewSheetBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, buttonStyle))
            {
                if (HasAuthenticated())
                {
                    nextView = View.UploadNew;
                }
                else
                {
                    nextView = View.LaunchAuthURL;
                    viewAfterAuth = View.UploadNew;
                }
            }

            drawHelper.NewLine(2.5f);

            content.text = GDEConstants.ReauthWithGoogleLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeReauthWithGoogleLblKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, buttonStyle))
            {
                nextView = View.LaunchAuthURL;
            }
        }
Пример #14
0
        void DrawExportLocalFile()
        {
            content.text = GDEConstants.ExportExcelWorkbookLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportExcelWorkbookLblKey, content, headerStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, headerStyle);

            drawHelper.NewLine(2);

            content.text = GDEConstants.ExcelFileExportLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExcelFileExportLblKey, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);
            drawHelper.CurrentLinePosition += size.x + 2f;
            drawHelper.NewLine();

            spreadsheetPath = EditorGUI.TextField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), drawHelper.FullSeparatorWidth(),
                                                           textFieldStyle.fixedHeight), spreadsheetPath, textFieldStyle);
            drawHelper.CurrentLinePosition += size.x + 2f;
            drawHelper.NewLine(1.1f);

            content.text = GDEConstants.BrowseBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeBrowseBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, buttonStyle))
            {
                string newSpreadSheetPath = EditorUtility.OpenFilePanel(GDEConstants.OpenWBLbl, spreadsheetPath, string.Empty);
                if (!string.IsNullOrEmpty(newSpreadSheetPath) && !newSpreadSheetPath.Equals(spreadsheetPath))
                    spreadsheetPath = newSpreadSheetPath;
                GUI.FocusControl(string.Empty);
            }

            // Draw Back & Export Buttons
            content.text = GDEConstants.BackBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeBackBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
                nextView = View.Default;

            content.text = GDEConstants.ExportBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(position.width-size.x-drawHelper.LeftBuffer, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
            {
                GDESettings settings = GDESettings.Instance;
                settings.ExportedLocalSpreadsheetName = spreadsheetPath;
                settings.ExportType = ImportExportType.Local;
                settings.Save();

                GDEExcelManager.DoExport();
                nextView = View.ImportComplete;
            }
        }
Пример #15
0
        private void DragTab(Rect pos, GUIStyle tabStyle)
        {
            int   controlID = GUIUtility.GetControlID(FocusType.Passive);
            float tabWidth  = this.GetTabWidth(pos.width);
            Event current   = Event.current;

            if (DockArea.s_DragMode != 0 && GUIUtility.hotControl == 0)
            {
                PaneDragTab.get.Close();
                DockArea.ResetDragVars();
            }
            EventType typeForControl = current.GetTypeForControl(controlID);

            switch (typeForControl)
            {
            case EventType.MouseDown:
                if (pos.Contains(current.mousePosition) && GUIUtility.hotControl == 0)
                {
                    int tabAtMousePos = this.GetTabAtMousePos(current.mousePosition, pos);
                    if (tabAtMousePos < this.m_Panes.Count)
                    {
                        int button = current.button;
                        if (button != 0)
                        {
                            if (button == 2)
                            {
                                this.m_Panes[tabAtMousePos].Close();
                                current.Use();
                            }
                        }
                        else
                        {
                            if (tabAtMousePos != this.selected)
                            {
                                this.selected = tabAtMousePos;
                            }
                            GUIUtility.hotControl        = controlID;
                            DockArea.s_StartDragPosition = current.mousePosition;
                            DockArea.s_DragMode          = 0;
                            current.Use();
                        }
                    }
                }
                goto IL_744;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlID)
                {
                    Vector2 vector = GUIUtility.GUIToScreenPoint(current.mousePosition);
                    if (DockArea.s_DragMode != 0)
                    {
                        DockArea.s_DragMode = 0;
                        PaneDragTab.get.Close();
                        Delegate arg_49D_0 = EditorApplication.update;
                        if (DockArea.< > f__mg$cache1 == null)
                        {
                            DockArea.< > f__mg$cache1 = new EditorApplication.CallbackFunction(DockArea.CheckDragWindowExists);
                        }
                        EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_49D_0, DockArea.< > f__mg$cache1);
                        if (DockArea.s_DropInfo != null && DockArea.s_DropInfo.dropArea != null)
                        {
                            DockArea.s_DropInfo.dropArea.PerformDrop(DockArea.s_DragPane, DockArea.s_DropInfo, vector);
                        }
                        else
                        {
                            EditorWindow editorWindow = DockArea.s_DragPane;
                            DockArea.ResetDragVars();
                            this.RemoveTab(editorWindow);
                            Rect position = editorWindow.position;
                            position.x = vector.x - position.width * 0.5f;
                            position.y = vector.y - position.height * 0.5f;
                            if (Application.platform == RuntimePlatform.WindowsEditor)
                            {
                                position.y = Mathf.Max(InternalEditorUtility.GetBoundsOfDesktopAtPoint(vector).y, position.y);
                            }
                            EditorWindow.CreateNewWindowForEditorWindow(editorWindow, false, false);
                            editorWindow.position = editorWindow.m_Parent.window.FitWindowRectToScreen(position, true, true);
                            GUIUtility.hotControl = 0;
                            GUIUtility.ExitGUI();
                        }
                        DockArea.ResetDragVars();
                    }
                    GUIUtility.hotControl = 0;
                    current.Use();
                }
                goto IL_744;

            case EventType.MouseMove:
            case EventType.KeyDown:
            case EventType.KeyUp:
            case EventType.ScrollWheel:
IL_6F:
                if (typeForControl != EventType.ContextClick)
                {
                    goto IL_744;
                }
                if (pos.Contains(current.mousePosition) && GUIUtility.hotControl == 0)
                {
                    int tabAtMousePos2 = this.GetTabAtMousePos(current.mousePosition, pos);
                    if (tabAtMousePos2 < this.m_Panes.Count)
                    {
                        base.PopupGenericMenu(this.m_Panes[tabAtMousePos2], new Rect(current.mousePosition.x, current.mousePosition.y, 0f, 0f));
                    }
                }
                goto IL_744;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    Vector2 vector2 = current.mousePosition - DockArea.s_StartDragPosition;
                    current.Use();
                    Rect screenPosition = base.screenPosition;
                    bool flag           = base.window.showMode != ShowMode.MainWindow || this.GetMainWindowPaneCount() > 1;
                    if (DockArea.s_DragMode == 0 && vector2.sqrMagnitude > 99f && flag)
                    {
                        DockArea.s_DragMode       = 1;
                        DockArea.s_PlaceholderPos = this.selected;
                        DockArea.s_DragPane       = this.m_Panes[this.selected];
                        if (this.m_Panes.Count == 1)
                        {
                            DockArea.s_IgnoreDockingForView = this;
                        }
                        else
                        {
                            DockArea.s_IgnoreDockingForView = null;
                        }
                        DockArea.s_OriginalDragSource = this;
                        PaneDragTab.get.Show(new Rect(pos.x + screenPosition.x + tabWidth * (float)this.selected, pos.y + screenPosition.y, tabWidth, pos.height), DockArea.s_DragPane.titleContent, base.position.size, GUIUtility.GUIToScreenPoint(current.mousePosition));
                        Delegate arg_2F8_0 = EditorApplication.update;
                        if (DockArea.< > f__mg$cache0 == null)
                        {
                            DockArea.< > f__mg$cache0 = new EditorApplication.CallbackFunction(DockArea.CheckDragWindowExists);
                        }
                        EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(arg_2F8_0, DockArea.< > f__mg$cache0);
                        GUIUtility.ExitGUI();
                    }
                    if (DockArea.s_DragMode == 1)
                    {
                        DropInfo          dropInfo  = null;
                        ContainerWindow[] windows   = ContainerWindow.windows;
                        Vector2           vector3   = GUIUtility.GUIToScreenPoint(current.mousePosition);
                        ContainerWindow   inFrontOf = null;
                        ContainerWindow[] array     = windows;
                        for (int i = 0; i < array.Length; i++)
                        {
                            ContainerWindow containerWindow = array[i];
                            SplitView       rootSplitView   = containerWindow.rootSplitView;
                            if (rootSplitView != null)
                            {
                                dropInfo = rootSplitView.DragOverRootView(vector3);
                            }
                            if (dropInfo == null)
                            {
                                View[] allChildren = containerWindow.rootView.allChildren;
                                for (int j = 0; j < allChildren.Length; j++)
                                {
                                    View      view     = allChildren[j];
                                    IDropArea dropArea = view as IDropArea;
                                    if (dropArea != null)
                                    {
                                        dropInfo = dropArea.DragOver(DockArea.s_DragPane, vector3);
                                    }
                                    if (dropInfo != null)
                                    {
                                        break;
                                    }
                                }
                            }
                            if (dropInfo != null)
                            {
                                inFrontOf = containerWindow;
                                break;
                            }
                        }
                        if (dropInfo == null)
                        {
                            dropInfo = new DropInfo(null);
                        }
                        if (dropInfo.type != DropInfo.Type.Tab)
                        {
                            DockArea.s_PlaceholderPos = -1;
                        }
                        DockArea.s_DropInfo = dropInfo;
                        if (PaneDragTab.get.m_Window)
                        {
                            PaneDragTab.get.SetDropInfo(dropInfo, vector3, inFrontOf);
                        }
                    }
                }
                goto IL_744;

            case EventType.Repaint:
            {
                float num  = pos.xMin;
                int   num2 = 0;
                if (base.actualView)
                {
                    for (int k = 0; k < this.m_Panes.Count; k++)
                    {
                        if (!(DockArea.s_DragPane == this.m_Panes[k]))
                        {
                            if (DockArea.s_DropInfo != null && object.ReferenceEquals(DockArea.s_DropInfo.dropArea, this) && DockArea.s_PlaceholderPos == num2)
                            {
                                num += tabWidth;
                            }
                            Rect  rect      = new Rect(num, pos.yMin, tabWidth, pos.height);
                            float num3      = Mathf.Round(rect.x);
                            Rect  position2 = new Rect(num3, rect.y, Mathf.Round(rect.x + rect.width) - num3, rect.height);
                            tabStyle.Draw(position2, this.m_Panes[k].titleContent, false, false, k == this.selected, base.hasFocus);
                            num += tabWidth;
                            num2++;
                        }
                    }
                }
                else
                {
                    Rect  rect2     = new Rect(num, pos.yMin, tabWidth, pos.height);
                    float num4      = Mathf.Round(rect2.x);
                    Rect  position3 = new Rect(num4, rect2.y, Mathf.Round(rect2.x + rect2.width) - num4, rect2.height);
                    tabStyle.Draw(position3, "Failed to load", false, false, true, false);
                }
                goto IL_744;
            }
            }
            goto IL_6F;
IL_744:
            this.selected = Mathf.Clamp(this.selected, 0, this.m_Panes.Count - 1);
        }
Пример #16
0
        public void OnGUI()
        {
            base.ClearBackground();
            EditorGUIUtility.ResetGUIState();
            SplitView splitView = base.parent as SplitView;

            if (Event.current.type == EventType.Repaint && splitView)
            {
                View child = this;
                while (splitView)
                {
                    int controlID = splitView.controlID;
                    if (controlID == GUIUtility.hotControl || GUIUtility.hotControl == 0)
                    {
                        int num = splitView.IndexOfChild(child);
                        if (splitView.vertical)
                        {
                            if (num != 0)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, base.position.width, 5f), MouseCursor.SplitResizeUpDown, controlID);
                            }
                            if (num != splitView.children.Length - 1)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0f, base.position.height - 5f, base.position.width, 5f), MouseCursor.SplitResizeUpDown, controlID);
                            }
                        }
                        else
                        {
                            if (num != 0)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, 5f, base.position.height), MouseCursor.SplitResizeLeftRight, controlID);
                            }
                            if (num != splitView.children.Length - 1)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(base.position.width - 5f, 0f, 5f, base.position.height), MouseCursor.SplitResizeLeftRight, controlID);
                            }
                        }
                    }
                    child     = splitView;
                    splitView = (splitView.parent as SplitView);
                }
                splitView = (base.parent as SplitView);
            }
            bool flag = false;

            if (base.window.rootView.GetType() != typeof(MainView))
            {
                flag = true;
                if (base.windowPosition.y == 0f)
                {
                    this.background = "dockareaStandalone";
                }
                else
                {
                    this.background = "dockarea";
                }
            }
            else
            {
                this.background = "dockarea";
            }
            if (splitView)
            {
                Event @event = new Event(Event.current);
                @event.mousePosition += new Vector2(base.position.x, base.position.y);
                splitView.SplitGUI(@event);
                if (@event.type == EventType.Used)
                {
                    Event.current.Use();
                }
            }
            Rect rect = this.background.margin.Remove(new Rect(0f, 0f, base.position.width, base.position.height));

            rect.x = (float)this.background.margin.left;
            rect.y = (float)this.background.margin.top;
            Rect  windowPosition = base.windowPosition;
            float num2           = 2f;

            if (windowPosition.x == 0f)
            {
                rect.x     -= num2;
                rect.width += num2;
            }
            if (windowPosition.xMax == base.window.position.width)
            {
                rect.width += num2;
            }
            if (windowPosition.yMax == base.window.position.height)
            {
                rect.height += ((!flag) ? 2f : 2f);
            }
            GUI.Box(rect, GUIContent.none, this.background);
            if (this.tabStyle == null)
            {
                this.tabStyle = "dragtab";
            }
            if (this.m_Panes.Count > 0)
            {
                HostView.BeginOffsetArea(new Rect(rect.x + 2f, rect.y + 17f, rect.width - 4f, rect.height - 17f - 2f), GUIContent.none, "TabWindowBackground");
                Vector2 vector = GUIUtility.GUIToScreenPoint(Vector2.zero);
                Rect    pos    = base.borderSize.Remove(base.position);
                pos.x = vector.x;
                pos.y = vector.y;
                this.m_Panes[this.selected].m_Pos = pos;
                HostView.EndOffsetArea();
            }
            this.DragTab(new Rect(rect.x + 1f, rect.y, rect.width - 40f, 17f), this.tabStyle);
            this.tabStyle = "dragtab";
            base.ShowGenericMenu();
            if (this.m_Panes.Count > 0)
            {
                base.InvokeOnGUI(rect);
            }
            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
Пример #17
0
 public virtual void RemoveChild(View child)
 {
   int idx = Array.IndexOf<View>(this.m_Children, child);
   if (idx == -1)
     Debug.LogError((object) "Unable to remove child - it's not IN the view");
   else
     this.RemoveChild(idx);
 }
Пример #18
0
		public override void AddChild(View child, int idx)
		{
			base.AddChild(child, idx);
			this.ChildrenMinMaxChanged();
			this.splitState = null;
		}
Пример #19
0
        void DrawLaunchAuthURL()
        {
            content.text = GDEConstants.AuthWithGoogleLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeAuthWithGoogleLblKey, content, headerStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, headerStyle);

            drawHelper.NewLine(2);

            content.text = GDEConstants.AuthInstruction1_1;
            drawHelper.TryGetCachedSize(GDEConstants.SizeAuthInstruction1_1Key, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            drawHelper.NewLine();

            content.text = GDEConstants.AuthInstruction1_2;
            drawHelper.TryGetCachedSize(GDEConstants.SizeAuthInstruction1_2Key, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            drawHelper.NewLine(2);

            content.text = GDEConstants.AuthInstruction2_1;
            drawHelper.TryGetCachedSize(GDEConstants.SizeAuthInstruction2_1Key, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            drawHelper.NewLine();

            content.text = GDEConstants.AuthInstruction2_2;
            drawHelper.TryGetCachedSize(GDEConstants.SizeAuthInstruction2_2Key, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            // Draw Back & GOTO Auth buttons
            content.text = GDEConstants.BackBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeBackBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
                nextView = View.Default;

            content.text = GDEConstants.GotoAuthURL;
            drawHelper.TryGetCachedSize(GDEConstants.SizeGotoAuthURLKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(position.width-size.x-drawHelper.LeftBuffer, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
            {
                GDEDriveHelper.Instance.RequestAuthFromUser();
                nextView = View.Authenticate;
            }
        }
Пример #20
0
		public void RemoveChildNice(View child)
		{
			if (base.children.Length != 1)
			{
				int num = base.IndexOfChild(child);
				float num2;
				if (num == 0)
				{
					num2 = 0f;
				}
				else
				{
					if (num == base.children.Length - 1)
					{
						num2 = 1f;
					}
					else
					{
						num2 = 0.5f;
					}
				}
				num2 = ((!this.vertical) ? Mathf.Lerp(child.position.xMin, child.position.xMax, num2) : Mathf.Lerp(child.position.yMin, child.position.yMax, num2));
				if (num > 0)
				{
					View view = base.children[num - 1];
					Rect position = view.position;
					if (this.vertical)
					{
						position.yMax = num2;
					}
					else
					{
						position.xMax = num2;
					}
					view.position = position;
					if (view is SplitView)
					{
						((SplitView)view).Reflow();
					}
				}
				if (num < base.children.Length - 1)
				{
					View view2 = base.children[num + 1];
					Rect position2 = view2.position;
					if (this.vertical)
					{
						view2.position = new Rect(position2.x, num2, position2.width, position2.yMax - num2);
					}
					else
					{
						view2.position = new Rect(num2, position2.y, position2.xMax - num2, position2.height);
					}
					if (view2 is SplitView)
					{
						((SplitView)view2).Reflow();
					}
				}
			}
			this.RemoveChild(child);
		}
		private static void Clear()
		{
			EditorApplicationLayout.m_RootSplit = null;
			EditorApplicationLayout.m_GameView = null;
		}
 internal void InternalCloseWindow()
 {
   this.Save();
   if ((bool) ((Object) this.m_MainView))
   {
     if (this.m_MainView is GUIView)
       ((GUIView) this.m_MainView).RemoveFromAuxWindowList();
     Object.DestroyImmediate((Object) this.m_MainView, true);
     this.m_MainView = (View) null;
   }
   Object.DestroyImmediate((Object) this, true);
 }
Пример #23
0
 public int IndexOfChild(View child)
 {
     int num = 0;
     foreach (View view in this.m_Children)
     {
         if (view == child)
         {
             return num;
         }
         num++;
     }
     return -1;
 }
Пример #24
0
		internal void InternalCloseWindow()
		{
			this.Save();
			if (this.m_MainView)
			{
				if (this.m_MainView is GUIView)
				{
					((GUIView)this.m_MainView).RemoveFromAuxWindowList();
				}
				UnityEngine.Object.DestroyImmediate(this.m_MainView, true);
				this.m_MainView = null;
			}
			UnityEngine.Object.DestroyImmediate(this, true);
		}
Пример #25
0
 public virtual void AddChild(View child, int idx)
 {
     Array.Resize<View>(ref this.m_Children, this.m_Children.Length + 1);
     if (idx != (this.m_Children.Length - 1))
     {
         Array.Copy(this.m_Children, idx, this.m_Children, idx + 1, (this.m_Children.Length - idx) - 1);
     }
     this.m_Children[idx] = child;
     if (child.m_Parent != null)
     {
         child.m_Parent.RemoveChild(child);
     }
     child.m_Parent = this;
     child.SetWindowRecurse(this.window);
     this.ChildrenMinMaxChanged();
 }
Пример #26
0
        void DrawUploadExistingView()
        {
            content.text = GDEConstants.ExportGoogleSheetLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportGoogleSheetLblKey, content, headerStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, headerStyle);

            drawHelper.NewLine(2);

            content.text = GDEConstants.SelectExportSpreadSheetLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeSelectExportSpreadSheetLblKey, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            drawHelper.NewLine(1.1f);

            downloadSelectionIndex = EditorGUI.Popup(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), drawHelper.FullSeparatorWidth(), size.y),
                downloadSelectionIndex, GDEDriveHelper.Instance.SpreadSheetNames, comboBoxStyle);

            // Draw Back & Upload Buttons
            content.text = GDEConstants.BackBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeBackBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
                nextView = View.Default;

            content.text = GDEConstants.UploadBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeUploadBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(position.width-size.x-drawHelper.LeftBuffer, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
            {
                GDESettings settings = GDESettings.Instance;
                settings.ExportedGoogleSpreadsheetPath = GDEDriveHelper.Instance.SpreadSheetNames[downloadSelectionIndex];
                settings.ExportType = ImportExportType.Google;
                settings.Save();

                GDEExcelManager.DoExport();
                nextView = View.ImportComplete;
            }
        }
Пример #27
0
 public int IndexOfChild(View child)
 {
   int num = 0;
   foreach (UnityEngine.Object child1 in this.m_Children)
   {
     if (child1 == (UnityEngine.Object) child)
       return num;
     ++num;
   }
   return -1;
 }
Пример #28
0
 internal void InternalCloseWindow()
 {
     this.Save();
     if (this.m_RootView != null)
     {
         if (this.m_RootView is GUIView)
         {
             ((GUIView) this.m_RootView).RemoveFromAuxWindowList();
         }
         Object.DestroyImmediate(this.m_RootView, true);
         this.m_RootView = null;
     }
     Object.DestroyImmediate(this, true);
 }
Пример #29
0
        void DrawUploadNewView()
        {
            content.text = GDEConstants.ExportNewGoogleSheetLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeExportToNewSheetBtnKey, content, headerStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CenteredOnLine(size.x), drawHelper.TopOfLine(), size.x, size.y), content, headerStyle);

            drawHelper.NewLine(2);

            content.text = GDEConstants.NewSheetFileNameLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeNewSheetFileNameLblKey, content, labelStyle, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);

            drawHelper.NewLine(1.1f);

            spreadsheetName = EditorGUI.TextField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), drawHelper.FullSeparatorWidth(), size.y),
                spreadsheetName, textFieldStyle);

            // Draw Back & Upload Buttons
            content.text = GDEConstants.BackBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeBackBtnKey, content, buttonStyle, out size);
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
                nextView = View.Default;

            content.text = GDEConstants.UploadBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeUploadBtnKey, content, buttonStyle, out size);
            if (!string.IsNullOrEmpty(spreadsheetName) &&
                GUI.Button(new Rect(position.width-size.x-drawHelper.LeftBuffer, position.height-size.y-drawHelper.BottomBuffer, size.x, size.y), content, buttonStyle))
            {
                GDESettings settings = GDESettings.Instance;
                settings.ExportedGoogleSpreadsheetPath = spreadsheetName;
                settings.ExportType = ImportExportType.Google;
                settings.Save();

                GDEExcelManager.DoExport(true);
                nextView = View.ImportComplete;
            }
        }
Пример #30
0
 public void AddChild(View child)
 {
     this.AddChild(child, this.m_Children.Length);
 }
Пример #31
0
        void OnGUI()
        {
            SetStyles();

            size = Vector2.zero;

            drawHelper.ResetToTop();

            if (currentView.Equals(View.Default))
                DrawDefaultView();
            else if (currentView.Equals(View.LaunchAuthURL))
                DrawLaunchAuthURL();
            else if (currentView.Equals(View.Authenticate))
                DrawAuthenticateView();
            else if (currentView.Equals(View.UploadExisting))
                DrawUploadExistingView();
            else if (currentView.Equals(View.UploadNew))
                DrawUploadNewView();
            else if (currentView.Equals(View.LocalFile))
                DrawExportLocalFile();
            else if (currentView.Equals(View.ImportComplete))
                DrawImportCompleteView();

            currentView = nextView;
        }
Пример #32
0
 public virtual void RemoveChild(View child)
 {
     int index = Array.IndexOf<View>(this.m_Children, child);
     if (index == -1)
     {
         Debug.LogError("Unable to remove child - it's not IN the view");
     }
     else
     {
         this.RemoveChild(index);
     }
 }
Пример #33
0
 public static void Unmaximize(EditorWindow win)
 {
     HostView parent = win.m_Parent;
     if (parent == null)
     {
         UnityEngine.Debug.LogError("Host view was not found");
         RevertFactorySettings();
     }
     else
     {
         UnityEngine.Object[] objArray = InternalEditorUtility.LoadSerializedFileAndForget(Path.Combine(layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
         if (objArray.Length < 2)
         {
             UnityEngine.Debug.Log("Maximized serialized file backup not found");
             RevertFactorySettings();
         }
         else
         {
             SplitView child = objArray[0] as SplitView;
             EditorWindow item = objArray[1] as EditorWindow;
             if (child == null)
             {
                 UnityEngine.Debug.Log("Maximization failed because the root split view was not found");
                 RevertFactorySettings();
             }
             else
             {
                 ContainerWindow window = win.m_Parent.window;
                 if (window == null)
                 {
                     UnityEngine.Debug.Log("Maximization failed because the root split view has no container window");
                     RevertFactorySettings();
                 }
                 else
                 {
                     try
                     {
                         ContainerWindow.SetFreezeDisplay(true);
                         if (parent.parent == null)
                         {
                             throw new Exception();
                         }
                         int idx = parent.parent.IndexOfChild(parent);
                         Rect position = parent.position;
                         View view3 = parent.parent;
                         view3.RemoveChild(idx);
                         view3.AddChild(child, idx);
                         child.position = position;
                         DockArea area = item.m_Parent as DockArea;
                         int index = area.m_Panes.IndexOf(item);
                         parent.actualView = null;
                         win.m_Parent = null;
                         area.AddTab(index, win);
                         area.RemoveTab(item);
                         UnityEngine.Object.DestroyImmediate(item);
                         foreach (UnityEngine.Object obj2 in objArray)
                         {
                             EditorWindow window3 = obj2 as EditorWindow;
                             if (window3 != null)
                             {
                                 window3.MakeParentsSettingsMatchMe();
                             }
                         }
                         view3.Initialize(view3.window);
                         view3.position = view3.position;
                         child.Reflow();
                         UnityEngine.Object.DestroyImmediate(parent);
                         win.Focus();
                         window.DisplayAllViews();
                         win.m_Parent.MakeVistaDWMHappyDance();
                     }
                     catch (Exception exception)
                     {
                         UnityEngine.Debug.Log("Maximization failed: " + exception);
                         RevertFactorySettings();
                     }
                     try
                     {
                         if (((Application.platform == RuntimePlatform.OSXEditor) && SystemInfo.operatingSystem.Contains("10.7")) && SystemInfo.graphicsDeviceVendor.Contains("ATI"))
                         {
                             foreach (GUIView view4 in UnityEngine.Resources.FindObjectsOfTypeAll(typeof(GUIView)))
                             {
                                 view4.Repaint();
                             }
                         }
                     }
                     finally
                     {
                         ContainerWindow.SetFreezeDisplay(false);
                     }
                 }
             }
         }
     }
 }