Exemplo n.º 1
0
        private void RebuildList()
        {
            AdrAzimuthEditorLineNeighbor[] currentLines = m_uiHelperNeighbors.Self.GetComponentsInChildren <AdrAzimuthEditorLineNeighbor>();
            int stopsCount = AdrNeighborhoodExtension.GetStopsCount();

            if (stopsCount == 0)
            {
                stopsCount = 1;
            }

            m_borderCities = new List <AdrAzimuthEditorLineNeighbor>();
            int count = 0;

            for (int i = 0; i < stopsCount; i++, count++)
            {
                if (i < currentLines.Length)
                {
                    currentLines[i].SetLegendInfo(GetColorForNumber(i), i + 1);
                    m_borderCities.Add(currentLines[i]);
                }
                else
                {
                    AdrAzimuthEditorLineNeighbor line = KlyteMonoUtils.CreateElement <AdrAzimuthEditorLineNeighbor>(m_uiHelperNeighbors.Self.transform);
                    line.SetLegendInfo(GetColorForNumber(i), i + 1);
                    line.OnValueChange += ValidateAngleStr;
                    m_borderCities.Add(line);
                }
            }
            for (int i = count; i < currentLines.Length; i++)
            {
                GameObject.Destroy(currentLines[i].gameObject);
            }
            ReordenateFields();
        }
Exemplo n.º 2
0
        private void RebuildList()
        {
            m_isLoading = true;
            AdrAzimuthEditorLineNeighbor[] currentLines = m_neighborsList?.GetComponentsInChildren <AdrAzimuthEditorLineNeighbor>();
            if (currentLines is null)
            {
                return;
            }

            int stopsCount = AdrNeighborhoodExtension.GetStopsCount();

            if (stopsCount == 0)
            {
                stopsCount = 1;
            }

            m_borderCities = new List <AdrAzimuthEditorLineNeighbor>();
            int count = 0;

            for (int i = 0; i < stopsCount; i++, count++)
            {
                if (i < currentLines.Length)
                {
                    currentLines[i].SetLegendInfo(GetColorForNumber(i), i + 1);
                    m_borderCities.Add(currentLines[i]);
                }
                else
                {
                    KlyteMonoUtils.CreateUIElement(out UIPanel newEntry, m_neighborsList.transform, "NeighborhoodEntry");
                    AdrAzimuthEditorLineNeighbor line = newEntry.gameObject.AddComponent <AdrAzimuthEditorLineNeighbor>();
                    line.SetLegendInfo(GetColorForNumber(i), i + 1);
                    line.OnValueChange     += ValidateAngleStr;
                    line.OnFixedNameChange += SetFixedName;
                    m_borderCities.Add(line);
                }
            }
            for (int i = count; i < currentLines.Length; i++)
            {
                GameObject.Destroy(currentLines[i].gameObject);
            }
            m_isLoading = false;
            ReordenateFields();
        }