Esempio n. 1
0
    private void SaveImage()
    {
        //Generating sample red texture with 32x32 resolution
        var gallery            = UM_Application.GalleryService;
        var sampleBlackTexture = SA_IconManager.GetIcon(Color.black, 32, 32);

        gallery.SaveImage(sampleBlackTexture, "sample_black_image.png", UM_DialogsUtility.DisplayResultMessage);
    }
Esempio n. 2
0
    private void Start()
    {
        //Native Sharing
        m_SystemSharingDialog.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.SystemSharingDialog(MakeSharingBuilder(), PrintSharingResult);
        });

        m_SendMailDialog.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            var dialog = new UM_EmailDialogBuilder();

            dialog.SetSubject("Subject");
            dialog.SetText("Hello World!");
            dialog.SetUrl("https://stansassets.com/");

            //Juts generating simple red texture with 32x32 resolution
            var sampleRedTexture = SA_IconManager.GetIcon(Color.red, 32, 32);
            dialog.AddImage(sampleRedTexture);
            dialog.AddRecipient("*****@*****.**");

            client.ShowSendMailDialog(dialog, PrintSharingResult);
        });


        //Sharing to Social Media
        m_Facebook.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.ShareToFacebook(MakeSharingBuilder(), PrintSharingResult);
        });


        m_Instagram.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.ShareToInstagram(MakeSharingBuilder(), PrintSharingResult);
        });


        m_Twitter.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.ShareToTwitter(MakeSharingBuilder(), PrintSharingResult);
        });

        m_Whatsapp.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.ShareToWhatsapp(MakeSharingBuilder(), PrintSharingResult);
        });
    }
Esempio n. 3
0
    private UM_ShareDialogBuilder MakeSharingBuilder()
    {
        var builder = new UM_ShareDialogBuilder();

        builder.SetText("Hello world!");
        builder.SetUrl("https://stansassets.com/");

        //Juts generating simple red texture with 32x32 resolution
        var sampleRedTexture = SA_IconManager.GetIcon(Color.red, 32, 32);

        builder.AddImage(sampleRedTexture);

        return(builder);
    }
Esempio n. 4
0
    private UM_ShareDialogBuilder MakeSharingBuilder()
    {
        var builder = new UM_ShareDialogBuilder();

        builder.SetText("Помоги, собрать загаданные слова!");
        builder.SetUrl("https://play.google.com/store/apps/details?id=" + Application.identifier);

        //Juts generating simple red texture with 32x32 resolution
        var sampleRedTexture = SA_IconManager.GetIcon(Color.red, 32, 32);

        builder.AddImage(screenShot());

        return(builder);
    }
        private void SetupUI()
        {
            InitStyles();

            HandleInputEvents();

            UCL_LogEntries.SetFlag(UCL_ConsoleFlags.LogLevelLog, true);
            UCL_LogEntries.SetFlag(UCL_ConsoleFlags.LogLevelWarning, true);
            UCL_LogEntries.SetFlag(UCL_ConsoleFlags.LogLevelError, true);

            if (!EditorGUIUtility.isProSkin)
            {
                GUI.DrawTexture(new Rect(0, 0, position.width, position.height), SA_IconManager.GetIconFromHtmlColorString("#DFDFDFFF"));
            }
        }
Esempio n. 6
0
        public IEnumerator SaveImage()
        {
            yield return(null);

            if (Application.isEditor)
            {
                var @lock              = new CallbackLock();
                var gallery            = UM_Application.GalleryService;
                var sampleBlackTexture = SA_IconManager.GetIcon(Color.black, 32, 32);
                gallery.SaveImage(sampleBlackTexture, "sample_black_image.png", (result) => {
                    Assert.IsTrue(result.IsSucceeded);
                    @lock.Unlock();
                });

                yield return(@lock.WaitToUnlock());
            }
        }
    private void SaveImage()
    {
        //Generating sample red texture with 32x32 resolution
        var gallery            = UM_Application.GalleryService;
        var sampleBlackTexture = SA_IconManager.GetIcon(Color.black, 32, 32);

        gallery.SaveImage(sampleBlackTexture, "sample_black_image.png", (result) =>
        {
            if (result.IsSucceeded)
            {
                Debug.Log("Image saved.");
            }
            else
            {
                Debug.Log("Failed to save an Image: " + result.Error.FullMessage);
            }
        });
    }
Esempio n. 8
0
        public IEnumerator ShareToWhatsapp()
        {
            var @lock   = new CallbackLock();
            var client  = UM_SocialService.SharingClient;
            var builder = new UM_ShareDialogBuilder();

            //Juts generating smaple red tuxture with 32x32 resolution
            Texture2D sampleRedTexture = SA_IconManager.GetIcon(Color.red, 32, 32);

            builder.AddImage(sampleRedTexture);

            client.ShareToWhatsapp(builder, (result) => {
                @lock.Unlock();
                Assert.IsTrue(result.IsSucceeded);
            });

            yield return(@lock.WaitToUnlock());
        }
        public IEnumerator SystemShareDialog()
        {
            var @lock   = new CallbackLock();
            var client  = UM_SocialService.SharingClient;
            var builder = new UM_ShareDialogBuilder();

            builder.SetText("Hello world!");
            builder.SetUrl("https://stansassets.com/");

            //Juts generating smaple red tuxture with 32x32 resolution
            Texture2D sampleRedTexture = SA_IconManager.GetIcon(Color.red, 32, 32);

            builder.AddImage(sampleRedTexture);

            client.SystemSharingDialog(builder, (result) => {
                @lock.Unlock();
                Assert.IsTrue(result.IsSucceeded);
            });

            yield return(@lock.WaitToUnlock());
        }
        public IEnumerator MailDialog()
        {
            var @lock  = new CallbackLock();
            var client = UM_SocialService.SharingClient;
            var dialog = new UM_EmailDialogBuilder();

            dialog.SetSubject("Subject");
            dialog.SetText("Hello World!");
            dialog.SetUrl("https://stansassets.com/");

            //Juts generating smaple red tuxture with 32x32 resolution
            Texture2D sampleRedTexture = SA_IconManager.GetIcon(Color.red, 32, 32);

            dialog.AddImage(sampleRedTexture);
            dialog.AddRecipient("*****@*****.**");

            client.ShowSendMailDialog(dialog, (result) => {
                @lock.Unlock();
                Assert.IsTrue(result.IsSucceeded);
            });

            yield return(@lock.WaitToUnlock());
        }
Esempio n. 11
0
        void OnGUI()
        {
            if (Event.current.type == EventType.MouseMove)
            {
                Repaint();
            }

            position = new Rect(position.x, position.y, 700f, 560f);
            if (m_shouldEnabled)
            {
                foreach (var section in m_sections)
                {
                    section.Layout.OnLayoutEnable();
                }

                m_shouldEnabled = false;
            }

            BeforeGUI();
            using (new SA_GuiBeginHorizontal()) {
                m_sectionScrollPos = GUILayout.BeginScrollView(m_sectionScrollPos, SA_EditorStyles.PreferencesSectionBox, GUILayout.Width(TabSelectionWidth));

                for (int i = 0; i < m_sections.Count; i++)
                {
                    var section = m_sections[i];

                    Rect rect = GUILayoutUtility.GetRect(section.Content, SA_EditorStyles.PreferencesSection, GUILayout.ExpandWidth(true));

                    if (i == m_selectedSection && Event.current.type == EventType.Repaint)
                    {
                        Color color;
                        if (EditorGUIUtility.isProSkin)
                        {
                            color = new Color(62f / 255f, 95f / 255f, 150f / 255f, 1f);
                        }
                        else
                        {
                            color = new Color(62f / 255f, 125f / 255f, 231f / 255f, 1f);
                        }

                        GUI.DrawTexture(rect, SA_IconManager.GetIcon(color));
                    }

                    EditorGUI.BeginChangeCheck();
                    if (GUI.Toggle(rect, m_selectedSection == i, section.Content, SA_EditorStyles.PreferencesSection))
                    {
                        m_selectedSection = i;
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        GUIUtility.keyboardControl = 0;
                    }
                }

                GUILayout.EndScrollView();
                GUILayout.Space(10f);

                using (new SA_GuiBeginVertical()) {
                    m_tabScrollPos = GUILayout.BeginScrollView(m_tabScrollPos, GUILayout.Width(position.width - TabSelectionWidth - 10));
                    {
                        //  GUILayout.Label(m_sections[m_selectedSection].Content, SA_EditorStyles.Collection.SectionHeader);

                        using (new SA_GuiBeginVertical(GUILayout.Width(position.width - TabSelectionWidth - 25))) {
                            m_sections[m_selectedSection].Layout.OnGUI();
                        }
                    }
                    GUILayout.EndScrollView();
                }
            }
            AfterGUI();
        }
Esempio n. 12
0
        private void TestNotificationWithVariantId(int variantId)
        {
            var builder = new AN_NotificationCompat.Builder();


            //should be created automatically
            builder.SetChanelId("test_chanel");
            var icon = SA_IconManager.GetIcon(Color.cyan, 32, 32);

            builder.SetLargeIcon(icon);


            var trigger = new AN_AlarmNotificationTrigger();

            trigger.SetDate(TimeSpan.FromSeconds(1));

            int id = SA_IdFactory.NextId;


            switch (variantId)
            {
            case 1:
                builder.SetContentText("Default");
                builder.SetContentTitle("SetDefaults Test");
                builder.SetDefaults(AN_Notification.DEFAULT_LIGHTS | AN_Notification.DEFAULT_SOUND);
                break;

            case 2:

                builder.SetContentText("BigTextStyle");
                builder.SetContentTitle("BigTextStyle Title");

                var bigTextStyle = new AN_NotificationCompat.BigTextStyle();
                bigTextStyle.BigText("This is test big text style");
                builder.SetStyle(bigTextStyle);
                builder.SetDefaults(AN_Notification.DEFAULT_ALL);
                break;

            case 3:

                builder.SetContentText("BigPictureStyle");
                builder.SetContentTitle("BigPictureStyle title");

                var bigPictureStyle = new AN_NotificationCompat.BigPictureStyle();
                bigPictureStyle.BigPicture(SA_IconManager.GetIcon(Color.red, 32, 32));
                bigPictureStyle.BigLargeIcon(SA_IconManager.GetIcon(Color.green, 32, 32));
                builder.SetStyle(bigPictureStyle);
                builder.SetDefaults(AN_Notification.DEFAULT_ALL);
                break;
            }


            if (variantId == 4)
            {
                SetResult(SA_TestResult.OK);
            }
            else
            {
                m_sendedRequest = new AN_NotificationRequest(id, builder, trigger);
                AN_NotificationManager.Schedule(m_sendedRequest);
            }
        }