Beispiel #1
0
 void OnCompleted(DiffusionPlatform platform)
 {
     Debug.Log("Thanks for sharing on " + platform.ToString());
     if (platform == DiffusionPlatform.SaveToCameraRoll)
         Camera.main.backgroundColor = Color.magenta;
     else if (platform == DiffusionPlatform.Twitter)
         Camera.main.backgroundColor = Color.cyan;
     else
         Camera.main.backgroundColor = Color.green;
     Invoke("ResetColor", 2f);
 }
Beispiel #2
0
    void OnEnable()
    {
        message = serializedObject.FindProperty("message");
        url     = serializedObject.FindProperty("url");

        platform    = serializedObject.FindProperty("platformsToHide");
        newPlatform = (DiffusionPlatform)platform.intValue;

        customPlatforms = serializedObject.FindProperty("customPlatforms");

        eventReceiver = serializedObject.FindProperty("eventReceiver");
    }
Beispiel #3
0
    private void Completed(string platformAsInt)
    {
        DiffusionPlatform platform = (DiffusionPlatform)int.Parse(platformAsInt);

        if (eventReceiver != null)
        {
            eventReceiver.SendMessage("OnCompleted", platform, SendMessageOptions.DontRequireReceiver);
        }

        if (onCompleted != null)
        {
            onCompleted(platform);
        }
    }
    void OnEnable()
    {
        message = serializedObject.FindProperty("message");
        url = serializedObject.FindProperty("url");

        platform = serializedObject.FindProperty("platformsToHide");
        newPlatform = (DiffusionPlatform)platform.intValue;

        customPlatforms = serializedObject.FindProperty("customPlatforms");

        eventReceiver = serializedObject.FindProperty("eventReceiver");
    }
    public override void OnInspectorGUI()
    {
        EditorStyles.textField.wordWrap = true;
        serializedObject.Update();
        twitterHidden = ((newPlatform & DiffusionPlatform.Twitter) == DiffusionPlatform.Twitter);
        urlEntered = !string.IsNullOrEmpty(url.stringValue);

        // Message box
        EditorGUILayout.LabelField("Message");
        message.stringValue = EditorGUILayout.TextField(message.stringValue, GUILayout.Height(60f) );

        // Warnings and char count
        if (string.IsNullOrEmpty(message.stringValue)) {
            EditorGUILayout.HelpBox("This is the default message, it will be attached when sharing, " +
                                    "unless it is explicitly overridden.", MessageType.Info);
        } else {
            int length = message.stringValue.Length;
            MessageType type = MessageType.None;
            if (!twitterHidden && urlEntered && length > 118) {
                type = MessageType.Warning;
            }
            EditorGUILayout.HelpBox(length.ToString(), type);
            // warn the user about twitter URL length
            if (!twitterHidden && urlEntered) {
                EditorGUILayout.HelpBox("URLs will be treated as 22 characters on Twitter due to automatic " +
                                        "URL 'shortening', even if the URL is already shorter than 22 characters.", MessageType.Warning);
            }
        }

        // URL box
        EditorGUILayout.LabelField("URL");
        url.stringValue = EditorGUILayout.TextField(url.stringValue);
        if (!string.IsNullOrEmpty(url.stringValue)) {

            EditorGUILayout.HelpBox("The URL will be attached to the default message. This may modify " +
                                    "which platforms appear in the menu on the device.", MessageType.Info);

        }

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        // Platform hide selector
        newPlatform = (DiffusionPlatform)EditorGUILayout.EnumMaskField("Platforms to hide", newPlatform);
        platform.intValue = (int)newPlatform;

        EditorGUILayout.HelpBox("The menu is generated automatically based on which platforms can " +
                                "handle the data you want to share. This selection is to explicitly hide some options, " +
                                "even if they are supported.", MessageType.None);

        // Custom platforms
        EditorGUILayout.PropertyField(customPlatforms, true);
        if (customPlatforms.arraySize < 1) {
            EditorGUILayout.HelpBox("Custom platforms are additional UIActivies that should be included. These are " +
                "specified by their class name.", MessageType.None);
        } else {
            EditorGUILayout.HelpBox("Make sure you create categories that include the headers for these UIActivities!", MessageType.Warning);
        }

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        // Event receiver
        eventReceiver.objectReferenceValue = EditorGUILayout.ObjectField("Event receiver", eventReceiver.objectReferenceValue, typeof(GameObject), true);

        serializedObject.ApplyModifiedProperties();
    }
Beispiel #6
0
    public override void OnInspectorGUI()
    {
        EditorStyles.textField.wordWrap = true;
        serializedObject.Update();
        twitterHidden = ((newPlatform & DiffusionPlatform.Twitter) == DiffusionPlatform.Twitter);
        urlEntered    = !string.IsNullOrEmpty(url.stringValue);

        // Message box
        EditorGUILayout.LabelField("Message");
        message.stringValue = EditorGUILayout.TextField(message.stringValue, GUILayout.Height(60f));

        // Warnings and char count
        if (string.IsNullOrEmpty(message.stringValue))
        {
            EditorGUILayout.HelpBox("This is the default message, it will be attached when sharing, " +
                                    "unless it is explicitly overridden.", MessageType.Info);
        }
        else
        {
            int         length = message.stringValue.Length;
            MessageType type   = MessageType.None;
            if (!twitterHidden && urlEntered && length > 118)
            {
                type = MessageType.Warning;
            }
            EditorGUILayout.HelpBox(length.ToString(), type);
            // warn the user about twitter URL length
            if (!twitterHidden && urlEntered)
            {
                EditorGUILayout.HelpBox("URLs will be treated as 22 characters on Twitter due to automatic " +
                                        "URL 'shortening', even if the URL is already shorter than 22 characters.", MessageType.Warning);
            }
        }


        // URL box
        EditorGUILayout.LabelField("URL");
        url.stringValue = EditorGUILayout.TextField(url.stringValue);
        if (!string.IsNullOrEmpty(url.stringValue))
        {
            EditorGUILayout.HelpBox("The URL will be attached to the default message. This may modify " +
                                    "which platforms appear in the menu on the device.", MessageType.Info);
        }


        EditorGUILayout.Separator();
        EditorGUILayout.Separator();


        // Platform hide selector
        newPlatform       = (DiffusionPlatform)EditorGUILayout.EnumMaskField("Platforms to hide", newPlatform);
        platform.intValue = (int)newPlatform;

        EditorGUILayout.HelpBox("The menu is generated automatically based on which platforms can " +
                                "handle the data you want to share. This selection is to explicitly hide some options, " +
                                "even if they are supported.", MessageType.None);


        // Custom platforms
        EditorGUILayout.PropertyField(customPlatforms, true);
        if (customPlatforms.arraySize < 1)
        {
            EditorGUILayout.HelpBox("Custom platforms are additional UIActivies that should be included. These are " +
                                    "specified by their class name.", MessageType.None);
        }
        else
        {
            EditorGUILayout.HelpBox("Make sure you create categories that include the headers for these UIActivities!", MessageType.Warning);
        }

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();


        // Event receiver
        eventReceiver.objectReferenceValue = EditorGUILayout.ObjectField("Event receiver", eventReceiver.objectReferenceValue, typeof(GameObject), true);


        serializedObject.ApplyModifiedProperties();
    }