public bool DrawGUIList(EditorGUILayoutEx in_layout)
        {
            if (!_Initialized)
            {
                _Initialized        = true;
                UseTypeRow          = Google2uGUIUtil.GetBool(Prefix + "UseTypeRow", UseTypeRow);
                WorksheetExportType = Google2uGUIUtil.GetEnum(Prefix + "ExportType", WorksheetExportType);
            }

            var old = GUI.enabled;

            if (WorksheetQueryStatus != QueryStatus.Idle && RowsDisplay.Length == 0)
            {
                GUI.enabled = false;
            }


            var newExportType = WorksheetExportType;

            if (IsDataValid)
            {
                newExportType = (ExportType)EditorGUILayout.EnumPopup(WorksheetName, WorksheetExportType);
            }
            else if (WorksheetQueryStatus != QueryStatus.Idle)
            {
                EditorGUILayout.LabelField(WorksheetName,
                                           Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_CELLS) +
                                           Google2u.Ellipses);
            }
            else
            {
                var oldColor = GUI.color;
                if (GUI.GetNameOfFocusedControl() != WorksheetName + "Invalid")
                {
                    GUI.color = Color.red;
                }
                GUI.SetNextControlName(WorksheetName + "Invalid");
                newExportType = (ExportType)EditorGUILayout.EnumPopup(WorksheetName, WorksheetExportType);
                GUI.color     = oldColor;
            }

            if (newExportType != WorksheetExportType)
            {
                WorksheetExportType = Google2uGUIUtil.SetEnum(Prefix + "ExportType", newExportType);
            }

            GUI.enabled = old;

            return(WorksheetExportType != ExportType.DoNotExport);
        }
Exemple #2
0
        public void ShowFade(string in_label, string in_savedVar, bool in_isOuter, FadeOpenCallback[] in_callbacks)
        {
            var savedVar = Google2uGUIUtil.GetBool(in_savedVar, false);
            var fadeVar  = MyGUILayout.BeginFadeArea(savedVar, in_label, in_savedVar,
                                                     in_isOuter ? MyGUILayout.OuterBox : MyGUILayout.InnerBox,
                                                     in_isOuter ? MyGUILayout.OuterBoxHeader : MyGUILayout.InnerBoxHeader);

            Google2uGUIUtil.SetBool(in_savedVar, fadeVar.Open);
            if (fadeVar.Show())
            {
                foreach (var fadeOpenCallback in in_callbacks)
                {
                    fadeOpenCallback();
                }
            }
            MyGUILayout.EndFadeArea();
        }
Exemple #3
0
        public Google2uExportOptions(string in_prefix)
        {
            _Prefix = in_prefix;

            LowercaseHeader = Google2uGUIUtil.GetBool(in_prefix + "LowercaseHeader", LowercaseHeader);

            TrimStrings      = Google2uGUIUtil.GetBool(in_prefix + "TrimStrings", TrimStrings);
            TrimStringArrays = Google2uGUIUtil.GetBool(in_prefix + "TrimStringArrays", TrimStringArrays);

            ArrayDelimiters        = Google2uGUIUtil.GetInt(in_prefix + "ArrayDelimiters", ArrayDelimiters);
            StringArrayDelimiters  = Google2uGUIUtil.GetInt(in_prefix + "StringArrayDelimiters", StringArrayDelimiters);
            ComplexTypeDelimiters  = Google2uGUIUtil.GetInt(in_prefix + "ComplexTypeDelimiters", ComplexTypeDelimiters);
            ComplexArrayDelimiters = Google2uGUIUtil.GetInt(in_prefix + "ComplexArrayDelimiters", ComplexArrayDelimiters);

            #region ObjectDatabase Options

            var dbObjName = Google2uGUIUtil.GetString(_Prefix + "GameObjectDatabaseName", string.Empty);
            if (string.IsNullOrEmpty(dbObjName) == false)
            {
                var go = GameObject.Find(dbObjName);
                if (go)
                {
                    ExportDatabaseGameObjectName = dbObjName;
                    _ExportDatabaseGameObject    = go;
                }
            }


            _OverrideObjectDatabaseNames = new Dictionary <string, string>();


            var tmpOverrides = Google2uGUIUtil.GetString(_Prefix + "OverrideObjectDatabaseNames",
                                                         string.Empty);
            var tmpOverrideSplit = tmpOverrides.Split(',');
            foreach (var s in tmpOverrideSplit)
            {
                var sSplit = s.Split('|');
                if (sSplit.Length == 2)
                {
                    _OverrideObjectDatabaseNames.Add(sSplit[0], sSplit[1]);
                }
            }

            GeneratePlaymakerActions = Google2uGUIUtil.GetBool(in_prefix + "GeneratePlaymakerActions",
                                                               GeneratePlaymakerActions);
            UseDoNotDestroy     = Google2uGUIUtil.GetBool(in_prefix + "UseDoNotDestroy", UseDoNotDestroy);
            ObjectDBCullColumns = Google2uGUIUtil.GetBool(in_prefix + "ObjectDBCullColumns", ObjectDBCullColumns);
            ObjectDBCullRows    = Google2uGUIUtil.GetBool(in_prefix + "ObjectDBCullRows", ObjectDBCullRows);

            #endregion

            #region Static DB Options

            StaticDBCullColumns = Google2uGUIUtil.GetBool(in_prefix + "StaticDBCullColumns", StaticDBCullColumns);
            StaticDBCullRows    = Google2uGUIUtil.GetBool(in_prefix + "StaticDBCullRows", StaticDBCullRows);

            #endregion

            #region JSON Options

            EscapeUnicode         = Google2uGUIUtil.GetBool(in_prefix + "EscapeUnicode", EscapeUnicode);
            JSONCellArrayToString = Google2uGUIUtil.GetBool(in_prefix + "JSONCellArrayToString", JSONCellArrayToString);
            JSONExportClass       = Google2uGUIUtil.GetBool(in_prefix + "JSONExportClass", JSONExportClass);
            JSONExportType        = Google2uGUIUtil.GetEnum(in_prefix + "JSONExportType", JSONExportType);
            JSONCullColumns       = Google2uGUIUtil.GetBool(in_prefix + "JSONCullColumns", JSONCullColumns);
            JSONCullRows          = Google2uGUIUtil.GetBool(in_prefix + "JSONCullRows", JSONCullRows);
            JSONIgnoreIDColumn    = Google2uGUIUtil.GetBool(in_prefix + "JSONIgnoreIDColumn", JSONIgnoreIDColumn);
            JSONExportPretty      = Google2uGUIUtil.GetBool(in_prefix + "JSONExportPretty", JSONExportPretty);
            #endregion

            #region XML Options

            XMLCellArrayToString = Google2uGUIUtil.GetBool(in_prefix + "XMLCellArrayToString", XMLCellArrayToString);
            XMLCullColumns       = Google2uGUIUtil.GetBool(in_prefix + "XMLCullColumns", XMLCullColumns);
            XMLCullRows          = Google2uGUIUtil.GetBool(in_prefix + "XMLCullRows", XMLCullRows);

            #endregion

            #region CSV Options

            EscapeCSVStrings     = Google2uGUIUtil.GetBool(in_prefix + "EscapeCSVStrings", EscapeCSVStrings);
            CSVCullColumns       = Google2uGUIUtil.GetBool(in_prefix + "CSVCullColumns", CSVCullColumns);
            CSVCullRows          = Google2uGUIUtil.GetBool(in_prefix + "CSVCullRows", CSVCullRows);
            CSVConvertLineBreaks = Google2uGUIUtil.GetBool(in_prefix + "CSVConvertLineBreaks", CSVConvertLineBreaks);

            #endregion

            #region NGUI Options

            EscapeNGUIStrings     = Google2uGUIUtil.GetBool(in_prefix + "EscapeNGUIStrings", EscapeNGUIStrings);
            NGUICullColumns       = Google2uGUIUtil.GetBool(in_prefix + "NGUICullColumns", NGUICullColumns);
            NGUICullRows          = Google2uGUIUtil.GetBool(in_prefix + "NGUICullRows", NGUICullRows);
            NGUIConvertLineBreaks = Google2uGUIUtil.GetBool(in_prefix + "NGUIConvertLineBreaks", NGUIConvertLineBreaks);
            NGUILegacyExport      = Google2uGUIUtil.GetBool(in_prefix + "NGUILegacyExport", NGUILegacyExport);

            #endregion
        }
Exemple #4
0
        private void Init()
        {
            var lastChecked =
                Convert.ToDateTime(Google2uGUIUtil.GetString("Google2uLastCheckedForUpdate",
                                                             Convert.ToString(DateTime.MinValue)));

            if ((DateTime.Now - lastChecked).Days >= 1)
            {
                Google2uGUIUtil.SetString("Google2uLastCheckedForUpdate", Convert.ToString(DateTime.Now));
                var t = new Thread(CheckForUpdate);
                t.Start();
            }

            ShowDocsAtStartup = Google2uGUIUtil.GetBool("ShowDocsAtStartup", ShowDocsAtStartup);
            if (ShowDocsAtStartup)
            {
                Google2uDocs.ShowWindow(MyGUILayout, LocalizationInfo);
            }

            ServicePointManager.ServerCertificateValidationCallback = Validator;
            OAuthToken     = Google2uGUIUtil.GetString("OAuthToken", OAuthToken);
            RefreshToken   = Google2uGUIUtil.GetString("RefreshToken", RefreshToken);
            RefreshTimeout =
                DateTime.ParseExact(Google2uGUIUtil.GetString("RefreshTimeout", RefreshTimeout.ToString("O")), "O",
                                    CultureInfo.InvariantCulture);

            if (InstanceData.Service == null && !string.IsNullOrEmpty(OAuthToken))
            {
                SetupParameters();

                _authParameters.AccessToken = OAuthToken;


                var requestFactory = new GOAuth2RequestFactory("structuredcontent", "Google2Unity", _authParameters);
                InstanceData.Service = new SpreadsheetsService("Google2Unity")
                {
                    RequestFactory = requestFactory
                };

                Thread.Sleep(100);

                if (!InstanceData.Commands.Contains(GFCommand.RetrieveWorkbooks))
                {
                    InstanceData.Commands.Add(GFCommand.RetrieveWorkbooks);
                }
            }

            // Close lingering editor windows
            var ed = GetWindow <Google2uEditor>();

            if (ed != null)
            {
                ed.Close();
            }

            if (ObjDbExport == null)
            {
                ObjDbExport = new List <Google2uObjDbExport>();
            }

            Instance = this;
        }
        public void DrawGUIFull(EditorGUILayoutEx in_layout)
        {
            if (!_Initialized)
            {
                _Initialized        = true;
                UseTypeRow          = Google2uGUIUtil.GetBool(Prefix + "UseTypeRow", UseTypeRow);
                WorksheetExportType = Google2uGUIUtil.GetEnum(Prefix + "ExportType", WorksheetExportType);
            }

            if (WorksheetQueryStatus != QueryStatus.QueryComplete && WorksheetQueryStatus != QueryStatus.Idle &&
                RowsDisplay.Length == 0)
            {
                EditorGUILayout.LabelField(
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_CELLS) +
                    Google2u.Ellipses);
            }
            else if (RowsDisplay.Length == 0)
            {
                if (WorksheetQueryStatus == QueryStatus.QueryComplete || WorksheetQueryStatus == QueryStatus.Idle)
                {
                    EditorGUILayout.LabelField(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_EMPTY_WORKSHEET));
                }
            }
            else
            {
                if (DoInitialSizeCheck)
                {
                    DoInitialSizeCheck = false;
                    for (var i = 0; i < ColOptions.Count; ++i)
                    {
                        CalculateColumnWidth(i, this);
                    }
                }

                if ((DateTime.Now - LastUpdateTime).TotalSeconds > 15)
                {
                    DoUpdateQuery = true;
                }

                if (ActiveCell != null)
                {
                    if (!ActiveCell.SkipValidation && !string.IsNullOrEmpty(ActiveCell.Tooltip))
                    {
                        EditorGUILayoutEx.SetColor(Color.red);
                        GUILayout.Label(ActiveCell.Tooltip);
                        EditorGUILayoutEx.ResetColor();
                    }
                    if (ActiveCell.DrawCellValue(in_layout))
                    {
                        WorksheetQueryStatus = QueryStatus.Idle;
                        LastUpdateTime       = DateTime.MinValue;
                        DoUpdateQuery        = true;
                        UpdateValidation     = true;
                    }
                }
                else
                {
                    var old = GUI.enabled;
                    GUI.enabled = false;
                    EditorGUILayout.TextField(string.Empty);
                    GUI.enabled = old;
                }

                // Calculate the total width and height of the scroll area
                var totalHeight = Math.Max(120, 22 + (24 * RowsDisplay.Length));
                var totalWidth  = 40 + ColOptions.Sum(in_colOption => in_colOption.Width);

                EditorGUILayout.Separator();
                if (Event.current.type == EventType.Repaint)
                {
                    _LastRect = GUILayoutUtility.GetLastRect();
                }
                var scrollHeight = Screen.height - _LastRect.y - 30;
                var screenRect   = new Rect(0f, _LastRect.y, Screen.width, scrollHeight);
                var viewRect     = new Rect(0f, 0f, totalWidth, totalHeight);

                _MyScrollPos = GUI.BeginScrollView(screenRect, _MyScrollPos, viewRect);

                var curRect = new Rect(0.0f, 0.0f, 40.0f, 22.0f);

                // Blank
                GUI.Label(curRect, string.Empty, in_layout.CellHeader);

                // Column Letters (Resizable Columns)
                for (var i = 0; i < RowsDisplay[0].Count; i++)
                {
                    var label = GetColumnName(i + 1);
                    curRect.x    += curRect.width;
                    curRect.width = ColOptions[i].Width;
                    GUI.Label(curRect, label, in_layout.CellHeader);

                    ColOptions[i].ColumnRect       = curRect;
                    ColOptions[i].ColumnRect.width = ColOptions[i].Width;

                    if (ColOptions[i].ColumnRect.Contains(Event.current.mousePosition))
                    {
                        ColOptions[i].HasMouse = true;
                    }

                    if (!ColOptions[i].HasMouse)
                    {
                        continue;
                    }

                    if ((Event.current.type == EventType.MouseDown) && (Event.current.clickCount >= 2))
                    {
                        // Doubleclick
                        CalculateColumnWidth(i, this);
                    }
                    if (Event.current.type == EventType.MouseDrag)
                    {
                        ColOptions[i].CurPos = Event.current.mousePosition;

                        if (!ColOptions[i].Dragging)
                        {
                            ColOptions[i].Dragging = true;
                            ColOptions[i].StartPos = ColOptions[i].CurPos;
                        }
                    }

                    if (Event.current.type == EventType.MouseUp)
                    {
                        ColOptions[i].Dragging = false;
                        ColOptions[i].HasMouse = false;
                    }

                    if (!ColOptions[i].Dragging)
                    {
                        continue;
                    }

                    if (Event.current.isMouse)
                    {
                        Event.current.Use();
                    }

                    ColOptions[i].Width +=
                        Convert.ToInt32((ColOptions[i].CurPos.x - ColOptions[i].StartPos.x));
                    ColOptions[i].StartPos = ColOptions[i].CurPos;
                    ColOptions[i].Width    = Math.Max(26, ColOptions[i].Width);
                }


                curRect = new Rect(0.0f, 22.0f, 40.0f, 24.0f);

                // The rest of the rows
                for (var i = 0; i < RowsDisplay.Length; i++)
                {
                    if (i == 1)
                    {
                        // Could be type row
                        if (GUI.Button(curRect, UseTypeRow ? "Type" : "2", in_layout.CellTypeButton))
                        {
                            if (UseTypeRow == false)
                            {
                                if (EditorUtility.DisplayDialog(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_HEADER),
                                                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_MESSAGE), "OK", "Cancel"))
                                {
                                    UseTypeRow      = !UseTypeRow;
                                    UpdateCellTypes = true;
                                }
                            }
                            else
                            {
                                UseTypeRow      = !UseTypeRow;
                                UpdateCellTypes = true;
                            }
                        }
                    }
                    else
                    {
                        // Row Number
                        GUI.Label(curRect, Convert.ToString(i + 1), in_layout.CellHeader);
                    }

                    // Cell Values

                    if (i == 1 && UseTypeRow)
                    {
                        for (var j = 0; j < RowsDisplay[i].Count; j++)
                        {
                            curRect.x    += curRect.width;
                            curRect.width = ColOptions[j].Width;

                            var myCell = RowsDisplay[i][j];

                            if (myCell.MyType == SupportedType.Unrecognized)
                            {
                                myCell.SetTypeFromValue();
                            }

                            var cellType    = myCell.MyType;
                            var curSelected = 0;
                            foreach (var guiContent in _ComboBoxList)
                            {
                                if (guiContent.text.Equals(Convert.ToString(cellType)))
                                {
                                    break;
                                }
                                curSelected++;
                            }
                            if (curSelected >= _ComboBoxList.Length)
                            {
                                curSelected = 0;
                            }

                            Google2uGUIUtil.ComboBox comboBoxControl;
                            if (!_ComboBoxes.ContainsKey(j))
                            {
                                comboBoxControl = new Google2uGUIUtil.ComboBox(curRect, _ComboBoxList[curSelected],
                                                                               _ComboBoxList, in_layout.CellTypeButton, in_layout.OuterBox, in_layout.CellHeader);
                                _ComboBoxes.Add(j, comboBoxControl);
                            }
                            else
                            {
                                comboBoxControl = _ComboBoxes[j];
                            }
                            comboBoxControl.width  = curRect.width;
                            comboBoxControl.height = curRect.height;
                            comboBoxControl.x      = curRect.x;
                            comboBoxControl.y      = curRect.y;
                            var newSelected = comboBoxControl.Show();
                            if (newSelected != curSelected)
                            {
                                var newType =
                                    (SupportedType)
                                    Enum.Parse(typeof(SupportedType), _ComboBoxList[newSelected].text, true);
                                myCell.MyType = newType;
                                myCell.SetValueFromType();
                                UpdateCellTypes  = true;
                                UpdateValidation = true;
                            }
                        }
                    }
                    else
                    {
                        for (var j = 0; j < RowsDisplay[i].Count; j++)
                        {
                            curRect.x    += curRect.width;
                            curRect.width = ColOptions[j].Width;

                            if (curRect.x + curRect.width > _MyScrollPos.x && curRect.x < _MyScrollPos.x + Screen.width &&
                                curRect.y + curRect.height > _MyScrollPos.y && curRect.y < _MyScrollPos.y + scrollHeight)
                            {
                                if (i < 2 || i > 5 || !_ComboBoxes.ContainsKey(j) || _ComboBoxes[j].IsShown == false)
                                {
                                    var newCell = RowsDisplay[i][j].DrawGUI(in_layout, curRect, ActiveCell);
                                    if (newCell != null)
                                    {
                                        GUI.FocusControl("Blank");
                                        ActiveCell = newCell;
                                    }
                                }
                            }
                        }
                    }


                    curRect.x     = 0.0f;
                    curRect.width = 40.0f;
                    curRect.y    += curRect.height;
                }

                GUI.EndScrollView();
            }
        }
Exemple #6
0
        public override bool DrawGUIList(EditorGUILayoutEx in_layout, bool in_showAll)
        {
            var ret = true;

            var spreadsheetVisibleString = "workbook" + WorkbookName.Replace(' ', '_') + "_Visible";

            SpreadsheetVisible = Google2uGUIUtil.GetBool(spreadsheetVisibleString, SpreadsheetVisible);
            if ((SpreadsheetVisible == false) && !in_showAll)
            {
                return(true);
            }

            ShowSpreadsheet = Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_Open",
                                                      ShowSpreadsheet);
            var mainFadeArea = in_layout.BeginFadeArea(ShowSpreadsheet, WorkbookName,
                                                       "workbook" + WorkbookName.Replace(' ', '_'), in_layout.OuterBox, in_layout.OuterBoxHeader,
                                                       spreadsheetVisibleString);

            ShowSpreadsheet = mainFadeArea.Open;
            Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_Open", ShowSpreadsheet);

            // We have to do this here. Otherwise there is a threading issue (Can't initialize from EditorPreferences outside the main thread)
            if (ExportOptions == null)
            {
                ExportOptions = new Google2uExportOptions("workbook" + WorkbookName.Replace(' ', '_') + "_Option_");
            }

            if (mainFadeArea.Show())
            {
                var showExport   = false;
                var exportsheets = new List <Google2uWorksheet>();

                switch (WorksheetQueryStatus)
                {
                case QueryStatus.Idle:
                {
                    WorksheetQueryStatus = QueryStatus.Uninitialized;
                }
                break;

                case QueryStatus.Querying:
                    EditorGUILayout.LabelField(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_WORKSHEETS) +
                        Google2u.Ellipses);
                    break;

                case QueryStatus.QueryComplete:
                    if (WorksheetsDisplay.Length > 0)
                    {
                        foreach (var google2UWorksheet in WorksheetsDisplay)
                        {
                            if (google2UWorksheet.DrawGUIList(in_layout))
                            {
                                exportsheets.Add(google2UWorksheet);
                                showExport = true;
                            }
                        }

                        if (_OpenInvalidSheet)
                        {
                            var stillQuerying = false;
                            for (var i = 0; i < Worksheets.Count; ++i)
                            {
                                if (!exportsheets.Contains(Worksheets[i]))
                                {
                                    continue;
                                }

                                if (Worksheets[i].UpdateValidation || Worksheets[i].Validating)
                                {
                                    stillQuerying = true;
                                }


                                if (Worksheets[i].IsDataValid == false)
                                {
                                    var ed = EditorWindow.GetWindow <Google2uEditor>();
                                    Google2u.ActiveWorkbookWindow = ed;
                                    ed.Workbook = this;
                                    ed.Layout   = in_layout;


#if (UNITY_4)
                                    ed.title = WorkbookName;
#elif (UNITY_5_0)
                                    ed.title = WorkbookName;
#else
                                    ed.titleContent.text = WorkbookName;
#endif

                                    ed.wantsMouseMove    = true;
                                    ActiveWorksheetIndex = i;
                                    Worksheets[i].HighlightFirstInvalidCell();
                                    _OpenInvalidSheet = false;
                                    break;
                                }
                            }
                            if (!stillQuerying)
                            {
                                _OpenInvalidSheet = false;
                            }
                        }

                        EditorGUILayout.BeginHorizontal();
                        var content = new GUIContent(in_layout.RefreshButton,
                                                     Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_REFRESH_WORKBOOK));
                        if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                             GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                        {
                            Worksheets.Clear();
                            WorksheetQueryStatus = QueryStatus.Uninitialized;
                        }


                        var querying            = false;
                        var bAllWorksheetsValid = true;
                        foreach (var google2UWorksheet in exportsheets)
                        {
                            if (google2UWorksheet.IsDataValid == false)
                            {
                                bAllWorksheetsValid = false;
                            }
                            if (google2UWorksheet.WorksheetQueryStatus != QueryStatus.Idle)
                            {
                                querying = true;
                            }
                        }
                        {
                            var guiEnabled = GUI.enabled;
                            if (querying)
                            {
                                GUI.enabled = false;
                            }

                            content = bAllWorksheetsValid
                                    ? new GUIContent(in_layout.ValidateButtonGreen,
                                                     Google2u.LocalizationInfo.Localize(
                                                         Localization.rowIds.ID_LABEL_VALIDATE_WORKBOOK))
                                    : new GUIContent(in_layout.ValidateButtonRed,
                                                     Google2u.LocalizationInfo.Localize(
                                                         Localization.rowIds.ID_LABEL_VALIDATE_WORKBOOK));

                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                                 GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                // Do Validation for the worksheets we will be exporting
                                foreach (var google2UWorksheet in exportsheets)
                                {
                                    google2UWorksheet.UpdateValidation = true;
                                    google2UWorksheet.Validating       = true;
                                }
                                _OpenInvalidSheet = true;
                            }
                            GUI.enabled = guiEnabled;
                        }

                        content = new GUIContent(in_layout.EditButton,
                                                 Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EDIT_WORKBOOK));
                        if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                             GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                        {
                            var ed = EditorWindow.GetWindow <Google2uEditor>();
                            Google2u.ActiveWorkbookWindow = ed;
                            ed.Workbook = this;
                            ed.Layout   = in_layout;
#if (UNITY_4)
                            ed.title = WorkbookName;
#elif (UNITY_5_0)
                            ed.title = WorkbookName;
#else
                            ed.titleContent.text = WorkbookName;
#endif
                            ed.wantsMouseMove = true;
                        }

                        GUILayout.FlexibleSpace();

                        if (showExport)
                        {
                            var oldEnabled = GUI.enabled;
                            if (bAllWorksheetsValid == false)
                            {
                                GUI.enabled = false;
                            }
                            content = new GUIContent(in_layout.SaveButton,
                                                     Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT));
                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                                 GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                DoExport(exportsheets);
                            }
                            GUI.enabled = oldEnabled;
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                    else
                    {
                        EditorGUILayout.LabelField(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_NO_WORKSHEETS));
                    }
                    break;
                }
            }
            in_layout.EndFadeArea();
            return(ret);
        }
        public FadeArea BeginFadeArea(bool in_open, string in_label, string in_id, GUIStyle in_areaStyle,
                                      GUIStyle in_labelStyle, string in_WorkbookVisibilityString)
        {
            var tmp1 = GUI.color;

            var fadeArea = BeginFadeArea(in_open, in_id, 26, in_areaStyle);

            var tmp2 = GUI.color;

            GUI.color = tmp1;

            EditorGUILayout.BeginHorizontal();

            if (!in_open)
            {
                if (GUILayout.Button(string.Empty, PlusButton))
                {
                    fadeArea.Open = !fadeArea.Open;
                    GuiEditor.Repaint();
                }
            }
            else
            {
                if (GUILayout.Button(string.Empty, MinusButton))
                {
                    fadeArea.Open = !fadeArea.Open;
                    GuiEditor.Repaint();
                }
            }

            if (in_label != "")
            {
                if (GUILayout.Button(in_label, in_labelStyle))
                {
                    fadeArea.Open = !fadeArea.Open;
                    GuiEditor.Repaint();
                }
            }

            GUILayout.FlexibleSpace();

            var spreadsheetVisible = true;

            if (!string.IsNullOrEmpty(in_WorkbookVisibilityString))
            {
                spreadsheetVisible = Google2uGUIUtil.GetBool(in_WorkbookVisibilityString, true);
            }
            if (spreadsheetVisible)
            {
                if (GUILayout.Button(string.Empty, VisibilityButton))
                {
                    Google2uGUIUtil.SetBool(in_WorkbookVisibilityString, false);
                }
            }
            else
            {
                if (GUILayout.Button(string.Empty, VisibilityHiddenButton))
                {
                    Google2uGUIUtil.SetBool(in_WorkbookVisibilityString, true);
                }
            }

            EditorGUILayout.EndHorizontal();

            GUI.color = tmp2;
            return(fadeArea);
        }