void InitMap()
 {
     if (!playerTransform)
     {
         hasMapInit = false;
         Debug.LogError("You must specify the player transform");
     }
     mapRect  = GetComponent <RectTransform> ();
     innerMap = GetComponentInChildren <InnerMap> ();
     if (!innerMap)
     {
         hasMapInit = false;
         Debug.LogError("InnerMap component is missing from children");
     }
     mapArrow = GetComponentInChildren <MapArrow> ();
     if (!mapArrow)
     {
         hasMapInit = false;
         Debug.LogError("MapArrow component is missing from children");
     }
     markerGroup = GetComponentInChildren <MarkerGroup> ();
     if (!markerGroup)
     {
         hasMapInit = false;
         Debug.LogError("MerkerGroup component is missing. It must be a child of InnerMap");
     }
     innerMapRadius = innerMap.getMapRadius();
 }
Example #2
0
    private void Awake()
    {
        if (!GameManager.Instance)
        {
            FindObjectOfType <GameManager>().Initialize();
        }
        this.playerTransform = GameManager.Instance.Player.transform;
        if (!playerTransform)
        {
            Debug.LogError("You must specify the player transform");
        }

        mapRect = GetComponent <RectTransform>();

        innerMap = GetComponentInChildren <InnerMap>();
        if (!innerMap)
        {
            Debug.LogError("InnerMap component is missing from children");
        }

        mapArrow = GetComponentInChildren <MapArrow>();
        if (!mapArrow)
        {
            Debug.LogError("MapArrow component is missing from children");
        }

        markerGroup = GetComponentInChildren <MarkerGroup>();
        if (!markerGroup)
        {
            Debug.LogError("MerkerGroup component is missing. It must be a child of InnerMap");
        }

        innerMapRadius = innerMap.getMapRadius();
    }
Example #3
0
 public void TestGetConfigName01()
 {
     using (MarkerGroup markerGroup = MarkerGroupFactory.CreateMarkerGroup01())
     {
         string str = markerGroup.GetConfigName();
     }
 }
Example #4
0
    void Awake()
    {
        if (!playerTransform)
        {
            playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
            Debug.LogError("You must specify the player transform");
        }

        mapRect = GetComponent <RectTransform>();

        innerMap = GetComponentInChildren <InnerMap>();
        if (!innerMap)
        {
            Debug.LogError("InnerMap component is missing from children");
        }

        mapArrow = GetComponentInChildren <MapArrow>();
        if (!mapArrow)
        {
            Debug.LogError("MapArrow component is missing from children");
        }

        markerGroup = GetComponentInChildren <MarkerGroup>();
        if (!markerGroup)
        {
            Debug.LogError("MerkerGroup component is missing. It must be a child of InnerMap");
        }

        innerMapRadius = innerMap.getMapRadius();
    }
        private void GroupMarkers()
        {
            List <MarkerGroup> groups = new List <MarkerGroup>();

            for (int zoom = OnlineMaps.MAXZOOM; zoom >= 3; zoom--)
            {
                List <OnlineMapsMarker> ms = markers.Select(m => m).ToList();

                for (int j = 0; j < ms.Count - 1; j++)
                {
                    OnlineMapsMarker marker = ms[j];
                    MarkerGroup      group = null;
                    double           px, py;
                    marker.GetPosition(out px, out py);
                    OnlineMaps.instance.projection.CoordinatesToTile(px, py, zoom, out px, out py);

                    int k = j + 1;

                    while (k < ms.Count)
                    {
                        OnlineMapsMarker marker2 = ms[k];

                        double p2x, p2y;
                        marker2.GetPosition(out p2x, out p2y);
                        OnlineMaps.instance.projection.CoordinatesToTile(p2x, p2y, zoom, out p2x, out p2y);

                        if (OnlineMapsUtils.Magnitude(px, py, p2x, p2y) < distance)
                        {
                            if (group == null)
                            {
                                group = new MarkerGroup(zoom, groupTexture);
                                groups.Add(group);
                                group.Add(marker);
                                if (marker.range.min == 3)
                                {
                                    marker.range.min = zoom + 1;
                                }
                            }
                            group.Add(marker2);
                            if (marker2.range.min == 3)
                            {
                                marker2.range.min = zoom + 1;
                            }
                            ms.RemoveAt(k);
                            px = group.tilePositionX;
                            py = group.tilePositionY;
                        }
                        else
                        {
                            k++;
                        }
                    }
                }
            }

            foreach (MarkerGroup g in groups)
            {
                g.Apply(font);
            }
        }
Example #6
0
        public void Read(IMetaNode[] mode, string TagPath)
        {
            // Read the Compression Info
            IMetaNode[] Fields = (IMetaNode[])mode[4].GetValue();
            CompressionInfo.Read(Fields);

            // Regions
            Regions = new Region[((H2XTagBlock)mode[5]).GetChunkCount()];
            for (int i = 0; i < Regions.Length; i++)
            {
                ((H2XTagBlock)mode[5]).ChangeIndex(i);
                Fields     = (IMetaNode[])mode[5].GetValue();
                Regions[i] = new Region();
                Regions[i].Read(Fields);
            }

            // Sections
            Sections = new Section[((H2XTagBlock)mode[6]).GetChunkCount()];
            for (int i = 0; i < Sections.Length; i++)
            {
                ((H2XTagBlock)mode[6]).ChangeIndex(i);
                Fields      = (IMetaNode[])mode[6].GetValue();
                Sections[i] = new Section();
                Sections[i].Read(Fields, TagPath, CompressionInfo);
            }

            // Nodes
            Nodes = new Node[((H2XTagBlock)mode[15]).GetChunkCount()];
            for (int i = 0; i < Nodes.Length; i++)
            {
                ((H2XTagBlock)mode[15]).ChangeIndex(i);
                Fields   = (IMetaNode[])mode[15].GetValue();
                Nodes[i] = new Node();
                Nodes[i].Read(Fields);
            }

            // Markers
            Markers = new MarkerGroup[((H2XTagBlock)mode[17]).GetChunkCount()];
            for (int i = 0; i < Markers.Length; i++)
            {
                ((H2XTagBlock)mode[17]).ChangeIndex(i);
                Fields     = (IMetaNode[])mode[17].GetValue();
                Markers[i] = new MarkerGroup();
                Markers[i].Read(Fields);
            }

            // Materials
            Materials = new Portal.Model.Material[((H2XTagBlock)mode[18]).GetChunkCount()];
            for (int i = 0; i < Materials.Length; i++)
            {
                ((H2XTagBlock)mode[18]).ChangeIndex(i);
                Fields       = (IMetaNode[])mode[18].GetValue();
                Materials[i] = new Portal.Model.Material();
                Materials[i].Read(Fields);
            }

            // Object Properties
            //hlmt = new ObjectProperties(TagPath);
        }
Example #7
0
 public void TestSetCurrentGrpName01()
 {
     using (MarkerGroup markerGroup = MarkerGroupFactory.CreateMarkerGroup01())
     {
         string grpName = string.Empty;
         markerGroup.SetCurrentGrpName(grpName);
     }
 }
Example #8
0
 public void TestSetFormType01()
 {
     using (MarkerGroup markerGroup = MarkerGroupFactory.CreateMarkerGroup01())
     {
         FormType type = FormType.Edit;
         markerGroup.SetFormType(type);
     }
 }
Example #9
0
 public void TestInitializeComponent01()
 {
     using (MarkerGroup markerGroup = MarkerGroupFactory.CreateMarkerGroup01())
     {
         Accessor markerGroupAccessor = ReflectionAccessor.Wrap(markerGroup);
         markerGroupAccessor.Call("InitializeComponent");
     }
 }
Example #10
0
 public void TestDispose01()
 {
     using (MarkerGroup markerGroup = MarkerGroupFactory.CreateMarkerGroup01())
     {
         bool     disposing           = true;
         Accessor markerGroupAccessor = ReflectionAccessor.Wrap(markerGroup);
         markerGroupAccessor.SetField("components", new System.ComponentModel.Container());
         markerGroupAccessor.Call("Dispose", disposing);
     }
 }
Example #11
0
 public void TestTranslateCaption01()
 {
     using (MarkerGroup markerGroup = MarkerGroupFactory.CreateMarkerGroup01())
     {
         markerGroup.SetFormType(FormType.Load);
         markerGroup.TranslateCaption();
         markerGroup.SetFormType(FormType.Save);
         markerGroup.TranslateCaption();
     }
 }
Example #12
0
        private void GroupMarkers()
        {
            List <MarkerGroup> groups = new List <MarkerGroup>();

            for (int zoom = 20; zoom >= 3; zoom--)
            {
                List <OnlineMapsMarker> ms = markers.Select(m => m).ToList();

                for (int j = 0; j < ms.Count - 1; j++)
                {
                    OnlineMapsMarker marker = ms[j];
                    MarkerGroup      group  = null;
                    Vector2          pos    = OnlineMapsUtils.LatLongToTilef(marker.position, zoom);

                    int k = j + 1;

                    while (k < ms.Count)
                    {
                        OnlineMapsMarker marker2 = ms[k];
                        Vector2          pos2    = OnlineMapsUtils.LatLongToTilef(marker2.position, zoom);
                        if ((pos - pos2).magnitude < distance)
                        {
                            if (group == null)
                            {
                                group = new MarkerGroup(zoom, groupTexture);
                                groups.Add(group);
                                group.Add(marker);
                                if (marker.range.min == 3)
                                {
                                    marker.range.min = zoom + 1;
                                }
                            }
                            group.Add(marker2);
                            if (marker2.range.min == 3)
                            {
                                marker2.range.min = zoom + 1;
                            }
                            ms.RemoveAt(k);
                            pos = group.tilePosition;
                        }
                        else
                        {
                            k++;
                        }
                    }
                }
            }

            foreach (MarkerGroup g in groups)
            {
                g.Apply(font);
            }
        }
    public void Load()
    {
        if (!playerTransform)
        {
            if (Camera.main.GetComponent <vThirdPersonCamera>().target == null)
            {
                if (GameController.Instance.IsMultyPlayer())
                {
                    this.gameObject.SetActive(false);
                    return;
                }
            }
            else
            {
                playerTransform = Camera.main.GetComponent <vThirdPersonCamera>().target.transform;
            }
        }

        if (!playerTransform)
        {
            Debug.LogError("You must specify the player transform");
        }

        mapRect = GetComponent <RectTransform>();

        innerMap = GetComponentInChildren <InnerMap>();
        if (!innerMap)
        {
            Debug.LogError("InnerMap component is missing from children");
        }

        mapArrow = GetComponentInChildren <MapArrow>();
        if (!mapArrow)
        {
            Debug.LogError("MapArrow component is missing from children");
        }

        markerGroup = GetComponentInChildren <MarkerGroup>();
        if (!markerGroup)
        {
            Debug.LogError("MerkerGroup component is missing. It must be a child of InnerMap");
        }

        innerMapRadius = innerMap.getMapRadius();
    }
        private void GroupMarkers()
        {
            List<MarkerGroup> groups = new List<MarkerGroup>();

            for (int zoom = 20; zoom >= 3; zoom--)
            {
                List<OnlineMapsMarker> ms = markers.Select(m => m).ToList();

                for (int j = 0; j < ms.Count - 1; j++)
                {
                    OnlineMapsMarker marker = ms[j];
                    MarkerGroup group = null;
                    Vector2 pos = OnlineMapsUtils.LatLongToTilef(marker.position, zoom);

                    int k = j + 1;

                    while (k < ms.Count)
                    {
                        OnlineMapsMarker marker2 = ms[k];
                        Vector2 pos2 = OnlineMapsUtils.LatLongToTilef(marker2.position, zoom);
                        if ((pos - pos2).magnitude < distance)
                        {
                            if (group == null)
                            {
                                group = new MarkerGroup(zoom, groupTexture);
                                groups.Add(group);
                                group.Add(marker);
                                if (marker.range.min == 3) marker.range.min = zoom + 1;
                            }
                            group.Add(marker2);
                            if (marker2.range.min == 3) marker2.range.min = zoom + 1;
                            ms.RemoveAt(k);
                            pos = group.tilePosition;
                        }
                        else k++;
                    }
                }
            }

            foreach (MarkerGroup g in groups) g.Apply(font);
        }
Example #15
0
 public void TestCreateMarkerGroup01()
 {
     using (MarkerGroup markerGroup = CreateMarkerGroup01())
     {
         Assert.IsNotNull(markerGroup);
         #region Record State
         ValueRecorder recorder = new ValueRecorder();
         recorder.Record((string)markerGroup.AccessibleDefaultActionDescription);
         recorder.Record((string)markerGroup.AccessibleDescription);
         recorder.Record((string)markerGroup.AccessibleName);
         recorder.Record((AccessibleRole)markerGroup.AccessibleRole);
         recorder.Record((bool)markerGroup.AllowDrop);
         recorder.Record((bool)markerGroup.AllowTransparency);
         recorder.Record((AnchorStyles)markerGroup.Anchor);
         recorder.Record((AutoScaleMode)markerGroup.AutoScaleMode);
         recorder.Record((bool)markerGroup.AutoScroll);
         recorder.Record((bool)markerGroup.AutoSize);
         recorder.Record((AutoSizeMode)markerGroup.AutoSizeMode);
         recorder.Record((AutoValidate)markerGroup.AutoValidate);
         recorder.Record((ImageLayout)markerGroup.BackgroundImageLayout);
         recorder.Record((int)markerGroup.Bottom);
         recorder.Record((bool)markerGroup.CanFocus);
         recorder.Record((bool)markerGroup.CanSelect);
         recorder.Record((bool)markerGroup.Capture);
         recorder.Record((bool)markerGroup.CausesValidation);
         recorder.Record((string)markerGroup.CompanyName);
         recorder.Record((bool)markerGroup.ContainsFocus);
         recorder.Record((bool)markerGroup.ControlBox);
         recorder.Record((bool)markerGroup.Created);
         recorder.Record((DialogResult)markerGroup.DialogResult);
         recorder.Record((bool)markerGroup.Disposing);
         recorder.Record((DockStyle)markerGroup.Dock);
         recorder.Record((bool)markerGroup.Enabled);
         recorder.Record((bool)markerGroup.Focused);
         recorder.Record((FormBorderStyle)markerGroup.FormBorderStyle);
         recorder.Record((bool)markerGroup.HasChildren);
         recorder.Record((int)markerGroup.Height);
         recorder.Record((bool)markerGroup.HelpButton);
         recorder.Record((ImeMode)markerGroup.ImeMode);
         recorder.Record((bool)markerGroup.InvokeRequired);
         recorder.Record((bool)markerGroup.IsAccessible);
         recorder.Record((bool)markerGroup.IsDisposed);
         recorder.Record((bool)markerGroup.IsHandleCreated);
         recorder.Record((bool)markerGroup.IsMdiChild);
         recorder.Record((bool)markerGroup.IsMdiContainer);
         recorder.Record((bool)markerGroup.IsMirrored);
         recorder.Record((bool)markerGroup.IsRestrictedWindow);
         recorder.Record((bool)markerGroup.KeyPreview);
         recorder.Record((int)markerGroup.Left);
         recorder.Record((bool)markerGroup.MaximizeBox);
         recorder.Record((bool)markerGroup.MinimizeBox);
         recorder.Record((bool)markerGroup.Modal);
         recorder.Record((string)markerGroup.Name);
         recorder.Record((double)markerGroup.Opacity);
         recorder.Record((string)markerGroup.ProductName);
         recorder.Record((string)markerGroup.ProductVersion);
         recorder.Record((bool)markerGroup.RecreatingHandle);
         recorder.Record((int)markerGroup.Right);
         recorder.Record((RightToLeft)markerGroup.RightToLeft);
         recorder.Record((bool)markerGroup.RightToLeftLayout);
         recorder.Record((bool)markerGroup.ShowIcon);
         recorder.Record((bool)markerGroup.ShowInTaskbar);
         recorder.Record((SizeGripStyle)markerGroup.SizeGripStyle);
         recorder.Record((FormStartPosition)markerGroup.StartPosition);
         recorder.Record((bool)ReflectionAccessor.Wrap(markerGroup).GetProperty("System.Windows.Forms.Layout.IArrangedElement.ParticipatesInLayout"));
         recorder.Record((int)markerGroup.TabIndex);
         recorder.Record((bool)markerGroup.TabStop);
         recorder.Record((string)markerGroup.Text);
         recorder.Record((int)markerGroup.Top);
         recorder.Record((bool)markerGroup.TopLevel);
         recorder.Record((bool)markerGroup.TopMost);
         recorder.Record((bool)markerGroup.UseWaitCursor);
         recorder.Record((string)markerGroup.ViewID);
         recorder.Record((string)markerGroup.ViewType);
         recorder.Record((bool)markerGroup.Visible);
         recorder.Record((int)markerGroup.Width);
         recorder.Record((FormWindowState)markerGroup.WindowState);
         recorder.FinishRecording();
         #endregion
         #region Assertions
         Assert.IsNull((string)markerGroup.AccessibleDefaultActionDescription);
         Assert.IsFalse((bool)markerGroup.AllowDrop);
         Assert.AreEqual(global::System.Windows.Forms.AutoScaleMode.Font, (AutoScaleMode)markerGroup.AutoScaleMode);
         Assert.AreEqual(global::System.Windows.Forms.AutoValidate.EnablePreventFocusChange, (AutoValidate)markerGroup.AutoValidate);
         Assert.IsFalse((bool)markerGroup.CanFocus);
         Assert.AreEqual("ST Electronics Ltd", (string)markerGroup.CompanyName);
         Assert.IsFalse((bool)markerGroup.Created);
         Assert.IsTrue((bool)markerGroup.Enabled);
         Assert.IsTrue((bool)markerGroup.HasChildren);
         Assert.IsFalse((bool)markerGroup.InvokeRequired);
         Assert.IsFalse((bool)markerGroup.IsHandleCreated);
         Assert.IsFalse((bool)markerGroup.IsRestrictedWindow);
         Assert.IsFalse((bool)markerGroup.MaximizeBox);
         Assert.AreEqual(1.0, (double)markerGroup.Opacity, 1E-7);
         Assert.IsFalse((bool)markerGroup.RecreatingHandle);
         Assert.IsTrue((bool)markerGroup.ShowIcon);
         Assert.AreEqual(global::System.Windows.Forms.FormStartPosition.CenterScreen, (FormStartPosition)markerGroup.StartPosition);
         Assert.AreEqual("Load Marker Configuration", (string)markerGroup.Text);
         Assert.IsFalse((bool)markerGroup.TopMost);
         Assert.IsFalse((bool)markerGroup.Visible);
         #endregion
     }
 }
Example #16
0
        public static MarkerGroup CreateMarkerGroup01()
        {
            MarkerGroup markerGroup = new MarkerGroup();

            return(markerGroup);
        }
    void Awake()
    {
        if (!playerTransform)
        {
            Debug.LogError("You must specify the player transform");
        }

        mapRect = GetComponent<RectTransform>();

        innerMap = GetComponentInChildren<InnerMap>();
        if (!innerMap)
        {
            Debug.LogError("InnerMap component is missing from children");
        }

        mapArrow = GetComponentInChildren<MapArrow>();
        if (!mapArrow)
        {
            Debug.LogError("MapArrow component is missing from children");
        }

        markerGroup = GetComponentInChildren<MarkerGroup>();
        if (!markerGroup)
        {
            Debug.LogError("MerkerGroup component is missing. It must be a child of InnerMap");
        }

        innerMapRadius = innerMap.getMapRadius();
    }
Example #18
0
 public void FixtureSetUp()
 {
     markerGroup = new MarkerGroup();
 }