private void AddParameterResponseArrived(AsyncOperation asyncOperation)
        {
            UnityWebRequest request = ((UnityWebRequestAsyncOperation)asyncOperation).webRequest;

            if (request.isHttpError || request.isNetworkError)
            {
                Debug.Log("Failed to add parameter: " + request.error);
            }
            else
            {
                _parent.RefreshData();
            }
        }
Example #2
0
        private void DrawEventList()
        {
            EditorGUILayout.BeginVertical(GUILayout.Width(LIST_WIDTH));
            if (GUILayout.Button("Refresh") || _eventProvider.IsStale)
            {
                _parent.RefreshData();
            }

            if (_environmentProvider.DrawEnvironmentDropdown())
            {
                // TODO: try to map to the same event in the other environment?
                // (they get different IDs so this would not be trivial)
                ClearSelectedEvent();
            }

            if (_eventProvider.FetchInProgress)
            {
                EditorGUILayout.HelpBox("Fetching Events...", MessageType.Info);
            }

            if (_eventProvider.HasData)
            {
                _listScrollPosition = EditorGUILayout.BeginScrollView(_listScrollPosition);
                foreach (DDNAEventManagerEvent apiEvent in _eventProvider.Data)
                {
                    // TODO: this is cheating, there's an environmentId= querystring parameter!
                    if (apiEvent.environment == _environmentProvider.CurrentEnvironmentId)
                    {
                        GUIStyle buttonStyle = apiEvent.id == _selectedEventId ? EditorStyles.boldLabel : EditorStyles.label;
                        if (GUILayout.Button(apiEvent.name, buttonStyle))
                        {
                            SelectEvent(apiEvent);
                        }
                    }
                }
                EditorGUILayout.EndScrollView();
            }

            GUILayout.FlexibleSpace();
            if (_environmentProvider.CurrentEnvironmentIsEditable &&
                GUILayout.Button("+"))
            {
                _mode = Mode.Create;
            }

            EditorGUILayout.EndVertical();
        }
        private void AddParameterResponseArrived(AsyncOperation asyncOperation)
        {
            UnityWebRequest request = ((UnityWebRequestAsyncOperation)asyncOperation).webRequest;

#if UNITY_2020_2_OR_NEWER
            if (request.result == UnityWebRequest.Result.ProtocolError || request.result == UnityWebRequest.Result.ConnectionError)
#else
            if (request.isHttpError || request.isNetworkError)
#endif
            {
                Debug.Log("Failed to add parameter: " + request.error);
            }
            else
            {
                _parent.RefreshData();
            }
        }
Example #4
0
        private void DrawParameterList()
        {
            EditorGUILayout.BeginVertical(GUILayout.Width(LIST_WIDTH));

            if (GUILayout.Button("Refresh") || _parameterProvider.IsStale)
            {
                _parent.RefreshData();
            }

            if (_environmentProvider.DrawEnvironmentDropdown())
            {
                // TODO: try to map to the same parameter in the other environment?
                // (they get different IDs so this would not be trivial)
                ClearSelectedParameter();
            }

            if (_parameterProvider.FetchInProgress)
            {
                EditorGUILayout.HelpBox("Fetching Parameters...", MessageType.Info);
            }

            if (_parameterProvider.HasData)
            {
                _listScrollPosition = EditorGUILayout.BeginScrollView(_listScrollPosition);
                foreach (DDNAEventManagerEventParameter parameter in _parameterProvider.Data)
                {
                    if (parameter.application == _parent.CurrentApplicationId)
                    {
                        GUIStyle buttonStyle = parameter.id == _selectedParameterId ? EditorStyles.boldLabel : EditorStyles.label;
                        if (GUILayout.Button(parameter.name, buttonStyle))
                        {
                            SelectNewParameter(parameter);
                        }
                    }
                }
                EditorGUILayout.EndScrollView();
            }

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("+"))
            {
                _mode = Mode.Create;
            }
            EditorGUILayout.EndVertical();
        }