Ejemplo n.º 1
0
        public ActionResult deteleadv(int id)
        {
            DemoContext   _context = new DemoContext();
            Advertisement objadv   = new AdvertisementHandler().GetDetailAdvertisement(id);

            foreach (var child in objadv.Images.ToList())
            {
                String PATH = Request.MapPath("~/" + child.Url);
                if (System.IO.File.Exists(PATH))
                {
                    System.IO.File.Delete(PATH);
                }
                if (PATH != null)
                {
                    _context.Entry(child).State = System.Data.Entity.EntityState.Deleted;
                    _context.SaveChanges();
                }
            }

            _context.Entry(objadv).State = System.Data.Entity.EntityState.Deleted;
            // _context.Advertisements.Remove(objadv);
            _context.SaveChanges();

            return(RedirectToAction("index", "home1"));
        }
Ejemplo n.º 2
0
    private void Awake()
    {
        UnityEngine.Debug.LogWarning("MainMenuPromoPopup::Awake");
        this.sprite      = base.GetComponentInChildren <UnmanagedSprite>();
        this.closeSprite = base.transform.Find("Close").gameObject.GetComponent <Sprite>();
        if (AdvertisementHandler.MainMenuPromoRenderable != null)
        {
            if (AdvertisementHandler.GetMainMenuPopupTexture() != null)
            {
                UnityEngine.Debug.LogWarning("MainMenuPromoPopup::Awake::OnRenderableReady");
                this.OnRenderableReady(true);
            }
        }
        else
        {
            UnityEngine.Debug.LogWarning("MainMenuPromoPopup::Awake::MainMenuPromoRenderable is NULL");
        }
        Dialog component = base.GetComponent <Dialog>();

        if (component != null)
        {
            component.onOpen += this.HideObjects;
            base.GetComponent <Dialog>().onClose += this.HandleClose;
        }
        EventManager.Connect(new EventManager.OnEvent <LevelLoadedEvent>(this.OnLevelLoaded));
        UnityEngine.Object.DontDestroyOnLoad(this);
    }
Ejemplo n.º 3
0
    private void OnEnable()
    {
        Singleton <KeyListener> .Instance.GrabFocus(this);

        KeyListener.keyReleased += this.HandleKeyListenerkeyReleased;
        if (WPFMonoBehaviour.levelManager.gameState != LevelManager.GameState.MechanicGiftScreen)
        {
            return;
        }
        this.superGlueButton.SetActive(false);
        this.turboChargeButton.SetActive(false);
        this.superMagnetButton.SetActive(false);
        Texture2D rewardNativeTexture = AdvertisementHandler.GetRewardNativeTexture();

        if (!WPFMonoBehaviour.levelManager.m_SuperGlueAllowed && !WPFMonoBehaviour.levelManager.m_SuperMagnetAllowed && !WPFMonoBehaviour.levelManager.m_TurboChargeAllowed)
        {
            this.SendClose();
        }
        else if (rewardNativeTexture != null)
        {
            this.GiveGift();
            this.SetTexture(rewardNativeTexture);
        }
        else
        {
            this.SendClose();
        }
    }
Ejemplo n.º 4
0
    private void OnRenderableReady(bool isReady)
    {
        if (!UnityEngine.Application.isPlaying || !isReady)
        {
            return;
        }
        UnityEngine.Debug.LogWarning("CrossPromoButton::OnRenderableReady texture set");
        Renderer component = this.sprite.GetComponent <Renderer>();

        if (this.crossPromoType == CrossPromoButton.CrossPromoType.Main && AdvertisementHandler.CrossPromoMainRenderable != null)
        {
            component.material.mainTexture = AdvertisementHandler.GetCrossPromoMainTexture();
        }
        else if (this.crossPromoType == CrossPromoButton.CrossPromoType.Episode && AdvertisementHandler.CrossPromoEpisodeRenderable != null)
        {
            component.material.mainTexture = AdvertisementHandler.GetCrossPromoEpisodeTexture();
        }
        if (component.material != null && component.material.mainTexture != null)
        {
            float num  = (float)component.material.mainTexture.width;
            float num2 = (float)component.material.mainTexture.height;
            component.transform.localScale = Vector3.up * component.transform.localScale.y + Vector3.right * component.transform.localScale.y * (num / num2);
            this.OnRenderableShow();
        }
    }
    void OnGUI()
    {
        rect.x = 20;
        rect.y = 40;

        rect.width  = Screen.width * 0.3f;
        rect.height = Screen.height * 0.1f;
        // Make the Enable Button
        if (GUI.Button(rect, "Enable"))
        {
            AdvertisementHandler.EnableAds();
        }

        rect.y = rect.y + rect.height;
        if (GUI.Button(rect, "Disable"))
        {
            AdvertisementHandler.DisableAds();
        }

        rect.y = rect.y + rect.height;
        // Make the Hide Button
        if (GUI.Button(rect, "Hide"))
        {
            AdvertisementHandler.HideAds();
        }

        rect.y = rect.y + rect.height;
        // Make the Show button.
        if (GUI.Button(rect, "Show"))
        {
            AdvertisementHandler.ShowAds();
        }
    }
Ejemplo n.º 6
0
        public ActionResult Delete(int id)
        {
            Advertisement a = new AdvertisementHandler().Getadvertisemnt(id);

            new AdvertisementHandler().Delete(a);

            return(RedirectToAction("Admin", "Home"));
        }
Ejemplo n.º 7
0
        public ActionResult PenddingPost()
        {
            DemoContext _context = new DemoContext();
            //ViewBag.lstAdv = new AdvertisementHandler().GetPenddingAdvertisement().ToAdvertiseSumModel();
            List <Advertisement> AdvList = new AdvertisementHandler().GetPenddingAdvertisement().ToList();

            return(View(AdvList));
        }
Ejemplo n.º 8
0
        public ActionResult Edit(int id)
        {
            // changed here too
            Advertisement a = new AdvertisementHandler().Getadvertisemnt(id);

            ViewBag.Ad = a;
            return(View());
        }
Ejemplo n.º 9
0
 void Start()
 {
     LevelDone    = 0;
     textuerMover = 0;
     StartCoroutine(ProgressBar(0));
     orignalWidth  = Screen.width;
     orignalHeight = Screen.height;
     AdvertisementHandler.EnableAds();
     AdvertisementHandler.ShowAds();
 }
Ejemplo n.º 10
0
 public void Load()
 {
     if (AdvertisementHandler.IsAdvertisementReady(this.placement))
     {
         this.SetState(AdReward.State.Ready, false);
     }
     else
     {
         this.SetState(AdReward.State.Loading, false);
     }
 }
Ejemplo n.º 11
0
        public ActionResult Edit(FormCollection data)
        {
            // my changes
            var ad = new AdvertisementHandler().Getadvertisemnt(Convert.ToInt32(data["Ad"]));

            ad.Status = new AdStatus {
                Id = Convert.ToInt32(data["Status"])
            };
            new AdvertisementHandler().Update(ad.Id, ad);
            return(RedirectToAction("Admin"));
        }
Ejemplo n.º 12
0
    private void OnLevelLoaded(LevelLoadedEvent data)
    {
        GameManager.GameState gameState = Singleton <GameManager> .Instance.GetGameState();

        if (base.gameObject.activeSelf && (gameState == GameManager.GameState.Level || gameState == GameManager.GameState.Cutscene))
        {
            base.GetComponent <Dialog>().Close();
        }
        else if (!base.gameObject.activeSelf && AdvertisementHandler.GetMainMenuPopupTexture() != null)
        {
            this.OnRenderableReady(true);
        }
    }
Ejemplo n.º 13
0
        public ActionResult DetailProduct(int id)
        {
            DemoContext db = new DemoContext();
            //var product= db.Advertisements.Include("AdvertisementImages").Where(x => x.ID == id).FirstOrDefault();
            Advertisement objAdvertisement = new AdvertisementHandler().GetDetailAdvertisement(id);

            //        AdvSumModel tem = new AdvSumModel();
            //tem.Id = objAdvertisement.ID;
            //tem.ImgUrl = (objAdvertisement.Images.Count > 0) ? objAdvertisement.Images.First().Url : "/Images/temp/nophoto.png";


            //Function for getting the Recommended AdvertisementProduct
            ViewBag.recomendedAdvertisement = new AdvertisementHandler().GetRecomendAdvertisement(objAdvertisement.SubCatagory.Catagory.ID).ToAdvertiseSumModel();
            return(View(objAdvertisement));
        }
Ejemplo n.º 14
0
 private void OnRenderableReady(bool isReady)
 {
     if (!UnityEngine.Application.isPlaying)
     {
         return;
     }
     if (AdvertisementHandler.MainMenuPromoRenderable == null || !isReady)
     {
         return;
     }
     UnityEngine.Debug.LogWarning("MainMenuPromoPopup::OnRenderableReady texture set");
     this.sprite.GetComponent <Renderer>().sharedMaterial.mainTexture = AdvertisementHandler.GetMainMenuPopupTexture();
     if (this.IsAllowedToShow())
     {
         CoroutineRunner.Instance.StartCoroutine(this.DelayShow());
     }
 }
Ejemplo n.º 15
0
        public ActionResult UserProfile(int id)
        {
            DemoContext _context = new DemoContext();
            User        objUser  = new UserHandler().getUserById(id);
            // ViewBag.ListAdv= new AdvertisementHandler().GetUserAdvertisement(objUser.ID).ToAdvertiseSumModel();
            List <Advertisement> uAdvertisementList = new AdvertisementHandler().GetUserAdvertisement(objUser.ID).ToList();

            ViewBag.UAdvList = uAdvertisementList;

            var showpenddinglist = _context.Advertisements.Include(x => x.City.Province.Country)
                                   .Include(x => x.Images).Include(x => x.Status).Include(x => x.SubCatagory.Catagory)
                                   .Include(x => x.Type).Include(x => x.User)
                                   .Where(x => x.User.ID == id && x.Status.ID == 3)
                                   .ToList();

            ViewBag.penddinglist = showpenddinglist;
            return(View(objUser));
        }
Ejemplo n.º 16
0
    private IEnumerator CheckVideoTimeout()
    {
        float counter = 0f;

        while (counter <= 10f)
        {
            counter += Time.unscaledDeltaTime;
            if (AdvertisementHandler.IsAdvertisementReady(this.placement))
            {
                break;
            }
            if (this.state == AdReward.State.Stalled || this.disposed)
            {
                yield break;
            }
            yield return(null);
        }
        yield break;
    }
Ejemplo n.º 17
0
    private IEnumerator CheckVideoTimeout()
    {
        float counter = 0f;

        while (counter <= 10f)
        {
            counter += Time.deltaTime;
            if (AdvertisementHandler.IsAdvertisementReady(AdvertisementHandler.SnoutCoinRewardVideoPlacement))
            {
                break;
            }
            if (this.state == SnoutCoinAdRewardDialog.State.Stalled)
            {
                yield break;
            }
            yield return(null);
        }
        yield break;
    }
    // Use this for initialization
    void Start()
    {
        Debug.Log("Unity Calling Start");
        Debug.Log("Initializing with " +
                  "  Pub ID: " + m_publisherId +
                  "  Adv Size: " + m_advSize +
                  "  Orientation: " + m_orientation +
                  "  Position 1: " + m_positionOne +
                  "  Position 2: " + m_positionTwo +
                  "  IsTesting: " + m_isTesting +
                  "  DeviceID: " + m_testDeviceId +
                  "  AnimIn: " + m_animationInType +
                  "  AnimOut: " + m_animationOutType +
                  "  LevelOfDebug: " + m_levelOfDebug
                  );

        //Initializing Plugin with values
        AdvertisementHandler.Instantiate(m_publisherId, m_advSize, m_orientation, m_positionOne, m_positionTwo, m_isTesting, m_testDeviceId, m_animationInType, m_animationOutType, m_levelOfDebug);

        //Shoot request to enable advertisements
        AdvertisementHandler.EnableAds();
    }
Ejemplo n.º 19
0
        public ActionResult EditPost(int id)
        {
            DemoContext   _context = new DemoContext();
            Advertisement objAdv   = new AdvertisementHandler().GetDetailAdvertisement(id);
            var           type     = new AdvertisementTypeHandler().GetAllAdvertisementTypes().ToSelectList();

            // type.Find(x => Convert.ToInt32(x.Value)==objAdv.Type.ID).Selected = true;
            ViewBag.advType = type;

            //This code is  select the selected Country of the Post
            ViewBag.CountryList = new SelectList(_context.Countries, "ID", "Name", objAdv.City.Province.Country.ID);

            //This code is  select the selected Province of the Post
            List <SelectListItem> prv = ModelHelper.ToSelectList(new LocationHandler().getProvincesBtCountry(objAdv.City.Province.Country));

            prv.Find(x => Convert.ToInt32(x.Value) == objAdv.City.Province.ID).Selected = true;
            ViewBag.ProvinceList = prv;


            //This code is  select the selected Cities of the Post
            var citi = ModelHelper.ToSelectList(_context.Ciities.OrderBy(c => c.Name).Where(x => x.Province.ID.Equals(objAdv.City.Province.ID)).ToList());
            // ViewBag.ciList = citi;

            var s = new SelectList(_context.Ciities.OrderBy(x => x.Name).Where(x => x.Province.ID == objAdv.City.Province.ID).ToList(), "ID", "Name");

            ViewBag.ciList = s;
            //This code is also select the selected Catagory of the post
            ViewBag.CatagoryList = new SelectList(_context.Catagories.OrderBy(x => x.Name), "ID", "Name", objAdv.SubCatagory.Catagory.ID);

            //This code is  select the selected SubCatagory of the post
            List <SelectListItem> subcats = ModelHelper.ToSelectList(new CatagoryHendler().getSubCatagoriesByCatagoryId(objAdv.SubCatagory.Catagory));

            subcats.Find(x => Convert.ToInt32(x.Value) == objAdv.SubCatagory.ID).Selected = true;
            ViewBag.SubCatagoryList = subcats;
            // ViewBag.SubCatagoryList = new SelectList(_context.SubCatagories.OrderBy(x => x.Name), "ID", "Name", objAdv.SubCatagory.ID);

            return(View(objAdv));
        }
Ejemplo n.º 20
0
 private void Awake()
 {
     UnityEngine.Debug.LogWarning("CrossPromoButton::Awake");
     if (this.crossPromoType == CrossPromoButton.CrossPromoType.Main && AdvertisementHandler.CrossPromoMainRenderable != null)
     {
         if (AdvertisementHandler.GetCrossPromoMainTexture() != null)
         {
             UnityEngine.Debug.LogWarning("CrossPromoButton::Awake::OnRenderableReady: Main");
             this.OnRenderableReady(true);
         }
         else
         {
             UnityEngine.Debug.LogWarning("CrossPromoButton::Awake::GetCrossPromoMainTexture is NULL");
             AdvertisementHandler.RenderableHandler crossPromoMainRenderable = AdvertisementHandler.CrossPromoMainRenderable;
             crossPromoMainRenderable.onRenderableReady = (Action <bool>)Delegate.Combine(crossPromoMainRenderable.onRenderableReady, new Action <bool>(this.OnRenderableReady));
             base.gameObject.SetActive(false);
         }
     }
     else if (this.crossPromoType == CrossPromoButton.CrossPromoType.Episode && AdvertisementHandler.CrossPromoEpisodeRenderable != null)
     {
         if (AdvertisementHandler.GetCrossPromoEpisodeTexture() != null)
         {
             UnityEngine.Debug.LogWarning("CrossPromoButton::Awake::OnRenderableReady: Episode");
             this.OnRenderableReady(true);
         }
         else
         {
             UnityEngine.Debug.LogWarning("CrossPromoButton::Awake::GetCrossPromoEpisodeTexture is NULL");
             AdvertisementHandler.RenderableHandler crossPromoEpisodeRenderable = AdvertisementHandler.CrossPromoEpisodeRenderable;
             crossPromoEpisodeRenderable.onRenderableReady = (Action <bool>)Delegate.Combine(crossPromoEpisodeRenderable.onRenderableReady, new Action <bool>(this.OnRenderableReady));
             base.gameObject.SetActive(false);
         }
     }
     else
     {
         base.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 21
0
        public ActionResult EditPost(Advertisement objAdv, FormCollection data)
        {
            DemoContext _context    = new DemoContext();
            User        currentUser = (User)Session[WebUtil.CURRENT_USER];

            Advertisement objAdv1 = new AdvertisementHandler().GetDetailAdvertisement(objAdv.ID);

            objAdv1.City = new City {
                ID = Convert.ToInt32(data["CityId"])
            };
            _context.Entry(objAdv1.City).State = System.Data.Entity.EntityState.Unchanged;
            objAdv1.Title       = data["Title"];
            objAdv1.price       = Convert.ToSingle(data["Price"]);
            objAdv1.VilidUpTo   = Convert.ToDateTime(data["ValidUpTO"]);
            objAdv1.SubCatagory = new SubCatagory {
                ID = Convert.ToInt32(data["SubCatagoryID"])
            };
            _context.Entry(objAdv1.SubCatagory).State = System.Data.Entity.EntityState.Unchanged;
            objAdv1.Type = new AdvertisementType {
                ID = Convert.ToInt32(data["advTpye"])
            };
            _context.Entry(objAdv1.Type).State = System.Data.Entity.EntityState.Unchanged;
            objAdv1.Description = data["Descrip"];
            objAdv1.Status      = new AdvertisementStatus {
                ID = 2
            };
            _context.Entry(objAdv1.Status).State = System.Data.Entity.EntityState.Unchanged;

            objAdv1.User = new User {
                ID = currentUser.ID
            };
            _context.Entry(objAdv1.User).State = System.Data.Entity.EntityState.Unchanged;


            //THis Method is for geleter the Images form the table
            foreach (var c in objAdv1.Images.ToList())
            {
                string Path = Request.MapPath("~/" + c.Url);
                if (System.IO.File.Exists(Path))
                {
                    System.IO.File.Delete(Path);
                }
                _context.Entry(c).State = System.Data.Entity.EntityState.Deleted;
                _context.SaveChanges();
            }
            objAdv1.PostedOn = DateTime.Now;
            long uno   = DateTime.Now.Ticks;
            int  count = 0;

            foreach (string file_Name in Request.Files)
            {
                HttpPostedFileBase file = Request.Files[file_Name];
                if (!string.IsNullOrWhiteSpace(file.FileName))
                {
                    string url  = "/Images/PostAdvImages/" + $"{uno}_{++count}" + file.FileName.Substring(file.FileName.LastIndexOf("."));
                    string path = Server.MapPath(url);
                    file.SaveAs(path);
                    objAdv1.Images.Add(new AdvertisementImages {
                        Url = url, Priority = count
                    });
                }
            }
            //_context.Entry(objAdv1).State = System.Data.Entity.EntityState.Modified;
            _context.Advertisements.Add(objAdv1);


            return(RedirectToAction("UserProfile", "User", new { id = currentUser.ID }));
        }
 private void btnAddAds_Click(object sender, RoutedEventArgs e)
 {
     AdvertisementHandler.addAdds(tbNameAds.Text, tbDetailAds.Text);
     MessageBox.Show("Added Ads");
 }
 private void btnUpdAds_Click(object sender, RoutedEventArgs e)
 {
     AdvertisementHandler.updAds(Int32.Parse(tbAdsId.Text), tbNameAds.Text, tbDetailAds.Text);
     MessageBox.Show("Updated Ads");
 }
 private void btnDelAds_Click(object sender, RoutedEventArgs e)
 {
     AdvertisementHandler.delAds(Int32.Parse(tbAdsId.Text));
     MessageBox.Show("Deleted Ads");
 }
Ejemplo n.º 25
0
        public ActionResult DetailPost(int id)
        {
            Advertisement objAdvertisement = new AdvertisementHandler().GetDetailAdvertisement(id);

            return(View(objAdvertisement));
        }
Ejemplo n.º 26
0
    public override LevelManager.GameState SetGameState(LevelManager.GameState currentState, LevelManager.GameState newState)
    {
        LevelManager.GameState gameState = currentState;
        switch (newState)
        {
        case LevelManager.GameState.Building:
            if (GameTime.IsPaused())
            {
                GameTime.Pause(false);
            }
            if (currentState == LevelManager.GameState.Running || currentState == LevelManager.GameState.PausedWhileRunning)
            {
                base.StopRunningContraption();
                this.retries++;
                if (this.retries == 3 && !this.levelManager.m_sandbox && !this.tutorialBookOpened)
                {
                    int num = GameProgress.GetInt("Tutorial_Promotion_Count", 0, GameProgress.Location.Local, null);
                    if (num < 3 && !GameProgress.IsLevelCompleted(Singleton <GameManager> .Instance.CurrentSceneName) && GameProgress.GetInt(this.TutorialPromotionCount, 0, GameProgress.Location.Local, null) == 0)
                    {
                        this.openTutorial = true;
                        num++;
                        GameProgress.SetInt("Tutorial_Promotion_Count", num, GameProgress.Location.Local);
                        GameProgress.SetInt(this.TutorialPromotionCount, 1, GameProgress.Location.Local);
                    }
                }
                bool @bool = GameProgress.GetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", false, GameProgress.Location.Local, null);
                bool bool2 = GameProgress.GetBool("PermanentBlueprint", false, GameProgress.Location.Local, null);
                if (!this.levelManager.m_sandbox && this.retries % 5 == 0 && AdvertisementHandler.GetRewardNativeTexture() != null)
                {
                    int @int = GameProgress.GetInt("branded_reward_gifts_today", 0, GameProgress.Location.Local, null);
                    int num2 = 2;
                    if (Singleton <GameConfigurationManager> .IsInstantiated() && Singleton <GameConfigurationManager> .Instance.HasValue("branded_reward_gift_count", "count"))
                    {
                        num2 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("branded_reward_gift_count", "count");
                    }
                    if (@int < num2)
                    {
                        if (!GameProgress.HasKey("branded_reward_gift_time", GameProgress.Location.Local, null))
                        {
                            GameProgress.SetInt("branded_reward_gift_time", Singleton <TimeManager> .Instance.CurrentEpochTime, GameProgress.Location.Local);
                        }
                        GameProgress.SetInt("branded_reward_gifts_today", @int + 1, GameProgress.Location.Local);
                        this.openMechanicGift = true;
                    }
                }
            }
            if (this.levelManager.m_toolboxOpenUponShopActivation)
            {
                this.levelManager.InGameGUI.BuildMenu.ToolboxButton.OnPressed();
            }
            this.levelManager.SetupDynamicObjects();
            base.ContraptionProto.SetVisible(true);
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(true, true);
            }
            if (GameProgress.GetString("REPLAY_LEVEL", string.Empty, GameProgress.Location.Local, null) == SceneManager.GetActiveScene().name&& LightManager.enabledLightPositions != null && LightManager.enabledLightPositions.Count > 0)
            {
                PointLightSource[] array = UnityEngine.Object.FindObjectsOfType <PointLightSource>();
                for (int i = 0; i < array.Length; i++)
                {
                    if (LightManager.enabledLightPositions.Contains(array[i].transform.position))
                    {
                        array[i].isEnabled = true;
                    }
                }
                GameProgress.SetString("REPLAY_LEVEL", string.Empty, GameProgress.Location.Local);
            }
            break;

        case LevelManager.GameState.Preview:
            this.levelManager.m_previewSpeed = 1f;
            this.levelManager.m_previewTime  = 0f;
            base.ContraptionProto.SetVisible(false);
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(false, true);
            }
            break;

        case LevelManager.GameState.PreviewMoving:
            this.levelManager.m_previewTime = 0f;
            base.ContraptionProto.SetVisible(false);
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(false, true);
            }
            this.levelManager.SetupDynamicObjects();
            break;

        case LevelManager.GameState.PreviewWhileBuilding:
            if (this.levelManager.EggRequired)
            {
                this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_eggTransportGoal);
            }
            else if (this.levelManager.PumpkinRequired)
            {
                this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_pumpkinTransportGoal);
            }
            else
            {
                this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_basicGoal);
            }
            this.levelManager.InGameGUI.PreviewMenu.SetChallenges(this.levelManager.Challenges);
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(false, true);
            }
            this.levelManager.PreviewCenter     = base.ContraptionProto.transform.position;
            this.levelManager.m_previewDragging = false;
            break;

        case LevelManager.GameState.PreviewWhileRunning:
            this.levelManager.PreviewCenter = base.ContraptionRunning.transform.position;
            GameTime.Pause(true);
            this.levelManager.m_previewDragging = false;
            break;

        case LevelManager.GameState.Running:
            if (GameTime.IsPaused())
            {
                GameTime.Pause(false);
            }
            this.levelManager.TimeElapsed = 0f;
            this.levelManager.PartsInGoal.Clear();
            this.levelManager.TimeStarted      = false;
            this.levelManager.PigStartPosition = base.ContraptionProto.FindPig().transform.position;
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(false, false);
            }
            base.ContraptionRunning = base.ContraptionProto.Clone();
            base.ContraptionProto.SetVisible(false);
            if (base.ContraptionProto.HasRegularGlue)
            {
                if (!base.ContraptionProto.HasGluedParts)
                {
                    GameProgress.AddSuperGlue(1);
                }
                base.ContraptionProto.RemoveSuperGlue();
            }
            if (base.ContraptionProto.HasSuperMagnet)
            {
                base.ContraptionProto.HasSuperMagnet = false;
            }
            if (base.ContraptionProto.HasNightVision)
            {
                this.levelManager.LightManager.ToggleNightVision();
                base.ContraptionProto.HasNightVision = false;
            }
            base.ContraptionRunning.StartContraption();
            if (base.ContraptionProto.HasTurboCharge)
            {
                base.ContraptionProto.HasTurboCharge = false;
            }
            base.ContraptionRunning.SaveContraption(base.GetCurrentContraptionName());
            break;

        case LevelManager.GameState.Continue:
            if (GameTime.IsPaused())
            {
                GameTime.Pause(false);
            }
            if (gameState == LevelManager.GameState.Building || gameState == LevelManager.GameState.PausedWhileBuilding)
            {
                newState = LevelManager.GameState.Building;
            }
            else if (gameState == LevelManager.GameState.CustomizingPart)
            {
                newState = LevelManager.GameState.CustomizingPart;
            }
            else if (!this.levelManager.HasCompleted && gameState == LevelManager.GameState.LootCrateOpening)
            {
                newState = LevelManager.GameState.Running;
            }
            else
            {
                newState = ((!this.levelManager.HasCompleted) ? LevelManager.GameState.Running : LevelManager.GameState.Completed);
            }
            break;

        case LevelManager.GameState.Completed:
            this.levelManager.InGameGUI.ShowCurrentMenu(false);
            base.ContraptionRunning.TurnOffAllPoweredParts();
            this.levelManager.PlayVictorySound();
            if (this.levelManager.EggRequired)
            {
                this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_eggTransportGoal);
            }
            else if (this.levelManager.PumpkinRequired)
            {
                this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_pumpkinTransportGoal);
            }
            else
            {
                this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_basicGoal);
            }
            this.levelManager.InGameGUI.LevelCompleteMenu.SetChallenges(this.levelManager.Challenges);
            break;

        case LevelManager.GameState.PausedWhileRunning:
            GameTime.Pause(true);
            break;

        case LevelManager.GameState.PausedWhileBuilding:
            GameTime.Pause(true);
            break;

        case LevelManager.GameState.AutoBuilding:
            this.levelManager.StartAutoBuild(this.levelManager.m_oneStarContraption);
            break;

        case LevelManager.GameState.ShowingUnlockedParts:
            GameTime.Pause(false);
            this.levelManager.UnlockedParts     = new List <ConstructionUI.PartDesc>(this.levelManager.ConstructionUI.UnlockedParts);
            this.levelManager.UnlockedPartIndex = -1;
            this.levelManager.PartShowTimer     = 0f;
            break;

        case LevelManager.GameState.Snapshot:
            GameTime.Pause(true);
            this.levelManager.InGameGUI.ShowCurrentMenu(false);
            WPFMonoBehaviour.ingameCamera.TakeSnapshot(new Action(this.levelManager.HandleSnapshotFinished));
            break;

        case LevelManager.GameState.SuperAutoBuilding:
            this.levelManager.StartAutoBuild(this.levelManager.m_threeStarContraption[this.levelManager.CurrentSuperBluePrint]);
            if (Singleton <SocialGameManager> .IsInstantiated())
            {
                Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.CHIPS_FOR_WHIPS", 100.0);
            }
            break;
        }
        currentState = newState;
        return(currentState);
    }