コード例 #1
0
        internal void ReloadShield()
        {
            m_middleBar.isVisible = CurrentSelection != null;
            m_containerSelectionDescription.isVisible = CurrentSelection != null;
            if (CurrentSelection != null)
            {
                WTSHighwayShieldsSingleton.GetTargetDescriptor(CurrentSelection, out ConfigurationSource source, out HighwayShieldDescriptor target);
                m_labelSelectionDescription.text   = $"{CurrentSelection}\n";
                m_labelSelectionDescription.suffix = $"{Locale.Get("K45_WTS_CURRENTLY_USING")}: {Locale.Get("K45_WTS_CONFIGURATIONSOURCE", source.ToString())}";
                EditingInstance            = target;
                CurrentConfigurationSource = source;
                EventOnHwTypeSelectionChanged?.Invoke(EditingInstance, CurrentConfigurationSource);

                m_btnNew.isVisible        = CurrentConfigurationSource != ConfigurationSource.CITY;
                m_btnCopyToCity.isVisible = CurrentConfigurationSource != ConfigurationSource.CITY && CurrentConfigurationSource != ConfigurationSource.NONE;
                m_btnDelete.isVisible     = CurrentConfigurationSource == ConfigurationSource.CITY;
                m_btnExport.isVisible     = CurrentConfigurationSource == ConfigurationSource.CITY;
                OnTabChange(0);
            }
            m_editArea.isVisible     = CurrentSelection != null && CurrentConfigurationSource == ConfigurationSource.CITY;
            m_cantEditText.isVisible = CurrentConfigurationSource == ConfigurationSource.GLOBAL;
            m_plusButton.isVisible   = CurrentSelection != null && CurrentConfigurationSource == ConfigurationSource.CITY;
            m_editTabstrip.isVisible = CurrentSelection != null && CurrentConfigurationSource != ConfigurationSource.NONE;
            m_btnCopy.isVisible      = CurrentSelection != null && CurrentConfigurationSource != ConfigurationSource.NONE;
            m_btnPaste.isVisible     = m_clipboard != null && CurrentConfigurationSource == ConfigurationSource.CITY;
        }
コード例 #2
0
        private IEnumerator WriteHwShieldTextureCoroutine(ushort seedId)
        {
            string id = $"{seedId}";

            if (m_hwShieldsAtlas[id] is null)
            {
                yield return(0);

                while (!CheckHwShieldCoroutineCanContinue())
                {
                    yield return(null);
                }
                var hwData = WriteTheSignsMod.Controller.ConnectorADR.GetHighwayData(seedId);
                if (hwData is null)
                {
                    yield break;
                }
                WTSHighwayShieldsSingleton.GetTargetDescriptor(hwData.layoutName ?? "", out ConfigurationSource src, out HighwayShieldDescriptor layoutDescriptor);
                if (src == ConfigurationSource.NONE)
                {
                    yield break;
                }

                var drawingCoroutine = CoroutineWithData.From(this, RenderHighwayShield(
                                                                  FontServer.instance[layoutDescriptor.FontName] ?? FontServer.instance[WTSEtcData.Instance.FontSettings.HighwayShieldsFont] ?? FontServer.instance[WTSController.DEFAULT_FONT_KEY],
                                                                  layoutDescriptor, hwData));
                yield return(drawingCoroutine.Coroutine);

                while (!CheckHwShieldCoroutineCanContinue())
                {
                    yield return(null);
                }
                TextureAtlasUtils.RegenerateTextureAtlas(m_hwShieldsAtlas, new List <UITextureAtlas.SpriteInfo>
                {
                    new UITextureAtlas.SpriteInfo
                    {
                        name    = id,
                        texture = drawingCoroutine.result
                    }
                });
                HwShieldIsDirty     = true;
                m_hwShieldsMaterial = null;
                HighwayShieldsCache.Clear();
                StopAllCoroutines();
                yield break;
            }
            yield return(0);

            var bri = new BasicRenderInformation
            {
                m_YAxisOverflows = new RangeVector {
                    min = 0, max = 20
                },
            };

            yield return(0);

            WTSAtlasesLibrary.BuildMeshFromAtlas(id, bri, m_hwShieldsAtlas);
            yield return(0);

            if (m_hwShieldsMaterial is null)
            {
                m_hwShieldsMaterial = new Material(m_hwShieldsAtlas.material)
                {
                    shader = WTSController.DEFAULT_SHADER_TEXT,
                };
            }
            WTSAtlasesLibrary.RegisterMeshSingle(seedId, bri, HighwayShieldsCache, m_hwShieldsAtlas, HwShieldIsDirty, m_hwShieldsMaterial);
            HwShieldIsDirty = false;
            yield break;
        }