Exemple #1
0
        void OnGUI_Spreadsheet_Google()
        {
            GUILayout.Space(20);

#if UNITY_WEBPLAYER
            mConnection_Text = string.Empty;
            EditorGUILayout.HelpBox("Google Synchronization is not supported when in WebPlayer mode." + mConnection_Text, MessageType.Info);

            mProp_GoogleUpdateFrequency.enumValueIndex = mProp_GoogleUpdateFrequency.enumValueIndex;              // to avoid the warning "unused"
#else
            OnGUI_GoogleCredentials();

            OnGUI_ShowMsg();

            if (string.IsNullOrEmpty(mProp_Google_WebServiceURL.stringValue))
            {
                return;
            }

            if (mWebService_Status == "Offline")
            {
                return;
            }

            GUILayout.Space(20);

            GUI.backgroundColor = Color.Lerp(Color.gray, Color.white, 0.5f);
            GUILayout.BeginVertical(EditorStyles.textArea, GUILayout.Height(1));
            GUI.backgroundColor = Color.white;
            GUILayout.Space(10);
            OnGUI_GoogleSpreadsheetsInGDrive();
            GUILayout.EndVertical();

            if (mConnection_WWW != null)
            {
                // Connection Status Bar
                int    time    = (int)((Time.realtimeSinceStartup % 2) * 2.5);
                string Loading = mConnection_Text + ".....".Substring(0, time);
                GUI.color = Color.gray;
                GUILayout.BeginHorizontal(EditorStyles.textArea);
                GUILayout.Label(Loading, EditorStyles.miniLabel);
                GUI.color = Color.white;
                if (GUILayout.Button("Cancel", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
                {
                    StopConnectionWWW();
                }
                GUILayout.EndHorizontal();
                Repaint();
            }
            //else
            //	GUILayout.Space(10);


            GUI.changed = false;
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            LanguageSource.eGoogleUpdateFrequency GoogleUpdateFrequency = (LanguageSource.eGoogleUpdateFrequency)mProp_GoogleUpdateFrequency.enumValueIndex;
            GoogleUpdateFrequency = (LanguageSource.eGoogleUpdateFrequency)EditorGUILayout.EnumPopup("Auto Update Frequency", GoogleUpdateFrequency, GUILayout.ExpandWidth(true));
            if (GUI.changed)
            {
                mProp_GoogleUpdateFrequency.enumValueIndex = (int)GoogleUpdateFrequency;
            }

            GUILayout.Space(10);
            GUILayout.Label("Delay:");
            mProp_GoogleUpdateDelay.floatValue = EditorGUILayout.FloatField(mProp_GoogleUpdateDelay.floatValue, GUILayout.Width(30));
            GUILayout.Label("secs");

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(5);

            GUI.changed = false;
            bool OpenDataSourceAfterExport = EditorPrefs.GetBool("I2Loc OpenDataSourceAfterExport", true);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            OpenDataSourceAfterExport = GUILayout.Toggle(OpenDataSourceAfterExport, "Open Spreadsheet after Export");
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            if (GUI.changed)
            {
                GUI.changed = false;
                EditorPrefs.SetBool("I2Loc OpenDataSourceAfterExport", OpenDataSourceAfterExport);
            }
#endif

            GUILayout.Space(5);
        }
        void OnGUI_Spreadsheet_Google()
        {
            GUILayout.Space(20);

#if UNITY_WEBPLAYER
            mConnection_Text = string.Empty;
            EditorGUILayout.HelpBox("Google Synchronization is not supported when in WebPlayer mode." + mConnection_Text, MessageType.Info);

            mProp_GoogleUpdateFrequency.enumValueIndex = mProp_GoogleUpdateFrequency.enumValueIndex;              // to avoid the warning "unused"
#else
            OnGUI_GoogleCredentials();

            OnGUI_ShowMsg();

            if (string.IsNullOrEmpty(mProp_Google_WebServiceURL.stringValue))
            {
                return;
            }

            if (mWebService_Status == "Offline")
            {
                return;
            }

            GUILayout.Space(20);

            GUI.backgroundColor = Color.Lerp(Color.gray, Color.white, 0.5f);
            GUILayout.BeginVertical(EditorStyles.textArea, GUILayout.Height(1));
            GUI.backgroundColor = Color.white;
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("  Password", "This should match the value of the LocalizationPassword variable in the WebService Script in your Google Drive"), GUILayout.Width(108));
            mProp_Google_Password.stringValue = EditorGUILayout.TextField(mProp_Google_Password.stringValue, GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();

            OnGUI_GoogleSpreadsheetsInGDrive();
            GUILayout.EndVertical();

            if (mConnection_WWW != null)
            {
                // Connection Status Bar
                int    time    = (int)((Time.realtimeSinceStartup % 2) * 2.5);
                string Loading = mConnection_Text + ".....".Substring(0, time);
                GUI.color = Color.gray;
                GUILayout.BeginHorizontal(EditorStyles.textArea);
                GUILayout.Label(Loading, EditorStyles.miniLabel);
                GUI.color = Color.white;
                if (GUILayout.Button("Cancel", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
                {
                    StopConnectionWWW();
                }
                GUILayout.EndHorizontal();
                Repaint();
            }
            //else
            //	GUILayout.Space(10);


            GUI.changed = false;
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            LanguageSource.eGoogleUpdateFrequency GoogleUpdateFrequency = (LanguageSource.eGoogleUpdateFrequency)mProp_GoogleUpdateFrequency.enumValueIndex;
            GoogleUpdateFrequency = (LanguageSource.eGoogleUpdateFrequency)EditorGUILayout.EnumPopup("Auto Update Frequency", GoogleUpdateFrequency, GUILayout.ExpandWidth(true));
            if (GUI.changed)
            {
                mProp_GoogleUpdateFrequency.enumValueIndex = (int)GoogleUpdateFrequency;
            }

            GUILayout.Space(10);
            GUILayout.Label("Delay:");
            mProp_GoogleUpdateDelay.floatValue = EditorGUILayout.FloatField(mProp_GoogleUpdateDelay.floatValue, GUILayout.Width(30));
            GUILayout.Label("secs");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            var GoogleInEditorCheckFrequency = (LanguageSource.eGoogleUpdateFrequency)mProp_GoogleInEditorCheckFrequency.enumValueIndex;
            EditorGUI.BeginChangeCheck();
            GoogleInEditorCheckFrequency = (LanguageSource.eGoogleUpdateFrequency)EditorGUILayout.EnumPopup(new GUIContent("In-Editor Check Frequency", "How often the editor will verify that the Spreadsheet is up-to-date with the LanguageSource. Having un-synchronized Spreadsheets can lead to issues when playing in the device as the download data will override the one in the build"), GoogleInEditorCheckFrequency, GUILayout.ExpandWidth(false));
            if (EditorGUI.EndChangeCheck())
            {
                mProp_GoogleInEditorCheckFrequency.enumValueIndex = (int)GoogleInEditorCheckFrequency;
            }
            GUILayout.Space(122);
            GUILayout.EndHorizontal();

            GUILayout.Space(5);

            GUI.changed = false;
            bool OpenDataSourceAfterExport = EditorPrefs.GetBool("I2Loc OpenDataSourceAfterExport", true);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            OpenDataSourceAfterExport = GUILayout.Toggle(OpenDataSourceAfterExport, "Open Spreadsheet after Export");
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            if (GUI.changed)
            {
                GUI.changed = false;
                EditorPrefs.SetBool("I2Loc OpenDataSourceAfterExport", OpenDataSourceAfterExport);
            }
#endif

            GUILayout.Space(5);
        }