Exemplo n.º 1
0
        private async void RecordBTN_Clicked(object sender, EventArgs e)
        {
            await image1.RelRotateTo(360, 1000);

            Slidea.SetValue(IsVisibleProperty, false);
            Slide0.SetValue(IsVisibleProperty, true);
        }
Exemplo n.º 2
0
 private void BackBTN_Clicked(object sender, EventArgs e)
 {
     try {
         if (Slide1.IsVisible == IsVisible)
         {
             Slide1.SetValue(IsVisibleProperty, false);
             Slide0.SetValue(IsVisibleProperty, true);
             Nav.SetValue(IsVisibleProperty, false);
         }
         else
         {
             if (Slide2.IsVisible == IsVisible)
             {
                 Slide2.SetValue(IsVisibleProperty, false);
                 Slide1.SetValue(IsVisibleProperty, true);
             }
             else
             {
                 if (Slide3.IsVisible == IsVisible)
                 {
                     Slide3.SetValue(IsVisibleProperty, false);
                     Slide2.SetValue(IsVisibleProperty, true);
                 }
             }
         }
     }
     catch (Exception)
     {
         _ = DisplayAlert("خطأ", "جميع الحقول مطلوبة ! ", "OK");
     }
 }
Exemplo n.º 3
0
 private void BTN0_Clicked(object sender, EventArgs e)
 {
     try
     {
         if (NID.Text.Length == 10)
         {
             Slide0.SetValue(IsVisibleProperty, false);
             Slide1.SetValue(IsVisibleProperty, true);
             Nav.SetValue(IsVisibleProperty, true);
             IDLBL.Text = NID.Text;
         }
         else
         {
             _ = DisplayAlert("خطأ", "الرقم الوطني غير صحيح ! ", "OK");
         }
     }
     catch (Exception)
     {
         _ = DisplayAlert("خطأ", "جميع الحقول مطلوبة ! ", "OK");
     }
 }
Exemplo n.º 4
0
        public void DoCurvedRiver(int X, int Y, int Corner)
        {
            float pow      = 2f;
            float rivermin = 0.1f;
            float rivermax = 0.6f;
            //how deep the river carves
            float strength = 16f;
            //river width randomness - uses noise to align to tiles and smooth tranition
            //make this separate function returning vector2
            float rivernoisescale = 1f / 64f;
            float meanderscale    = 1f / 4f;
            float offset          = 0;
            //river midpoint should be in the middle of block
            float mid = ((float)BlockSize) / 2f;

            float Width0, Width1, Slide0, Slide1;


            float widthL = (Simplex.CalcPixel2D(X - 1, Y, rivernoisescale) + Simplex.CalcPixel2D(X, Y, rivernoisescale)) / 512f;

            float widthR = (Simplex.CalcPixel2D(X + 1, Y, rivernoisescale) + Simplex.CalcPixel2D(X, Y, rivernoisescale)) / 512f;

            float widthT = (Simplex.CalcPixel2D(X, Y - 1, rivernoisescale) + Simplex.CalcPixel2D(X, Y, rivernoisescale)) / 512f;

            float widthB = (Simplex.CalcPixel2D(X, Y + 1, rivernoisescale) + Simplex.CalcPixel2D(X, Y, rivernoisescale)) / 512f;


            float   slideL     = (Simplex.CalcPixel2D(X - 1, Y, meanderscale) + Simplex.CalcPixel2D(X, Y, meanderscale)) / 512f;
            float   slideR     = (Simplex.CalcPixel2D(X + 1, Y, meanderscale) + Simplex.CalcPixel2D(X, Y, meanderscale)) / 512f;
            float   slideT     = (Simplex.CalcPixel2D(X, Y - 1, meanderscale) + Simplex.CalcPixel2D(X, Y, meanderscale)) / 512f;
            float   slideB     = (Simplex.CalcPixel2D(X, Y + 1, meanderscale) + Simplex.CalcPixel2D(X, Y, meanderscale)) / 512f;
            float   degreebias = 0f;
            Vector2 CornerPoint;
            Vector2 bias = new Vector2(1, 1);
            float   P0   = -1;
            float   P1   = 2 + BlockSize;

            switch (Corner)
            {
            case RIVER_CORNER_TL:
            {
                CornerPoint = new Vector2(P0, P0);
                Width0      = widthT;
                Width1      = widthL;
                Slide0      = slideT;
                Slide1      = slideL;
                Slide0     -= 0.5f;
                Slide1     -= 0.5f;
                degreebias -= 0f;
                break;
            }

            case RIVER_CORNER_TR:
            {
                CornerPoint = new Vector2(P1, P0);
                Width0      = widthR;
                Width1      = widthT;
                Slide0      = slideR;
                Slide1      = 1f - slideT;
                Slide0     -= 0.5f;
                Slide1     -= 0.5f;
                degreebias -= 90f;
                bias        = new Vector2(1, 0);
                break;
            }

            case RIVER_CORNER_BL:
            {
                CornerPoint = new Vector2(P0, P1);
                Width0      = widthL;
                Width1      = widthB;
                Slide0      = 1 - slideL;
                Slide1      = slideB;    //

                Slide0     -= 0.5f;
                Slide1     -= 0.5f;
                degreebias += 90f;
                bias        = new Vector2(0, 1);
                break;
            }

            default:
            {
                CornerPoint = new Vector2(P1, P1);
                Width0      = widthB;
                Width1      = widthR;
                Slide0      = 1f - slideB;  //
                Slide1      = 1f - slideR;  //
                Slide0     -= 0.5f;
                Slide1     -= 0.5f;
                degreebias += 180f;
                bias        = new Vector2(1, 1);
                break;
            }
            }


            Width1 = MathHelper.Clamp(Width1, rivermin, rivermax);
            Width0 = MathHelper.Clamp(Width0, rivermin, rivermax);

            BlockTitle = "W0:" + Width0.ToString("F2") + " W1:" + Width1.ToString("F2") + " S0: " + Slide0.ToString("F2") + " S1:" + Slide1.ToString("F2");
            for (int x = 0; x < (BlockSize + 1 + 2); x++)
            {
                for (int y = 0; y < (BlockSize + 1 + 2); y++)
                {
                    Vector2 pointer = (new Vector2(x - 1, y - 1)) - CornerPoint;
                    float   M       = pointer.Length();
                    pointer = Vector2.Normalize(pointer);
                    float degrees = MathHelper.ToDegrees((float)Math.Atan2(pointer.Y, pointer.X));
                    degrees += degreebias;
                    if (degrees > 90f)
                    {
                        degrees = 1f / 0f;
                    }
                    degrees += 360f;
                    degrees  = degrees % 360;
                    degrees /= 90f;
                    float W = degrees;
                    if (W < 0f || W > 1f)
                    {
                        W /= 0f;
                    }
                    W *= (BlockSize + 1);
                    // Slide0 = -0.2f;
                    // Slide1 = 0.2f;
                    offset = GainDepth(M, W, Width0, Width1, Slide0, Slide1, strength);
                    // offset = ((float)Math.Pow((((float)(Z) - mid) / strength), pow) * -1f) + (float)Math.Pow(mid / strength, pow) * MathHelper.Lerp(Width0, Width1, Z/ (float)(BlockSize + 1 + 2)); ;
                    // TerrainVertex v = GainVertex(x - 1, y - 1, X, Y);
                    offset = MathHelper.Clamp(offset, 0, 999f);

                    /* #TODO: do something with the tilemap here
                     * if (offset > 0)
                     *  _vertices[(x + 0) + ((y + 0) * (BlockSize + 1 + 2))].MultiTexData.Z = 1f;
                     * //*/
                    _heightmap[x, y] -= offset;
                    //_vertices[(x + 0) + ((y + 0) * (BlockSize + 1 + 2))].Color = new Color(W/(BlockSize+1+2), 0f, 0f);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IApp page)
        {
            var slide = 0;

            var gallery = new Gallery();
            var fontAwsome = new TTF.fontawesome_webfont();
            gallery.GalleryContainer.style.fontFamily = fontAwsome;
            gallery.Lch.innerText = "\xf060";
            gallery.Rch.innerText = "\xf061";

            new bg().ToBackground(gallery.GalleryContainer.style);

            var first = new TextFloatDiv();
            var snd = new TextFloatDiv();
            var trd = new BigTextDiv();
            var pic = new NewPictureDiv();
            var slide0 = new Slide0();

            new IStyle(first.TextDiv)
            {
                left = "-40em",
                transition = "all 2s ease",
            };
            first.TextDiv.AttachTo(gallery.GalleryContainer);

            new IStyle(snd.TextDiv)
            {
                right = "-40em",
                transition = "all 2s ease",
            };
            snd.AttachTo(gallery.GalleryContainer);

            new IStyle(trd.TextDiv)
            {
                top = "-40em",
                transition = "all 2s ease",
            };
            trd.AttachTo(gallery.GalleryContainer);

            new IStyle(pic.TextDiv)
            {
                left = "-40em",
                transition = "all 2s ease",
            };
            pic.TextDiv.AttachTo(gallery.GalleryContainer);

            new IStyle(slide0.TextDiv)
            {
                left = "20%",
               // transition = "all 2s ease",
                transition = "opacity 2s ease-out",
                Opacity = 0
            };
            slide0.TextDiv.AttachTo(gallery.GalleryContainer);

            gallery.AttachToDocument();

            gallery.Lch.css.hover.style.color = "#606060";
            gallery.Rch.css.hover.style.color = "#606060";

           
            gallery.LeftContainer.onclick += async delegate
            {
                if (slide == 0)
                {
                    Native.window.requestAnimationFrame += delegate
                    {
                        slide0.TextDiv.style.Opacity = 0;
                    };
                    await 1000;

                    slide = 2;
                    Native.window.requestAnimationFrame += delegate
                    {
                        pic.TextDiv.style.left = "40%";
                    };
                    await 1000;
                  
                }
                else if(slide == 1)
                {
                    slide--;
                    Native.window.requestAnimationFrame += delegate
                    {
                        first.TextDiv.style.left = "-40em";
                        snd.TextDiv.style.right = "0em";
                        snd.TextDiv.style.Opacity = 0;
                        trd.TextDiv.style.top = "-40em";
                    };
                    await 1000;
                    Native.window.requestAnimationFrame += delegate
                    {
                        slide0.TextDiv.style.Opacity = 1;
                    };
                    await 1000;
                }
                else if (slide == 2)
                {
                    slide--;
                    Native.window.requestAnimationFrame += delegate
                    {
                        pic.TextDiv.style.left = "-40em";
                    };
                    await 1000;

                    Native.window.requestAnimationFrame += delegate
                    {
                        first.TextDiv.style.left = "40%";
                        snd.TextDiv.style.right = "40%";
                        snd.TextDiv.style.Opacity = 1;
                        trd.TextDiv.style.top = "5%";
                    };
                    await 1000;
                }
            };

            gallery.RightContainer.onclick += async delegate
            {
                if (slide == 0)
                {
                    Native.window.requestAnimationFrame += delegate
                    {
                        slide0.TextDiv.style.Opacity = 0;
                    };
                    await 1000;
                    Native.window.requestAnimationFrame += delegate
                    {
                        first.TextDiv.style.left = "40%";
                        snd.TextDiv.style.right = "40%";
                        snd.TextDiv.style.Opacity = 1;
                        trd.TextDiv.style.top = "5%";
                    };
                    await 1000;
                    slide++;
                }
                else if (slide == 1)
                {
                    Native.window.requestAnimationFrame += delegate
                    {
                        first.TextDiv.style.left = "-40em";
                        snd.TextDiv.style.right = "0em";
                        snd.TextDiv.style.Opacity = 0;
                        trd.TextDiv.style.top = "-40em";
                    };
                    await 1000;
                    Native.window.requestAnimationFrame += delegate
                    {
                        pic.TextDiv.style.left = "40%";
                    };
                    await 1000;
                    slide++;
                }
                else if (slide == 2)
                {
                    Native.window.requestAnimationFrame += delegate
                    {
                        pic.TextDiv.style.left = "-40em";
                    };
                    await 1000;
                    Native.window.requestAnimationFrame += delegate
                    {
                        slide0.TextDiv.style.Opacity = 1;
                    };
                    await 1000;
                    slide = 0;
                }
            };
        }
Exemplo n.º 6
0
        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IApp page)
        {
            var slide = 0;

            var gallery    = new Gallery();
            var fontAwsome = new TTF.fontawesome_webfont();

            gallery.GalleryContainer.style.fontFamily = fontAwsome;
            gallery.Lch.innerText = "\xf060";
            gallery.Rch.innerText = "\xf061";

            new bg().ToBackground(gallery.GalleryContainer.style);

            var first  = new TextFloatDiv();
            var snd    = new TextFloatDiv();
            var trd    = new BigTextDiv();
            var pic    = new NewPictureDiv();
            var slide0 = new Slide0();

            new IStyle(first.TextDiv)
            {
                left       = "-40em",
                transition = "all 2s ease",
            };
            first.TextDiv.AttachTo(gallery.GalleryContainer);

            new IStyle(snd.TextDiv)
            {
                right      = "-40em",
                transition = "all 2s ease",
            };
            snd.AttachTo(gallery.GalleryContainer);

            new IStyle(trd.TextDiv)
            {
                top        = "-40em",
                transition = "all 2s ease",
            };
            trd.AttachTo(gallery.GalleryContainer);

            new IStyle(pic.TextDiv)
            {
                left       = "-40em",
                transition = "all 2s ease",
            };
            pic.TextDiv.AttachTo(gallery.GalleryContainer);

            new IStyle(slide0.TextDiv)
            {
                left = "20%",
                // transition = "all 2s ease",
                transition = "opacity 2s ease-out",
                Opacity    = 0
            };
            slide0.TextDiv.AttachTo(gallery.GalleryContainer);

            gallery.AttachToDocument();

            gallery.Lch.css.hover.style.color = "#606060";
            gallery.Rch.css.hover.style.color = "#606060";


            gallery.LeftContainer.onclick += async delegate
            {
                if (slide == 0)
                {
                    Native.window.requestAnimationFrame += delegate
                    {
                        slide0.TextDiv.style.Opacity = 0;
                    };
                    await 1000;

                    slide = 2;
                    Native.window.requestAnimationFrame += delegate
                    {
                        pic.TextDiv.style.left = "40%";
                    };
                    await 1000;
                }
                else if (slide == 1)
                {
                    slide--;
                    Native.window.requestAnimationFrame += delegate
                    {
                        first.TextDiv.style.left  = "-40em";
                        snd.TextDiv.style.right   = "0em";
                        snd.TextDiv.style.Opacity = 0;
                        trd.TextDiv.style.top     = "-40em";
                    };
                    await 1000;
                    Native.window.requestAnimationFrame += delegate
                    {
                        slide0.TextDiv.style.Opacity = 1;
                    };
                    await 1000;
                }
                else if (slide == 2)
                {
                    slide--;
                    Native.window.requestAnimationFrame += delegate
                    {
                        pic.TextDiv.style.left = "-40em";
                    };
                    await 1000;

                    Native.window.requestAnimationFrame += delegate
                    {
                        first.TextDiv.style.left  = "40%";
                        snd.TextDiv.style.right   = "40%";
                        snd.TextDiv.style.Opacity = 1;
                        trd.TextDiv.style.top     = "5%";
                    };
                    await 1000;
                }
            };

            gallery.RightContainer.onclick += async delegate
            {
                if (slide == 0)
                {
                    Native.window.requestAnimationFrame += delegate
                    {
                        slide0.TextDiv.style.Opacity = 0;
                    };
                    await 1000;
                    Native.window.requestAnimationFrame += delegate
                    {
                        first.TextDiv.style.left  = "40%";
                        snd.TextDiv.style.right   = "40%";
                        snd.TextDiv.style.Opacity = 1;
                        trd.TextDiv.style.top     = "5%";
                    };
                    await 1000;
                    slide++;
                }
                else if (slide == 1)
                {
                    Native.window.requestAnimationFrame += delegate
                    {
                        first.TextDiv.style.left  = "-40em";
                        snd.TextDiv.style.right   = "0em";
                        snd.TextDiv.style.Opacity = 0;
                        trd.TextDiv.style.top     = "-40em";
                    };
                    await 1000;
                    Native.window.requestAnimationFrame += delegate
                    {
                        pic.TextDiv.style.left = "40%";
                    };
                    await 1000;
                    slide++;
                }
                else if (slide == 2)
                {
                    Native.window.requestAnimationFrame += delegate
                    {
                        pic.TextDiv.style.left = "-40em";
                    };
                    await 1000;
                    Native.window.requestAnimationFrame += delegate
                    {
                        slide0.TextDiv.style.Opacity = 1;
                    };
                    await 1000;
                    slide = 0;
                }
            };
        }