Esempio n. 1
0
        /// <summary>
        /// Update
        /// </summary>
        protected override void Update()
        {
            if (Global.IsGamePaused)
            {
                return;
            }

            if (_Zooms.Count > 0)
            {
                int index = 0;
                while (index < _Zooms.Count)
                {
                    ZoomData zd      = _Zooms[index];
                    float    percent = zd.Timer.Percent;
                    if (percent >= 1.0f)
                    {
                        zd.Image.TextureCoordinate = zd.DestRect;
                        _Zooms.RemoveAt(index);
                        continue;
                    }
                    else
                    {
                        Rect textcoords = new Rect();
                        textcoords.x               = Mathf.Lerp(zd.SourceRect.x, zd.DestRect.x, percent);
                        textcoords.y               = Mathf.Lerp(zd.SourceRect.y, zd.DestRect.y, percent);
                        textcoords.width           = Mathf.Lerp(zd.SourceRect.width, zd.DestRect.width, percent);
                        textcoords.height          = Mathf.Lerp(zd.SourceRect.height, zd.DestRect.height, percent);
                        zd.Image.TextureCoordinate = textcoords;
                    }
                    index++;
                }
            }
            base.Update();
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> PostZoomData(ZoomData zoomData)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError(string.Empty, "Error: ZoomData is not valid...!!!");
                //  return BadRequest(ModelState);
                return(BadRequest("Error: ZoomData is not valid...!!!"));
            }

            try
            {
                db.ZoomDatas.Add(zoomData);
                response = await DbHelper.SaveChangeDB(db);

                if (!response.IsSuccess)
                {
                    ModelState.AddModelError(string.Empty, response.Message);
                    //  return BadRequest(ModelState);
                    return(BadRequest(response.Message));
                }

                return(Ok(zoomData));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                //  return BadRequest(ModelState);
                return(BadRequest(ex.Message));
            }

            //  return CreatedAtRoute("DefaultApi", new { id = zoomData.ZoomDataId }, zoomData);
        }
Esempio n. 3
0
        // GET: ZoomDatas/Create
        public ActionResult Create()
        {
            var zoomData = new ZoomData {
            };

            //  CHEJ - Load ViewBag
            LoadViewBag(zoomData);

            return(View());
        }
Esempio n. 4
0
        public async Task <IHttpActionResult> GetZoomData(int id)
        {
            ZoomData zoomData = await db.ZoomDatas.FindAsync(id);

            if (zoomData == null)
            {
                return(NotFound());
            }

            return(Ok(zoomData));
        }
Esempio n. 5
0
 public void DoZoomStuff(ZoomData data, float lerpTime = 0)
 {
     if (!endData.EqualValues(data))
     {
         startPosition = transform.position;
         startData.Set(currentData);
         endData.Set(data);
         this.lerpTime            = lerpTime;
         time                     = 0;
         currentData.followPlayer = data.followPlayer;
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Zoom from startTextCoords to destTextCoords
        /// </summary>
        /// <param name="image">Image to apply zoom effect</param>
        /// <param name="duration">lenght of zoom animation</param>
        /// <param name="startTextCoords">start TextCoords</param>
        /// <param name="destTextCoords">destination TextCoords</param>
        public void Zoom(ImageWithTexCoords image, float duration, Rect startTextCoords, Rect destTextCoords)
        {
            if (image == null)
            {
                throw new System.ArgumentNullException("Invalid image");
            }
            ZoomData zd = new ZoomData();

            zd.Image      = image;
            zd.SourceRect = startTextCoords;
            zd.DestRect   = destTextCoords;
            zd.Timer.Begin(Mathf.Max(0, duration));
            _Zooms.Add(zd);
        }
Esempio n. 7
0
        public async Task <ActionResult> Edit(ZoomData zoomData)
        {
            if (ModelState.IsValid)
            {
                db.Entry(zoomData).State = EntityState.Modified;
                response = await DbHelper.SaveChangeDB(db);

                if (response.IsSuccess)
                {
                    return(RedirectToAction("Index"));
                }
            }
            ModelState.AddModelError(string.Empty, response.Message);

            //  CHEJ - Load ViewBag
            LoadViewBag(zoomData);
            return(View(zoomData));
        }
Esempio n. 8
0
        public async Task <IHttpActionResult> PutZoomData(int id, ZoomData zoomData)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError(string.Empty, "Error: ZoomData is null...!!!");
                //  return BadRequest(ModelState);
                return(BadRequest("Error: ZoomData is null...!!!"));
            }

            if (id != zoomData.ZoomDataId)
            {
                ModelState.AddModelError(string.Empty, "Error: Id != ZoomData.ZoomDataId...!!!");
                //  return BadRequest(ModelState);
                return(BadRequest("Error: Id != ZoomData.ZoomDataId...!!!"));
            }

            db.Entry(zoomData).State = EntityState.Modified;

            try
            {
                response = await DbHelper.SaveChangeDB(db);

                if (!response.IsSuccess)
                {
                    ModelState.AddModelError(string.Empty, response.Message);
                    return(BadRequest(response.Message));
                }

                return(Ok(zoomData));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ZoomDataExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            //  return StatusCode(HttpStatusCode.NoContent);
        }
Esempio n. 9
0
 private void LoadViewBag(ZoomData zoomData)
 {
     ViewBag.UserId =
         new SelectList(CombosHelper.GetUsersGetServicesVzLa(db), "UserId", "FullName", zoomData.UserId);
 }
Esempio n. 10
0
 public bool EqualValues(ZoomData data)
 {
     return(camSize == data.camSize && followPlayer == data.followPlayer && center == data.center);
 }
Esempio n. 11
0
 public void Set(ZoomData data)
 {
     camSize      = data.camSize;
     followPlayer = data.followPlayer;
     center       = data.center;
 }
Esempio n. 12
0
 private void EnterZoomZone(ZoomData zoomData, float lerpTime)
 {
     cam.DoZoomStuff(zoomData, lerpTime);
 }