Ejemplo n.º 1
0
        SImage Scale(SImage pix, int maxWidth, int maxHeight)
        {
            int width, height;

            ComputeScale(pix.Width, pix.Height, maxWidth, maxHeight, out width, out height);
            return(pix.ScaleSimple(width, height, Gdk.InterpType.Bilinear));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Used to log images.
        /// if you want to log something you have in your mod,
        /// ie. an embedded resource, use log and put in @(filepath)
        /// </summary>
        /// <param name="img">The texture of the item/enemy/image you want to log.</param>
        /// <returns></returns>
        public static SImage LogImage(Texture img)
        {
            var image = new SImage(img);

            ETGModConsole.Instance.GUI[0].Children.Add(image);
            return(image);
        }
Ejemplo n.º 3
0
        public void ScaleInplace(int maxWidth, int maxHeight)
        {
            SImage scalled;

            scalled = Scale(image, maxWidth, maxHeight);
            image.Dispose();
            image = scalled;
        }
Ejemplo n.º 4
0
 // this constructor is automatically called during deserialization
 public Image(SerializationInfo info, StreamingContext context)
 {
     try {
         image = Deserialize((byte[])info.GetValue("pngbuf", typeof(byte[]))).Value;
     } catch {
         image = null;
     }
 }
Ejemplo n.º 5
0
 public bool Update(SImage entity)
 {
     if (Validation(entity, true))
     {
         _sImageRepository.Update(entity);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 6
0
        public void Scale(int maxWidth, int maxHeight)
        {
            SImage scalled;
            int    width, height;

            ComputeScale(image.Width, image.Height, maxWidth, maxHeight, out width, out height);
            scalled = image.GetThumbnailImage(width, height, new SImage.GetThumbnailImageAbort(ThumbnailAbort), IntPtr.Zero);
            image.Dispose();
            image = scalled;
        }
Ejemplo n.º 7
0
        public void Scale(int maxWidth, int maxHeight)
        {
            SImage scalled;
            int    width, height;

            ComputeScale(image.Width, image.Height, maxWidth, maxHeight, out width, out height);
            scalled = image.ScaleSimple(width, height, Gdk.InterpType.Bilinear);
            image.Dispose();
            image = scalled;
        }
Ejemplo n.º 8
0
        public static Image Composite(Image image1, Image image2)
        {
            SImage dest = new SImage(image1.Value.Colorspace, true, image1.Value.BitsPerSample,
                                     image1.Width, image1.Height);

            image1.Value.Composite(dest, 0, 0, image2.Width, image2.Height, 0, 0, 1, 1,
                                   Gdk.InterpType.Bilinear, 255);
            image2.Value.Composite(dest, 0, 0, image2.Width, image2.Height, 0, 0, 1, 1,
                                   Gdk.InterpType.Bilinear, 255);
            return(new Image(dest));
        }
Ejemplo n.º 9
0
    // Create SImage
    public static SImage AddImage(GameObject gameObject)
    {
        SImage image = UGUITools.AddChild <SImage>(gameObject);

        image.Atlas         = atlas;
        image.SpriteName    = selectedSprite;
        image.raycastTarget = false;
        UGUITools.ResetGameObject(image.gameObject);

        return(image);
    }
Ejemplo n.º 10
0
        public bool Validation(SImage entity, bool IdValidation)
        {
            bool isValid = true;

            if (IdValidation == true)
            {
                if (entity.SImageId == 0 || _sImageRepository.GetById(entity.SImageId) == null)
                {
                    ErrorMessage += "SImageId is Invalid."; isValid = false;
                }
            }
            if (string.IsNullOrEmpty(entity.Url))
            {
                ErrorMessage += "Image Url Is Empty \n";
                isValid       = false;
            }
            return(isValid);
        }
Ejemplo n.º 11
0
 public Image(SImage image)
 {
     this.image = image;
 }
Ejemplo n.º 12
0
 public static Image LoadFromResource(string resource)
 {
     return(new Image(SImage.LoadFromResource(resource)));
 }
Ejemplo n.º 13
0
 public static void SetCursor(Cursors cursors)
 {
     cursor = ImageManage.GetSImage($"cursor_{cursors.ToString()}.png");
     size   = cursor.Size;
 }
Ejemplo n.º 14
0
Archivo: Hero.cs Proyecto: AL-XQ/Team02
 public override void LoadContent()
 {
     trailImage      = ImageManage.GetSImage("trail.png");
     sounds["death"] = SoundManage.GetSound("Player_Death.wav");
     base.LoadContent();
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Used to log messages. messages can have the mod name, mod icon, both, or none in front.
        /// if color is set to null, messege color will be set to white
        /// note that modifiers are applied the sGroup children, not to the sGroup. if you want to change/add modifiers to the sGroup, use the returned sGroup
        /// n order to log an image in your text, you do "@(embedded file path, sizemult)" in your text, sizemult is not required, will default to 1.
        /// </summary>
        /// <param name="msg">the object or string you want to log</param>
        /// <param name="modifiers">an array of Selement modifiers to be added to each element logged</param>
        /// <param name="col">text color in unity Color32 or Color</param>
        /// <param name="HaveModName">whether your log messege will have the mod name at the front</param>
        /// <param name="HaveModIcon">whether your logged messege will have your mod icon at the front</param>
        public static SGroup Log(object msg, Color32?col = null, bool HaveModName = false, bool HaveModIcon = false, SModifier[] modifiers = null)
        {
            //in your module outside of methods you need:
            // public static ETGModuleMetadata metadata = new ETGModuleMetadata();

            //then in your modules init you need:
            // metadata = this.Metadata;
            Color color = Color.white;

            if (col != null)
            {
                color = col.Value;
            }
            string message = msg.ToString();

            SGroup sGroup = new SGroup();

            sGroup.AutoGrowDirection = SGroup.EDirection.Vertical;
            sGroup.AutoLayout        = (SGroup g) => g.AutoLayoutHorizontal;
            sGroup.OnUpdateStyle     = delegate(SElement elem)
            {
                elem.Fill();
            };
            sGroup.AutoLayoutVerticalStretch   = false;
            sGroup.AutoLayoutHorizontalStretch = false;
            sGroup.GrowExtra         = Vector2.zero;
            sGroup.ContentSize       = Vector2.zero;
            sGroup.AutoLayoutPadding = 0;
            sGroup.Background        = Color.clear;

            if (File.Exists(Initialisation.metadata.Archive))
            {
                if (HaveModIcon)
                {
                    SImage icon = new SImage(Initialisation.metadata.Icon);
                    sGroup.Children.Add(icon);
                }
            }
            if (HaveModName)
            {
                LogLabel modname = new LogLabel(Initialisation.metadata.Name + ": ");
                modname.Colors[0] = color;
                sGroup.Children.Add(modname);
            }
            string[] split = Regex.Split(message, "(@\\(.+?\\))");
            foreach (string item in split)
            {
                if (item.StartsWith("@("))
                {
                    string   image    = item.TrimStart('@', '(').TrimEnd(')');
                    string[] sizeMult = image.Split(',');
                    image = sizeMult[0];
                    float SizeMultButForReal = 1;

                    if (sizeMult.Length > 1)
                    {
                        if (sizeMult[1] != null && sizeMult[1] != "" && sizeMult[1] != " ")
                        {
                            SizeMultButForReal = float.Parse(sizeMult[1]);
                        }
                    }

                    string    extension = !image.EndsWith(".png") ? ".png" : "";
                    string    path      = image + extension;
                    Texture2D tex       = GetTextureFromResource(path);
                    TextureScale.Point(tex, Mathf.RoundToInt(tex.width * SizeMultButForReal), Mathf.RoundToInt(tex.height * SizeMultButForReal));

                    SImage img = new SImage(tex);
                    sGroup.Children.Add(img);
                    var idx = sGroup.Children.IndexOf(img);
                }
                else
                {
                    LogLabel label = new LogLabel(item);
                    label.Colors[0]  = color;
                    label.Background = Color.clear;
                    sGroup.Children.Add(label);
                }
                if (modifiers != null)
                {
                    for (int i = 0; i < modifiers.Length; i++)
                    {
                        sGroup.Children[sGroup.Children.Count - 1].Modifiers.Add(modifiers[i]);
                    }
                }
            }
            ETGModConsole.Instance.GUI[0].Children.Add(sGroup);

            ETGModConsole.Instance.GUI[0].UpdateStyle();
            return(sGroup);
        }
Ejemplo n.º 16
0
 public override void LoadContent()
 {
     border          = ImageManage.GetSImage("fileiconborder.png");
     sounds["click"] = SoundManage.GetSound("click.wav");
     base.LoadContent();
 }
Ejemplo n.º 17
0
        public override void Initialize()
        {
            base.Initialize();

            SImage arrow = ImageManage.GetSImage("arrow.png");

            //重力操作の説明
            new ObjUI(this)
            {
                Coordinate = new Vector2(3350, 1300),
                Size       = new Size(256, 64) * 3,
                Rotation   = (float)(-10 * Math.PI / 180),
                Image      = arrow,
            };

            //壁のぼりの説明

            new ObjUI(this)
            {
                Coordinate = new Vector2(5043, 1472),
                Size       = new Size(256, 64),
                Image      = arrow,
            };

            new ObjUI(this)
            {
                Coordinate = new Vector2(5400, 1500),
                Size       = new Size(256, 64),
                Rotation   = (float)(-90 * Math.PI / 180),
                Image      = arrow,
            };

            new ObjUI(this)
            {
                Coordinate = new Vector2(5500, 1300),
                Size       = new Size(192, 128),
                Image      = ImageManage.GetSImage("DKey.png"),
            };

            //天井歩行の説明

            new ObjUI(this)
            {
                Coordinate = new Vector2(5200, 80),
                Size       = new Size(64, 64),
                Image      = ImageManage.GetSImage("QKey.png"),
            };

            new ObjUI(this)
            {
                Coordinate = new Vector2(5734, 250),
                Size       = new Size(256, 64),
                Rotation   = (float)(-90 * Math.PI / 180),
                Image      = arrow,
            };

            new ObjUI(this)
            {
                Coordinate = new Vector2(6000, 75),
                Size       = new Size(256, 64),
                Image      = arrow,
            };

            new ObjUI(this)
            {
                Coordinate = new Vector2(5900, 60),
                Size       = new Size(192, 128),
                Image      = ImageManage.GetSImage("AKey.png"),
            };

            //戦闘のチュートリアル

            new ObjUI(this)
            {
                Coordinate = new Vector2(126, 9) * 64,
                Size       = new Size(128, 128),
                Image      = ImageManage.GetSImage("CombatTutorial.png"),
            };

            new ObjUI(this)
            {
                Coordinate = new Vector2(149, 7) * 64,
                Size       = new Size(128, 128),
                Image      = ImageManage.GetSImage("DeathBlockTutorial.png"),
            };
        }
Ejemplo n.º 18
0
 public Image(string filename)
 {
     this.image = new SImage(filename);
 }