Example #1
0
        public DialogBox(Texture2D background, WallpaperType wallpaperType, Texture2D buttonTex, SpriteFont font, Rectangle window, SoundBank soundBack)
        {
            this.background = background;
            this.wallpaperType = wallpaperType;
            this.buttonTex = buttonTex;
            this.font = font;
            this.window = window;
            this.frameSize = new Point(buttonTex.Width, buttonTex.Height/3);

            this.soundBack = soundBack;
        }
Example #2
0
        public BaseApiResult SetupPlayer(WallpaperType wpType, string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return(BaseApiResult.ErrorState(ErrorType.Failed, "The parameter cannot be null"));
            }

            if (AppManager.PlayerDownloader.IsBusy)
            {
                return(BaseApiResult.BusyState());
            }

            AppManager.PlayerDownloader.PrgoressEvent += PlayerDownloader_PrgoressEvent;
            string folder = null;

            switch (wpType)
            {
            case WallpaperType.Video:
                folder = VideoRender.PlayerFolderName;
                break;
            }
            AppManager.PlayerDownloader.DistDir = Path.Combine(AppManager.UserSetting.Wallpaper.ExternalPlayerFolder, folder);
            return(AppManager.PlayerDownloader.SetupFile(url));
        }
Example #3
0
 protected ExternalProcessRender(WallpaperType type, List <string> extension, bool mouseEvent = true) : base(type, extension, mouseEvent)
 {
 }
        /// <summary>
        /// Sets provided texture as wallpaper
        /// </summary>
        /// <param name="wallpaperTexture"> A texture, that will supply the wallpaper imagery.</param>
        /// <param name="visibleCropHint">
        /// The rectangular subregion of fullImage that should be displayed as wallpaper. Passing null for this parameter means
        /// that the full image should be displayed if possible given the image's and device's aspect ratios, etc.
        /// </param>
        /// <param name="allowBackup">
        /// True if the OS is permitted to back up this wallpaper image for restore to a future device; false otherwise.
        /// </param>
        /// <param name="which">
        /// Which wallpaper to configure with the new imagery.
        /// </param>
        public static void SetWallpaper([NotNull] Texture2D wallpaperTexture,
                                        AndroidRect visibleCropHint = null, bool allowBackup = true, WallpaperType which = WallpaperType.Unspecified)
        {
            if (wallpaperTexture == null)
            {
                throw new ArgumentNullException("wallpaperTexture");
            }

            if (AGUtils.IsNotAndroid())
            {
                return;
            }

            var wallpaperPath = AndroidPersistanceUtilsInternal.SaveWallpaperImageToExternalStorage(wallpaperTexture);

            if (Check.IsSdkGreaterOrEqual(AGDeviceInfo.VersionCodes.N))
            {
                SetWallpaperBitmap(AGUtils.DecodeBitmap(wallpaperPath), visibleCropHint, allowBackup, which);
                return;
            }

            SetWallpaperBitmap(AGUtils.DecodeBitmap(wallpaperPath));
        }
 static void StartCropAndSetWallpaperActivity(AndroidJavaObject uri, AndroidRect visibleCropHint, bool allowBackup, WallpaperType which)
 {
     try
     {
         var intent = WallpaperManager.CallAJO("getCropAndSetWallpaperIntent", uri);
         AGUtils.StartActivity(intent);
     }
     catch (Exception)
     {
         Debug.Log("Setting wallpaper with crop failed, falling back to setting just image");
         var bitmapAjo = C.AndroidProviderMediaStoreImagesMedia.AJCCallStaticOnceAJO("getBitmap", AGUtils.ContentResolver, uri);
         SetWallpaperBitmap(bitmapAjo, visibleCropHint, allowBackup, which);
     }
 }
        /// <summary>
        ///  <remarks>
        /// WARNING: This method works on my devices but always crashes on emulators and I can't find a way to fix it.
        /// It may be something with emulator but use this method with care and test carefully before using it.
        /// </remarks>
        ///  Sets provided image on the provided filepath as wallpaper allowing user to crop beforehand. File MUST exist.
        /// </summary>
        /// <param name="imagePath"> A path to the image file </param>
        /// <param name="visibleCropHint">
        /// The rectangular subregion of fullImage that should be displayed as wallpaper. Passing null for this parameter means
        /// that the full image should be displayed if possible given the image's and device's aspect ratios, etc.
        /// </param>
        /// <param name="allowBackup">
        /// True if the OS is permitted to back up this wallpaper image for restore to a future device; false otherwise.
        /// </param>
        /// <param name="which">
        /// Which wallpaper to configure with the new imagery.
        /// </param>
        public static void ShowCropAndSetWallpaperChooser([NotNull] string imagePath,
                                                          AndroidRect visibleCropHint = null, bool allowBackup = true, WallpaperType which = WallpaperType.Unspecified)
        {
            if (imagePath == null)
            {
                throw new ArgumentNullException("imagePath");
            }

            if (AGUtils.IsNotAndroid())
            {
                return;
            }

            if (AGDeviceInfo.SDK_INT < AGDeviceInfo.VersionCodes.KITKAT)
            {
                return;
            }

            CheckIfFileExists(imagePath);
            var uri = AndroidPersistanceUtilsInternal.GetUriFromFilePath(imagePath);

            StartCropAndSetWallpaperActivity(uri, visibleCropHint, allowBackup, which);
        }
        /// <summary>
        /// <remarks>
        /// WARNING: This method works on my devices but always crashes on emulators and I can't find a way to fix it.
        /// It may be something with emulator but use this method with care and test carefully before using it.
        /// </remarks>
        ///  Sets provided texture as wallpaper allowing user to crop beforehand
        /// </summary>
        /// <param name="wallpaperTexture"> A texture, that will supply the wallpaper imagery.</param>
        /// <param name="visibleCropHint">
        /// The rectangular subregion of fullImage that should be displayed as wallpaper. Passing null for this parameter means
        /// that the full image should be displayed if possible given the image's and device's aspect ratios, etc.
        /// </param>
        /// <param name="allowBackup">
        /// True if the OS is permitted to back up this wallpaper image for restore to a future device; false otherwise.
        /// </param>
        /// <param name="which">
        /// Which wallpaper to configure with the new imagery.
        /// </param>
        public static void ShowCropAndSetWallpaperChooser([NotNull] Texture2D wallpaperTexture,
                                                          AndroidRect visibleCropHint = null, bool allowBackup = true, WallpaperType which = WallpaperType.Unspecified)
        {
            if (wallpaperTexture == null)
            {
                throw new ArgumentNullException("wallpaperTexture");
            }

            if (AGUtils.IsNotAndroid())
            {
                return;
            }

            if (AGDeviceInfo.SDK_INT < AGDeviceInfo.VersionCodes.KITKAT)
            {
                return;
            }

            var uri = AndroidPersistanceUtilsInternal.SaveWallpaperImageToExternalStorageUri(wallpaperTexture);

            StartCropAndSetWallpaperActivity(uri, visibleCropHint, allowBackup, which);
        }
        /// <summary>
        /// Sets provided image on the provided filepath as wallpaper. File MUST exist.
        /// </summary>
        /// <param name="imagePath"> A path to the image file </param>
        /// <param name="visibleCropHint">
        /// The rectangular subregion of fullImage that should be displayed as wallpaper. Passing null for this parameter means
        /// that the full image should be displayed if possible given the image's and device's aspect ratios, etc.
        /// </param>
        /// <param name="allowBackup">
        /// True if the OS is permitted to back up this wallpaper image for restore to a future device; false otherwise.
        /// </param>
        /// <param name="which">
        /// Which wallpaper to configure with the new imagery.
        /// </param>
        public static void SetWallpaper([NotNull] string imagePath,
                                        AndroidRect visibleCropHint = null, bool allowBackup = true, WallpaperType which = WallpaperType.Unspecified)
        {
            if (imagePath == null)
            {
                throw new ArgumentNullException("imagePath");
            }

            if (AGUtils.IsNotAndroid())
            {
                return;
            }

            CheckIfFileExists(imagePath);

            SetWallpaperBitmap(AGUtils.DecodeBitmap(imagePath), visibleCropHint, allowBackup, which);
        }
Example #9
0
        private void setDefaultStyle()
        {
            this.BackColor = Color.FromArgb(185, pes.pes.BackColor);
            if (pes.BackGroundSkin != null)
            {
                BackGroundSkin = pes.BackGroundSkin;
                this.BackColor = Color.Transparent;
            }
            btn_point.BaseColor = Color.Red;
            btn_cg.ForeColor    = Color.FromArgb(255, pes.pes.BackColor);
            layeredPanel_cg.BringToFront();
            //常规界面相关处理
            foreach (DuiBaseControl item in layeredPanel_cg.DUIControls)
            {
                switch (item.Name)
                {
                case "ck_qd":
                    Ck_AutoStart = item as DuiCheckBox;
                    Ck_AutoStart.CheckRectColor  = Color.FromArgb(155, pes.pes.BackColor);
                    Ck_AutoStart.CheckFlagColor  = Color.FromArgb(155, pes.pes.BackColor);
                    Ck_AutoStart.CheckedChanged += Ck_AutoStart_CheckedChanged;
                    Ck_AutoStart.Checked         = pes.pes.AutoStart;
                    break;

                case "rd_min":
                case "rd_close":
                    RadioButton_CloseMode = item as DuiRadioButton;
                    RadioButton_CloseMode.CheckRectColor  = Color.FromArgb(155, pes.pes.BackColor);
                    RadioButton_CloseMode.CheckFlagColor  = Color.FromArgb(155, pes.pes.BackColor);
                    RadioButton_CloseMode.CheckedChanged += RadioButton_CloseMode_CheckedChanged;
                    if ((pes.pes.CloseMode == "isClose") && RadioButton_CloseMode.Name == "rd_close")
                    {
                        (item as DuiRadioButton).Checked = true;
                    }
                    else if ((pes.pes.CloseMode == "isMin") && RadioButton_CloseMode.Name == "rd_min")
                    {
                        (item as DuiRadioButton).Checked = true;
                    }
                    else
                    {
                        (item as DuiRadioButton).Checked = false;
                    }
                    break;

                case "":

                    break;

                default:
                    break;
                }
            }
            //壁纸切换界面相关处理
            foreach (DuiBaseControl item in layeredPanel_qhbz.DUIControls)
            {
                switch (item.Name)
                {
                case "ck_qd":
                    Ck_IsSwitchWallpaper = item as DuiCheckBox;
                    Ck_IsSwitchWallpaper.CheckRectColor  = Color.FromArgb(155, pes.pes.BackColor);
                    Ck_IsSwitchWallpaper.CheckFlagColor  = Color.FromArgb(155, pes.pes.BackColor);
                    Ck_IsSwitchWallpaper.Checked         = pes.pes.IsSwitchWallpaper;
                    Ck_IsSwitchWallpaper.CheckedChanged += Ck_IsSwitchWallpaper_CheckedChanged;
                    break;

                case "db_timedw":
                    ComboBox_InterValTimeUnit                       = item as DuiComboBox;
                    ComboBox_InterValTimeUnit.BackColor             = Color.FromArgb(155, pes.pes.BackColor);
                    ComboBox_InterValTimeUnit.SelectedIndexChanged += ComboBox_InterValTimeUnit_SelectedIndexChanged;
                    if (pes.pes.InterValTime < 60)
                    {
                        ComboBox_InterValTimeUnit.SelectedIndex = 0;
                        TextBox_InterValTime.Text = pes.pes.InterValTime.ToString();
                    }
                    else if (pes.pes.InterValTime < 3600)
                    {
                        ComboBox_InterValTimeUnit.SelectedIndex = 1;
                        TextBox_InterValTime.Text = (pes.pes.InterValTime / 60).ToString();
                    }
                    else
                    {
                        ComboBox_InterValTimeUnit.SelectedIndex = 2;
                        TextBox_InterValTime.Text = (pes.pes.InterValTime / 3600).ToString();
                    }
                    break;

                case "tb_timeStr":
                    TextBox_InterValTime              = item as DuiTextBox;
                    TextBox_InterValTime.BackColor    = Color.FromArgb(155, pes.pes.BackColor);
                    TextBox_InterValTime.AutoHeight   = true;
                    TextBox_InterValTime.Invalidated += TextBox_InterValTime_TextChanged;
                    //TextBox_InterValTime.Text = pes.pes.InterValTime.ToString();
                    break;

                default:
                    if (item is DuiButton && item.Name.Contains("btn_"))
                    {
                        DuiButton Button_SwitchWallpaperType = item as DuiButton;
                        Button_SwitchWallpaperType.Cursor          = System.Windows.Forms.Cursors.Hand;
                        Button_SwitchWallpaperType.MouseClick     += Button_SwitchWallpaperType_MouseClick;
                        Button_SwitchWallpaperType.BaseColor       = Color.Transparent;
                        Button_SwitchWallpaperType.BackgroundImage = Properties.Resources.btn_n;
                        Button_SwitchWallpaperType.IsPureColor     = false;
                        Button_SwitchWallpaperType.Tag             = false.ToString();
                        foreach (var WallpaperType in pes.pes.SwitchWallpaperTypes)
                        {
                            if (item.Name.Replace("btn_", "") == WallpaperType.ToString())
                            {
                                Button_SwitchWallpaperType.Tag             = true.ToString();
                                Button_SwitchWallpaperType.BackgroundImage = Properties.Resources.btn_select_n;
                            }
                        }
                        Button_SwitchWallpaperType.BackgroundImageLayout = ImageLayout.Stretch;
                    }
                    break;
                }
            }
            //下载设置界面相关处理
            foreach (DuiBaseControl item in layeredPanel_xzsz.DUIControls)
            {
                switch (item.Name)
                {
                case "rd_SizeForThumb":
                case "rd_SizeFor1600900":
                case "rd_SizeFor1440900":
                case "rd_SizeFor12801024":
                case "rd_SizeFor1024768":
                case "rd_SizeFor1280800":
                    RadioButton_picSize = item as DuiRadioButton;
                    RadioButton_picSize.CheckFlagColor  = Color.FromArgb(155, pes.pes.BackColor);
                    RadioButton_picSize.CheckRectColor  = Color.FromArgb(155, pes.pes.BackColor);
                    RadioButton_picSize.CheckedChanged += RadioButton_picSize_CheckedChanged;
                    if ("rd_SizeFor" + (pes.pes.PicSize == "default" ? "Thumb" : pes.pes.PicSize) == item.Name)
                    {
                        RadioButton_picSize.Checked = true;
                    }
                    else
                    {
                        RadioButton_picSize.Checked = false;
                    }
                    break;

                case "text_downloadPath":
                    lb_downloadPath           = item as DuiTextBox;
                    lb_downloadPath.BackColor = Color.FromArgb(155, pes.pes.BackColor);
                    lb_downloadPath.Text      = (String.IsNullOrEmpty(pes.pes.DownloadPath) ? AppDomain.CurrentDomain.BaseDirectory + @"ImageWallpaper\" : pes.pes.DownloadPath);
                    break;

                case "btn_selectDownloadPath":
                    btn_selectDownloadPath             = item as DuiButton;
                    btn_selectDownloadPath.Cursor      = System.Windows.Forms.Cursors.Hand;
                    btn_selectDownloadPath.MouseClick += Btn_selectDownloadPath_MouseClick;
                    break;

                case "text_cachePath":
                    lb_cachePath           = item as DuiTextBox;
                    lb_cachePath.BackColor = Color.FromArgb(155, pes.pes.BackColor);
                    lb_cachePath.Text      = (String.IsNullOrEmpty(pes.pes.CachePath) ? AppDomain.CurrentDomain.BaseDirectory + @"CacheWallpaper\" : pes.pes.CachePath);
                    if (lb_nowCacheSize != null && lb_cachePath != null)
                    {
                        lb_nowCacheSize.Text = "当前缓存:" + GetDirectoryLength(lb_cachePath.Text) / (1024 * 1024) + "MB";
                    }

                    break;

                case "btn_selectCachePath":
                    btn_selectCachePath             = item as DuiButton;
                    btn_selectCachePath.Cursor      = System.Windows.Forms.Cursors.Hand;
                    btn_selectCachePath.MouseClick += Btn_selectCachePath_MouseClick;
                    break;

                case "lb_nowCacheSize":
                    lb_nowCacheSize = item as DuiLabel;
                    if (lb_cachePath != null && lb_nowCacheSize != null)
                    {
                        lb_nowCacheSize.Text = "当前缓存:" + GetDirectoryLength(lb_cachePath.Text) / (1024 * 1024) + "MB";
                    }
                    break;

                case "lb_clearCache":
                    lb_clearCache             = item as DuiLabel;
                    lb_clearCache.Cursor      = System.Windows.Forms.Cursors.Hand;
                    lb_clearCache.MouseClick += Lb_clearCache_MouseClick;
                    break;

                default:
                    break;
                }
            }
            //关于界面相关处理
            foreach (DuiBaseControl item in layeredPanel_gy.DUIControls)
            {
                switch (item.Name)
                {
                case "lb_ver":
                    lb_ver      = item as DuiLabel;
                    lb_ver.Text = pes.pes.VerNo;
                    break;

                case "btn_update":
                    btn_update             = item as DuiButton;
                    btn_update.Cursor      = System.Windows.Forms.Cursors.Hand;
                    btn_update.BaseColor   = Color.FromArgb(155, pes.pes.BackColor);
                    btn_update.MouseClick += Btn_update_MouseClick;
                    break;

                case "btn_sendyj":
                    btn_sendyj             = item as DuiButton;
                    btn_sendyj.Cursor      = System.Windows.Forms.Cursors.Hand;
                    btn_sendyj.BaseColor   = Color.FromArgb(155, pes.pes.BackColor);
                    btn_sendyj.MouseClick += Btn_sendyj_MouseClick;
                    break;

                case "lb_mxnr1":
                    lb_mxnr1             = item as DuiLabel;
                    lb_mxnr1.Cursor      = System.Windows.Forms.Cursors.Hand;
                    lb_mxnr1.MouseClick += Lb_mxnr1_MouseClick;
                    break;

                case "lb_mxnr2":
                    lb_mxnr2             = item as DuiLabel;
                    lb_mxnr2.Cursor      = System.Windows.Forms.Cursors.Hand;
                    lb_mxnr2.MouseClick += Lb_mxnr1_MouseClick;
                    break;

                case "lb_zzemail":
                    lb_zzemail             = item as DuiLabel;
                    lb_zzemail.Cursor      = System.Windows.Forms.Cursors.Hand;
                    lb_zzemail.MouseClick += Lb_zzemail_MouseClick;
                    break;

                default:
                    break;
                }
            }
        }
Example #10
0
 protected BaseRender(WallpaperType type, List <string> extension, bool supportMouseEvent)
 {
     SupportType       = type;
     SupportExtension  = extension;
     SupportMouseEvent = supportMouseEvent;
 }
Example #11
0
 public HowToPlay(Texture2D backGround, WallpaperType wallpaperType, Texture2D buttonTex, SpriteFont font, Color color, Rectangle window, SoundBank soundBack)
     : base(backGround, wallpaperType, buttonTex, font, window, soundBack)
 {
     this.AddButton("Start Game",color, new Vector2(window.Width / 2f, window.Height / 2f) + new Vector2(backGround.Width / 2f, backGround.Height / 2f) - new Vector2(0, buttonTex.Height));
     this.AddButton("Back",color,  new Vector2(window.Width / 2f, window.Height / 2f) + new Vector2(backGround.Width / 2f, backGround.Height / 2f) - new Vector2(50, buttonTex.Height/2f));
 }