Exemplo n.º 1
0
    public void AddList()
    {
        manager.ResetFileStatus();

        int count = manager.xmlDic.Count;

        count++;

        string title = "noname";

        title = title + count;

        for (int i = 0; i < manager.xmlArrayList.Count; i++)
        {
            Xml_Manager.XmlMarker tmp_xmlData = manager.xmlArrayList [i] as Xml_Manager.XmlMarker;
            if (tmp_xmlData.locationName == title)
            {
                title = title + "_";
            }
        }

        XML_Data xmldata = new XML_Data();

        manager.xmlArrayList.Add(xmldata.Default(title));

        manager.xmlDic = new Dictionary <string, int> ();

        for (int i = 0; i < manager.xmlArrayList.Count; i++)
        {
            Xml_Manager.XmlMarker tmp_xmlData = manager.xmlArrayList [i] as Xml_Manager.XmlMarker;
            manager.xmlDic.Add(tmp_xmlData.locationName, i);
        }
    }
Exemplo n.º 2
0
    public void Sample()
    {
        manager = GameObject.Find("Manager").GetComponent <Xml_Manager> ();

        if (GUILayout.Button("Sample", GUILayout.Height(30), GUILayout.Width(100f)))
        {
            manager.ListClear();
            manager.ResetFileStatus();
            manager.selectedMark = "";

            XML_Data xmldata = new XML_Data();
            for (int i = 0; i < xmldata.Sample().Count; i++)
            {
                manager.xmlArrayList.Add(xmldata.Sample() [i]);
            }

            manager.xmlDic = new Dictionary <string, int> ();

            for (int i = 0; i < manager.xmlArrayList.Count; i++)
            {
                Xml_Manager.XmlMarker tmp_xmlData = manager.xmlArrayList [i] as Xml_Manager.XmlMarker;
                manager.xmlDic.Add(tmp_xmlData.locationName, i);
            }
        }
    }
Exemplo n.º 3
0
    public Xml_Manager.XmlMarker Default(string title)
    {
        Xml_Manager.XmlMarker xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = title;
        xmlData.coordinate_x       = "0";
        xmlData.coordinate_y       = "0";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = 0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.normalColor_r      = 128;
        xmlData.normalColor_g      = 128;
        xmlData.normalColor_b      = 128;
        xmlData.normalColor_a      = 128;
        xmlData.textShow           = true;
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38;
        xmlData.textColor_g        = 38;
        xmlData.textColor_b        = 38;
        xmlData.textColor_a        = 255;
        return(xmlData);
    }
Exemplo n.º 4
0
    void LoadData()
    {
        Xml_Manager manager = GameObject.Find("Manager").GetComponent <Xml_Manager> ();

        FileName = EditorUtility.OpenFilePanel("XML Maker", "Assets/MapToolkit_2.0/Temp/XmlData", "xml");

        if (FileName == null || FileName == "")
        {
            manager.LoadFileStatus((int)FileStatus.Cancel);
            return;
        }
        else
        {
            manager.ListClear();
            manager.ResetFileStatus();
        }

        XML_Mark_Container xmlMarkCollection = XML_Mark_Container.Load(FileName);

        for (int i = 0; i < xmlMarkCollection.XML_Marks.Length; i++)
        {
            Xml_Manager.XmlMarker xmlData = new Xml_Manager.XmlMarker();

            xmlData.locationName = xmlMarkCollection.XML_Marks [i].Name;
            xmlData.coordinate_x = xmlMarkCollection.XML_Marks [i].coordinate_x;
            xmlData.coordinate_y = xmlMarkCollection.XML_Marks [i].coordinate_y;

            xmlData.normalPixelInset_x = xmlMarkCollection.XML_Marks [i].normalPixelInset_x;
            xmlData.normalPixelInset_y = xmlMarkCollection.XML_Marks [i].normalPixelInset_y;
            xmlData.normalPixelInset_w = xmlMarkCollection.XML_Marks [i].normalPixelInset_w;
            xmlData.normalPixelInset_h = xmlMarkCollection.XML_Marks [i].normalPixelInset_h;


            xmlData.normalSprite  = xmlMarkCollection.XML_Marks [i].normalSprite;
            xmlData.normalColor_r = xmlMarkCollection.XML_Marks [i].normalColor_r;
            xmlData.normalColor_g = xmlMarkCollection.XML_Marks [i].normalColor_g;
            xmlData.normalColor_b = xmlMarkCollection.XML_Marks [i].normalColor_b;
            xmlData.normalColor_a = xmlMarkCollection.XML_Marks [i].normalColor_a;

            xmlData.hoverSprite  = xmlMarkCollection.XML_Marks [i].hoverSprite;
            xmlData.activeSprite = xmlMarkCollection.XML_Marks [i].activeSprite;

            xmlData.textPixelInset_x = xmlMarkCollection.XML_Marks [i].textPixelInset_x;
            xmlData.textPixelInset_y = xmlMarkCollection.XML_Marks [i].textPixelInset_y;

            xmlData.textFontSize = xmlMarkCollection.XML_Marks [i].textFontSize;
            xmlData.textShow     = xmlMarkCollection.XML_Marks [i].textShow;

            xmlData.textColor_r = xmlMarkCollection.XML_Marks [i].textColor_r;
            xmlData.textColor_g = xmlMarkCollection.XML_Marks [i].textColor_g;
            xmlData.textColor_b = xmlMarkCollection.XML_Marks [i].textColor_b;
            xmlData.textColor_a = xmlMarkCollection.XML_Marks [i].textColor_a;


            manager.xmlArrayList.Add(xmlData);
        }

        Xml_Manager.XmlMarker tmp_xmlData2 = manager.xmlArrayList [0] as Xml_Manager.XmlMarker;

        manager.selection        = tmp_xmlData2.locationName;
        manager.selection_number = 0;
        manager.SelectMarkClear();
        manager.selectedMark = "";

        manager.LoadFileStatus((int)FileStatus.Success);
    }
Exemplo n.º 5
0
    public void ItemList()
    {
        Xml_Manager manager = GameObject.Find("Manager").GetComponent <Xml_Manager> ();

        if (manager.xmlArrayList.Count > 0 && manager.xmlArrayList != null)
        {
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(3f);
                GUILayout.BeginVertical();

                mScroll = GUILayout.BeginScrollView(mScroll);

                bool delete = false;
                int  index  = 0;

                for (int k = 0; k < manager.xmlArrayList.Count; k++)
                {
                    Xml_Manager.XmlMarker tmp_xmlData = manager.xmlArrayList [k] as  Xml_Manager.XmlMarker;
                    ++index;
                    GUILayout.Space(-1f);

                    bool highlight = (manager.selectedMark == tmp_xmlData.locationName);

                    GUI.backgroundColor = highlight ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                    GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
                    GUI.backgroundColor = Color.white;
                    GUILayout.Label(index.ToString(), GUILayout.Width(24f));


                    if (GUILayout.Button(tmp_xmlData.locationName, "OL TextField", GUILayout.Height(20f)))
                    {
                        manager.selection        = tmp_xmlData.locationName;
                        manager.selection_number = k;

                        manager.selectListIndex = k;

                        manager.SelectMark(manager.selection, manager.selection_number);
                    }


                    if (mDelValues.Contains(k))
                    {
                        GUI.backgroundColor = Color.red;

                        if (GUILayout.Button("OK", GUILayout.Width(30f)))
                        {
                            delete = true;
                        }
                        GUI.backgroundColor = Color.green;
                        if (GUILayout.Button("Delete", GUILayout.Width(50f)))
                        {
                            mDelNames.Remove(tmp_xmlData.locationName);
                            mDelValues.Remove(k);
                            delete = false;
                        }
                        GUI.backgroundColor = Color.white;
                    }
                    else
                    {
                        if (GUILayout.Button("Delete", GUILayout.Width(50f)))
                        {
                            mDelNames.Add(tmp_xmlData.locationName);
                            mDelValues.Add(k);
                        }
                    }

                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
                GUILayout.EndVertical();
                GUILayout.Space(3f);
                GUILayout.EndHorizontal();

                // If this sprite was marked for deletion, remove it from the atlas
                if (delete)
                {
                    for (int i = 0; i < mDelNames.Count; i++)
                    {
                        for (int j = 0; j < manager.xmlArrayList.Count; j++)
                        {
                            Xml_Manager.XmlMarker tmp_xmlData = manager.xmlArrayList [j] as  Xml_Manager.XmlMarker;
                            if (tmp_xmlData.locationName == mDelNames [i])
                            {
                                manager.xmlArrayList.RemoveAt(j);
                            }
                        }
                    }
                    mDelValues.Clear();
                    mDelNames.Clear();
                }
                if (manager.xmlArrayList.Count == 0)
                {
                    manager.SelectMarkClear();
                }
            }
        }
    }
Exemplo n.º 6
0
    public void SaveData()
    {
        Xml_Manager manager = GameObject.Find("Manager").GetComponent <Xml_Manager> ();

        string sSavePath = EditorUtility.SaveFilePanel("Save Mark XML File", "Assets/MapToolkit_2.0/Temp/MarkData", "noname", "xml");

        if (sSavePath == null || sSavePath == "")
        {
            manager.SaveFileStatus((int)FileStatus.Cancel);
            return;
        }


        if (manager.xmlArrayList == null || manager.xmlArrayList.Count == 0)
        {
            manager.SaveFileStatus((int)FileStatus.Error);
            return;
        }


        string xmlData;

        xmlData = "<MapMarkCollection><XML_Marks>";

        for (int i = 0; i < manager.xmlArrayList.Count; i++)
        {
            Xml_Manager.XmlMarker tmp_xmlData = (Xml_Manager.XmlMarker)manager.xmlArrayList [i] as  Xml_Manager.XmlMarker;

            xmlData += "<XML_Mark name=\"" + tmp_xmlData.locationName + "\">";
            xmlData += "<coordinate_x>" + tmp_xmlData.coordinate_x + "</coordinate_x>";
            xmlData += "<coordinate_y>" + tmp_xmlData.coordinate_y + "</coordinate_y>";

            xmlData += "<normalSprite>" + tmp_xmlData.normalSprite + "</normalSprite>";
            xmlData += "<hoverSprite>" + tmp_xmlData.hoverSprite + "</hoverSprite>";
            xmlData += "<activeSprite>" + tmp_xmlData.activeSprite + "</activeSprite>";

            xmlData += "<normalColor_r>" + tmp_xmlData.normalColor_r + "</normalColor_r>";
            xmlData += "<normalColor_g>" + tmp_xmlData.normalColor_g + "</normalColor_g>";
            xmlData += "<normalColor_b>" + tmp_xmlData.normalColor_b + "</normalColor_b>";
            xmlData += "<normalColor_a>" + tmp_xmlData.normalColor_a + "</normalColor_a>";


            xmlData += "<normalPixelInset_x>" + tmp_xmlData.normalPixelInset_x + "</normalPixelInset_x>";
            xmlData += "<normalPixelInset_y>" + tmp_xmlData.normalPixelInset_y + "</normalPixelInset_y>";
            xmlData += "<normalPixelInset_w>" + tmp_xmlData.normalPixelInset_w + "</normalPixelInset_w>";
            xmlData += "<normalPixelInset_h>" + tmp_xmlData.normalPixelInset_h + "</normalPixelInset_h>";

            xmlData += "<textPixelInset_x>" + tmp_xmlData.textPixelInset_x + "</textPixelInset_x>";
            xmlData += "<textPixelInset_y>" + tmp_xmlData.textPixelInset_y + "</textPixelInset_y>";

            xmlData += "<textFontSize>" + tmp_xmlData.textFontSize + "</textFontSize>";


            int textCheck;
            if (tmp_xmlData.textShow)
            {
                textCheck = 1;
            }
            else
            {
                textCheck = 0;
            }
            xmlData += "<textShow>" + textCheck + "</textShow>";

            xmlData += "<textColor_r>" + tmp_xmlData.textColor_r + "</textColor_r>";
            xmlData += "<textColor_g>" + tmp_xmlData.textColor_g + "</textColor_g>";
            xmlData += "<textColor_b>" + tmp_xmlData.textColor_b + "</textColor_b>";
            xmlData += "<textColor_a>" + tmp_xmlData.textColor_a + "</textColor_a>";

            xmlData += "</XML_Mark>";
        }

        xmlData += "</XML_Marks></MapMarkCollection>";

        XML_Mark_Container xml_Mark_Container = XML_Mark_Container.LoadFromText(xmlData);

        xml_Mark_Container.Save(sSavePath);


        string[] filename = sSavePath.Split('/');
        message = filename [filename.Length - 1] + " ";

        manager.SaveFileStatus((int)FileStatus.Success);
    }
Exemplo n.º 7
0
    public ArrayList Sample()
    {
        ArrayList xmlArrayList = new ArrayList();

        Xml_Manager.XmlMarker xmlData = new Xml_Manager.XmlMarker();
        xmlData.locationName       = "Angkor Wat";
        xmlData.coordinate_x       = "103.867";
        xmlData.coordinate_y       = "13.41247";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;

        xmlArrayList.Add(xmlData);
        xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = "Cathedral of Basil";
        xmlData.coordinate_x       = "37.62316";
        xmlData.coordinate_y       = "55.752696";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;

        xmlArrayList.Add(xmlData);
        xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = "Eiffel Tower";
        xmlData.coordinate_x       = "2.294388";
        xmlData.coordinate_y       = "48.85823";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;

        xmlArrayList.Add(xmlData);

        xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = "Osaka Castle";
        xmlData.coordinate_x       = "135.5262";
        xmlData.coordinate_y       = "34.68732";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;

        xmlArrayList.Add(xmlData);

        xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = "Seoul";
        xmlData.coordinate_x       = "126.978";
        xmlData.coordinate_y       = "37.56654";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;

        xmlArrayList.Add(xmlData);

        xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = "Summer Palace";
        xmlData.coordinate_x       = "116.2678";
        xmlData.coordinate_y       = "39.99846";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;


        xmlArrayList.Add(xmlData);


        xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = "Tāj Mahal";
        xmlData.coordinate_x       = "78.0425";
        xmlData.coordinate_y       = "27.17484";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;


        xmlArrayList.Add(xmlData);
        xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = "Unity Technologies";
        xmlData.coordinate_x       = "-122.403";
        xmlData.coordinate_y       = "37.79823";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;

        xmlArrayList.Add(xmlData);


        xmlData = new Xml_Manager.XmlMarker();

        xmlData.locationName       = "Westminster Abbey";
        xmlData.coordinate_x       = "-0.128455";
        xmlData.coordinate_y       = "51.49953";
        xmlData.normalPixelInset_x = -21f;
        xmlData.normalPixelInset_y = -0f;
        xmlData.normalPixelInset_w = 64f;
        xmlData.normalPixelInset_h = 64f;
        xmlData.normalSprite       = "Mark_Green";
        xmlData.normalColor_r      = 137;
        xmlData.normalColor_g      = 137;
        xmlData.normalColor_b      = 137;
        xmlData.normalColor_a      = 255;
        xmlData.hoverSprite        = "Mark_Blue";
        xmlData.activeSprite       = "Mark_Pin_Red";
        xmlData.textPixelInset_x   = 32.16f;
        xmlData.textPixelInset_y   = 43.6f;
        xmlData.textShow           = true;
        xmlData.textFontSize       = 28;
        xmlData.textColor_r        = 38f;
        xmlData.textColor_g        = 38f;
        xmlData.textColor_b        = 38f;
        xmlData.textColor_a        = 255f;


        xmlArrayList.Add(xmlData);

        return(xmlArrayList);
    }