コード例 #1
0
        private void BunifuButton1_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog();

            ofd.Filter = "All|*|Bitmap|*.bmp|JPEG|*.jpg|PNG|*.png"; // If you like file type filters you can add them here
                                                                    // any other modifications to the dialog
            if (ofd.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            try
            {
                var fi = new FileInfo(ofd.FileName);
                if (fi.Length / 1000d <= 2000d)
                {
                    var bmp = new Bitmap(ofd.FileName);
                    // bmp.RotateFlip(RotateFlipType.Rotate90FlipNone)
                    // pbBagLogo.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
                    SelectedLogo           = new LogoInfo();
                    SelectedLogo.Image     = bmp;
                    SelectedLogo.Extension = fi.Extension;
                    SelectedLogo.Name      = fi.FullName;
                    SelectedLogo.MbSize    = (int)Math.Round(fi.Length / 1000d);
                    pbBagLogo.Image        = bmp;
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Image exceeds size limit", "The maximum image size is 2MB. Please decrease image size or resolution.", this);
                }
            }
            catch
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error:", "Not a valid image file.", this);
            }
        }
コード例 #2
0
    private void PutIconsOnPath(LogoInfo logoInfo)
    {
        float   pathPercentage = 0f;
        Vector3 newScale       = Vector3.zero;

        pathPercentage = Mathf.Lerp(pathMilestones[logoInfo.currentPosition], pathMilestones[logoInfo.targetPosition], logoInfo.currentPercentage);
        newScale       = Vector3.Lerp(scaleMilestones[logoInfo.currentPosition], scaleMilestones[logoInfo.targetPosition], logoInfo.currentPercentage);

        logoInfo.parentObject.transform.localScale = newScale;
        iTween.PutOnPath(logoInfo.parentObject, movePath, pathPercentage);
    }
コード例 #3
0
        public virtual PartialViewResult Logo()
        {
            var model = new LogoInfo();
            var skin  = HttpContext.SkinCookie();

            if (!string.IsNullOrWhiteSpace(skin) &&
                Url.IsLocalUrl(string.Format("~/content/skins/{0}/head-logo.png", skin)) &&
                System.IO.File.Exists(Server.MapPath(string.Format("~/content/skins/{0}/head-logo.png", skin))))
            {
                model.SkinName = skin;
            }
            return(PartialView(model));
        }
コード例 #4
0
ファイル: HomeController.cs プロジェクト: gmf520/osharp-layui
        public IActionResult Init()
        {
            HomeInfo home = new HomeInfo()
            {
                Title = "主页", Icon = "layui-icon layui-icon-home", Href = Url.Action("Dashboard")
            };
            LogoInfo logo = new LogoInfo()
            {
                Title = "OSHARP", Image = "/images/logo.png", Href = Url.Action("Index")
            };
            List <MenuInfo> menus = GetMenuInfos();
            InitModel       model = new InitModel()
            {
                HomeInfo = home, LogoInfo = logo, MenuInfo = menus
            };

            return(Json(model, new JsonSerializerSettings()
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }));
        }
コード例 #5
0
 public static IEnumerable <Datum> GetDataItems(this LogoInfo info, Func <Datum, bool> filter) =>
 info?.Data?.Where(filter).ToList();
コード例 #6
0
 public static Datum GetFirstDataItem(this LogoInfo info, string name) =>
 info?.Data?.FirstOrDefault(d => d.Name == name);
コード例 #7
0
ファイル: LogosPanel.cs プロジェクト: gicait/ur-scape
    private void OnPatchVisibilityChange(DataLayer dataLayer, Patch patch, bool visible)
    {
        if (visible)
        {
            if (TryGetLogo(patch, out string patchLogoURLs))
            {
                var matches = CsvHelper.regex.Matches(patchLogoURLs);
                if (matches.Count > 0)
                {
                    var logoURLs = new List <string>();
                    patches.Add(patch, logoURLs);

                    foreach (Match match in matches)
                    {
                        var logoURL = match.Groups[2].Value;
                        logoURLs.Add(logoURL);

                        if (logos.TryGetValue(logoURL, out LogoInfo info))
                        {
                            info.count++;
                        }
                        else
                        {
                            string dir      = Path.GetDirectoryName(patch.Filename);
                            string filename = Path.Combine(dir, logoURL);

                            var logoTexture = new Texture2D(2, 2);
                            logoTexture.LoadImage(File.ReadAllBytes(filename));                             // This will auto-resize the texture
                            var logoSprite = Sprite.Create(logoTexture, new Rect(0, 0, logoTexture.width, logoTexture.height), Vector2.zero, 100);

                            var logoImage = new GameObject("Logo").AddComponent <Image>();
                            logoImage.preserveAspect = true;
                            logoImage.sprite         = logoSprite;
                            logoImage.transform.SetParent(transform, false);
                            var rt = logoImage.transform as RectTransform;
                            rt.pivot = Vector2.one;
                            float height = logoTexture.height;
                            float width  = logoTexture.width;
                            if (width > maxLogoWidth)
                            {
                                height = maxLogoWidth * height / width;
                                width  = maxLogoWidth;
                            }
                            rt.sizeDelta = new Vector2(width, Mathf.Min(maxLogoHeight, height));

                            info = new LogoInfo(logoImage.gameObject);
                            logos.Add(logoURL, info);
                        }
                    }
                }
            }
        }
        else
        {
            if (patches.TryGetValue(patch, out List <string> patchLogos))
            {
                patches.Remove(patch);

                foreach (var patchLogo in patchLogos)
                {
                    var info = logos[patchLogo];
                    info.count--;
                    if (info.count == 0)
                    {
                        logos.Remove(patchLogo);
                        Destroy(info.go);
                    }
                }
            }
        }

        GuiUtils.RebuildLayout(transform);
    }