Ejemplo n.º 1
0
 public void CollectReward(bool hideProgressBar = true)
 {
     EventManager.Disconnect(new EventManager.OnEvent <LevelUpEvent>(this.OnPlayerLevelUp));
     if (this.collectRewardButton != null)
     {
         this.collectRewardButton.SetActive(false);
     }
     if (this.rewardGameObject != null)
     {
         UnityEngine.Object.Destroy(this.rewardGameObject);
     }
     this.machineIsLocked = false;
     BackgroundMask.Show(false, this, "Popup", null, Vector3.back, true);
     if (hideProgressBar)
     {
         ResourceBar.Instance.ShowItem(ResourceBar.Item.PlayerProgress, false, true);
     }
     ResourceBar.Instance.ShowItem(ResourceBar.Item.SnoutCoin, true, true);
     this.SetMachineAnimation(this.hideRewardAnimationName, false, false, true);
     this.partListingButton.UpdateNewTagState();
     if (!this.IsAlienMachine)
     {
         this.customizationsFullCheck.Check();
     }
     else
     {
         this.UpdateAlienPartSilhouette();
     }
     this.alienConverter.Check();
 }
Ejemplo n.º 2
0
    public void OpenChallengeLevel(int index)
    {
        if (!Singleton <DailyChallenge> .Instance.Initialized)
        {
            return;
        }
        if (index < 0 || index >= Singleton <DailyChallenge> .Instance.Count)
        {
            return;
        }
        int levelIndex   = Singleton <DailyChallenge> .Instance.Challenges[index].levelIndex;
        int episodeIndex = Singleton <DailyChallenge> .Instance.Challenges[index].episodeIndex;

        if (Singleton <GameManager> .Instance.IsInGame() && levelIndex == Singleton <GameManager> .Instance.CurrentLevel && episodeIndex == Singleton <GameManager> .Instance.CurrentEpisodeIndex)
        {
            this.Close();
            WPFMonoBehaviour.levelManager.SetGameState(LevelManager.GameState.Continue);
            return;
        }
        int page = (levelIndex <= 14) ? 1 : ((levelIndex <= 29) ? 2 : 3);

        if (LevelInfo.IsLevelUnlocked(episodeIndex, levelIndex))
        {
            BackgroundMask.SetParent(base.transform);
            Singleton <GameManager> .Instance.LoadLevelSelectionAndLevel(DailyChallengeDialog.LevelSelectionPages[episodeIndex], levelIndex);

            this.OnGameLevelLoaded = (Action)Delegate.Combine(this.OnGameLevelLoaded, new Action(delegate()
            {
                BackgroundMask.SetParent(null);
                this.gameObject.SetActive(false);
            }));
        }
        else
        {
            Singleton <GameManager> .Instance.LoadLevelSelection(DailyChallengeDialog.LevelSelectionPages[episodeIndex], true);

            this.OnSceneWasLoaded = (Action)Delegate.Combine(this.OnSceneWasLoaded, new Action(delegate()
            {
                this.gameObject.SetActive(false);
                if (!WPFMonoBehaviour.levelSelector)
                {
                    return;
                }
                if (WPFMonoBehaviour.levelSelector.CurrentPage > page)
                {
                    for (int i = 0; i < WPFMonoBehaviour.levelSelector.CurrentPage - page; i++)
                    {
                        WPFMonoBehaviour.levelSelector.PreviousPage();
                    }
                }
                else if (WPFMonoBehaviour.levelSelector.CurrentPage < page)
                {
                    for (int j = 0; j < page - WPFMonoBehaviour.levelSelector.CurrentPage; j++)
                    {
                        WPFMonoBehaviour.levelSelector.NextPage();
                    }
                }
            }));
        }
    }
Ejemplo n.º 3
0
    private void OnEnable()
    {
        if (this.scrollPivot == null)
        {
            this.CreateGUI();
        }
        BackgroundMask.Show(true, this, this.sortingLayer, base.transform, new Vector3(0f, 0f, 0.1f), false);
        Singleton <KeyListener> .Instance.GrabFocus(this);

        KeyListener.keyReleased += this.HandleKeyReleased;
    }
Ejemplo n.º 4
0
 public void ShowRewarding(bool showHorns, int rewardAmount, GameObject target, BackgroundType bgType, Action OnEnd)
 {
     base.gameObject.SetActive(true);
     this.ShowHorns(showHorns);
     BackgroundMask.Show(true, this, "Popup", base.transform, Vector3.forward * 0.1f, false);
     this.icon = this.ConstructIcon(target, bgType, rewardAmount);
     this.icon.transform.parent        = this.targetPosition;
     this.icon.transform.localPosition = Vector3.zero;
     this.icon.transform.localRotation = Quaternion.identity;
     this.icon.transform.localScale    = Vector3.one;
     this.OnClosed = OnEnd;
     this.ShowAnimation();
 }
Ejemplo n.º 5
0
 public void OnPressed()
 {
     if (!base.gameObject.activeSelf)
     {
         return;
     }
     base.gameObject.SetActive(false);
     BackgroundMask.Show(false, this, string.Empty, null, default(Vector3), false);
     if (this.OnClosed != null)
     {
         this.OnClosed();
     }
 }
Ejemplo n.º 6
0
    private void OnDisable()
    {
        if (BackgroundMask.Instantiated)
        {
            BackgroundMask.Show(false, this, string.Empty, null, default(Vector3), false);
        }
        if (Singleton <KeyListener> .IsInstantiated())
        {
            Singleton <KeyListener> .Instance.ReleaseFocus(this);

            KeyListener.keyReleased -= this.HandleKeyReleased;
        }
    }
Ejemplo n.º 7
0
 public static void Show(bool show, object owner, string sortingLayerName = "", Transform target = null, Vector3 offset = default(Vector3), bool smoothFade = false)
 {
     if (owner == null)
     {
         throw new ArgumentException("Argument 'owner' cannot be null!");
     }
     if (BackgroundMask.Instance == null)
     {
         return;
     }
     BackgroundMask.applySmoothFade = smoothFade;
     if (show)
     {
         BackgroundData backgroundData = new BackgroundData(sortingLayerName, target, offset, owner);
         if (!BackgroundMask.Add(backgroundData))
         {
             return;
         }
         BackgroundMask.prevDepth = BackgroundMask.depth++;
         BackgroundMask.SetBackground(backgroundData);
         BackgroundMask.showing = true;
     }
     else if (!show && BackgroundMask.depthPositions.Count > 0)
     {
         if (!BackgroundMask.Remove(owner))
         {
             return;
         }
         BackgroundMask.prevDepth = BackgroundMask.depth--;
         if (BackgroundMask.depthPositions.Count > 0)
         {
             BackgroundMask.SetBackground(BackgroundMask.depthPositions.Peek());
         }
         BackgroundMask.showing = (BackgroundMask.depth > 0);
     }
     if (BackgroundMask.applySmoothFade)
     {
         BackgroundMask.instance.gameObject.SetActive(true);
     }
     else
     {
         BackgroundMask.instance.gameObject.SetActive(BackgroundMask.showing);
     }
 }
Ejemplo n.º 8
0
        public LegendItemViewModel Clone()
        {
            LegendItemViewModel newItem = new LegendItemViewModel
            {
                NotifiedGeoFont        = NotifiedGeoFont.Clone(),
                BackgroundMask         = BackgroundMask == null ? null : (AreaStyle)BackgroundMask.CloneDeep(),
                BottomPadding          = BottomPadding,
                Height                 = Height,
                ImageBottomPadding     = ImageBottomPadding,
                ImageHeight            = ImageHeight,
                ImageJustificationMode = ImageJustificationMode,
                ImageLeftPadding       = ImageLeftPadding,
                ImageMask              = ImageMask == null ? null : (AreaStyle)ImageMask.CloneDeep(),
                ImageRightPadding      = ImageRightPadding,
                //ImageStyle = ImageStyle.CloneDeep(),
                ImageTopPadding   = ImageTopPadding,
                ImageWidth        = ImageWidth,
                LeftPadding       = LeftPadding,
                LegendItemType    = LegendItemType,
                TextBottomPadding = TextBottomPadding,
                TextLeftPadding   = TextLeftPadding,
                TextMask          = TextMask == null ? null : (AreaStyle)TextMask.CloneDeep(),
                TextRightPadding  = TextRightPadding,
                TextSolidBrush    = TextSolidBrush,
                TextTopPadding    = TextTopPadding,
                Text       = this.Text,
                TopPadding = TopPadding,
                Width      = Width,
                Parent     = Parent
            };

            if (ImageStyle != null)
            {
                newItem.ImageStyle = ImageStyle.CloneDeep();
            }

            return(newItem);
        }
Ejemplo n.º 9
0
 private void OnDisable()
 {
     BackgroundMask.Show(false, this, string.Empty, null, default(Vector3), false);
     EventManager.Send(new UIEvent(UIEvent.Type.ClosedWorkshopIntroduction));
 }
Ejemplo n.º 10
0
 private void OnEnable()
 {
     BackgroundMask.Show(true, this, "Popup", base.transform, Vector3.forward, false);
     EventManager.Send(new UIEvent(UIEvent.Type.OpenedWorkshopIntroduction));
 }
Ejemplo n.º 11
0
        private void DrawInternal(GeoCanvas canvas, Collection <SimpleCandidate> labelsInAllLayers)
        {
            RectangleShape currentBoundingBox = GetBoundingBox();

            AreaStyle brushStyle = BackgroundMask.CloneDeep() as AreaStyle;

            brushStyle.OutlinePen.Width = 0;
            brushStyle.Draw(new BaseShape[] { currentBoundingBox }, canvas, new Collection <SimpleCandidate>(), labelsInAllLayers);

            // Clear Cache images
            if (LastmapExtent != null)
            {
                if (LastmapExtent.UpperLeftPoint.X != MapExtent.UpperLeftPoint.X ||
                    LastmapExtent.UpperLeftPoint.Y != MapExtent.UpperLeftPoint.Y ||
                    LastmapExtent.LowerRightPoint.X != MapExtent.LowerRightPoint.X ||
                    LastmapExtent.LowerRightPoint.Y != MapExtent.LowerRightPoint.Y ||
                    IsDrawing)
                {
                    mapImageCache = null;
                }
            }

            //For adjusting the world extent of the map to the ratio of the drawing area.
            RectangleShape adjustedWorldExtent = ExtentHelper.GetDrawingExtent(MapExtent, (float)currentBoundingBox.Width, (float)currentBoundingBox.Height);
            RectangleShape boundingBox         = GetBoundingBox();
            PointShape     ajustedWorldCenter  = adjustedWorldExtent.GetCenterPoint();
            PageGeoCanvas  pageGeoCanvas       = new PageGeoCanvas(new RectangleShape(0, boundingBox.Height, boundingBox.Width, 0), currentBoundingBox);

            //if (EnableClipping)
            //{
            //    pageGeoCanvas.EnableCliping = true;
            //    pageGeoCanvas.ClipingArea = adjustedWorldExtent;
            //}

            //if (canvas is GdiPlusGeoCanvas && DrawingMode != Core.DrawingMode.Vector)
            // only display on map.
            if (DrawingMode != MapPrinterDrawingMode.Vector && !(canvas is PrinterGeoCanvas))
            {
                double   width  = boundingBox.Width / canvas.CurrentWorldExtent.Width * canvas.Width;
                double   height = boundingBox.Height / canvas.CurrentWorldExtent.Height * canvas.Height;
                GeoImage image  = GetCacheImage(pageGeoCanvas, canvas.MapUnit, adjustedWorldExtent, labelsInAllLayers, width, height);

                pageGeoCanvas.BeginDrawing(canvas, adjustedWorldExtent, MapUnit);
                if (image != null)
                {
                    pageGeoCanvas.DrawWorldImage(image, ajustedWorldCenter.X, ajustedWorldCenter.Y, (float)boundingBox.Width - 0.5f, (float)boundingBox.Height - 0.5f, DrawingLevel.LabelLevel);
                }
                if (DrawDescription)
                {
                    DrawDescriptionText(pageGeoCanvas);
                }
                //pageGeoCanvas.EnableCliping = false;
                pageGeoCanvas.EndDrawing();
            }
            // display on map or printer.
            else
            {
                pageGeoCanvas.BeginDrawing(canvas, adjustedWorldExtent, MapUnit);
                double increase = 0;
                if (BackgroundMask.OutlinePen != null)
                {
                    float haflPenWidth = BackgroundMask.OutlinePen.Width / 2;
                    increase = haflPenWidth * canvas.CurrentWorldExtent.Width / canvas.Width;
                }
                canvas.ClippingArea = new RectangleShape(
                    currentBoundingBox.UpperLeftPoint.X - increase,
                    currentBoundingBox.UpperLeftPoint.Y + increase,
                    currentBoundingBox.LowerRightPoint.X + increase,
                    currentBoundingBox.LowerRightPoint.Y - increase);
                if (canvas is PrinterGeoCanvas)
                {
                    foreach (Layer layer in Layers)
                    {
                        pageGeoCanvas.Flush();

                        float        savedDrawingMarginPercentage = 0;
                        FeatureLayer featureLayer = layer as FeatureLayer;
                        if (featureLayer != null)
                        {
                            savedDrawingMarginPercentage      = featureLayer.DrawingMarginInPixel;
                            featureLayer.DrawingMarginInPixel = 0;
                        }
                        layer.SafeProcess(() =>
                        {
                            layer.Draw(pageGeoCanvas, labelsInAllLayers);
                        });
                        if (featureLayer != null && savedDrawingMarginPercentage != 0)
                        {
                            featureLayer.DrawingMarginInPixel = savedDrawingMarginPercentage;
                        }
                    }
                }
                else
                {
                    using (MemoryStream ms = GetImageStream(canvas, labelsInAllLayers, adjustedWorldExtent, boundingBox))
                    {
                        pageGeoCanvas.DrawWorldImage(new GeoImage(ms), ajustedWorldCenter.X, ajustedWorldCenter.Y, (float)boundingBox.Width - 0.5f, (float)boundingBox.Height - 0.5f, DrawingLevel.LabelLevel);
                    }
                    //foreach (Layer layer in Layers)
                    //{
                    //    pageGeoCanvas.Flush();
                    //    layer.SafeProcess(() =>
                    //    {
                    //        layer.Draw(pageGeoCanvas, labelsInAllLayers);
                    //    });
                    //}
                }
                if (DrawDescription)
                {
                    DrawDescriptionText(pageGeoCanvas);
                }
                //pageGeoCanvas.EnableCliping = false;
                var areaStyle = new AreaStyle(BackgroundMask.OutlinePen)
                {
                    DrawingLevel = DrawingLevel.LabelLevel
                };
                areaStyle.Draw(new BaseShape[1] {
                    currentBoundingBox
                }, canvas, new Collection <SimpleCandidate>(), labelsInAllLayers);
                canvas.ClippingArea = null;
            }

            AreaStyle lineStyle = new AreaStyle(BackgroundMask.OutlinePen.CloneDeep());

            lineStyle.DrawingLevel = DrawingLevel.LabelLevel;
            lineStyle.Draw(new BaseShape[] { currentBoundingBox }, canvas, new Collection <SimpleCandidate>(), labelsInAllLayers);
            LastmapExtent = new RectangleShape(MapExtent.UpperLeftPoint.X, MapExtent.UpperLeftPoint.Y, MapExtent.LowerRightPoint.X, MapExtent.LowerRightPoint.Y);
        }
Ejemplo n.º 12
0
    private IEnumerator WaitForReward(GameObject reward, int exp)
    {
        Transform[] tfs = reward.GetComponentsInChildren <Transform>();
        foreach (Transform transform in tfs)
        {
            transform.gameObject.layer = LayerMask.NameToLayer("Default");
        }
        MeshRenderer[] mrs = reward.GetComponentsInChildren <MeshRenderer>();
        foreach (MeshRenderer meshRenderer in mrs)
        {
            meshRenderer.sortingLayerName = "Default";
            meshRenderer.sortingOrder     = 0;
        }
        reward.SetActive(false);
        float waitTime = 1f;

        while (waitTime > 0f)
        {
            waitTime -= Time.deltaTime;
            yield return(null);
        }
        reward.SetActive(true);
        waitTime = 6.18f;
        while (waitTime > 0f)
        {
            waitTime -= Time.deltaTime;
            yield return(null);
        }
        if (this.IsAlienMachine)
        {
            Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(this.gameData.commonAudioCollection.alienMachineReveal);
        }
        foreach (MeshRenderer meshRenderer2 in mrs)
        {
            meshRenderer2.sortingLayerName = "Popup";
            meshRenderer2.sortingOrder     = 0;
        }
        reward.transform.ResetPosition(TransformCategory.Axis.Z);
        BackgroundMask.Show(true, this, "Popup", null, Vector3.forward, true);
        ResourceBar.Instance.ShowItem(ResourceBar.Item.PlayerProgress, true, false);
        foreach (Transform transform2 in tfs)
        {
            transform2.gameObject.layer = LayerMask.NameToLayer("HUD");
        }
        yield return(new WaitForSeconds(2f));

        if (PlayerProgressBar.Instance)
        {
            PlayerProgressBar.Instance.AddParticles(reward, exp, 0f, 0f, delegate(bool active)
            {
                if (active)
                {
                    ResourceBar.Instance.ShowItem(ResourceBar.Item.PlayerProgress, true, true);
                }
            });
        }
        if (this.collectRewardButton != null)
        {
            this.collectRewardButton.SetActive(true);
        }
        EventManager.Connect(new EventManager.OnEvent <LevelUpEvent>(this.OnPlayerLevelUp));
        yield break;
    }
Ejemplo n.º 13
0
 private void OnDisable()
 {
     BackgroundMask.Show(false, this, string.Empty, null, default(Vector3), false);
 }
Ejemplo n.º 14
0
 private void OnEnable()
 {
     BackgroundMask.Show(true, this, this.sortingLayerName, base.transform, Vector3.zero, false);
 }