Exemplo n.º 1
0
 private void Update()
 {
     this.CheckUserInput();
     if ((this.isEnabled || this.isEnabledTemp) && this.minimapIsCreated && this.minimapIcons != null)
     {
         for (int i = 0; i < this.minimapIcons.Length; i++)
         {
             Minimap.MinimapIcon minimapIcon = this.minimapIcons[i];
             bool flag2 = minimapIcon == null;
             if (flag2)
             {
                 Anarchy.AnarchyExtensions.RemoveAt <Minimap.MinimapIcon>(ref this.minimapIcons, i);
             }
             else
             {
                 bool flag3 = !minimapIcon.UpdateUI(this.minimapOrthographicBounds, this.maximized ? ((float)this.MINIMAP_SIZE) : this.MINIMAP_CORNER_SIZE);
                 if (flag3)
                 {
                     minimapIcon.Destroy();
                     Anarchy.AnarchyExtensions.RemoveAt <Minimap.MinimapIcon>(ref this.minimapIcons, i);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private void TrackGameObject(GameObject objToTrack, Color iconColor, bool trackOrientation, bool depthAboveAll = false, Minimap.IconStyle iconStyle = Minimap.IconStyle.Circle)
 {
     if (minimap != null)
     {
         Minimap.MinimapIcon minimapIcon;
         if (trackOrientation)
         {
             minimapIcon = Minimap.MinimapIcon.CreateWithRotation(this.minimap, objToTrack, iconStyle, this.MINIMAP_POINTER_DIST);
         }
         else
         {
             minimapIcon = Minimap.MinimapIcon.Create(this.minimap, objToTrack, iconStyle);
         }
         minimapIcon.SetColor(iconColor);
         minimapIcon.SetDepth(depthAboveAll);
         Vector2 sizeForStyle = this.GetSizeForStyle(iconStyle);
         if (this.maximized)
         {
             minimapIcon.SetSize(sizeForStyle);
             if (minimapIcon.Rotation)
             {
                 minimapIcon.SetPointerSize(this.MINIMAP_POINTER_SIZE, this.MINIMAP_POINTER_DIST);
             }
         }
         else
         {
             float num = 1f - ((float)this.MINIMAP_SIZE - this.MINIMAP_CORNER_SIZE) / (float)this.MINIMAP_SIZE;
             sizeForStyle.x = Mathf.Max(sizeForStyle.x * num, sizeForStyle.x * 0.5f);
             sizeForStyle.y = Mathf.Max(sizeForStyle.y * num, sizeForStyle.y * 0.5f);
             minimapIcon.SetSize(sizeForStyle);
             if (minimapIcon.Rotation)
             {
                 float num2 = this.MINIMAP_POINTER_SIZE * num;
                 num2 = Mathf.Max(num2, this.MINIMAP_POINTER_SIZE * 0.5f);
                 float num3 = (this.MINIMAP_POINTER_SIZE - num2) / this.MINIMAP_POINTER_SIZE;
                 num3 = this.MINIMAP_POINTER_DIST * num3;
                 minimapIcon.SetPointerSize(num2, num3);
             }
         }
         if (this.minimapIcons == null)
         {
             this.minimapIcons = new MinimapIcon[] { minimapIcon };
         }
         else
         {
             Minimap.MinimapIcon[] array = new Minimap.MinimapIcon[this.minimapIcons.Length + 1];
             for (int i = 0; i < this.minimapIcons.Length; i++)
             {
                 array[i] = this.minimapIcons[i];
             }
             array[array.Length - 1] = minimapIcon;
             this.minimapIcons       = array;
         }
     }
 }