Exemplo n.º 1
0
    /// <summary>
    /// Получить по тексту, каждого типа
    /// </summary>
    /// <param name="types"></param>
    /// <returns></returns>
    public static List <TextData> GetOneType(List <string> types)
    {
        TextDataList    baseTemp = new TextDataList();
        List <TextData> result   = new List <TextData>();

        for (int i = 0; i < types.Count; i++)
        {
            TextDataList temp = data.Find(x => x.type == types[i]);

            if (temp == null)
            {
                temp = dataEmpty.Find(x => x.type == emptyText);
            }

            if (i == 0)
            {
                baseTemp = temp;
            }
            else
            {
                baseTemp.data.AddRange(temp.CopyList());
            }
        }

        for (int i = 0; i < types.Count; i++)
        {
            TextData tempTextData = baseTemp.Get();
            string   typeClear    = tempTextData.type;
            baseTemp.ClearThisType(typeClear);
            result.Add(tempTextData);
        }


        return(result);
    }
Exemplo n.º 2
0
        internal AdvScenarioTextDataInPage AddTextDataInPage(AdvCommand command)
        {
            AdvScenarioTextDataInPage textData = new AdvScenarioTextDataInPage(command);

            TextDataList.Add(textData);
            return(textData);
        }
Exemplo n.º 3
0
    public static void AddType(string type)
    {
        TextDataList added = InitDataList(type);

        if (added != null)
        {
            data.Add(added);
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Проинициализировать пустые
    /// </summary>
    static GameText()
    {
        dataEmpty = new List <TextDataList>();
        TextDataList added = InitDataList(emptyText);

        if (added != null)
        {
            dataEmpty.Add(added);
        }
    }
Exemplo n.º 5
0
 /// <summary>
 /// Проинициализировать все списки, которые мы будем использовать в текущий момент
 /// </summary>
 /// <param name="types">Список типов, которые мы будем использовать</param>
 public static void Initialization(List <string> types)
 {
     data = new List <TextDataList>();
     for (int i = 0; i < types.Count; i++)
     {
         TextDataList added = InitDataList(types[i]);
         if (added != null)
         {
             data.Add(added);
         }
     }
 }
Exemplo n.º 6
0
    /// <summary>
    /// Получить текст
    /// </summary>
    /// <param name="type">Тип текста</param>
    /// <returns></returns>
    public static TextData Get(string type)
    {
        TextDataList temp = data.Find(x => x.type == type);

        if (temp == null)
        {
            temp = dataEmpty.Find(x => x.type == emptyText);
        }

        TextData result = temp.Get();

        return(result);
    }
Exemplo n.º 7
0
    /// <summary>
    /// Получить TextDataList
    /// </summary>
    /// <param name="path"></param>
    /// <returns></returns>
    private static TextDataList InitDataList(string path)
    {
        TextDataList result = null;
        GameObject   prefab = Resources.Load <GameObject>("TextResources/" + path);

        if (prefab != null)
        {
            GameObject    go            = MonoBehaviour.Instantiate(prefab);
            TextBehaviour textBehaviour = go.GetComponent <TextBehaviour>();
            result = textBehaviour.dataList;
            result.Initialization();
            MonoBehaviour.Destroy(go);
        }
        return(result);
    }
Exemplo n.º 8
0
 internal void AddTextData(AdvCommandText command)
 {
     TextDataList.Add(command);
 }
Exemplo n.º 9
0
        public void CadXmlRead()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(cadXmlPath);

            XmlElement root      = doc.DocumentElement;
            string     nameSpace = root.NamespaceURI;

            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
            XmlNode             Data  = doc.SelectSingleNode("Data", nsmgr);

            XmlNodeList LineList    = Data.SelectNodes("LINE", nsmgr);
            XmlNodeList PolyList    = Data.SelectNodes("POLY", nsmgr);
            XmlNodeList CircleList  = Data.SelectNodes("CIRCLE", nsmgr);
            XmlNodeList TextList    = Data.SelectNodes("TEXT", nsmgr);
            XmlNodeList P2DPolyList = Data.SelectNodes("P2DPOLY", nsmgr);

            foreach (XmlNode Line in LineList)
            {
                LineData lineData = new LineData();
                lineData.Layer = Line.Attributes.GetNamedItem("layer").InnerText;
                lineData.Coordinate_start.Longitude = Convert.ToDouble(Line.Attributes.GetNamedItem("longitude_start").InnerText);
                lineData.Coordinate_start.Latitude  = Convert.ToDouble(Line.Attributes.GetNamedItem("latitude_start").InnerText);
                lineData.Coordinate_end.Longitude   = Convert.ToDouble(Line.Attributes.GetNamedItem("longitude_end").InnerText);
                lineData.Coordinate_end.Latitude    = Convert.ToDouble(Line.Attributes.GetNamedItem("latitude_end").InnerText);
                LineDataList.Add(lineData);
            }

            foreach (XmlNode Poly in PolyList)
            {
                PolyData polyData = new PolyData();
                polyData.Layer   = Poly.Attributes.GetNamedItem("layer").InnerText;
                polyData.Id      = Convert.ToInt32(Poly.Attributes.GetNamedItem("id").InnerText);
                polyData.OrderId = Convert.ToInt32(Poly.Attributes.GetNamedItem("order").InnerText);
                polyData.Coordinate.Longitude = Convert.ToDouble(Poly.Attributes.GetNamedItem("longitude").InnerText);
                polyData.Coordinate.Latitude  = Convert.ToDouble(Poly.Attributes.GetNamedItem("latitude").InnerText);
                PolyDataList.Add(polyData);
            }

            foreach (XmlNode Circle in CircleList)
            {
                CircleData circleData = new CircleData();
                circleData.Layer = Circle.Attributes.GetNamedItem("layer").InnerText;
                circleData.Coordinate.Longitude = Convert.ToDouble(Circle.Attributes.GetNamedItem("longitude").InnerText);
                circleData.Coordinate.Latitude  = Convert.ToDouble(Circle.Attributes.GetNamedItem("latitude").InnerText);
                circleData.Radious = Convert.ToDouble(Circle.Attributes.GetNamedItem("radious").InnerText);
                CircleDataList.Add(circleData);
            }

            foreach (XmlNode Text in TextList)
            {
                TextData textData = new TextData();
                textData.Layer = Text.Attributes.GetNamedItem("layer").InnerText;
                textData.Coordinate.Longitude = Convert.ToDouble(Text.Attributes.GetNamedItem("longitude").InnerText);
                textData.Coordinate.Latitude  = Convert.ToDouble(Text.Attributes.GetNamedItem("latitude").InnerText);
                textData.Content = Text.Attributes.GetNamedItem("value").InnerText.Replace("%%d", "°").Replace("'", "''");
                try
                {
                    textData.Type = Text.Attributes.GetNamedItem("recognized").InnerText;
                }
                catch
                {
                    textData.Type = "";
                }

                TextDataList.Add(textData);
            }

            foreach (XmlNode P2DPoly in P2DPolyList)
            {
                P2DPolyData p2DPoly = new P2DPolyData();

                p2DPoly.Layer   = P2DPoly.Attributes.GetNamedItem("layer").InnerText;
                p2DPoly.Id      = Convert.ToInt32(P2DPoly.Attributes.GetNamedItem("id").InnerText);
                p2DPoly.OrderId = Convert.ToInt32(P2DPoly.Attributes.GetNamedItem("order").InnerText);
                p2DPoly.Coordinate.Longitude = Convert.ToDouble(P2DPoly.Attributes.GetNamedItem("longitude").InnerText);
                p2DPoly.Coordinate.Latitude  = Convert.ToDouble(P2DPoly.Attributes.GetNamedItem("latitude").InnerText);

                P2DPolyDataList.Add(p2DPoly);
            }
        }