/**
  * Throws an error string, for testing error flows.
  */
 public void ThrowError(CastErrorCode errorCode)
 {
     if (gameObject.activeInHierarchy && displayExtension != null)
     {
         displayExtension.ThrowError(errorCode);
     }
 }
        public override void OnInspectorGUI()
        {
            CastRemoteDisplaySimulator simulator = (CastRemoteDisplaySimulator)target;

            serializedObject.Update();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("simulateRemoteDisplay"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("remoteDisplayRect"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("castDevices"), true);
            serializedObject.ApplyModifiedProperties();

            if (Application.isPlaying)
            {
                // Update the list of devices.
                if (GUILayout.Button("Update devices"))
                {
                    simulator.UpdateDevices();
                }
                EditorGUILayout.Space();

                // Throwing errors.
                errorCode = (CastErrorCode)EditorGUILayout.EnumPopup("Throw Error", errorCode);
                if (errorCode != CastErrorCode.NoError)
                {
                    if (GUILayout.Button("Throw"))
                    {
                        simulator.ThrowError(errorCode);
                    }
                }
            }
        }
    public override void OnInspectorGUI() {
      CastRemoteDisplaySimulator simulator = (CastRemoteDisplaySimulator) target;

      serializedObject.Update();
      EditorGUILayout.PropertyField(serializedObject.FindProperty("simulateRemoteDisplay"), true);
      EditorGUILayout.PropertyField(serializedObject.FindProperty("remoteDisplayRect"), true);
      EditorGUILayout.PropertyField(serializedObject.FindProperty("castDevices"), true);
      serializedObject.ApplyModifiedProperties();

      if (Application.isPlaying) {
        // Update the list of devices.
        if (GUILayout.Button("Update devices")) {
          simulator.UpdateDevices();
        }
        EditorGUILayout.Space();

        // Throwing errors.
        errorCode = (CastErrorCode) EditorGUILayout.EnumPopup("Throw Error", errorCode);
        if (errorCode != CastErrorCode.NoError) {
          if (GUILayout.Button("Throw")) {
            simulator.ThrowError(errorCode);
          }
        }
      }
    }
        public void ThrowError(CastErrorCode errorCode)
        {
            string rawErrorString = (int)errorCode + ": There was a fake error thrown by the " +
                                    "simulator - " + errorCode.ToString();

            extensionManager._callback_OnCastError(rawErrorString);
        }
        /**
         * Callback called from the native plugins when the SDK throws an error.
         */
        public void _callback_OnCastError(string rawErrorString)
        {
            string        errorString = extractErrorString(rawErrorString);
            CastErrorCode errorCode   = extractErrorCode(rawErrorString);

            lastError = new CastError(errorCode, errorString);
            disconnect();
            onErrorCallback();
        }
Beispiel #6
0
        /**
         * Callback called from the native plugins when the SDK throws an error.
         */
        public void _callback_OnCastError(string rawErrorString)
        {
            string        errorString = extractErrorString(rawErrorString);
            CastErrorCode errorCode   = extractErrorCode(rawErrorString);

            lastError = new CastError(errorCode, errorString);
            isCasting = false;
            onErrorCallback();
        }
 public void ThrowError(CastErrorCode errorCode) {
   string rawErrorString = (int) errorCode + ": There was a fake error thrown by the " +
     "simulator - " + errorCode.ToString();
   extensionManager._callback_OnCastError(rawErrorString);
 }
 /**
  * Throws an error string, for testing error flows.
  */
 public void ThrowError(CastErrorCode errorCode) {
   if (gameObject.activeInHierarchy && displayExtension != null) {
     displayExtension.ThrowError(errorCode);
   }
 }
 /**
  * Constructor for CastError.
  */
 public CastError(CastErrorCode errorCode, string message)
 {
     this.errorCode = errorCode;
     this.message   = message;
 }