Exemple #1
0
 private void OnDestroy()
 {
     if (!MenuMain.exitingToMenu)
     {
         OverlayIconManager.Unregister(this);
     }
 }
Exemple #2
0
            public void Update(bool checkGroup, float breakGroupExpandDuration)
            {
                bool flag  = LocalPlayer.Inventory && LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.World && Scene.Atmosphere;
                bool flag2 = PlayerPreferences.ShowOverlayIcons && flag;

                for (int i = 0; i < this._iconGroups.Count; i++)
                {
                    if (this._iconGroups[i].BreakGroupAlpha < 1f)
                    {
                        this._iconGroups[i].BreakGroupAlpha = Mathf.Clamp01(this._iconGroups[i].BreakGroupAlpha + Time.deltaTime / breakGroupExpandDuration);
                    }
                }
                for (int j = 0; j < this._iconSuperGroups.Count; j++)
                {
                    if (this._iconSuperGroups[j].BreakSuperGroupAlpha < 1f)
                    {
                        this._iconSuperGroups[j].BreakSuperGroupAlpha = Mathf.Clamp01(this._iconSuperGroups[j].BreakSuperGroupAlpha + Time.deltaTime / breakGroupExpandDuration);
                    }
                }
                for (int k = 0; k < this._icons.Count; k++)
                {
                    OverlayIcon overlayIcon = this._icons[k];
                    bool        flag3       = flag2;
                    if (flag2)
                    {
                        flag3 = (overlayIcon.IgnoreInCaveStatus || LocalPlayer.IsInCaves == overlayIcon.IsInCaves);
                    }
                    if (checkGroup && flag3)
                    {
                        if (overlayIcon.GroupDisplay)
                        {
                            flag3 = (overlayIcon.SuperGroupDisplay || overlayIcon.CurrentSuperGroup.BreakSuperGroup);
                        }
                        else if (overlayIcon.CurrentGroup.SuperGroupDisplay)
                        {
                            flag3 = (overlayIcon.CurrentGroup.BreakSuperGroup && overlayIcon.CurrentGroup.BreakGroup);
                        }
                        else
                        {
                            flag3 = (overlayIcon.CurrentGroup.CurrentSuperGroup.BreakSuperGroup && overlayIcon.CurrentGroup.BreakGroup);
                        }
                    }
                    if (flag3 && overlayIcon.ShouldRefreshTargetPosition)
                    {
                        if (!overlayIcon.target)
                        {
                            OverlayIconManager.Unregister(overlayIcon);
                            return;
                        }
                        overlayIcon.FinalTargetPosition = overlayIcon.target.position;
                    }
                    if (flag3 || overlayIcon._showing != flag3)
                    {
                        overlayIcon.DoUpdate(flag3, checkGroup);
                    }
                }
            }
Exemple #3
0
 private void Start()
 {
     if (this.ID == 0)
     {
         Vector3 worldPosition = (!this.target) ? ((!base.transform.parent) ? base.transform.position : base.transform.parent.position) : this.target.position;
         float   num           = Terrain.activeTerrain.SampleHeight(worldPosition) + Terrain.activeTerrain.transform.position.y - 3f;
         this.IsInCaves = (worldPosition.y < num);
     }
     this.IgnoreInCaveStatus = Scene.IsInSinkhole((!base.transform.parent) ? base.transform.position : base.transform.parent.position);
     this.ToggleIcons(false);
     if (this._type == OverlayIconTypes.Hammer)
     {
         OverlayIconManager.Register(this);
     }
 }
Exemple #4
0
 public void SetSubType(int subtype)
 {
     if (this._subtype != subtype)
     {
         if (this.ID == 0)
         {
             this.ID = OverlayIconManager.GetNewId();
             Vector3 worldPosition = (!this.target) ? ((!base.transform.parent) ? base.transform.position : base.transform.parent.position) : this.target.position;
             float   num           = Terrain.activeTerrain.SampleHeight(worldPosition) + Terrain.activeTerrain.transform.position.y - 3f;
             this.IsInCaves = (worldPosition.y < num);
         }
         OverlayIconManager.Unregister(this);
         this._subtype = subtype;
         OverlayIconManager.Register(this);
     }
 }
Exemple #5
0
 public static void Register(OverlayIcon oi)
 {
     if (!CoopPeerStarter.DedicatedHost)
     {
         if (OverlayIconManager.Instance)
         {
             if (!oi.GetComponentInParent <Rigidbody>())
             {
                 if (oi.ID == 0)
                 {
                     oi.ID = OverlayIconManager.GetNewId();
                 }
                 while (OverlayIconManager._instance._icons.Count <= oi.Type)
                 {
                     OverlayIconManager._instance._icons.Add(null);
                 }
                 if (OverlayIconManager._instance._icons[oi.Type] == null)
                 {
                     OverlayIconManager._instance._icons[oi.Type] = new OverlayIconManager.OverlayIconType();
                 }
                 if (oi.DistanceToOtherIcons == null)
                 {
                     oi.DistanceToOtherIcons = new Dictionary <int, float>();
                     oi.TargetPosition       = oi.target.position;
                 }
                 if (oi.Type != 0 && oi.Type != 6)
                 {
                     for (int i = 0; i < OverlayIconManager._instance._icons[oi.Type]._icons.Count; i++)
                     {
                         OverlayIcon overlayIcon = OverlayIconManager._instance._icons[oi.Type]._icons[i];
                         float       num         = Vector3.Distance(oi.TargetPosition, overlayIcon.TargetPosition);
                         oi.DistanceToOtherIcons.Add(overlayIcon.ID, num);
                         overlayIcon.DistanceToOtherIcons.Add(oi.ID, num);
                         if (num < OverlayIconManager._instance._groupingRange)
                         {
                             oi.InGroupingRangeIcons++;
                             overlayIcon.InGroupingRangeIcons++;
                         }
                         if (num < OverlayIconManager._instance._superGroupingRange)
                         {
                             oi.InSuperGroupingRangeIcons++;
                             overlayIcon.InSuperGroupingRangeIcons++;
                         }
                     }
                     OverlayIconManager._instance._icons[oi.Type]._icons.Add(oi);
                     OverlayIconManager._instance._icons[oi.Type].ProcessGroups(OverlayIconManager._instance._groupingRange, OverlayIconManager._instance._superGroupingRange);
                 }
                 else
                 {
                     OverlayIconManager._instance._icons[oi.Type]._icons.Add(oi);
                 }
             }
             else
             {
                 OverlayIconManager._instance._dynamicIcons._icons.Add(oi);
                 oi.ShouldRefreshTargetPosition = true;
                 oi.BreakGroupAlpha             = 1f;
                 oi.BreakSuperGroupAlpha        = 1f;
                 oi.CurrentGroup = oi;
                 if (oi.target == oi.transform)
                 {
                     oi.target = oi.transform.parent;
                 }
             }
         }
     }
     else
     {
         oi.DoUpdate(false, false);
     }
 }