public string GetResult(TLMMapCityTransportObject cto, string cityName, DateTime currentTime) => $@"
      <!DOCTYPE html><html><head> <meta charset='UTF-8'> 
      <style>{KlyteResourceLoader.LoadResourceString("MapDrawer.lineDrawBasicCss.css") }</style>
      <script src=""https://code.jquery.com/jquery-3.6.0.min.js"" integrity=""sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="" crossorigin=""anonymous""></script>
      <script>var _infoLines = {cto.ToJson()};</script>
      <script>{KlyteResourceLoader.LoadResourceString("MapDrawer.app.js") }</script>
      </head><body>
      <div id=""mapContainer"">
             <div id=""mapGroup"">
                 <svg id=""map"">                 
                     <defs>                 
                         <marker orient=""auto"" markerHeight=""6"" markerWidth=""6"" refY=""2.5"" refX=""1"" viewBox=""0 0 10 5"" id=""Triangle1"">
                             <path d=""M 0 0 L 10 2.5 L 0 5 z"" />
                         </marker>
                         <marker orient=""auto"" markerHeight=""6"" markerWidth=""6"" refY=""2.5"" refX=""1"" viewBox=""0 0 10 5"" id=""Triangle2"">
                             <path d=""M 10 0 L 0 2.5 L 10 5 z"" />
                         </marker>
                     </defs>
                 </svg>
                 <div id=""stationsContainer""></div>
             </div>
         </div>
     </div>
     <div id=""linesPanel"">
         <div id=""title"">{cityName}</div>
         <div id=""date"">{currentTime.ToString(CultureInfo.GetCultures(CultureTypes.SpecificCultures).Where(c => c.TwoLetterISOLanguageName == KlyteLocaleManager.CurrentLanguageId).FirstOrDefault())}</div>
         <div id=""content"">
     </div></body></html>";
Exemple #2
0
        public void OnSettingsUI(UIHelperBase helperDefault)
        {
            m_onSettingsUiComponent = new UIHelperExtension((UIHelper)helperDefault).Self ?? m_onSettingsUiComponent;

            if (Locale.Get(KlyteLocaleManager.m_defaultTestKey) != "OK" || Locale.Get(KlyteLocaleManager.m_defaultModControllingKey) == CommonProperties.ModName)
            {
                if (Locale.Get(KlyteLocaleManager.m_defaultModControllingKey) != CommonProperties.ModName)
                {
                    KlyteMonoUtils.CreateElement <KlyteLocaleManager>(new GameObject(typeof(U).Name).transform);
                    if (Locale.Get(KlyteLocaleManager.m_defaultTestKey) != "OK")
                    {
                        LogUtils.DoErrorLog("CAN'T LOAD LOCALE!!!!!");
                    }
                    LocaleManager.eventLocaleChanged += KlyteLocaleManager.ReloadLanguage;
                }

                m_showLangDropDown = true;
            }
            foreach (string lang in KlyteLocaleManager.locales)
            {
                string content = KlyteResourceLoader.LoadResourceString($"UI.i18n.{lang}.properties");
                if (content != null)
                {
                    File.WriteAllText($"{KlyteLocaleManager.m_translateFilesPath}{lang}{Path.DirectorySeparatorChar}1_{Assembly.GetExecutingAssembly().GetName().Name}.txt", content);
                }
                content = KlyteResourceLoader.LoadResourceString($"commons.UI.i18n.{lang}.properties");
                if (content != null)
                {
                    File.WriteAllText($"{KlyteLocaleManager.m_translateFilesPath}{lang}{Path.DirectorySeparatorChar}0_common_{K45DialogControl.VERSION}.txt", content);
                }
            }
            KlyteLocaleManager.ReloadLanguage(true);
            DoWithSettingsUI(new UIHelperExtension(m_onSettingsUiComponent));
        }
Exemple #3
0
 /// <summary>
 /// The header.<>
 /// 0 = Height
 /// 1 = Width
 /// </summary>
 public string getHtmlHeader(int height, int width, CityTransportObject cto)
 {
     return($@"
      <!DOCTYPE html><html><head> <meta charset='UTF-8'> 
      <style>{KlyteResourceLoader.LoadResourceString("MapDrawer.lineDrawBasicCss.css") }</style>
      <script src=""https://code.jquery.com/jquery-3.3.1.min.js"" integrity=""sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="" crossorigin=""anonymous""></script>
      <script>var _infoLines = {cto.toJson()};</script>
      <script>{KlyteResourceLoader.LoadResourceString("MapDrawer.app.js") }</script>
      </head><body>
      <style id=""styleSelectionLineMap""></style>
      <svg id=""map"" height='{height}' width='{width}'>
      <defs>
      <marker orient=""auto"" markerHeight=""6"" markerWidth=""6"" refY=""2.5"" refX=""1"" viewBox=""0 0 10 5"" id=""Triangle1""><path d=""M 0 0 L 10 2.5 L 0 5 z""/></marker>
      <marker orient=""auto"" markerHeight=""6"" markerWidth=""6"" refY=""2.5"" refX=""1"" viewBox=""0 0 10 5"" id=""Triangle2""><path d=""M 10 0 L 0 2.5 L 10 5 z""/></marker>
      </defs>");
 }
Exemple #4
0
        public bool ShowVersionInfoPopup(bool force = false)
        {
            if (needShowPopup || force)
            {
                try
                {
                    string title = $"{SimpleName} v{Version}";
                    string notes = KlyteResourceLoader.LoadResourceString("UI.VersionNotes.txt");
                    string text  = $"{SimpleName} was updated! Release notes:\n\n{notes}\n\n<k45symbol K45_HexagonIcon_NOBORDER,5e35b1,K> Current Version: <color #FFFF00>{FullVersion}</color>";
                    if (!force)
                    {
                        text += "\n\n<Color #FF0000>REMEMBER!</Color> If you just activated the mod in the mod list, restart the game before playing by the first time!\nIf you just reading this on the main menu when opened the game, just go ahead and enjoy the game. =V";
                    }
                    ShowModal(new BindProperties()
                    {
                        icon         = IconName,
                        showClose    = true,
                        showButton1  = true,
                        textButton1  = "Okay!",
                        showButton2  = true,
                        textButton2  = "See the news on the mod page at Workshop!",
                        showButton3  = true,
                        textButton3  = "Follow Klyte45 on Twitter!",
                        showButton4  = true,
                        textButton4  = "Follow Klyte45 on Facebook!",
                        showButton5  = true,
                        textButton5  = "Subscribe to Klyte45 channel on YouTube!",
                        messageAlign = UIHorizontalAlignment.Left,
                        title        = title,
                        message      = text,
                    }, (x) =>
                    {
                        switch (x)
                        {
                        case 0:
                        case 1:
                            needShowPopup            = false;
                            CurrentSaveVersion.value = FullVersion;
                            break;

                        case 2:
                            ColossalFramework.Utils.OpenUrlThreaded("https://steamcommunity.com/sharedfiles/filedetails/?id=" + ModId);
                            break;

                        case 3:
                            ColossalFramework.Utils.OpenUrlThreaded("https://twitter.com/klyte45");
                            break;

                        case 4:
                            ColossalFramework.Utils.OpenUrlThreaded("https://fb.com/klyte45");
                            break;

                        case 5:
                            ColossalFramework.Utils.OpenUrlThreaded("https://youtube.com/klyte45");
                            break;
                        }
                        return(x <= 1);
                    });

                    return(true);
                }
                catch (Exception e)
                {
                    DoErrorLog("showVersionInfoPopup ERROR {0} {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
                }
            }
            return(false);
        }