コード例 #1
0
        private void updateCheckboxes()
        {
            bool oldIsLoading = isLoading;

            isLoading = true;
            DepotAI       depotAI            = Singleton <BuildingManager> .instance.m_buildings.m_buffer[m_buildingIdSelecionado.Building].Info.GetAI() as DepotAI;
            List <string> prefixOptions      = TLMUtils.getDepotPrefixesOptions(TLMCW.getConfigIndexForTransportInfo(m_secondary ? depotAI.m_secondaryTransportInfo : depotAI.m_transportInfo));
            var           prefixesServedList = TLMDepotAI.getPrefixesServedByDepot(m_buildingIdSelecionado.Building, m_secondary);

            for (uint i = 0; i <= 64; i++)
            {
                if (i < prefixOptions.Count)
                {
                    prefixesCheckboxes[i].isVisible = true;
                    prefixesCheckboxes[i].isChecked = prefixesServedList.Contains(i);
                    prefixesCheckboxes[i].text      = prefixOptions[(int)i];
                }
                else
                {
                    prefixesCheckboxes[i].isVisible = false;
                }
            }
            prefixesCheckboxes[65].isChecked = prefixesServedList.Contains(65);
            isLoading = oldIsLoading;
        }
コード例 #2
0
        public void RefreshData()
        {
            Building b = Singleton <BuildingManager> .instance.m_buildings.m_buffer[this.m_buildingID];

            m_depotName.text = Singleton <BuildingManager> .instance.GetBuildingName(this.m_buildingID, default(InstanceID));

            byte districtID = Singleton <DistrictManager> .instance.GetDistrict(b.m_position);

            string districtName = districtID == 0 ? Locale.Get("TLM_DISTRICT_NONE") : Singleton <DistrictManager> .instance.GetDistrictName(districtID);

            m_districtName.text = districtName;
            if (!(b.Info.GetAI() is ShelterAI))
            {
                m_prefixesServed.relativePosition = new Vector2(340, 0);
                //prefix
                m_prefixesServed.text = TLMLineUtils.getPrefixesServedString(m_buildingID, secondary);
                DepotAI       buildingAI    = b.Info.GetAI() as DepotAI;
                List <string> prefixOptions = TLMUtils.getDepotPrefixesOptions(TransportSystemDefinition.from(secondary ? buildingAI.m_secondaryTransportInfo : buildingAI.m_transportInfo).toConfigIndex());
                prefixOptions.Add(Locale.Get("TLM_REGIONAL"));
                if (m_prefixOptions.items.Length != prefixOptions.Count)
                {
                    m_prefixOptions.items = prefixOptions.ToArray();
                    onChangePrefixSelected(m_prefixOptions.selectedIndex);
                }
            }
            m_isDirty = false;
        }
コード例 #3
0
        public void RefreshData()
        {
            if (Singleton <BuildingManager> .exists)
            {
                m_prefixesServedList = TLMDepotAI.getPrefixesServedByDepot(m_buildingID);
                if (m_prefixesServedList == null)
                {
                    GameObject.Destroy(gameObject); return;
                }
                bool isRowVisible;

                isRowVisible = TLMPublicTransportDetailPanel.instance.isOnCurrentPrefixFilter(m_prefixesServedList);

                if (!isRowVisible)
                {
                    GetComponent <UIComponent>().isVisible = false;
                    return;
                }
                GetComponent <UIComponent>().isVisible = true;
                Building b = Singleton <BuildingManager> .instance.m_buildings.m_buffer[this.m_buildingID];
                this.m_depotName.text = Singleton <BuildingManager> .instance.GetBuildingName(this.m_buildingID, default(InstanceID));

                byte districtID = Singleton <DistrictManager> .instance.GetDistrict(b.m_position);

                string districtName = districtID == 0 ? Locale.Get("TLM_DISTRICT_NONE") : Singleton <DistrictManager> .instance.GetDistrictName(districtID);

                this.m_districtName.text = districtName;

                //prefix
                this.m_prefixesServed.text = TLMUtils.getPrefixesServedAbstract(this.m_buildingID);

                List <string> prefixOptions = TLMUtils.getDepotPrefixesOptions(TLMCW.getConfigIndexForTransportInfo((b.Info.GetAI() as DepotAI).m_transportInfo));
                prefixOptions.Add(Locale.Get("TLM_REGIONAL"));
                if (this.m_prefixOptions.items.Length != prefixOptions.Count)
                {
                    this.m_prefixOptions.items = prefixOptions.ToArray();
                    onChangePrefixSelected(m_prefixOptions.selectedIndex);
                }
            }
        }