Example #1
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");
     }
 }
Example #2
0
 private void NextBTN_Clicked(object sender, EventArgs e)
 {
     try
     {
         if (Slide1.IsVisible == IsVisible)
         {
             Slide1.SetValue(IsVisibleProperty, false);
             Slide2.SetValue(IsVisibleProperty, true);
         }
         else
         {
             if (Slide2.IsVisible == IsVisible)
             {
                 Slide2.SetValue(IsVisibleProperty, false);
                 Slide3.SetValue(IsVisibleProperty, true);
                 NationalIdLBL.Text = "الرقم الوطني : " + NID.Text;
                 NameLBL.Text       = "الاسم : " + Name.Text;
                 AgeLBL.Text        = "العمر : " + Age.SelectedItem;
                 PhoneLBL.Text      = "  رقم الهاتف : " + Phone.Text;
                 EduLBL.Text        = " المستوى التعليمي : " + Edu.SelectedItem;
                 JobLBL.Text        = " المهنة : " + Job.Text;
                 CityLBL.Text       = " القرية : " + City.SelectedItem;
             }
         }
     }
     catch (Exception)
     {
         _ = DisplayAlert("خطأ", "جميع الحقول مطلوبة ! ", "OK");
     }
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     AddNickname.SetActive(false);
     Slide1.SetActive(false);
     Slide2.SetActive(false);
     Slide3.SetActive(false);
     Slide4.SetActive(false);
 }
Example #4
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");
     }
 }
Example #5
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);
                }
            }
        }