/// <summary>
 /// Convert Image to Byte[]
 /// Image img = Image.FromFile("c:\\hcha.jpg");
 /// </summary>
 /// <param name="image"></param>
 /// <returns></returns>
 public static byte[] ImageToBytes(Image image)
 {
     ImageFormat format = image.RawFormat;
     using (MemoryStream ms = new MemoryStream())
     {
         if (format.Equals(ImageFormat.Jpeg))
         {
             image.Save(ms, ImageFormat.Jpeg);
         }
         else if (format.Equals(ImageFormat.Png))
         {
             image.Save(ms, ImageFormat.Png);
         }
         else if (format.Equals(ImageFormat.Bmp))
         {
             image.Save(ms, ImageFormat.Bmp);
         }
         else if (format.Equals(ImageFormat.Gif))
         {
             image.Save(ms, ImageFormat.Gif);
         }
         else if (format.Equals(ImageFormat.Icon))
         {
             image.Save(ms, ImageFormat.Icon);
         }
         byte[] buffer = new byte[ms.Length];
         //Image.Save()会改变MemoryStream的Position,需要重新Seek到Begin
         ms.Seek(0, SeekOrigin.Begin);
         ms.Read(buffer, 0, buffer.Length);
         return buffer;
     }
 }
        public Image Mark( Image image, string waterMarkText )
        {
            WatermarkText = waterMarkText;

            Bitmap originalBmp = (Bitmap)image;

            // avoid "A Graphics object cannot be created from an image that has an indexed pixel format." exception
            Bitmap tempBitmap = new Bitmap(originalBmp.Width, originalBmp.Height);
            // From this bitmap, the graphics can be obtained, because it has the right PixelFormat
            Graphics g = Graphics.FromImage(tempBitmap);

            using (Graphics graphics = Graphics.FromImage(tempBitmap))
            {
                // Draw the original bitmap onto the graphics of the new bitmap
                g.DrawImage(originalBmp, 0, 0);
                var size =
                    graphics.MeasureString(WatermarkText, Font);
                var brush =
                    new SolidBrush(Color.FromArgb(255, Color));
                graphics.DrawString
                    (WatermarkText, Font, brush,
                    GetTextPosition(image, size));
            }

            return tempBitmap as Image;
        }
        /// <summary>The quantize.</summary>
        /// <param name="image">The image.</param>
        /// <param name="pixelFormat">The pixel format.</param>
        /// <param name="useDither">The use dither.</param>
        /// <returns>The quantized image with the recalculated color palette.</returns>
        public static Bitmap Quantize(Image image, PixelFormat pixelFormat, bool useDither)
        {
            Bitmap tryBitmap = image as Bitmap;

            if (tryBitmap != null && tryBitmap.PixelFormat == PixelFormat.Format32bppArgb)
            {
                // The image passed to us is ALREADY a bitmap in the right format. No need to create
                // a copy and work from there.
                return DoQuantize(tryBitmap, pixelFormat, useDither);
            }

            // We use these values a lot
            int width = image.Width;
            int height = image.Height;
            Rectangle sourceRect = Rectangle.FromLTRB(0, 0, width, height);

            // Create a 24-bit rgb version of the source image
            using (Bitmap bitmapSource = new Bitmap(width, height, PixelFormat.Format32bppArgb))
            {
                using (Graphics grfx = Graphics.FromImage(bitmapSource))
                {
                    grfx.DrawImage(image, sourceRect, 0, 0, width, height, GraphicsUnit.Pixel);
                }

                return DoQuantize(bitmapSource, pixelFormat, useDither);
            }
        }
Example #4
1
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=F:\git\web-application-dev\online_album\App_Data\Database1.mdf;Integrated Security=True"); //创建连接对象
            con.Open();
            SqlCommand cmd = new SqlCommand("select * from [photo]", con);
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Panel box = new Panel();
                box.CssClass = "box";
                Panel1.Controls.Add(box);

                Image photo = new Image();
                photo.CssClass = "photo";
                photo.ImageUrl = "~/Images/" + dr["uid"].ToString() + "/" + dr["filename"].ToString(); ;
                box.Controls.Add(photo);

                box.Controls.Add(new Literal() { Text = "<br />" });

                Label uid = new Label();
                uid.Text = dr["uid"].ToString();
                box.Controls.Add(uid);

                box.Controls.Add(new Literal() { Text = "<br />" });

                Label datetime = new Label();
                datetime.Text = dr["datetime"].ToString();
                box.Controls.Add(datetime);
            }
        }
Example #5
1
        public MenuCell()
        {
            image = new Image {
                HeightRequest = 20,
                WidthRequest = 20,
            };

            image.Opacity = 0.5;
               // image.SetBinding(Image.SourceProperty, ImageSrc);

            label = new Label
            {

                YAlign = TextAlignment.Center,
                TextColor = Color.Gray,
            };

            var layout = new StackLayout
            {
               // BackgroundColor = Color.FromHex("2C3E50"),
                BackgroundColor = Color.White,

                Padding = new Thickness(20, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Spacing = 20,
                //HorizontalOptions = LayoutOptions.StartAndExpand,
                Children = { image,label }
            };
            View = layout;
        }
    public void Start()
    {
        _image = GetComponent<Image>();

        Texture2D tex = _image.sprite.texture as Texture2D;

        bool isInvalid = false;
        if (tex != null)
        {
            try
            {
                tex.GetPixels32();
            }
            catch (UnityException e)
            {
                Debug.LogError(e.Message);
                isInvalid = true;
            }
        }
        else
        {
            isInvalid = true;
        }

        if (isInvalid)
        {
            Debug.LogError("This script need an Image with a readbale Texture2D to work.");
        }
    }
        protected void grdCourses_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (IsPostBack)
            {
                if (e.Row.RowType == DataControlRowType.Header)
                {
                    Image SortImage = new Image();

                    for (int i = 0; i <= grdCourses.Columns.Count - 1; i++)
                    {
                        if (grdCourses.Columns[i].SortExpression == Session["SortColumn"].ToString())
                        {
                            if (Session["SortDirection"].ToString() == "DESC")
                            {
                                SortImage.ImageUrl = "/images/desc.jpg";
                                SortImage.AlternateText = "Sort Descending";
                            }
                            else
                            {
                                SortImage.ImageUrl = "/images/asc.jpg";
                                SortImage.AlternateText = "Sort Ascending";
                            }

                            e.Row.Cells[i].Controls.Add(SortImage);

                        }
                    }
                }

            }
        }
 public TipSpomenika(string sifra, string ime, string opis, Image ikonica)
 {
     this.SifraTipaSpomenika = sifra;
     this.ImeTipa = ime;
     this.Opis = opis;
     this.Ikonica = ikonica;
 }
Example #9
1
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var img = _imageConverter.Convert(value, targetType, parameter, culture) as BitmapImage;
            if (img == null) return Binding.DoNothing;

            var result = new Image() { Source = img };

            var strParam = parameter as string;
            if (strParam != null)
            {
                var dim = strParam.Split(',');
                if (dim != null && dim.Length == 2)
                {
                    int w, h;
                    if (int.TryParse(dim[0], out w))
                    {
                        result.MaxWidth = w;
                    }
                    if (int.TryParse(dim[1], out h))
                    {
                        result.MaxHeight = h;
                    }
                }
            }

            return result;
        }
        /// <summary>
        /// Rotate an image on a point with a specified angle
        /// </summary>
		/// <param name="pe">The paint area event where the image will be displayed</param>
		/// <param name="img">The image to display</param>
		/// <param name="alpha">The angle of rotation in radian</param>
		/// <param name="ptImg">The location of the left upper corner of the image to display in the paint area in nominal situation</param>
		/// <param name="ptRot">The location of the rotation point in the paint area</param>
		/// <param name="scaleFactor">Multiplication factor on the display image</param>
        protected void RotateImage(PaintEventArgs pe, Image img, Double alpha, Point ptImg, Point ptRot, float scaleFactor)
        {
            double beta = 0; 	// Angle between the Horizontal line and the line (Left upper corner - Rotation point)
            double d = 0;		// Distance between Left upper corner and Rotation point)		
            float deltaX = 0;	// X componant of the corrected translation
            float deltaY = 0;	// Y componant of the corrected translation

			// Compute the correction translation coeff
            if (ptImg != ptRot)
            {
				//
                if (ptRot.X != 0)
                {
                    beta = Math.Atan((double)ptRot.Y / (double)ptRot.X);
                }

                d = Math.Sqrt((ptRot.X * ptRot.X) + (ptRot.Y * ptRot.Y));

                // Computed offset
                deltaX = (float)(d * (Math.Cos(alpha - beta) - Math.Cos(alpha) * Math.Cos(alpha + beta) - Math.Sin(alpha) * Math.Sin(alpha + beta)));
                deltaY = (float)(d * (Math.Sin(beta - alpha) + Math.Sin(alpha) * Math.Cos(alpha + beta) - Math.Cos(alpha) * Math.Sin(alpha + beta)));
            }

            // Rotate image support
            pe.Graphics.RotateTransform((float)(alpha * 180 / Math.PI));

            // Dispay image
            pe.Graphics.DrawImage(img, (ptImg.X + deltaX) * scaleFactor, (ptImg.Y + deltaY) * scaleFactor, img.Width * scaleFactor, img.Height * scaleFactor);

            // Put image support as found
            pe.Graphics.RotateTransform((float)(-alpha * 180 / Math.PI));

        }
        private void ProcessFrame(object sender, EventArgs arg)
        {
            frame = capture.QueryFrame();


            if (frame != null)
            {

                // add cross hairs to image
                int totalwidth = frame.Width;
                int totalheight = frame.Height;
                PointF[] linepointshor = new PointF[] { 
                    new PointF(0, totalheight/2),
                    new PointF(totalwidth, totalheight/2)
                  
                };
                PointF[] linepointsver = new PointF[] { 
                    new PointF(totalwidth/2, 0),
                    new PointF(totalwidth/2, totalheight)
                  
                };

                frame.DrawPolyline(Array.ConvertAll<PointF, System.Drawing.Point>(linepointshor, System.Drawing.Point.Round), false, new Bgr(System.Drawing.Color.AntiqueWhite), 1);
                frame.DrawPolyline(Array.ConvertAll<PointF, System.Drawing.Point>(linepointsver, System.Drawing.Point.Round), false, new Bgr(System.Drawing.Color.AntiqueWhite), 1);




            }
            CapturedImageBox.Image = frame;

        }
        public void PlayFile(string path)
        {
            try
            {
                if (!File.Exists(path))
                {
                    if (PlayFinishedEvent != null)
                    {
                        PlayFinishedEvent(this, EventArgs.Empty);
                    }
                }
                if (image != null)
                    image.Dispose();
                image = new Bitmap(path);
                state = PlayState.Running;
                tickcount = 0;
                Refresh();
            }
            catch (Exception exp)
            {

                if (PlayFinishedEvent != null)
                {
                    PlayFinishedEvent(this, EventArgs.Empty);
                }

            }
        }
 public static void ShowDetail(Image img)
 {
     FileItem fileItem = img.Tag as FileItem;
     if (fileItem == null) return;
     MoreInfo moreInfo = new MoreInfo(fileItem.Name, fileItem.FullName, fileItem.IconAssociated);
     moreInfo.ShowDialog();
 }
Example #14
1
		public NodeImageItem(Image image, int width, int height, bool inputEnabled = false, bool outputEnabled = false) :
			base(inputEnabled, outputEnabled)
		{
			this.Width = width;
			this.Height = height;
			this.Image = image;
		}
	void Awake()
	{
		if (this.gameObject.GetComponent<Image> () != null) 
		{
			CanvasImage = this.gameObject.GetComponent<Image> ();
		}
	}
	void Start () {
		thisImage = this.GetComponent<Image> ();
		if (locked == true) {
			thisImage.sprite = LockedImage;
			GetComponent<Button>().interactable=false;
		}
	}
        private void ProcessImage(Image<Bgr, byte> image)
        {
            Stopwatch watch = Stopwatch.StartNew(); // time the detection process

             List<Image<Gray, Byte>> licensePlateImagesList = new List<Image<Gray, byte>>();
             List<Image<Gray, Byte>> filteredLicensePlateImagesList = new List<Image<Gray, byte>>();
             List<MCvBox2D> licenseBoxList = new List<MCvBox2D>();
             List<List<Word>> words = _licensePlateDetector.DetectLicensePlate(
            image,
            licensePlateImagesList,
            filteredLicensePlateImagesList,
            licenseBoxList);

             watch.Stop(); //stop the timer
             processTimeLabel.Text = String.Format("License Plate Recognition time: {0} milli-seconds", watch.Elapsed.TotalMilliseconds);

             panel1.Controls.Clear();
             Point startPoint = new Point(10, 10);
             for (int i = 0; i < words.Count; i++)
             {
            AddLabelAndImage(
               ref startPoint,
               String.Format("License: {0}", String.Join(" ", words[i].ConvertAll<String>(delegate(Word w) { return w.Text; }).ToArray())),
               licensePlateImagesList[i].ConcateVertical(filteredLicensePlateImagesList[i]));
            image.Draw(licenseBoxList[i], new Bgr(Color.Red), 2);
             }

             imageBox1.Image = image;
        }
Example #18
1
 /// <summary>
 /// Shows the dialog with the specified image.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="title">The title.</param>
 /// <param name="image">The image.</param>
 public void Show(IWin32Window owner, string title, Image image)
 {
     this.ClientSize = image.Size;
     this.Text = title;
     this.pictureBox.Image = image;
     base.ShowDialog();
 }
 public Image<Bgr, Byte> GetAveraging(Image<Bgr, Byte> sourceImage, int matrixWidthSize, int matrixHeightSize)
 {
     Image<Bgr, Byte> image = new Image<Bgr, Byte>(sourceImage.Width, sourceImage.Height);
     for (int y = 0; y < sourceImage.Height; y++)
     {
         for (int x = 0; x < sourceImage.Width; x++)
         {
             int n = 0;
             int[] value = new int[3];
             int my = y - matrixHeightSize / 2;
             my = Math.Max(my, 0);
             int mx = x - matrixWidthSize / 2;
             mx = Math.Max(mx, 0);
             for (int i = 0; i < matrixHeightSize && my + i < sourceImage.Height; i++)
             {
                 for (int j = 0; j < matrixWidthSize && mx + j < sourceImage.Width; j++)
                 {
                     for (int z = 0; z < sourceImage.Data.GetLength(2); z++)
                     {
                         value[z] += sourceImage.Data[my + i, mx + j, z];
                     }
                     n++;
                 }
             }
             n = Math.Max(n, 1);
             for (int z = 0; z < sourceImage.Data.GetLength(2); z++)
             {
                 image.Data[y, x, z] = (byte)(value[z] / n);
             }
         }
     }
     return image;
 }
Example #20
1
 public Photo_Post(int postId, Image photo, string photoCaption, string photoName)
 {
     PostId = postId;
     Photo = photo;
     PhotoCaption = photoCaption;
     PhotoName = photoName;
 }
Example #21
1
 public TaskElement()
 {
     InitializeComponent();
     this.progress = this.FindName("Progress") as Image;
     this.success = this.FindName("Success") as Image;
     this.fail = this.FindName("Fail") as Image;
 }
Example #22
1
        public override void Render(Image image, double x, double y, 
            double w, double h)
        {
            x *= _zoom;
              y *= _zoom;
              w *= _zoom;
              h *= _zoom;

              int ix = _offx + (int) x;
              int iy = _offy + (int) y;
              int iw = (int) w;
              int ih = (int) h;

              if (ix + iw == _pw)
            iw--;
              if (iy + ih == _ph)
            ih--;

              _pixmap.DrawRectangle(_gc, false, ix, iy, iw, ih);
              _pixmap.DrawRectangle(_gc, true, ix, iy, iw, ih);

              var clone = RotateAndScale(image, w, h);
              int tw = clone.Width;
              int th = clone.Height;

              ix += (iw - tw) / 2;
              iy += (ih - th) / 2;

              var pixbuf = clone.GetThumbnail(tw, th, Transparency.KeepAlpha);

              pixbuf.RenderToDrawable(_pixmap, _gc, 0, 0, ix, iy, -1, -1,
                  RgbDither.Normal, 0, 0);
              pixbuf.Dispose();
        }
 public ImageCropper(Image image, int maxWidth, int maxHeight, CropAnchor anchor)
 {
     _image = image;
     _maxWidth = maxWidth;
     _maxHeight = maxHeight;
     _anchor = anchor;
 }
Example #24
1
 public Cursor(Image regular, Image clicked)
     : base(new Vector2(Mouse.GetState().X, Mouse.GetState().Y), regular)
 {
     Layer = int.MaxValue;
     Regular = regular; Clicked = clicked;
     Regular.Parallax = new Vector2(); Clicked.Parallax = new Vector2();
 }
Example #25
0
        /// <summary>
        /// Initializes the map with values from parameter.
        /// </summary>
        /// <param name="folderName">Deprecated</param>
        /// <param name="id"></param>
        /// <param name="title"></param>
        /// <param name="description"></param>
        /// <param name="fieldSize"></param>
        /// <param name="hitbox"></param>
        /// <param name="carStartSpeed"></param>
        /// <param name="carStartDirection"></param>
        /// <param name="published"></param>
        /// <param name="carStartPositions"></param>
        /// <param name="roundFinishedPositions"></param>
        /// <param name="forbiddenPositions"></param>
        public Map(
            String folderName, String id, String title, String description,
            int fieldSize, int hitbox, int carStartSpeed,
            String carStartDirection, Boolean published, BindingList<Node> carStartPositions,
            BindingList<Node> roundFinishedPositions, BindingList<Node> forbiddenPositions,
            Image image
            )
        {
            this.FolderName = folderName;

            this.Id = id;
            this.Title = title;
            this.Description = description;

            this.FieldSize = fieldSize;
            this.Hitbox = hitbox;
            this.CarStartSpeed = carStartSpeed;
            this.CarStartDirection = carStartDirection;
            this.Published = published;

            this.CarStartPositions = carStartPositions;
            this.RoundFinishedPositions = roundFinishedPositions;
            this.ForbiddenPositions = forbiddenPositions;

            this.Image = image;
        }
        public AnimatedGifWindow()
        {
            var img = new Image();
            var src = default(BitmapImage);

            var source = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                "background.gif");

            if (File.Exists(source)) {
                src = new BitmapImage();
                src.BeginInit();
                src.StreamSource = File.OpenRead(source);
                src.EndInit();
            
                ImageBehavior.SetAnimatedSource(img, src);
                this.Content = img;
                this.Width = src.Width;
                this.Height = src.Height;
            }
                        
            this.AllowsTransparency = true;
            this.WindowStyle = WindowStyle.None;
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            this.ShowInTaskbar = true;
            this.Topmost = true;
            this.TaskbarItemInfo = new TaskbarItemInfo {
                ProgressState = TaskbarItemProgressState.Normal
            };
            this.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
        }
Example #27
0
        private byte[] CropImageFile(Image imageFile, int targetW, int targetH, int targetX, int targetY)
        {
            var imgMemoryStream = new MemoryStream();
            Image imgPhoto = imageFile;

            var bmPhoto = new Bitmap(targetW, targetH, PixelFormat.Format24bppRgb);
            bmPhoto.SetResolution(72, 72);

            Graphics grPhoto = Graphics.FromImage(bmPhoto);
            grPhoto.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            grPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            grPhoto.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

            try
            {
                grPhoto.DrawImage(imgPhoto, new Rectangle(0, 0, targetW, targetH),
                                    targetX, targetY, targetW, targetH, GraphicsUnit.Pixel);
                bmPhoto.Save(imgMemoryStream, ImageFormat.Jpeg);
            }

            catch (Exception e)
            {
                throw e;
            }

            return imgMemoryStream.GetBuffer();
        }
Example #28
0
        public LeadListHeaderView(Command newLeadTappedCommand)
        {
            _NewLeadTappedCommand = newLeadTappedCommand;

            #region title label
            Label headerTitleLabel = new Label()
            {
                Text = TextResources.Leads_LeadListHeaderTitle.ToUpperInvariant(),
                TextColor = Palette._003,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                FontAttributes = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment = TextAlignment.Center
            };
            #endregion

            #region new lead image "button"
            var newLeadImage = new Image
            {
                Source = new FileImageSource { File = Device.OnPlatform("add_ios_gray", "add_android_gray", null) },
                Aspect = Aspect.AspectFit, 
                HorizontalOptions = LayoutOptions.EndAndExpand,
            };
            //Going to use FAB
            newLeadImage.IsVisible = false;
            newLeadImage.GestureRecognizers.Add(new TapGestureRecognizer()
                {
                    Command = _NewLeadTappedCommand,
                    NumberOfTapsRequired = 1
                });
            #endregion

            #region absolutLayout
            AbsoluteLayout absolutLayout = new AbsoluteLayout();

            absolutLayout.Children.Add(
                headerTitleLabel, 
                new Rectangle(0, .5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize), 
                AbsoluteLayoutFlags.PositionProportional);

            absolutLayout.Children.Add(
                newLeadImage, 
                new Rectangle(1, .5, AbsoluteLayout.AutoSize, .5), 
                AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.HeightProportional);
            #endregion

            #region setup contentView
            ContentView contentView = new ContentView()
            {
                Padding = new Thickness(10, 0), // give the content some padding on the left and right
                HeightRequest = RowSizes.MediumRowHeightDouble, // set the height of the content view
            };
            #endregion

            #region compose the view hierarchy
            contentView.Content = absolutLayout;
            #endregion

            Content = contentView;
        }
Example #29
0
 void Awake()
 {
     image = GetComponent<Image>();
     button = GetComponent<Button>();
     text = GetComponentInChildren<Text>();
     References.stateManager.changeState += onChangeState;
 }
Example #30
0
        public Image RunFilter(Image src)
        {
            filterDataContext db = new filterDataContext();
            //Bilateral Bilateral = new Bilateral();
            double[] sigma = new double[] { 3, 0.1 };
            double w = 5;
            MWNumericArray mw_sigma = new MWNumericArray(sigma);
            //MWArray Result = Bilateral.bfilter2(image, w, mw_sigma);
            //MWArray image = new MWNumericArray(src.Array.Array);
            /*
            int H = src.Height;
            int W = src.Width;

            int sq = W * H;
            */
            MWArray[] Result = bilateral(2, src.image, w, mw_sigma);
            //MWArray[] Result = bfilter2(2, src.image, w, mw_sigma);
            MWNumericArray descriptor = null;
            descriptor = (MWNumericArray)Result[0];
            double[,] result = null;
            result = (double[,])descriptor.ToArray(MWArrayComponent.Real);
            Image res = new Image(result);
            MWNumericArray e_descriptor = null;
            e_descriptor = (MWNumericArray)Result[1];
            WorkTime = (double)e_descriptor.ToScalarDouble();
            db.add_b_res(src.Height, src.Height / src.Width, WorkTime, w, sigma[0], sigma[1]);
            Result = null;
            e_descriptor = null;
            result = null;
            mw_sigma = null;
            GC.Collect();
            return res;
        }
        public static int Main()
        {
            // Initialization
            //--------------------------------------------------------------------------------------
            const int screenWidth  = 800;
            const int screenHeight = 450;

            InitWindow(screenWidth, screenHeight, "raylib [texture] example - image text drawing");

            // TTF Font loading with custom generation parameters
            Font font = LoadFontEx("resources/KAISG.ttf", 64, null, 95);

            Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)

            // Draw over image using custom font
            ImageDrawTextEx(ref parrots, font, "[Parrots font drawing]", new Vector2(20, 20), font.baseSize, 0, WHITE);

            Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)

            UnloadImage(parrots);                              // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM

            Vector2 position = new Vector2(screenWidth / 2 - texture.width / 2, screenHeight / 2 - texture.height / 2 - 20);

            bool showFont = false;

            SetTargetFPS(60);
            //--------------------------------------------------------------------------------------

            // Main game loop
            while (!WindowShouldClose())    // Detect window close button or ESC key
            {
                // Update
                //----------------------------------------------------------------------------------
                if (IsKeyDown(KEY_SPACE))
                {
                    showFont = true;
                }
                else
                {
                    showFont = false;
                }
                //----------------------------------------------------------------------------------

                // Draw
                //----------------------------------------------------------------------------------
                BeginDrawing();
                ClearBackground(RAYWHITE);

                if (!showFont)
                {
                    // Draw texture with text already drawn inside
                    DrawTextureV(texture, position, WHITE);

                    // Draw text directly using sprite font
                    DrawTextEx(font, "[Parrots font drawing]", new Vector2(position.X + 20,
                                                                           position.Y + 20 + 280), font.baseSize, 0, WHITE);
                }
                else
                {
                    DrawTexture(font.texture, screenWidth / 2 - font.texture.width / 2, 50, BLACK);
                }

                DrawText("PRESS SPACE to SEE USED SPRITEFONT ", 290, 420, 10, DARKGRAY);

                EndDrawing();
                //----------------------------------------------------------------------------------
            }

            // De-Initialization
            //--------------------------------------------------------------------------------------
            UnloadTexture(texture); // Texture unloading

            UnloadFont(font);       // Unload custom spritefont

            CloseWindow();          // Close window and OpenGL context
            //--------------------------------------------------------------------------------------

            return(0);
        }
Example #32
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString() == "Video")
                {
                    AForge.Video.FFMPEG.VideoFileReader reader = new AForge.Video.FFMPEG.VideoFileReader();
                    reader.Open(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());

                    Bitmap videoFrame_left;
                    Bitmap videoFrame_right;
                    videoFrame_left       = reader.ReadVideoFrame();
                    left_pictureBox.Image = videoFrame_left;

                    reader.Open(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString());

                    videoFrame_right       = reader.ReadVideoFrame();
                    right_pictureBox.Image = videoFrame_right;

                    anaglyphImage             = this.mainForm.apply3D2(videoFrame_left, videoFrame_right, color);
                    anaglyph_pictureBox.Image = anaglyphImage;
                }
                else
                {
                    left_pictureBox.Image     = (Bitmap)Image.FromFile(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
                    right_pictureBox.Image    = (Bitmap)Image.FromFile(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString());
                    anaglyph_pictureBox.Image = this.mainForm.apply3D2((Bitmap)Image.FromFile(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()), (Bitmap)Image.FromFile(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString()), dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString());
                }
            }
            catch (Exception ex) { }
        }
Example #33
0
 public void Encode <TPixel>(Image <TPixel> image, Stream stream)
     where TPixel : unmanaged, IPixel <TPixel>
 {
     // TODO record this happened so we can verify it.
 }
Example #34
0
	// Use this for initialization
	void Start () {
        joyBG = joyObj.GetComponent<Image>();
        joyFG = joyBG.transform.GetChild(0).GetComponent<Image>();

	}
Example #35
0
 public override void GetUserInterfaceInfo(out string name, out Image icon)
 {
     name = "Double";
     icon = Properties.Resources.B16x16_Button_Double;
 }
Example #36
0
 public void AddImage(Image image)
 {
     _context.Images.Add(image);
 }
    // Use this for initialization
    void Start()
    {
        ChatButton = GameObject.Find("ChatButton").GetComponent<Button>();
        co = ChatButton.GetComponent<ChatObjects>();

        ChatPanel = co.ChatPanel;
        ChatContent = co.ChatContent;

        ExitButton = co.ExitButton;
        SendButton = co.SendButton;
        chatInput = co.chatInput;
        scrollbar = co.scrollbar;

        //ChatPanel = GameObject.Find("ChatPanel");
        //ChatContent = GameObject.Find("ChatContent");

        //ExitButton = GameObject.Find("ExitButton").GetComponent<Button>();
        //SendButton = GameObject.Find("SendButton").GetComponent<Button>();
        //chatInput = GameObject.Find("ChatInputField").GetComponent<InputField>();
        //scrollbar = GameObject.Find("Scrollbar Vertical").GetComponent<Scrollbar>();

        chatInput.onEndEdit.RemoveAllListeners();
        chatInput.onEndEdit.AddListener(onEndEditChatInput);

        ChatButton.onClick.RemoveAllListeners();
        ChatButton.onClick.AddListener(() => { onChatButtonClick(); });

        ExitButton.onClick.RemoveAllListeners();
        ExitButton.onClick.AddListener(() => { onExitButtonClick(); });

        SendButton.onClick.RemoveAllListeners();
        SendButton.onClick.AddListener(() => { onSendButtonClick(); });

        ChatPanel.SetActive(false);

        playerBox = GameObject.Find("Player Box");
        normalRoom = GameObject.Find("Normal Door");
        bossRoom = GameObject.Find("Boss Door");

        p1 = GameObject.Find("PlayerInfoContainer1");

        p2 = GameObject.Find("PlayerInfoContainer2");

        p3 = GameObject.Find("PlayerInfoContainer3");

        p4 = GameObject.Find("PlayerInfoContainer4");
        enemy = GameObject.Find("EnemyInfoContainer");
        container = GameObject.Find("Container");


        if (isLocalPlayer)
        {
            if (numOfPlayer < 4)
            {
                p4.SetActive(false);
                if (numOfPlayer < 3)
                {
                    p3.SetActive(false);
                    if (numOfPlayer < 2)
                    {
                        p2.SetActive(false);
                    }
                }
            }

            if (string.IsNullOrEmpty(pName))
            {
                co.localPlayerName = "";
            }
            else
            {
                co.localPlayerName = pName;
            }

            playerNameText = GameObject.Find("Name").GetComponent<Text>();
            if (playerNameText != null)
            {
                playerNameText.text = "You are " + pName;
            }
        }

        id = int.Parse(GetComponent<NetworkIdentity>().netId.ToString());

        PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        PlayerPortraitText.text = pName;

        OnPlayerName(pName);

        //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();

        characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();

        //if (numOfPlayer == 1)
        //{
        //    PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //    PlayerPortraitText.text = pName;

        //    OnPlayerName(pName);

        //    //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //    //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //    //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //    //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //    //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();

        //    characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //    playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //    playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //    playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //    playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //    turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();

        //}

        //if (numOfPlayer == 2)
        //{

        //    if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 3)
        //    {
        //        PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        PlayerPortraitText.text = pName;

        //        OnPlayerName(pName);

        //        //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();

        //        characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //    }
        //    else
        //    {
        //        PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        PlayerPortraitText.text = pName;

        //        OnPlayerName(pName);

        //        //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();

        //        characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //    }
        //}

        //if (numOfPlayer == 3)
        //{

        //    if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 4)
        //    {
        //        PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        PlayerPortraitText.text = pName;

        //        OnPlayerName(pName);

        //        //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();

        //        characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //    }
        //    else
        //    {
        //        PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        PlayerPortraitText.text = pName;

        //        OnPlayerName(pName);

        //        //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();

        //        characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //    }

        //}

        //if (numOfPlayer == 4)
        //{

        //    if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 5)
        //    {
        //        PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        PlayerPortraitText.text = pName;

        //        OnPlayerName(pName);

        //        //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();

        //        characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //        playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>();
        //        turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>();
        //    }
        //    else
        //    {
        //        PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        PlayerPortraitText.text = pName;

        //        OnPlayerName(pName);

        //        //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();
        //        //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>();
        //        //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>();

        //        characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //        playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>();
        //        turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>();
        //    }
        //}


        turn = pName + ":Your Turn";
        OnTurnChanged(turn);

        playerHealth = PLAYER_HEALTH;
        playerEnergy = PLAYER_ENERGY;


        playerCountText = GameObject.Find("PlayerCount").GetComponent<Text>();

        countText = GameObject.Find("Count").GetComponent<Text>();
        playerCount = numOfPlayer;
        count = playerCount;
        OnCountChanged(count);
        OnPlayerCountChanged(playerCount);

        canvasText = GameObject.Find("Canvas").GetComponent<Text>();
        canvas = false;
        OnCanvasChanged(canvas);

        enemyHealthText = GameObject.Find("EnemyHealth").GetComponent<Text>();
        enemyHealth = ENEMY_HEALTH;
        enemyHealth2Text = GameObject.Find("EnemyHealth2").GetComponent<Text>();
        enemyHealth2 = ENEMY_HEALTH;
        enemyEnergyText = GameObject.Find("EnemyEnergy").GetComponent<Text>();
        enemyEnergy = ENEMY_ENERGY;
        enemyHealthImage = GameObject.Find("EnemyHealthBar").GetComponent<Image>();
        enemyEnergyImage = GameObject.Find("EnemyEnergyBar").GetComponent<Image>();
        currentState = BattleStates.PLAYERCHOICE;

        characterImage.sprite = Resources.Load<Sprite>(characterName) as Sprite;
        if(isServer)
            RpcChangeBoxImage();

        container.GetComponent<CanvasGroup>().alpha = 0;


    }
Example #38
0
void Update()
{
if (this.gameObject.GetComponent<Image> () != null) 
{
if (CanvasImage==null) CanvasImage = this.gameObject.GetComponent<Image> ();
}		
if ((ShaderChange == 0) && (ForceMaterial != null)) 
{
ShaderChange=1;
if (tempMaterial!=null) DestroyImmediate(tempMaterial);
if(this.gameObject.GetComponent<SpriteRenderer>() != null)
{
this.GetComponent<Renderer>().sharedMaterial = ForceMaterial;
}
else if(this.gameObject.GetComponent<Image>() != null)
{
CanvasImage.material = ForceMaterial;
}
ForceMaterial.hideFlags = HideFlags.None;
ForceMaterial.shader=Shader.Find(shader);

}
if ((ForceMaterial == null) && (ShaderChange==1))
{
if (tempMaterial!=null) DestroyImmediate(tempMaterial);
tempMaterial = new Material(Shader.Find(shader));
tempMaterial.hideFlags = HideFlags.None;
if(this.gameObject.GetComponent<SpriteRenderer>() != null)
{
this.GetComponent<Renderer>().sharedMaterial = tempMaterial;
}
else if(this.gameObject.GetComponent<Image>() != null)
{
CanvasImage.material = tempMaterial;
}
ShaderChange=0;
}

#if UNITY_EDITOR
string dfname = "";
if(this.gameObject.GetComponent<SpriteRenderer>() != null) dfname=this.GetComponent<Renderer>().sharedMaterial.shader.name;
if(this.gameObject.GetComponent<Image>() != null) 
{
Image img = this.gameObject.GetComponent<Image>();
if (img.material==null)	dfname="Sprites/Default";
}
if (dfname == "Sprites/Default")
{
ForceMaterial.shader=Shader.Find(shader);
ForceMaterial.hideFlags = HideFlags.None;
if(this.gameObject.GetComponent<SpriteRenderer>() != null)
{
this.GetComponent<Renderer>().sharedMaterial = ForceMaterial;
}
else if(this.gameObject.GetComponent<Image>() != null)
{
Image img = this.gameObject.GetComponent<Image>();
if (img.material==null) CanvasImage.material = ForceMaterial;
}
__MainTex2 = Resources.Load ("_2dxFX_ShadowTXT") as Texture2D;
if(this.gameObject.GetComponent<SpriteRenderer>() != null)
{
this.GetComponent<Renderer>().sharedMaterial.SetTexture ("_MainTex2", __MainTex2);
}
else if(this.gameObject.GetComponent<Image>() != null)
{
Image img = this.gameObject.GetComponent<Image>();
if (img.material==null)	CanvasImage.material.SetTexture ("_MainTex2", __MainTex2);
}

}
#endif
if (ActiveChange)
{
if(this.gameObject.GetComponent<SpriteRenderer>() != null)
{
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_Alpha", 1-_Alpha); 
  if (_2DxFX.ActiveShadow && AddShadow)
                {
                    this.GetComponent<Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
                    if (ReceivedShadow)
                    {
                        this.GetComponent<Renderer>().receiveShadows = true;
                        this.GetComponent<Renderer>().sharedMaterial.renderQueue = 2450;
                        this.GetComponent<Renderer>().sharedMaterial.SetInt("_Z", 1);
                    }
                    else
                    {
                        this.GetComponent<Renderer>().receiveShadows = false;
                        this.GetComponent<Renderer>().sharedMaterial.renderQueue = 3000;
                        this.GetComponent<Renderer>().sharedMaterial.SetInt("_Z", 0);
                    }
                }
                else
                {
                    this.GetComponent<Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
                    this.GetComponent<Renderer>().receiveShadows = false;
                    this.GetComponent<Renderer>().sharedMaterial.renderQueue = 3000;
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_Z", 0);
                }

                if (BlendMode == 0) // Normal
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                }
                if (BlendMode == 1) // Additive
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One);
                }
                if (BlendMode == 2) // Darken
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.ReverseSubtract);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.DstColor);
                }
                if (BlendMode == 3) // Lighten
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Max);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One);
                }
                if (BlendMode == 4) // Linear Burn
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.ReverseSubtract);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One);
                }
                if (BlendMode == 5) // Linear Dodge
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Max);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                }
                if (BlendMode == 6) // Multiply
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.DstColor);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                }
                if (BlendMode == 7) // Soft Aditive
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusDstColor);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One);
                }
                if (BlendMode == 8) // 2x Multiplicative
                {
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.ReverseSubtract);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.DstAlpha);
                    this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.DstColor);
                }
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_Zoom",_Zoom);
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_Intensity",_Intensity);

if ((_AutoScrollX == false) && (_AutoScrollY == false))
{
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetX",_OffsetX);
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetY",_OffsetY);
}

if ((_AutoScrollX == true) && (_AutoScrollY == false))
{
_AutoScrollCountX+=_AutoScrollSpeedX*Time.deltaTime;
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetX",_AutoScrollCountX);
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetY",_OffsetY);
}
if ((_AutoScrollX == false) && (_AutoScrollY == true))
{
_AutoScrollCountY+=_AutoScrollSpeedY*Time.deltaTime;
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetX",_OffsetX);
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetY",_AutoScrollCountY);
}
if ((_AutoScrollX == true) && (_AutoScrollY == true))
{
_AutoScrollCountX+=_AutoScrollSpeedX*Time.deltaTime;
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetX",_AutoScrollCountX);
_AutoScrollCountY+=_AutoScrollSpeedY*Time.deltaTime;
this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetY",_AutoScrollCountY);
}
}

else if(this.gameObject.GetComponent<Image>() != null)
{
CanvasImage.material.SetFloat("_Alpha", 1-_Alpha);
CanvasImage.material.SetFloat("_Zoom",_Zoom);
CanvasImage.material.SetFloat("_Intensity",_Intensity);

if ((_AutoScrollX == false) && (_AutoScrollY == false))
{
CanvasImage.material.SetFloat("_OffsetX",_OffsetX);
CanvasImage.material.SetFloat("_OffsetY",_OffsetY);
}

if ((_AutoScrollX == true) && (_AutoScrollY == false))
{
_AutoScrollCountX+=_AutoScrollSpeedX*Time.deltaTime;
CanvasImage.material.SetFloat("_OffsetX",_AutoScrollCountX);
CanvasImage.material.SetFloat("_OffsetY",_OffsetY);
}
if ((_AutoScrollX == false) && (_AutoScrollY == true))
{
_AutoScrollCountY+=_AutoScrollSpeedY*Time.deltaTime;
CanvasImage.material.SetFloat("_OffsetX",_OffsetX);
CanvasImage.material.SetFloat("_OffsetY",_AutoScrollCountY);
}
if ((_AutoScrollX == true) && (_AutoScrollY == true))
{
_AutoScrollCountX+=_AutoScrollSpeedX*Time.deltaTime;
CanvasImage.material.SetFloat("_OffsetX",_AutoScrollCountX);
_AutoScrollCountY+=_AutoScrollSpeedY*Time.deltaTime;
CanvasImage.material.SetFloat("_OffsetY",_AutoScrollCountY);
}

}
if (_AutoScrollCountX > 1) _AutoScrollCountX = 0;
if (_AutoScrollCountX < -1) _AutoScrollCountX = 0;
if (_AutoScrollCountY > 1) _AutoScrollCountY = 0;
if (_AutoScrollCountY < -1) _AutoScrollCountY = 0;


}


}
Example #39
0
        public void AddCluster(StackLayout stack, string ClusterName, ItemsRequestStructure locParent)
        {
            Grid grid = CreateGrid(90);
            Frame f = new Frame
            {
                OutlineColor = Color.White,
                Padding = new Thickness(1),
                BackgroundColor = Color.White,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            f.Content = new Xamarin.Forms.Label
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                TextColor = Color.Gray,
                FontSize = 16,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment = TextAlignment.Center,
                Text = ClusterName,
            };

            grid.Children.Add(f, 0, 0);

            Xamarin.Forms.Label l = new Xamarin.Forms.Label
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                TextColor = (Color)App.Current.Resources["textColor"],
                FontSize = 14,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment = TextAlignment.Center,
                BindingContext = GoodItem,

            };
            l.SetBinding(Xamarin.Forms.Label.TextProperty, locParent.VarName);
            TapGestureRecognizer tgr = new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                CommandParameter = locParent
            };
            tgr.Tapped += Tgr_Tapped;
            l.GestureRecognizers.Add(tgr);

            Frame f1 = new Frame
            {
                OutlineColor = Color.White,
                Padding = new Thickness(1),
                BackgroundColor = Color.White,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };
            f1.Content = l;

            grid.Children.Add(f1, 1, 0);

            Image I1 = new Image
            {
                Source = "loop_72_72.PNG"
            };
            TapGestureRecognizer tgr1 = new TapGestureRecognizer { NumberOfTapsRequired = 1, CommandParameter = locParent };
            tgr1.Tapped += Tgr1_Tapped;
            I1.GestureRecognizers.Add(tgr1);

            grid.Children.Add(I1, 2, 0);

            stack.Children.Add(grid);
        }
Example #40
0
 void Awake()
 {
     image = GetComponent <Image>();
     text  = GetComponentInChildren <Text>();
 }
Example #41
0
 private void Start()
 {
     riddleImage = gameObject.GetComponent <Image>();
 }
		public static void Show_Item_Middle(CUIComponent com, CFR frData, CUIFormScript uiFrom)
		{
			IntimacyRelationViewUT.SetButtonParam(com.m_widgets[16], frData);
			IntimacyRelationViewUT.SetButtonParam(com.m_widgets[14], frData);
			IntimacyRelationViewUT.SetButtonParam(com.m_widgets[12], frData);
			IntimacyRelationViewUT.SetButtonParam(com.m_widgets[7], frData);
			int cDDays = frData.CDDays;
			GameObject obj = Utility.FindChild(com.gameObject, "mengban");
			obj.CustomSetActive(cDDays != -1);
			if (cDDays != -1)
			{
				com.m_widgets[5].CustomSetActive(true);
				com.m_widgets[6].CustomSetActive(false);
				IntimacyRelationViewUT.Set_Middle_Text(com, true, string.Format(UT.FRData().IntimRela_CD_CountDown, cDDays), false);
				return;
			}
			if (frData.state == COM_INTIMACY_STATE.COM_INTIMACY_STATE_VALUE_FULL && cDDays == -1)
			{
				com.m_widgets[5].CustomSetActive(true);
				com.m_widgets[6].CustomSetActive(true);
				com.m_widgets[10].CustomSetActive(false);
				IntimacyRelationViewUT.Set_Drop_Text(com, !frData.bInShowChoiseRelaList, frData);
				IntimacyRelationViewUT.Set_Drop_List(com, frData.bInShowChoiseRelaList);
				IntimacyRelationViewUT.Set_Middle_Text(com, false, string.Empty, false);
			}
			if (IntimacyRelationViewUT.IsRelaState(frData.state))
			{
				com.m_widgets[5].CustomSetActive(true);
				com.m_widgets[6].CustomSetActive(false);
				IntimacyRelationViewUT.Set_Middle_Text(com, true, IntimacyRelationViewUT.GetMiddleTextStr(frData.state), true);
				ushort num;
				CFriendModel.EIntimacyType eIntimacyType;
				bool flag;
				Singleton<CFriendContoller>.instance.model.GetFriendIntimacy(frData.ulluid, frData.worldID, out num, out eIntimacyType, out flag);
				if (num > 0)
				{
					int relaLevel = IntimacyRelationViewUT.CalcRelaLevel((int)num);
					string relaIconByRelaLevel = IntimacyRelationViewUT.GetRelaIconByRelaLevel(relaLevel, frData.state);
					if (!string.IsNullOrEmpty(relaIconByRelaLevel))
					{
						GameObject p = com.m_widgets[10];
						GameObject gameObject = Utility.FindChild(p, "Icon");
						if (gameObject != null)
						{
							Image component = gameObject.GetComponent<Image>();
							if (component != null)
							{
								component.gameObject.CustomSetActive(true);
								component.SetSprite(relaIconByRelaLevel, uiFrom, true, false, false, false);
								component.SetNativeSize();
							}
						}
					}
				}
			}
			if (IntimacyRelationViewUT.IsRelaStateConfirm(frData.state))
			{
				if (frData.bReciveOthersRequest)
				{
					com.m_widgets[5].CustomSetActive(true);
					com.m_widgets[6].CustomSetActive(false);
					COM_INTIMACY_STATE stateByConfirmState = IntimacyRelationViewUT.GetStateByConfirmState(frData.state);
					string relationText = IntimacyRelationViewUT.GetRelationText(stateByConfirmState);
					string txt = string.Format(UT.FRData().IntimRela_Tips_ReceiveOtherReqRela, UT.Bytes2String(frData.friendInfo.szUserName), relationText);
					IntimacyRelationViewUT.Set_Middle_Text(com, true, txt, false);
				}
				else
				{
					com.m_widgets[5].CustomSetActive(true);
					com.m_widgets[6].CustomSetActive(false);
					IntimacyRelationViewUT.Set_Middle_Text(com, true, UT.FRData().IntimRela_Tips_Wait4TargetRspReqRela, false);
				}
			}
			if (IntimacyRelationViewUT.IsRelaStateDeny(frData.state))
			{
				if (frData.bReciveOthersRequest)
				{
					com.m_widgets[5].CustomSetActive(true);
					com.m_widgets[6].CustomSetActive(false);
					COM_INTIMACY_STATE stateByDenyState = IntimacyRelationViewUT.GetStateByDenyState(frData.state);
					string relationText2 = IntimacyRelationViewUT.GetRelationText(stateByDenyState);
					string txt2 = string.Format(UT.FRData().IntimRela_Tips_ReceiveOtherDelRela, UT.Bytes2String(frData.friendInfo.szUserName), relationText2);
					IntimacyRelationViewUT.Set_Middle_Text(com, true, txt2, false);
				}
				else
				{
					com.m_widgets[5].CustomSetActive(true);
					com.m_widgets[6].CustomSetActive(false);
					IntimacyRelationViewUT.Set_Middle_Text(com, true, UT.FRData().IntimRela_Tips_Wait4TargetRspDelRela, false);
				}
			}
		}
		public static void SetRelationBGImg(Image img, byte state)
		{
			IntimacyRelationViewUT.SetRelationBGImg(img, (COM_INTIMACY_STATE)state);
		}
Example #44
0
    void Awake()
    {
        audioC = GetComponent <AudioController>();
        bilder = GetComponent <Builder>();
        //ステージの取得
        stage = Resources.Load <GameObject>("StagePrefab/" + stageNumber.ToString());
        //プレイヤーの取得
        player       = GameObject.FindGameObjectWithTag("Player");
        playerScript = player.GetComponent <PlayerMove>();
        foreach (Transform child in player.transform)
        {
            if (child.gameObject.tag == "Cable")
            {
                cable = child.gameObject.GetComponent <Cable>();
                break;
            }
        }
        //ステージの生成
        instansStage = Instantiate(stage);

        //スカイボックスをステージに合わせる
        RenderSettings.skybox = Resources.Load <Material>(SKYBOX_PATH + stageNumber.ToString());

        foreach (Transform child in instansStage.transform)
        {
            if (child.gameObject.tag == "GimmickParent")
            {
                cable.gimmickParent = child.gameObject;
            }
        }

        //ビルダーにステージ情報を送る
        bilder.stage = instansStage;
        xBox         = GetComponent <XBox>();

        //プレイヤーの初期位置の設定
        foreach (Transform child in instansStage.transform)
        {
            if (child.gameObject.tag == "StartPosition")
            {
                startPosition                = child.transform.position;
                player.transform.position    = startPosition;
                player.transform.eulerAngles = child.transform.eulerAngles;
            }
        }

        //キャンバスの取得
        canvas = GameObject.FindGameObjectWithTag("Canvas");
        foreach (Transform child in canvas.transform)
        {
            if (child.gameObject.name == "Pause")
            {
                //ポーズ画面の取得
                pauseUi = child.gameObject.GetComponent <RawImage>();
            }
            //ブラックアウト用の画像の取得
            if (child.gameObject.name == "BlackOut")
            {
                blackBack = child.gameObject.GetComponent <Image>();
            }
        }

        //ポーズ画面の取得 +1はHelp画面を入れる
        images = new Texture[Enum.GetValues(typeof(PouseMode)).Length + 1];
        for (int i = 0; i < Enum.GetValues(typeof(PouseMode)).Length; i++)
        {
            PouseMode pm = (PouseMode)i;
            images[i] = Resources.Load <Texture>(POUSE_PATH + pm.ToString());
        }
        images[images.Length - 1] = Resources.Load <Texture>("Image/Help");

        //黒から透明に
        BlackOutAlpha(false, 1f, true, Color.black, BlackOutTime);

        //ステージにあったBGMの再生
        AudioController.Bgm bgm = (AudioController.Bgm)Enum.Parse(typeof(AudioController.Bgm), stageNumber.ToString() + "_Bgm");
        audioC.BgmSoundPlay(bgm);
    }
Example #45
0
        /// <summary>
        /// Encodes the image to the specified stream from the <see cref="ImageFrame{TPixel}"/>.
        /// </summary>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        /// <param name="image">The <see cref="ImageFrame{TPixel}"/> to encode from.</param>
        /// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
        public void Encode <TPixel>(Image <TPixel> image, Stream stream)
            where TPixel : unmanaged, IPixel <TPixel>
        {
            Guard.NotNull(image, nameof(image));
            Guard.NotNull(stream, nameof(stream));

            this.configuration = image.GetConfiguration();
            ImageMetadata metadata    = image.Metadata;
            BmpMetadata   bmpMetadata = metadata.GetBmpMetadata();

            this.bitsPerPixel = this.bitsPerPixel ?? bmpMetadata.BitsPerPixel;

            short bpp          = (short)this.bitsPerPixel;
            int   bytesPerLine = 4 * (((image.Width * bpp) + 31) / 32);

            this.padding = bytesPerLine - (int)(image.Width * (bpp / 8F));

            // Set Resolution.
            int hResolution = 0;
            int vResolution = 0;

            if (metadata.ResolutionUnits != PixelResolutionUnit.AspectRatio)
            {
                if (metadata.HorizontalResolution > 0 && metadata.VerticalResolution > 0)
                {
                    switch (metadata.ResolutionUnits)
                    {
                    case PixelResolutionUnit.PixelsPerInch:

                        hResolution = (int)Math.Round(UnitConverter.InchToMeter(metadata.HorizontalResolution));
                        vResolution = (int)Math.Round(UnitConverter.InchToMeter(metadata.VerticalResolution));
                        break;

                    case PixelResolutionUnit.PixelsPerCentimeter:

                        hResolution = (int)Math.Round(UnitConverter.CmToMeter(metadata.HorizontalResolution));
                        vResolution = (int)Math.Round(UnitConverter.CmToMeter(metadata.VerticalResolution));
                        break;

                    case PixelResolutionUnit.PixelsPerMeter:
                        hResolution = (int)Math.Round(metadata.HorizontalResolution);
                        vResolution = (int)Math.Round(metadata.VerticalResolution);

                        break;
                    }
                }
            }

            int infoHeaderSize = this.writeV4Header ? BmpInfoHeader.SizeV4 : BmpInfoHeader.SizeV3;
            var infoHeader     = new BmpInfoHeader(
                headerSize: infoHeaderSize,
                height: image.Height,
                width: image.Width,
                bitsPerPixel: bpp,
                planes: 1,
                imageSize: image.Height * bytesPerLine,
                clrUsed: 0,
                clrImportant: 0,
                xPelsPerMeter: hResolution,
                yPelsPerMeter: vResolution);

            if (this.writeV4Header && this.bitsPerPixel == BmpBitsPerPixel.Pixel32)
            {
                infoHeader.AlphaMask   = Rgba32AlphaMask;
                infoHeader.RedMask     = Rgba32RedMask;
                infoHeader.GreenMask   = Rgba32GreenMask;
                infoHeader.BlueMask    = Rgba32BlueMask;
                infoHeader.Compression = BmpCompression.BitFields;
            }

            int colorPaletteSize = this.bitsPerPixel == BmpBitsPerPixel.Pixel8 ? ColorPaletteSize8Bit : 0;

            var fileHeader = new BmpFileHeader(
                type: BmpConstants.TypeMarkers.Bitmap,
                fileSize: BmpFileHeader.Size + infoHeaderSize + infoHeader.ImageSize,
                reserved: 0,
                offset: BmpFileHeader.Size + infoHeaderSize + colorPaletteSize);

            Span <byte> buffer = stackalloc byte[infoHeaderSize];

            fileHeader.WriteTo(buffer);

            stream.Write(buffer, 0, BmpFileHeader.Size);

            if (this.writeV4Header)
            {
                infoHeader.WriteV4Header(buffer);
            }
            else
            {
                infoHeader.WriteV3Header(buffer);
            }

            stream.Write(buffer, 0, infoHeaderSize);

            this.WriteImage(stream, image.Frames.RootFrame);

            stream.Flush();
        }
 // Use this for initialization
 void Start()
 {
     targetingSight = GameObject.Find("Sight");
     sightImage = targetingSight.GetComponent<Image>();
     sightImage.color = new Color(0, 1, .75f, 0);
 }
Example #47
0
 public void UpdateImage(Image image)
 {
     // no code in this implementation
 }
Example #48
0
        private Grid getProUI(List<ProductDisplay> productList)
        {
            Thickness defaultPadding = new Thickness(5, 0, 0, 0);
            Grid grid = new Grid();
            grid.Margin = new Thickness(0, 0, 0, 0);
            int proCount = productList.Count;
            ColumnDefinition[] colDef = new ColumnDefinition[3 * proCount];
            for (int k = 0; k < 3 * proCount; k++) colDef[k] = new ColumnDefinition();
            for (int k = 0; k < 3 * proCount; k++)
            {
                if (k % 3 == 0)
                {
                    colDef[k].Width = new GridLength(75);
                }
                else if (k % 3 == 1)
                {
                    colDef[k].Width = new GridLength(120);
                }
                else
                {
                    colDef[k].Width = new GridLength(5);
                }
            }
            foreach (var c in colDef)
            {
                grid.ColumnDefinitions.Add(c);
            }

            RowDefinition[] rowDef = new RowDefinition[3];
            for (int k = 0; k < 3; k++) rowDef[k] = new RowDefinition();
            rowDef[0].Height = new GridLength(50);
            rowDef[1].Height = new GridLength(23);
            rowDef[2].Height = new GridLength(17);
            foreach (var r in rowDef) grid.RowDefinitions.Add(r);

            for (int i = 0; i < productList.Count; i++)
            {
                Image img = getImage(productList[i].ImgUrl);
                img.Tag = productList[i].Id;

                TextBlock proName = new TextBlock();
                proName.Tag = productList[i].Id;
                proName.Text = productList[i].Name;
                proName.FontSize = 20;
                proName.VerticalAlignment = VerticalAlignment.Top;
                //proName.FontWeight = FontWeights.Bold;
                proName.Padding = defaultPadding;
                proName.TextWrapping = TextWrapping.Wrap;
                proName.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#333333"));

                TextBlock proQuantity = new TextBlock();
                proQuantity.Text = (productList[i].Quantity > 0) ? "In stock" : "Out of stock";
                proQuantity.Padding = defaultPadding;
                proQuantity.TextAlignment = TextAlignment.Center;
                proQuantity.Background = (productList[i].Quantity > 0) ? (SolidColorBrush)(new BrushConverter().ConvertFrom("#00FF00")) : (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF0000"));
                proQuantity.FontSize = 14;

                TextBlock proPrice = new TextBlock();
                proPrice.Text = string.Format(new CultureInfo("vi-VN"), "{0:#,##0}", productList[i].Price) + "đ";
                proPrice.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF8C00"));
                proPrice.Padding = defaultPadding;
                proPrice.FontSize = 18;
                proPrice.FontWeight = FontWeights.Medium;

                TextBlock separator = new TextBlock();
                separator.Width = 0.4;
                separator.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000000"));

                Grid.SetRowSpan(separator, 3);
                Grid.SetColumn(separator, 3 * i + 2);

                Grid.SetRowSpan(img, 3);
                Grid.SetColumn(img, 3 * i);

                Grid.SetRow(proName, 0);
                Grid.SetColumn(proName, 3 * i + 1);

                Grid.SetRow(proPrice, 1);
                Grid.SetColumn(proPrice, 3 * i + 1);
                Grid.SetRow(proQuantity, 2);
                Grid.SetColumn(proQuantity, 3 * i + 1);

                img.PreviewMouseDown += getDetail;
                proName.PreviewMouseDown += getDetail;

                grid.Children.Add(img);
                grid.Children.Add(proName);
                grid.Children.Add(proPrice);
                grid.Children.Add(proQuantity);
                grid.Children.Add(separator);
            }
            return grid;
        }
Example #49
0
 // Start is called before the first frame update
 void Start()
 {
     healthRemainingBar = transform.GetChild(0).GetChild(0).GetComponent <Image>();
 }
Example #50
0
 private void rbnStone_CheckedChanged(object sender, EventArgs e)
 {
     pbxUser.Image = Image.FromFile("Stone.jpg");
     userChoice    = 3;
 }
Example #51
0
 static public stdole.IPictureDisp ImageToPictureDisp(Image image)
 {
     return (stdole.IPictureDisp)GetIPictureDispFromPicture(image);
 }
Example #52
0
 private void rbnPaper_CheckedChanged(object sender, EventArgs e)
 {
     pbxUser.Image = Image.FromFile("Paper.jpg");
     userChoice    = 2;
 }
Example #53
0
 public Task EncodeAsync <TPixel>(Image <TPixel> image, Stream stream, CancellationToken cancellationToken)
     where TPixel : unmanaged, IPixel <TPixel>
 {
     // TODO record this happened so we can verify it.
     return(Task.CompletedTask);
 }
Example #54
0
 private void rbnScissors_CheckedChanged(object sender, EventArgs e)
 {
     pbxUser.Image = Image.FromFile("Scissors.jpg");
     userChoice    = 1;
 }
Example #55
0
 private void Awake()
 {
     _img  = gameObject.GetComponent <Image>();
     _step = DelayStep;
 }
Example #56
0
 public Bitmap ReadFile(string sourceFile)
 {
     return(new Bitmap(Image.FromFile(sourceFile)));
 }
Example #57
0
 public void GimmeDatSpellInfo(GameObject spell_BlockObj, RectTransform spell_BlockRectTrans, CanvasGroup spell_BlockCanvasGr, Image spell_BlockImage)
 {
     spell_Block_Sprite = spell_BlockObj;
     rectTransform = spell_BlockRectTrans;
     canvasGroup = spell_BlockCanvasGr;
     image_Color = spell_BlockImage;
 }
Example #58
0
        void ChangeSliderAlpha(TextMeshProUGUI label, TextMeshProUGUI text, MinMaxPropertyControl control, Image slider, float alpha)
        {
            var textColor = m_TextColor;
            var sliderColor = m_SliderColor;
            var sliderBackColor = m_SliderBackgroundColor;
            textColor.a = alpha;
            sliderColor.a = alpha;
            sliderBackColor.a = alpha;

            label.color = textColor;
            text.color = textColor;
            control.GetComponent<Image>().color = sliderBackColor;
            slider.color = sliderColor;
        }
Example #59
0
        /// <summary>
        /// 根据图形获取图形类型
        /// </summary>
        /// <param name="p_Image"></param>
        /// <returns></returns>
        public static ImageFormat GetImageFormat(Image p_Image)
        {
            string strExtName = GetImageExtension(p_Image);

            return(GetImageFormat(strExtName));
        }
Example #60
0
        private void calculate_Winner(List <string> lineList)
        {
            int tempUSA        = 0;
            int tempRUS        = 0;
            int winnerBoxIndex = 0;

            for (int i = 1; i < lineList.Count; i += 6)
            {
                tempUSA = Int32.Parse(lineList[i]) + Int32.Parse(lineList[i + 1]) + Int32.Parse(lineList[i + 2]);
                tempRUS = Int32.Parse(lineList[i + 3]) + Int32.Parse(lineList[i + 4]) + Int32.Parse(lineList[i + 5]);
                PictureBox winnerBox = pictureBoxList[winnerBoxIndex];
                winnerBoxIndex++;
                if (tempUSA > tempRUS)
                {
                    winnerBox.Image    = Image.FromFile("C:\\Users\\ryang\\Desktop\\Windows Program\\Assignment3\\USFlag.png");
                    winnerBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    Console.WriteLine("USA wins by count");
                }
                else
                {
                    winnerBox.Image    = Image.FromFile("C:\\Users\\ryang\\Desktop\\Windows Program\\Assignment3\\RussiaFlag.png");
                    winnerBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    Console.WriteLine("Russia wins by count");
                }

                if (Int32.Parse(lineList[i]) > Int32.Parse(lineList[i + 3]))
                {
                    Console.WriteLine("USA wins by color");
                }
                else if (Int32.Parse(lineList[i]) < Int32.Parse(lineList[i + 3]))
                {
                    Console.WriteLine("Russia wins by color");
                }
                else if (Int32.Parse(lineList[i]) == Int32.Parse(lineList[i + 3]))
                {
                    if (Int32.Parse(lineList[i + 1]) > Int32.Parse(lineList[i + 4]))
                    {
                        Console.WriteLine("USA wins by color");
                    }
                    else if (Int32.Parse(lineList[i + 1]) < Int32.Parse(lineList[i + 4]))
                    {
                        Console.WriteLine("Russia wins by color");
                    }
                    else if (Int32.Parse(lineList[i + 1]) == Int32.Parse(lineList[i + 4]))
                    {
                        if (Int32.Parse(lineList[i + 2]) > Int32.Parse(lineList[i + 5]))
                        {
                            Console.WriteLine("USA wins by color");
                        }
                        else if (Int32.Parse(lineList[i + 2]) < Int32.Parse(lineList[i + 5]))
                        {
                            Console.WriteLine("Russia wins by color");
                        }
                        else if (Int32.Parse(lineList[i + 2]) == Int32.Parse(lineList[i + 5]))
                        {
                            Console.WriteLine("It is a tie by color");
                        }
                    }
                }
            }
        }