Пример #1
0
 void Pause()
 {
     escapeMenuUI.SetActive(true);
     whereAmI = menuType.PAUSE;
     UpdateMenu();
     Cursor.visible   = true;
     Cursor.lockState = CursorLockMode.Confined;
     Time.timeScale   = 0f;
     GameIsPaused     = true;
 }
Пример #2
0
        // Este método lo uso solo la primera vez para poder crear un objeto del tipo json que luego voy a desserializar
        private void crearJsonMenu()
        {
            menuDta mnu = new menuDta();

            mnu.Nombre = "Cena";
            mnu.id     = "1";
            mnu.types  = new List <menuType>();

            menuType type = new menuType();

            type.titulo_es  = "Platos";
            type.hora_desde = "10:00";
            type.hora_hasta = "18:00";
            type.items      = new List <menuItem>();

            menuItem item = new menuItem();

            item.titulo_es = "Papas Fritas";
            item.titulo_en = "Chips";
            item.titulo_pt = "Patatas Fritas";
            type.items.Add(item);
            menuItem item2 = new menuItem();

            item2.titulo_es = "Lomo";
            item2.titulo_en = "Meat Beef";
            item2.titulo_pt = "Rostizado";

            type.items.Add(item2);
            mnu.types.Add(type);

            //Obtengo el directorio para el archivo
            var    service     = HttpContext.RequestServices.GetService(typeof(Microsoft.AspNetCore.Hosting.IHostingEnvironment)) as Microsoft.AspNetCore.Hosting.IHostingEnvironment;
            string folderName  = "json/";
            string webRootPath = service.WebRootPath;
            string newPath     = Path.Combine(webRootPath, folderName);

            //Serializo el objeto a json
            string objeto = JsonConvert.SerializeObject(mnu);

            //Escribo en disco el archivo
            System.IO.File.WriteAllText(newPath + @"/menu_" + mnu.id + ".json", objeto);
        }
Пример #3
0
        private void writeMenuProfile(menuType direction)
        {
            string menuPos;
              string menuOrientation;
              string activeMenuStyle = null;
              string activeWeatherStyle = null;
              string acceleration = tbAcceleration.Text;
              string duration = tbDuration.Text;
              string activeRssImageType = null;
              string targetScreenRes = "SD";
              string tvRecentDisplayType = "full";
              string movPicsDisplayType = "full";
              string mostRecentTVSeriesSummStyle = "fanart";
              string mostRecentMovPicsSummStyle = "fanart";

              string settingDropShadow = cbDropShadow.Checked ? "true" : "false";
              string settingEnableRssfeed = enableRssfeed.Checked ? "true" : "false";
              string settingEnableTwitter = enableTwitter.Checked ? "true" : "false";
              string settingWrapString = wrapString.Checked ? "true" : "false";
              string settingWeatherBGlink = weatherBGlink.Checked ? "true" : "false";
              string settingFiveDayWeatherCheckBox = enableFiveDayWeather.Checked ? "true" : "false";
              string settingSummaryWeatherCheckBox = summaryWeatherCheckBox.Checked ? "true" : "false";
              string settingClearCacheOnGenerate = cboClearCache.Checked ? "true" : "false";
              string settingAnimatedWeather = WeatherIconsAnimated.Checked ? "true" : "false";
              string settingHorizontalContextLabels = horizontalContextLabels.Checked ? "true" : "false";
              string settingFullWeatherSummaryBottom = fullWeatherSummaryBottom.Checked ? "true" : "false";
              string settingFullWeatherSummaryMiddle = fullWeatherSummaryMiddle.Checked ? "true" : "false";
              string disableOnScreenClock = cbDisableClock.Checked ? "true" : "false";
              string hideFanartScrapingtext = cbHideFanartScraper.Checked ? "true" : "false";
              string enableOverlayFanart = cbOverlayFanart.Checked ? "true" : "false";
              string animatedBackground = cbAnimateBackground.Checked ? "true" : "false";
              string tvSeriesMostRecent = cbMostRecentTvSeries.Checked ? "true" : "false";
              string movPicsMostRecent = cbMostRecentMovPics.Checked ? "true" : "false";
              string mostRecentCycleFanart = cbCycleFanart.Checked ? "true" : "false";
              string mrSeriesEpisodeFormat = tvSeriesOptions.mrSeriesEpisodeFormat ? "true" : "false";
              string mrTitleLast = tvSeriesOptions.mrTitleLast ? "true" : "false";
              string settingOldStyleExitButtons = cbExitStyleNew.Checked ? "true" : "false";
              string mrTVSeriesCycleFanart = mostRecentTVSeriesCycleFanart ? "true" : "false";
              string mrMovPicsCycleFanart = mostRecentMovPicsCycleFanart ? "true" : "false";
              string mrMovPicsHideRuntime = movPicsOptions.HideRuntime ? "true" : "false";
              string mrMovPicsHideCertification = movPicsOptions.HideCertification ? "true" : "false";
              string mrMovPicsHideRating = movPicsOptions.HideRating ? "true" : "false";
              string mrMovPicsUseTextRating = movPicsOptions.UseTextRating ? "true" : "false";
              string mrMovPicsWatched = cbMovPicsRecentWatched.Checked ? "true" : "false";
              string mrTVSeriesWatched = cbTVSeriesRecentWatched.Checked ? "true" : "false";
              string mrTVSeriesDisableFadeLabel = tvSeriesOptions.mrDisableFadeLabels ? "true" : "false";
              string mrMovPicsDisableFadeLabel = movPicsOptions.DisableFadeLabels ? "true" : "false";
              string mrMusicEnabled = cbEnableRecentMusic.Checked ? "true" : "false";
              string mrRecordedTVEnabled = cbEnableRecentRecordedTV.Checked ? "true" : "false";
              string sleepControlEnabled = cbSleepControlOverlay.Checked ? "true" : "false";
              string stocksControlEnabled = cbSocksOverlay.Checked ? "true" : "false";
              string powerControlEnabled = cbPowerControlOverlay.Checked ? "true" : "false";
              string htpcinfoControlEnabled = cbHtpcInfoOverlay.Checked ? "true" : "false";
              string updateControlEnabled = cbUpdateControlOverlay.Checked ? "true" : "false";
              string MyeMailManagerEnabled = cbMyeMailManager.Checked ? "true" : "false";
              string disableExitMenu = cbDisableExitMenu.Checked ? "true" : "false";
              string contextLabelBelow = cbContextLabelBelow.Checked ? "true" : "false";

              if (direction == menuType.horizontal)
              {
            menuPos = "menuYPos";
            menuOrientation = "Horizontal";
              }
              else
              {
            menuPos = "menuXPos";
            menuOrientation = "Vertical";
              }

              switch (menuStyle)
              {
            case chosenMenuStyle.verticalStyle:
              activeMenuStyle = "verticalStyle";
              break;
            case chosenMenuStyle.horizontalStandardStyle:
              activeMenuStyle = "horizontalStandardStyle";
              break;
            case chosenMenuStyle.horizontalContextStyle:
              activeMenuStyle = "horizontalContextStyle";
              break;
            case chosenMenuStyle.graphicMenuStyle:
              activeMenuStyle = "graphicMenuStyle";
              break;
              }

              switch (rssImage)
              {
            case rssImageType.infoserviceImage:
              activeRssImageType = "infoservice";
              break;
            case rssImageType.noImage:
              activeRssImageType = "noimage";
              break;
            case rssImageType.skinImage:
              activeRssImageType = "skin";
              break;
              }

              if (weatherStyle == chosenWeatherStyle.bottom)
            activeWeatherStyle = "bottom";
              else if (weatherStyle == chosenWeatherStyle.middle)
            activeWeatherStyle = "middle";

              if (screenres == screenResolutionType.res1920x1080)
            targetScreenRes = "HD";
              else
            targetScreenRes = "SD";

              if (tvSeriesRecentStyle == tvSeriesRecentType.summary)
            tvRecentDisplayType = "summary";
              else
            tvRecentDisplayType = "full";

              if (movPicsRecentStyle == movPicsRecentType.summary)
            movPicsDisplayType = "summary";
              else
            movPicsDisplayType = "full";

              if (mrTVSeriesSummStyle == mostRecentTVSeriesSummaryStyle.fanart)
            mostRecentTVSeriesSummStyle = "fanart";
              else
            mostRecentTVSeriesSummStyle = "poster";

              if (mrMovPicsSummStyle == mostRecentMovPicsSummaryStyle.fanart)
            mostRecentMovPicsSummStyle = "fanart";
              else
            mostRecentMovPicsSummStyle = "poster";

              driveFreeSpaceList = string.Empty;
              foreach (string drive in driveFreeSpaceDrives)
              {
            driveFreeSpaceList += drive + ",";
              }
              if (driveFreeSpaceList.Length > 0)
            driveFreeSpaceList = driveFreeSpaceList.Substring(0, driveFreeSpaceList.Length - 1);

              xml = ("<profile>\n"
                + "\t<version>" + profileVersion + "</version>\n"
                + "\t<skin name=\"StreamedMP\">\n"
                + "\t\t<section name=" + quote + "StreamedMP Options" + quote + ">\n"
                + generateEntry("menustyle", activeMenuStyle, 3, true)
                + generateEntry("weatherstyle", activeWeatherStyle, 3, true)
                + generateEntry("menuitemFocus", focusAlpha.Text + txtFocusColour.Text, 3, true)
                + generateEntry("menuitemNoFocus", noFocusAlpha.Text + txtNoFocusColour.Text, 3, true)
                + generateEntry("labelFont", cboLabelFont.Text, 3, true)
                + generateEntry("selectedFont", cboSelectedFont.Text, 3, true)
                + generateEntry("menuType", menuOrientation, 3, true)
                + generateEntry(menuPos, txtMenuPos.Text, 3, true)
                + generateEntry("acceleration", acceleration, 3, true)
                + generateEntry("duration", duration, 3, true)
                + generateEntry("dropShadow", settingDropShadow, 3, true)
                + generateEntry("enableRssfeed", settingEnableRssfeed, 3, true)
                + generateEntry("enableTwitter", settingEnableTwitter, 3, true)
                + generateEntry("wrapString", settingWrapString, 3, true)
                + generateEntry("weatherBGlink", settingWeatherBGlink, 3, true)
                + generateEntry("fiveDayWeatherCheckBox", settingFiveDayWeatherCheckBox, 3, true)
                + generateEntry("summaryWeatherCheckBox", settingSummaryWeatherCheckBox, 3, true)
                + generateEntry("cboClearCache", settingClearCacheOnGenerate, 3, true)
                + generateEntry("animatedWeather", settingAnimatedWeather, 3, true)
                + generateEntry("horizontalContextLabels", settingHorizontalContextLabels, 3, true)
                + generateEntry("fullWeatherSummaryBottom", settingFullWeatherSummaryBottom, 3, true)
                + generateEntry("fullWeatherSummaryMiddle", settingFullWeatherSummaryMiddle, 3, true)
                + generateEntry("activeRssImageType", activeRssImageType, 3, true)
                + generateEntry("disableOnScreenClock", disableOnScreenClock, 3, true)
                + generateEntry("targetScreenRes", targetScreenRes, 3, true)
                + generateEntry("hideFanartScrapingtext", hideFanartScrapingtext, 3, true)
                + generateEntry("enableOverlayFanart", enableOverlayFanart, 3, true)
                + generateEntry("animatedBackground", animatedBackground, 3, true)
                + generateEntry("tvSeriesMostRecent", tvSeriesMostRecent, 3, true)
                + generateEntry("movPicsMostRecent", movPicsMostRecent, 3, true)
                + generateEntry("tvRecentDisplayType", tvRecentDisplayType, 3, true)
                + generateEntry("movPicsDisplayType", movPicsDisplayType, 3, true)
                + generateEntry("mostRecentTVSeriesSummStyle", mostRecentTVSeriesSummStyle, 3, true)
                + generateEntry("mostRecentMovPicsSummStyle", mostRecentMovPicsSummStyle, 3, true)
                + generateEntry("mostRecentCycleFanart", mostRecentCycleFanart, 3, true)
                + generateEntry("mrSeriesEpisodeFormat", mrSeriesEpisodeFormat, 3, true)
                + generateEntry("mrTitleLast", mrTitleLast, 3, true)
                + generateEntry("mrEpisodeFont", tvSeriesOptions.mrEpisodeFont, 3, true)
                + generateEntry("mrSeriesFont", tvSeriesOptions.mrSeriesFont, 3, true)
                + generateEntry("settingOldStyleExitButtons", settingOldStyleExitButtons, 3, true)
                + generateEntry("mrTVSeriesCycleFanart", mrTVSeriesCycleFanart, 3, true)
                + generateEntry("mrMovPicsCycleFanart", mrMovPicsCycleFanart, 3, true)
                + generateEntry("mrMovieTitleFont", movPicsOptions.MovieTitleFont, 3, true)
                + generateEntry("mrMovieDetailFont", movPicsOptions.MovieDetailFont, 3, true)
                + generateEntry("mrMovPicsHideRuntime", mrMovPicsHideRuntime, 3, true)
                + generateEntry("mrMovPicsHideCertification", mrMovPicsHideCertification, 3, true)
                + generateEntry("mrMovPicsHideRating", mrMovPicsHideRating, 3, true)
                + generateEntry("mrMovPicsUseTextRating", mrMovPicsUseTextRating, 3, true)
                + generateEntry("mrMovPicsWatched", mrMovPicsWatched, 3, true)
                + generateEntry("mrTVSeriesWatched", mrTVSeriesWatched, 3, true)
                + generateEntry("mrTVSeriesDisableFadeLabel", mrTVSeriesDisableFadeLabel, 3, true)
                + generateEntry("mrMovPicsDisableFadeLabel", mrMovPicsDisableFadeLabel, 3, true)
                + generateEntry("mrRecordedTVEnabled", mrRecordedTVEnabled, 3, true)
                + generateEntry("mrMusicEnabled", mrMusicEnabled, 3, true)
                + generateEntry("driveFreeSpaceList", driveFreeSpaceList, 3, true)
                + generateEntry("sleepControlEnabled", sleepControlEnabled, 3, true)
                + generateEntry("stocksControlEnabled", stocksControlEnabled, 3, true)
                + generateEntry("powerControlEnabled", powerControlEnabled, 3, true)
                + generateEntry("htpcinfoControlEnabled", htpcinfoControlEnabled, 3, true)
                + generateEntry("updateControlEnabled", updateControlEnabled, 3, true)
                + generateEntry("myeMailManagerEnabled", MyeMailManagerEnabled, 3, true)
                + generateEntry("disableExitMenu", disableExitMenu, 3, true)
                + generateEntry("contextLabelBelow", contextLabelBelow, 3, true)
                + "\t\t</section>");

              StringBuilder rawXML = new StringBuilder();

              rawXML.AppendLine("\n\t\t<!-- End Of Menu Options -->\n\t\t<section name=" + quote + "StreamedMP Menu Items" + quote + ">");

              int menuIndex = 0;
              rawXML.AppendLine(generateEntry("count", menuItems.Count.ToString(), 3, false));
              foreach (menuItem menItem in menuItems)
              {
            if (menItem.subMenuLevel1.Count > 0 || menItem.subMenuLevel2.Count > 0)
              menItem.disableBGSharing = true;

            rawXML.AppendLine("\t\t\t<!-- Menu Entry : " + menuIndex.ToString() + " -->");
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "name", menItem.name, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "label", menItem.contextLabel, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "folder", menItem.bgFolder, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "fanartproperty", menItem.fanartProperty, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "fanartSource", menItem.fhBGSource.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "fanarthandlerenabled", menItem.fanartHandlerEnabled.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "enablemusicnowplayingfanart", menItem.EnableMusicNowPlayingFanart.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "hyperlink", menItem.hyperlink, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "hyperlinkParameter", menItem.hyperlinkParameter, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "hyperlinkParameterOption", menItem.hyperlinkParameterOption, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "hyperlinkParameterSearch", menItem.hyperlinkParameterSearch, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "hyperlinkParameterCategory", menItem.hyperlinkParameterCategory, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "isdefault", menItem.isDefault.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "isweather", menItem.isWeather.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "id", menItem.id.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "xmlFileName", menItem.xmlFileName, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "buttonTexture", menItem.buttonTexture, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "updatestatus", menItem.updateStatus.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "defaultimage", menItem.defaultImage, 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "disableBGSharing", menItem.disableBGSharing.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "showMostRecent", menItem.showMostRecent.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "submenu1", menItem.subMenuLevel1.Count.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "submenu2", menItem.subMenuLevel2.Count.ToString(), 3, false));
            rawXML.AppendLine(generateEntry("menuitem" + menuIndex.ToString() + "subMenuLevel1ID", menItem.subMenuLevel1ID.ToString(), 3, false));

            if (menItem.subMenuLevel1.Count > 0)
            {
              int subCount = 0;
              subMenuL1Exists = true;
              rawXML.AppendLine("\t\t\t<!-- Menu Entry : " + menuIndex.ToString() + " Sub Level 1 -->");
              foreach (subMenuItem subItem in menItem.subMenuLevel1)
              {
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "displayName", subItem.displayName, 3, false));
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "baseDisplayName", subItem.baseDisplayName, 3, false));
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "xmlFileName", subItem.xmlFileName, 3, false));
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "hyperlink", subItem.hyperlink, 3, false));
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "hyperlinkParameter", subItem.hyperlinkParameter, 3, false));
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "hyperlinkParameterOption", subItem.hyperlinkParameterOption, 3, false));
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "hyperlinkParameterSearch", subItem.hyperlinkParameterSearch, 3, false));
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "hyperlinkParameterCategory", subItem.hyperlinkParameterCategory, 3, false));
            rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "1subitem" + subCount.ToString() + "mrDisplay", subItem.showMostRecent.ToString(), 3, false));
            subCount++;
              }

              subCount = 0;
              if (menItem.subMenuLevel2.Count > 0)
              {
            subMenuL2Exists = true;
            rawXML.AppendLine("\t\t\t<!-- Menu Entry : " + menuIndex.ToString() + " Sub Level 2 -->");
            foreach (subMenuItem subItem in menItem.subMenuLevel2)
            {
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "displayName", subItem.displayName, 3, false));
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "baseDisplayName", subItem.baseDisplayName, 3, false));
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "xmlFileName", subItem.xmlFileName, 3, false));
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "hyperlink", subItem.hyperlink, 3, false));
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "hyperlinkParameter", subItem.hyperlinkParameter, 3, false));
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "hyperlinkParameterOption", subItem.hyperlinkParameterOption, 3, false));
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "hyperlinkParameterSearch", subItem.hyperlinkParameterSearch, 3, false));
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "hyperlinkParameterCategory", subItem.hyperlinkParameterCategory, 3, false));
              rawXML.AppendLine(generateEntry("submenu" + menuIndex.ToString() + "2subitem" + subCount.ToString() + "mrDisplay", subItem.showMostRecent.ToString(), 3, false));
              subCount++;
            }
              }
            }

            menuIndex += 1;

            if (menItem.fanartHandlerEnabled)
              fanartHandlerUsed = true;

              }
              rawXML.AppendLine("\t\t</section>");
              rawXML.AppendLine("\t</skin>");
              rawXML.AppendLine("</profile>");

              xml += rawXML.ToString();

              if (System.IO.File.Exists(SkinInfo.mpPaths.configBasePath + "usermenuprofile.xml"))
            System.IO.File.Copy(SkinInfo.mpPaths.configBasePath + "usermenuprofile.xml", SkinInfo.mpPaths.configBasePath + "usermenuprofile.xml.backup." + DateTime.Now.Ticks.ToString());

              if (System.IO.File.Exists(SkinInfo.mpPaths.configBasePath + "usermenuprofile.xml"))
            System.IO.File.Delete(SkinInfo.mpPaths.configBasePath + "usermenuprofile.xml");

              StreamWriter writer;
              writer = System.IO.File.CreateText(SkinInfo.mpPaths.configBasePath + "usermenuprofile.xml");
              writer.Write(xml);
              writer.Close();
        }
Пример #4
0
        private void generateXML(menuType direction)
        {
            string menuPos;
              string skeletonFile;

              // Sync Submenu ID's with control ID's
              foreach (menuItem item in menuItems)
              {
            if (item.subMenuLevel1.Count > 0)
              menuItems[menuItems.IndexOf(item)].subMenuLevel1ID = (menuItems[menuItems.IndexOf(item)].id - 999) * 10000;
            else
              menuItems[menuItems.IndexOf(item)].subMenuLevel1ID = 0;
              }
              // Save out configuration into usermenuprofile.xml
              writeMenuProfile(direction);
              bgItems.Clear();

              if (direction == menuType.horizontal)
              {
            menuPos = "menuYPos:" + txtMenuPos.Text;
            skeletonFile = "StreamedMPEditor.xmlFiles.HBasicHomeSkeleton.xml";
              }
              else
              {
            menuPos = "menuXPos:" + txtMenuPos.Text;
            skeletonFile = "StreamedMPEditor.xmlFiles.VBasicHomeSkeleton.xml";
              }
              //if (getInfoServiceVersion().CompareTo(isWeatherVersion) >= 0)
              //  infoServiceDayProperty = "forecast";
              //else
              //  infoServiceDayProperty = "day";

              Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(skeletonFile);
              StreamReader reader = new StreamReader(stream);
              xml = reader.ReadToEnd();

              string acceleration = tbAcceleration.Text;
              string duration = tbDuration.Text;

              string randomFanartGames = randomFanart.fanartGames ? "Yes" : "No";
              string randomFanartMovies = randomFanart.fanartMovies ? "Yes" : "No";
              string randomMoviesScraperFanart = randomFanart.fanartMoviesScraperFanart ? "Yes" : "No";
              string randomFanartMovingPictures = randomFanart.fanartMovingPictures ? "Yes" : "No";
              string randomFanartMusic = randomFanart.fanartMusic ? "Yes" : "No";
              string randomMusicScraperFanart = randomFanart.fanartMusicScraperFanart ? "Yes" : "No";
              string randomFanartPictures = randomFanart.fanartPictures ? "Yes" : "No";
              string randomFanartPlugins = randomFanart.fanartPlugins ? "Yes" : "No";
              string randomFanartTv = randomFanart.fanartTv ? "Yes" : "No";
              string randomFanartTVSeries = randomFanart.fanartTVSeries ? "Yes" : "No";
              string randomScoreCenterFanart = randomFanart.fanartScoreCenter ? "Yes" : "No";

              if (fanartHandlerUsed)
              {
            if (fanartHandlerRelease2)
            {
              xml = xml.Replace("<!-- BEGIN GENERATED DEFINITIONS -->"
                        , "<define>#menuitemFocus:" + focusAlpha.Text + txtFocusColour.Text + "</define>"
                        + "<define>#menuitemNoFocus:" + noFocusAlpha.Text + txtNoFocusColour.Text + "</define>"
                        + "<define>#labelFont:" + cboLabelFont.Text + "</define>"
                        + "<define>#selectedFont:" + cboSelectedFont.Text + "</define>"
                        + "<define>#" + menuPos + "</define>"
                        + "<define>#useRandomGamesUserFanart:" + randomFanartGames + "</define>"
                        + "<define>#useRandomTVSeriesFanart:" + randomFanartTVSeries + "</define>"
                        + "<define>#useRandomPluginsUserFanart:" + randomFanartPlugins + "</define>"
                        + "<define>#useRandomMovingPicturesFanart:" + randomFanartMovingPictures + "</define>"
                        + "<define>#useRandomMusicUserFanart:" + randomFanartMusic + "</define>"
                        + "<define>#useRandomMusicScraperFanart:" + randomMusicScraperFanart + "</define>"
                        + "<define>#useRandomPicturesUserFanart:" + randomFanartPictures + "</define>"
                        + "<define>#useRandomTVUserFanart:" + randomFanartTv + "</define>"
                        + "<define>#useRandomMoviesUserFanart:" + randomFanartMovies + "</define>"
                        + "<define>#useRandomMoviesScraperFanart:" + randomMoviesScraperFanart + "</define>"
                        + "<define>#useRandomScoreCenterUserFanart:" + randomScoreCenterFanart + "</define>");

            }
            else
            {
              xml = xml.Replace("<!-- BEGIN GENERATED DEFINITIONS -->"
                        , "<define>#menuitemFocus:" + focusAlpha.Text + txtFocusColour.Text + "</define>"
                        + "<define>#menuitemNoFocus:" + noFocusAlpha.Text + txtNoFocusColour.Text + "</define>"
                        + "<define>#labelFont:" + cboLabelFont.Text + "</define>"
                        + "<define>#selectedFont:" + cboSelectedFont.Text + "</define>"
                        + "<define>#" + menuPos + "</define>"
                        + "<define>#useRandomGamesFanart:" + randomFanartGames + "</define>"
                        + "<define>#useRandomTVSeriesFanart:" + randomFanartTVSeries + "</define>"
                        + "<define>#useRandomPluginsFanart:" + randomFanartPlugins + "</define>"
                        + "<define>#useRandomMovingPicturesFanart:" + randomFanartMovingPictures + "</define>"
                        + "<define>#useRandomMusicFanart:" + randomFanartMusic + "</define>"
                        + "<define>#useRandomPicturesFanart:" + randomFanartPictures + "</define>"
                        + "<define>#useRandomTVFanart:" + randomFanartTv + "</define>"
                        + "<define>#useRandomMoviesFanart:" + randomFanartMovies + "</define>"
                        + "<define>#useRandomScoreCenterFanart:" + randomScoreCenterFanart + "</define>");
            }
              }
              else
              {
            xml = xml.Replace("<!-- BEGIN GENERATED DEFINITIONS -->"
                        , "<define>#menuitemFocus:" + focusAlpha.Text + txtFocusColour.Text + "</define>"
                        + "<define>#menuitemNoFocus:" + noFocusAlpha.Text + txtNoFocusColour.Text + "</define>"
                        + "<define>#labelFont:" + cboLabelFont.Text + "</define>"
                        + "<define>#selectedFont:" + cboSelectedFont.Text + "</define>"
                        + "<define>#" + menuPos + "</define>");

              }

              // Write out Sub Menu Code
              if (direction == menuType.vertical)
            xml = xml.Replace("<!-- BEGIN GENERATED SUBMENU CODE -->", bhSubMenuWriterV());
              else if(menuStyle == chosenMenuStyle.graphicMenuStyle)
            xml = xml.Replace("<!-- BEGIN GENERATED SUBMENU CODE -->", bhSubMenuWriterGraphical());
              else
            xml = xml.Replace("<!-- BEGIN GENERATED SUBMENU CODE -->", bhSubMenuWriterH());

              // String will we use to hold the create xml
              StringBuilder rawXML = new StringBuilder();

              // For each defined menu item create the visibility control and the 14 controls for menu item, 2 buttons and 12 label controls
              foreach (menuItem menItem in menuItems)
              {
            fillBackgroundItem(menItem);
            // Check if this menu item is TVSeries or MovingPictures and store the menu ID for use
            // with the InfoService 3 last added items function if a match
            if (menItem.hyperlink == tvseriesSkinID)
              basicHomeValues.tvseriesControl = menItem.id;

            if (menItem.hyperlink == movingPicturesSkinID)
              basicHomeValues.movingPicturesControl = menItem.id;

            if (menItem.hyperlink == musicSkinID)
              basicHomeValues.musicControl = menItem.id;

            if (menItem.hyperlink == tvMenuSkinID)
              basicHomeValues.tvControl = menItem.id;

            // Is this the default Item
            if (menItem.isDefault == true)
              xml = xml.Replace("<!-- BEGIN GENERATED DEFAULTCONTROL CODE-->", "<defaultcontrol>" + (menItem.id + 900).ToString() + "</defaultcontrol>");

            rawXML.AppendLine("<control>");
            rawXML.AppendLine("<description>Dummy label indicating " + menItem.name + " visibility when submen open</description>");
            rawXML.AppendLine("<id>" + menItem.id.ToString() + "</id>");
            rawXML.AppendLine("<type>label</type>");
            rawXML.AppendLine("<posX>100</posX>");
            rawXML.AppendLine("<posY>-100</posY>");
            rawXML.AppendLine("<width>500</width>");
            rawXML.AppendLine("<height>0</height>");
            rawXML.AppendLine("<label>-</label>");
            rawXML.AppendLine("<visible>Control.HasFocus(" + (menItem.id + 700).ToString() + ")|Control.HasFocus(" + (menItem.id + 800).ToString() + ")|Control.HasFocus(" + (menItem.id + 900).ToString() + ")|control.isvisible(" + (menItem.id + 100).ToString() + ")</visible>");
            rawXML.AppendLine("</control>");

            if (menuStyle == chosenMenuStyle.graphicMenuStyle)
            {
              // Write out the menu butons and lables
              for (int i = 0; i < 16; i++)
              {
            writeGraphicalMenu(i, menItem, ref rawXML);
              }
            }
            else
            {
              // Write out the menu butons and lables
              for (int i = 0; i < 14; i++)
              {
            if (direction == menuType.horizontal)
            {
              writeHorizonalMenu(i, menItem, ref rawXML);
            }
            else if (direction == menuType.vertical)
            {
              writeVerticalMenu(i, menItem, ref rawXML);
            }
              }
            }
              }
              xml = xml.Replace("<!-- BEGIN GENERATED BUTTON CODE-->", rawXML.ToString());

              if (direction == menuType.vertical && subMenuL1Exists)
            writeVerticalSubmenus();

              if (direction != menuType.vertical && subMenuL1Exists && menuStyle != chosenMenuStyle.graphicMenuStyle)
            writeHorizontalSubmenus();
        }
Пример #5
0
        private void generateBg(menuType direction)
        {
            StringBuilder rawXML = new StringBuilder();

              foreach (backgroundItem item in bgItems)
              {
            string subMenu = item.subMenuID.ToString();
            //
            // Main controls - these deal with random fanart
            //

            //sort out fanart handler....
            if (item.fanartHandlerEnabled && fanartHandlerRelease2)
            {
              switch (item.fanartPropery.ToLower())
              {
            case "games":
              fhUserDef = ".userdef";
              break;
            case "movie":
              if (item.fhBGSource == fanartSource.Scraper)
                fhUserDef = ".scraper";
              else
                fhUserDef = ".userdef";
              break;
            case "music":
              if (item.fhBGSource == fanartSource.Scraper)
                fhUserDef = ".scraper";
              else
                fhUserDef = ".userdef";
              break;
            case "picture":
              fhUserDef = ".userdef";
              break;
            case "plugins":
              fhUserDef = ".userdef";
              break;
            case "scorecenter":
              fhUserDef = ".userdef";
              break;
            case "tv":
              fhUserDef = ".userdef";
              break;
            default:
              fhUserDef = string.Empty;
              break;
              }
            }

            rawXML.AppendLine("<control>");
            rawXML.AppendLine("<description>" + item.name + " BACKGROUND 1</description>");
            if (item.fanartHandlerEnabled)
              rawXML.AppendLine("<id>" + (int.Parse(item.ids[0]) + 200).ToString() + "1</id>");
            else
              rawXML.AppendLine("<id>" + (int.Parse(item.ids[0]) + 200).ToString() + "</id>");

            if (weatherBGlink.Checked && item.isWeather)
            {
              rawXML.AppendLine("<type>image</type>");
              rawXML.AppendLine("<texture>" + bgFolderName + "\\linkedweather\\#WorldWeather.TodayIconNumber.jpg</texture>");
            }
            else
            {
              if (item.fanartHandlerEnabled)
              {
            rawXML.AppendLine("<type>image</type>");
            rawXML.AppendLine("<texture>#fanarthandler." + item.fanartPropery + fhUserDef + ".backdrop1.any</texture>");

              }
              else
              {
            rawXML.AppendLine("<type>image</type>");
            rawXML.AppendLine("<texture>" + item.image + "</texture>");
            rawXML.AppendLine("<shouldCache>true</shouldCache>");
              }
            }

            rawXML.AppendLine("<posx>0</posx>");
            rawXML.AppendLine("<posy>0</posy>");
            rawXML.AppendLine("<width>1280</width>");
            rawXML.AppendLine("<height>720</height>");

            if (item.fanartHandlerEnabled)
              rawXML.Append("<visible>[");
            else
              rawXML.Append("<visible>");

            for (int i = 0; i < item.ids.Count; i++)
            {
              if (i == 0)
              {
            if (subMenu == "0")
              rawXML.Append("control.isvisible(" + item.ids[i] + ")");
            else
              rawXML.Append("control.isvisible(" + subMenu + ")|control.isvisible(" + item.ids[i] + ")");
              }
              else
            rawXML.Append("|control.isvisible(" + item.ids[i] + ")");
            }

            if (item.fanartHandlerEnabled)
            {
              if (item.EnableMusicNowPlayingFanart)
            rawXML.Append("]+control.isvisible(91919297)+![control.isvisible(91919294)+Player.HasMedia]</visible>");
              else
            rawXML.Append("]+control.isvisible(91919297)</visible>");
            }
            else
              rawXML.Append("</visible>");

            if (validForMPVersion("1.1.5.0"))
              rawXML.AppendLine("<animation effect=\"fade\"  start=\"100\" end=\"0\" time=\"600\" reversible=\"false\">Hidden</animation>");

            rawXML.AppendLine("<animation effect=\"fade\" start=\"30\" end=\"100\" time=\"600\" reversible=\"false\">Visible</animation>");

            if (cbAnimateBackground.Checked)
            {
              rawXML.AppendLine("<animation effect=\"zoom\" start=\"105,105\" end=\"110,110\" time=\"20000\" tween=\"cubic\" easing=\"inout\" pulse=\"true\" reversible=\"false\" condition=\"true\">Conditional</animation>");
              rawXML.AppendLine("<animation effect=\"slide\" start=\"0,0\" end=\"-20,-20\" time=\"10000\" tween=\"cubic\" easing=\"inout\" pulse=\"true\" reversible=\"false\" condition=\"true\">Conditional</animation>");
            }
            rawXML.AppendLine("</control>");

            // Add second background control for random fanart provided
            if (item.fanartHandlerEnabled)
            {
              rawXML.AppendLine("<control>");

              rawXML.AppendLine("<description>" + item.name + " BACKGROUND 2</description>");
              rawXML.AppendLine("<id>" + (int.Parse(item.ids[0]) + 200).ToString() + "2</id>");
              rawXML.AppendLine("<type>image</type>");
              rawXML.AppendLine("<texture>#fanarthandler." + item.fanartPropery + fhUserDef + ".backdrop2.any</texture>");
              rawXML.AppendLine("<posx>0</posx>");
              rawXML.AppendLine("<posy>0</posy>");
              rawXML.AppendLine("<width>1280</width>");
              rawXML.AppendLine("<height>720</height>");
              rawXML.Append("<visible>[");

              for (int i = 0; i < item.ids.Count; i++)
              {
            if (i == 0)
            {
              if (subMenu == "0")
                rawXML.Append("control.isvisible(" + item.ids[i] + ")");
              else
                rawXML.Append("control.isvisible(" + subMenu + ")|control.isvisible(" + item.ids[i] + ")");
            }
            else
              rawXML.Append("|control.isvisible(" + item.ids[i] + ")");
              }

              if (item.EnableMusicNowPlayingFanart)
            rawXML.Append("]+control.isvisible(91919298)+![control.isvisible(91919294)+Player.HasMedia]</visible>");
              else
            rawXML.Append("]+control.isvisible(91919298)</visible>");

              if (validForMPVersion("1.1.5.0"))
            rawXML.AppendLine("<animation effect=\"fade\"  start=\"100\" end=\"0\" time=\"600\" reversible=\"false\">Hidden</animation>");

              rawXML.AppendLine("<animation effect=\"fade\" start=\"30\" end=\"100\" time=\"600\" reversible=\"false\">Visible</animation>");

              if (cbAnimateBackground.Checked)
              {
            rawXML.AppendLine("<animation effect=\"zoom\" start=\"105,105\" end=\"110,110\" time=\"20000\" tween=\"cubic\" easing=\"inout\" pulse=\"true\" reversible=\"false\" condition=\"true\">Conditional</animation>");
            rawXML.AppendLine("<animation effect=\"slide\" start=\"0,0\" end=\"-20,-20\" time=\"10000\" tween=\"cubic\" easing=\"inout\" pulse=\"true\" reversible=\"false\" condition=\"true\">Conditional</animation>");
              }
              rawXML.AppendLine("</control>");
            }

            //
            // Additional two controls that will be added if EnableMusicNowPlayingFanart is true, i.e. for thsi item if music is play display
            // fanart for the artist.
            //
            if (item.EnableMusicNowPlayingFanart)
            {
              //
              // Control 1
              //
              rawXML.AppendLine("<control>");

              rawXML.AppendLine("<description>" + item.name + " NOW PLAYING BACKGROUND 1</description>");
              rawXML.AppendLine("<id>" + (int.Parse(item.ids[0]) + 200).ToString() + "3</id>");
              rawXML.AppendLine("<type>image</type>");
              rawXML.AppendLine("<texture>#fanarthandler.music.backdrop1.play</texture>");
              rawXML.AppendLine("<posx>0</posx>");
              rawXML.AppendLine("<posy>0</posy>");
              rawXML.AppendLine("<width>1280</width>");
              rawXML.AppendLine("<height>720</height>");
              rawXML.Append("<visible>[");
              for (int i = 0; i < item.ids.Count; i++)
              {
            if (i == 0)
            {
              if (subMenu == "0")
                rawXML.Append("control.isvisible(" + item.ids[i] + ")");
              else
                rawXML.Append("control.isvisible(11111)|control.isvisible(" + item.ids[i] + ")");
            }
            else
              rawXML.Append("|control.isvisible(" + item.ids[i] + ")");
              }
              rawXML.Append("]+Player.HasMedia+control.isvisible(91919295)</visible>");
              if (validForMPVersion("1.1.5.0"))
            rawXML.AppendLine("<animation effect=\"fade\"  start=\"100\" end=\"0\" time=\"600\" reversible=\"false\">Hidden</animation>");

              rawXML.AppendLine("<animation effect=\"fade\" start=\"30\" end=\"100\" time=\"600\" reversible=\"false\">Visible</animation>");

              if (cbAnimateBackground.Checked)
              {
            rawXML.AppendLine("<animation effect=\"zoom\" start=\"105,105\" end=\"110,110\" time=\"20000\" tween=\"cubic\" easing=\"inout\" pulse=\"true\" reversible=\"false\" condition=\"true\">Conditional</animation>");
            rawXML.AppendLine("<animation effect=\"slide\" start=\"0,0\" end=\"-20,-20\" time=\"10000\" tween=\"cubic\" easing=\"inout\" pulse=\"true\" reversible=\"false\" condition=\"true\">Conditional</animation>");
              }
              rawXML.AppendLine("</control>");

              //
              // Control 2
              //
              rawXML.AppendLine("<control>");

              rawXML.AppendLine("<description>" + item.name + " NOW PLAYING BACKGROUND 2</description>");
              rawXML.AppendLine("<id>" + (int.Parse(item.ids[0]) + 200).ToString() + "4</id>");
              rawXML.AppendLine("<type>image</type>");
              rawXML.AppendLine("<texture>#fanarthandler.music.backdrop2.play</texture>");
              rawXML.AppendLine("<posx>0</posx>");
              rawXML.AppendLine("<posy>0</posy>");
              rawXML.AppendLine("<width>1280</width>");
              rawXML.AppendLine("<height>720</height>");
              rawXML.Append("<visible>[");
              for (int i = 0; i < item.ids.Count; i++)
              {
            if (i == 0)
            {
              if (subMenu == "0")
                rawXML.Append("control.isvisible(" + item.ids[i] + ")");
              else
                rawXML.Append("control.isvisible(11111)|control.isvisible(" + item.ids[i] + ")");
            }
            else
              rawXML.Append("|control.isvisible(" + item.ids[i] + ")");
              }
              rawXML.Append("]+Player.HasMedia+control.isvisible(91919296)</visible>");
              if (validForMPVersion("1.1.5.0"))
            rawXML.AppendLine("<animation effect=\"fade\"  start=\"100\" end=\"0\" time=\"600\" reversible=\"false\">Hidden</animation>");

              rawXML.AppendLine("<animation effect=\"fade\" start=\"30\" end=\"100\" time=\"600\" reversible=\"false\">Visible</animation>");

              if (cbAnimateBackground.Checked)
              {
            rawXML.AppendLine("<animation effect=\"zoom\" start=\"105,105\" end=\"110,110\" time=\"20000\" tween=\"cubic\" easing=\"inout\" pulse=\"true\" reversible=\"false\" condition=\"true\">Conditional</animation>");
            rawXML.AppendLine("<animation effect=\"slide\" start=\"0,0\" end=\"-20,-20\" time=\"10000\" tween=\"cubic\" easing=\"inout\" pulse=\"true\" reversible=\"false\" condition=\"true\">Conditional</animation>");
              }
              rawXML.AppendLine("</control>");
            }

              }
              xml = xml.Replace("<!-- BEGIN GENERATED BACKGROUND CODE-->", rawXML.ToString());
        }
Пример #6
0
        private void menu_check(object sender, RoutedEventArgs e)
        {
            menuType tmp = (menuType)(int.Parse((sender as MenuItem).Tag.ToString()));
            //MessageBox.Show(tmp.ToString());
            Process myProcess;

            switch (tmp)
            {
            case menuType.MENU_CALIBRATION:
                EvoCalibrationWin wina = new EvoCalibrationWin(_my._MachineInfo);
                wina.Show();
                break;

            case menuType.MENU_IMPORT:
                Microsoft.Win32.OpenFileDialog op = new Microsoft.Win32.OpenFileDialog();
                op.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory + "outport";
                op.Filter           = "evos File|*.evos";
                op.FilterIndex      = 1;
                if ((bool)op.ShowDialog())
                {
                    string savePath = op.FileName;
                    if (MessageBox.Show("Overwrite the current config?", "Hint", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        FunctionFileManage.ImpportDB(savePath);
                    }
                }
                break;

            case menuType.MENU_EXPORT:
                Microsoft.Win32.SaveFileDialog openFileDialog = new Microsoft.Win32.SaveFileDialog();
                openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory + "outport";
                openFileDialog.Filter           = "evos File|*.evos";
                openFileDialog.FilterIndex      = 1;

                if ((bool)openFileDialog.ShowDialog())
                {
                    string savePath = openFileDialog.FileName;
                    FunctionFileManage.ExportDB(savePath);
                }
                break;

            case menuType.MENU_COM:
                _my.ComCmd.Execute(513);
                break;

            case menuType.MENU_VISUAL:
                myProcess = new Process();
                try
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    myProcess.StartInfo.FileName        = "GIFConverter.exe";
                    myProcess.StartInfo.CreateNoWindow  = true;
                    myProcess.Start();
                }
                catch (Exception e1)
                {
                    Console.WriteLine(e1.Message);
                }
                break;

            case menuType.MENU_PIC:
                myProcess = new Process();
                try
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    myProcess.StartInfo.FileName        = "EVO.TOOL.MAKEPIC.exe";
                    myProcess.StartInfo.CreateNoWindow  = true;
                    myProcess.Start();
                }
                catch (Exception e1)
                {
                    Console.WriteLine(e1.Message);
                }
                break;

            case menuType.MENU_USB:
                myProcess = new Process();
                try
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    myProcess.StartInfo.FileName        = "EVO.TOOL.USBFILE.exe";
                    myProcess.StartInfo.CreateNoWindow  = true;
                    myProcess.Start();
                }
                catch (Exception e1)
                {
                    Console.WriteLine(e1.Message);
                }
                break;

            case menuType.MENU_HELP:
                MessageBox.Show("Coming Soon!!!");
                break;

            case menuType.MENU_ABOUT:
                MessageBox.Show("Version:" + MajorVersion.ToString() + "." + MinorVersion.ToString() + " supported by Crem", "Infomation");
                break;

            default:
                break;
            }
        }
Пример #7
0
 void CloseMenu()
 {
     ChangeMenu();
     curMenu  = menuType.paused;
     isPaused = false;
 }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        Time.timeScale = isPaused ? 0 : 1;

        //if (playerStats.MaxHP != playerHealthSlider.maxValue) { playerHealthSlider.maxValue = playerStats.MaxHP; }
        //if (playerStats.curHP != playerHealthSlider.value) { playerHealthSlider.value = playerStats.curHP; }

        playerHealthBar.transform.GetChild(0).Find("Health").gameObject.GetComponent <Image>().fillAmount = (float)playerStats.curHP / (float)playerStats.MaxHP;

        //Setting Cur HP
        curHP.text = "HP  " + playerStats.curHP.ToString().PadLeft(playerStats.MaxHP.ToString().Length, ' ') + "/" + playerStats.MaxHP.ToString();
        //Set Cur Floor
        curFloor.text = floorManager.FloorNum.ToString() + "F";
        //Set Cur Level
        curLevel.text = "Lv " + playerStats.Level.ToString();

        if (Input.GetKeyDown(KeyCode.R))
        {
            Random.InitState(Random.Range(-2100000000, 21000000));
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }


        if (Input.GetButtonDown("Start") && GameObject.Find("objPlayer").GetComponent <EntityMovement>().CurTurn&& !GameObject.Find("objPlayer").GetComponent <EntityMovement>().isMoving)
        {
            if (!isPaused)
            {
                isPaused = true;
            }
            else if (isPaused)
            {
                if (curMenu == menuType.paused)
                {
                    isPaused = false;
                }
            }
        }

        if (isPaused)
        {
            if (pauseHUD.gameObject.activeInHierarchy == false)
            {
                pauseHUD.gameObject.SetActive(true);
            }
            pauseHUD.gameObject.SetActive(true);


            #region Menu Navigation

            if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0)
            {
                inputHeld = false;
            }
            switch (curMenu)
            {
            case menuType.paused:
                if (Input.GetAxisRaw("Vertical") != 0 && !inputHeld)
                {
                    inputHeld         = true;
                    curMenuSelection -= 1 * (int)Mathf.Sign(Input.GetAxisRaw("Vertical"));
                }
                curMenuSelection = curMenuSelection < 0 ? 6 : curMenuSelection > 6 ? 0 : curMenuSelection;
                if (Input.GetButtonDown("RightButton"))
                {
                    switch (curMenuSelection)
                    {
                    //Moves
                    case 0:
                        curMenu = menuType.moves;
                        ChangeMenu();
                        break;

                    //Items
                    case 1:
                        curMenu = menuType.inventory;
                        ChangeMenu();
                        break;

                    //Stats
                    case 2:
                        curMenu = menuType.stats;
                        ChangeMenu();
                        break;

                    //Others
                    case 3:
                        curMenu = menuType.others;
                        ChangeMenu();
                        break;

                    //Ground
                    case 4:
                        curMenu = menuType.ground;
                        ChangeMenu();
                        break;

                    //Rest
                    case 5:
                        curMenu = menuType.rest;
                        ChangeMenu();
                        break;

                    //Exit
                    case 6:
                        isPaused = false;
                        break;
                    }
                }
                break;

            case menuType.moves:
                if (Input.GetAxisRaw("Vertical") != 0 && !inputHeld)
                {
                    inputHeld   = true;
                    curMoveSel -= 1 * (int)Mathf.Sign(Input.GetAxisRaw("Vertical"));
                }
                curMoveSel = curMoveSel <0 ? playerEntityManager.SpecialMoves.Count - 1 : curMoveSel> playerEntityManager.SpecialMoves.Count - 1 ? 0 : curMoveSel;
                if (Input.GetButtonDown("RightButton"))
                {
                    if (playerEntityManager.UseSMove(curMoveSel, GameObject.Find("objPlayer").GetComponent <EntityMovement>().CurDirection))
                    {
                        GameObject.Find("objPlayer").GetComponent <EntityMovement>().canMove = false;
                        CloseMenu();
                    }
                }

                if (Input.GetButtonDown("BottomButton"))
                {
                    ChangeMenu();
                    curMenu = menuType.paused;
                }
                break;

            case menuType.inventory:
                if (Input.GetAxisRaw("Vertical") != 0 && !inputHeld)
                {
                    if (!invContext)
                    {
                        inputHeld        = true;
                        curInvSelection -= 1 * (int)Mathf.Sign(Input.GetAxisRaw("Vertical"));
                    }
                    else
                    {
                        inputHeld         = true;
                        curInvContextSel -= 1 * (int)Mathf.Sign(Input.GetAxisRaw("Vertical"));
                    }
                }
                if (Input.GetAxisRaw("Horizontal") != 0 && !inputHeld)
                {
                    if (!invContext)
                    {
                        inputHeld        = true;
                        curInvPage      += 1 * (int)Mathf.Sign(Input.GetAxisRaw("Horizontal"));
                        curInvSelection += 10 * (int)Mathf.Sign(Input.GetAxisRaw("Horizontal"));
                        if (curInvSelection < 0)
                        {
                            curInvSelection = 0;
                        }
                        if (curInvSelection > playerInventory.Inventory.Count)
                        {
                            curInvSelection = playerInventory.Inventory.Count;
                        }
                    }
                }
                curInvPage = Mathf.Clamp(curInvPage, 0, Mathf.Clamp(playerInventory.Inventory.Count / 10, 0, 2));
                //Make sure inventory panel is being shown
                if (inventoryPanel.gameObject.activeInHierarchy == false)
                {
                    inventoryPanel.gameObject.SetActive(true);
                }
                //Makesure inventory context panel is being shown when it's supposed to be
                if (invContext && invContextPanel.gameObject.activeInHierarchy == false)
                {
                    invContextPanel.gameObject.SetActive(true);
                }
                else if (!invContext && invContextPanel.gameObject.activeInHierarchy == true)
                {
                    invContextPanel.gameObject.SetActive(false);
                }
                //Loop inventory panel selection
                if (curInvSelection < 0 + (curInvPage * 10))
                {
                    if (playerInventory.Inventory.Count >= 10 + (curInvPage * 10))
                    {
                        curInvSelection = 9 + (curInvPage * 10);
                    }
                    else
                    {
                        curInvSelection = playerInventory.InventoryCount.Count - 1;
                    }
                }
                if (curInvSelection > 9 + (curInvPage * 10) || curInvSelection > playerInventory.Inventory.Count - 1)
                {
                    curInvSelection = 0 + (curInvPage * 10);
                }
                if (Input.GetButtonDown("BottomButton"))
                {
                    if (!invContext && !usingItem)
                    {
                        curMenu = menuType.paused;
                        ChangeMenu();
                    }
                    else if (!invContext && usingItem)
                    {
                        usingItem = false;
                    }
                    else
                    {
                        invContext = false;
                    }
                }
                //Right Button Clicked
                if (Input.GetButtonDown("RightButton"))
                {
                    //Out of Context Menu
                    if (playerInventory.Inventory.Count == 0)
                    {
                        break;
                    }
                    if (!invContext)
                    {
                        if (!usingItem)
                        {
                            invContext       = true;
                            curInvContextSel = 0;
                        }
                        else
                        {
                            if (curInvSelection != invSlotBeingUsed)
                            {
                                if (inventoryText.text.Contains(">Chest"))
                                {
                                    if (invSlotBeingUsed > curInvSelection)
                                    {
                                        playerInventory.RemoveItem(invSlotBeingUsed, 1);
                                        playerInventory.RemoveItem(curInvSelection, 1);
                                    }
                                    else
                                    {
                                        playerInventory.RemoveItem(curInvSelection, 1);
                                        playerInventory.RemoveItem(invSlotBeingUsed, 1);
                                    }
                                    playerInventory.AddItem(floorManager.curFloorInfo.chestTable[GlobalFunc.ReturnIndexFromWeightedTable(Random.Range(0, GlobalFunc.GetTotalListValue(floorManager.curFloorInfo.chestSpawnWeight)), floorManager.curFloorInfo.treasureSpawnWeight)]);
                                    NewLogMessage(playerStats.entityName + " opened a chest!");
                                }
                            }
                        }
                    }
                    else       //Inside Context Menu
                    {
                        string itemName = playerInventory.Inventory[curInvSelection].itemName;
                        if (invContextText.text.Contains(">Consume"))      //Try to Eat
                        {
                            if (playerEntityManager.ConsumeItem(curInvSelection))
                            {
                                NewLogMessage(playerStats.entityName + " consumed " + itemName);
                                invContext = false;
                                CloseMenu();
                                GameObject.Find("objPlayer").GetComponent <EntityMovement>().EndTurn();
                            }
                        }
                        if (invContextText.text.Contains(">Equip"))
                        {
                            if (playerEntityManager.EquipItem(curInvSelection))
                            {
                                NewLogMessage(playerStats.entityName + " equiped " + itemName);
                                invContext = false;
                            }
                        }
                        if (invContextText.text.Contains(">Unequip"))
                        {
                            if (playerEntityManager.UnequipItem(curInvSelection))
                            {
                                NewLogMessage(playerStats.entityName + " unequiped " + itemName);
                            }
                        }
                        if (invContextText.text.Contains(">Throw"))
                        {
                            EntityMovement pm = GameObject.Find("objPlayer").GetComponent <EntityMovement>();
                            if (playerEntityManager.ThrowItem(curInvSelection, pm.CurDirection))
                            {
                                pm.canMove = false;
                                invContext = false;
                                CloseMenu();
                            }
                        }
                        if (invContextText.text.Contains(">Use"))
                        {
                            usingItem        = true;
                            invSlotBeingUsed = curInvSelection;
                            invContext       = false;
                        }
                        if (invContextText.text.Contains(">Exit"))
                        {
                            invContext = false;
                        }
                    }
                }
                break;

            case menuType.stats:
                if (Input.GetButtonDown("BottomButton"))
                {
                    ChangeMenu();
                    curMenu = menuType.paused;
                }
                if (Input.GetAxisRaw("Horizontal") != 0 && !inputHeld)
                {
                    if (!statsContext)
                    {
                        inputHeld     = true;
                        curStatsPage += 1 * (int)Mathf.Sign(Input.GetAxisRaw("Horizontal"));

                        /*if (curInvSelection < 0) { curInvSelection = 0; }
                         * if (curInvSelection > playerInventory.Inventory.Count) { curInvSelection = playerInventory.Inventory.Count; }*/
                    }
                }
                curStatsPage = Mathf.Clamp(curStatsPage, 0, 1);
                break;

            case menuType.others:
                if (Input.GetButtonDown("BottomButton"))
                {
                    ChangeMenu();
                    curMenu = menuType.paused;
                }
                break;

            case menuType.ground:
                if (Input.GetButtonDown("BottomButton"))
                {
                    ChangeMenu();
                    curMenu = menuType.paused;
                }
                if (Input.GetButtonDown("RightButton"))
                {
                    if (groundContextText.text.Contains(">Purchase"))
                    {
                        if (playerInventory.Gold >= playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Item.baseBuyAmt)
                        {
                            if (playerInventory.AddItem(playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Item))
                            {
                                playerInventory.GainGold(playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Item.baseBuyAmt * -1);
                                Destroy(playerEntityManager.ObjOntopOf);
                            }
                            else
                            {
                                CloseMenu();
                                NewLogMessage("You don't have the space for this!");
                            }
                        }
                        else
                        {
                            CloseMenu();
                            NewLogMessage("You don't have enough money!");
                        }
                    }
                }

                if (Input.GetAxisRaw("Vertical") != 0 && !inputHeld)
                {
                    if (playerEntityManager.ObjOntopOf != null)
                    {
                        inputHeld            = true;
                        curGroundContextSel -= 1 * (int)Mathf.Sign(Input.GetAxisRaw("Vertical"));
                    }
                }


                break;

            case menuType.rest:
                if (Input.GetButtonDown("BottomButton"))
                {
                    ChangeMenu();
                    curMenu = menuType.paused;
                }
                if (Input.GetAxisRaw("Vertical") != 0 && !inputHeld)
                {
                    inputHeld   = true;
                    curRestSel -= 1 * (int)Mathf.Sign(Input.GetAxisRaw("Vertical"));
                    if (curRestSel < 0)
                    {
                        curRestSel = 1;
                    }
                    if (curRestSel > 1)
                    {
                        curRestSel = 0;
                    }
                }
                break;
            }
            #endregion

            #region Menu Drawing
            //Handle Menu Drawing
            switch (curMenu)
            {
            case menuType.paused:
                if (pausePanel.gameObject.activeInHierarchy == false)
                {
                    pausePanel.gameObject.SetActive(true);
                }
                team1Hp.text       = playerStats.entityName + "\t" + playerStats.curHP.ToString().PadLeft(playerStats.MaxHP.ToString().Length, ' ') + "/" + playerStats.MaxHP.ToString();
                goldCounter.text   = "Money:" + playerInventory.Gold.ToString().PadLeft(17, ' ') + "G";
                bellyGauge.text    = "Belly: " + playerEntityManager.curBelly + "/" + playerEntityManager.maxBelly;
                pauseMenuText.text = "";
                //Draw Options
                for (int i = 0; i < 7; i++)
                {
                    if (i == curMenuSelection)
                    {
                        pauseMenuText.text += ">";
                    }
                    else
                    {
                        pauseMenuText.text += "  ";
                    }
                    switch (i)
                    {
                    case 0:
                        pauseMenuText.text += "Moves";
                        break;

                    case 1:
                        pauseMenuText.text += "Inventory";
                        break;

                    case 2:
                        pauseMenuText.text += "Stats";
                        break;

                    case 3:
                        pauseMenuText.text += "Others";
                        break;

                    case 4:
                        pauseMenuText.text += "Ground";
                        break;

                    case 5:
                        pauseMenuText.text += "Rest";
                        break;

                    case 6:
                        pauseMenuText.text += "Exit";
                        break;

                    default:
                        pauseMenuText.text += "ERROR";
                        break;
                    }
                    pauseMenuText.text += "\n";
                }
                break;

            case menuType.moves:
                if (movesPanel.gameObject.activeInHierarchy == false)
                {
                    movesPanel.gameObject.SetActive(true);
                }
                if (playerEntityManager.SpecialMoves.Count > 0)
                {
                    movesText.text = "";
                    for (int i = 0; i < playerEntityManager.SpecialMoves.Count; i++)
                    {
                        if (i == curMoveSel)
                        {
                            movesText.text += ">";
                        }
                        movesText.text += playerEntityManager.SpecialMoves[i].name;
                        movesText.text += i == (playerEntityManager.SpecialMoves.Count - 1) ? "" : "\n";
                    }
                }
                else
                {
                    movesText.text = "Currently under construction";
                }

                break;

            case menuType.inventory:
                invPageText.text = "Page: " + (curInvPage + 1) + "/" + Mathf.Clamp(Mathf.CeilToInt((float)playerInventory.Inventory.Count / 10), 1, 3).ToString();
                if (playerInventory.Inventory.Count == 0)
                {
                    inventoryText.text = ""; break;
                }
                inventoryText.text = "";
                for (int i = 0 + (curInvPage * 10); i < (playerInventory.Inventory.Count < 10 + (curInvPage * 10) ? playerInventory.Inventory.Count : 10 + (curInvPage * 10)); i++)
                {
                    if (i == curInvSelection)
                    {
                        inventoryText.text += ">";
                    }
                    if (usingItem && i == invSlotBeingUsed)
                    {
                        inventoryText.text += "-";
                    }
                    inventoryText.text += playerInventory.Inventory[i].itemName + "\t" + (playerInventory.InventoryCount[i] != 1 ? playerInventory.InventoryCount[i].ToString() : "");
                    if (i < 9 + (curInvPage * 10))
                    {
                        inventoryText.text += "\n";
                    }
                }
                //Context Options
                if (invContext)
                {
                    invContextText.text = "";
                    if (curInvContextSel == 0)
                    {
                        invContextText.text += ">";
                    }
                    invContextText.text += playerInventory.Inventory[curInvSelection].consumable && !invContextText.text.Contains("Consume") ?
                                           "Consume" : playerInventory.Inventory[curInvSelection].throwable && !invContextText.text.Contains("Throw") ?
                                           "Throw" : playerInventory.Inventory[curInvSelection].useable && !invContextText.text.Contains("Use") ?
                                           "Use" : playerInventory.Inventory[curInvSelection].equipable && !invContextText.text.Contains("Equip") ?
                                           "Equip" : !invContextText.text.Contains("Exit") ? "Exit" : "";
                    invContextText.text += "\n";
                    if (curInvContextSel == 1)
                    {
                        invContextText.text += ">";
                    }
                    invContextText.text += playerInventory.Inventory[curInvSelection].throwable && !invContextText.text.Contains("Throw") ?
                                           "Throw" : playerInventory.Inventory[curInvSelection].useable && !invContextText.text.Contains("Use") ?
                                           "Use" : playerInventory.Inventory[curInvSelection].equipable && !invContextText.text.Contains("Equip") ?
                                           "Equip" : !invContextText.text.Contains("Exit") ? "Exit" : "";
                    invContextText.text += "\n";
                    if (curInvContextSel == 2)
                    {
                        invContextText.text += ">";
                    }
                    invContextText.text += playerInventory.Inventory[curInvSelection].useable && !invContextText.text.Contains("Use") ?
                                           "Use" : playerInventory.Inventory[curInvSelection].equipable && !invContextText.text.Contains("Equip") ?
                                           "Equip" : !invContextText.text.Contains("Exit") ? "Exit" : "";
                    invContextText.text += "\n";
                    if (curInvContextSel == 3)
                    {
                        invContextText.text += ">";
                    }
                    invContextText.text += playerInventory.Inventory[curInvSelection].equipable && !invContextText.text.Contains("Equip") ?
                                           "Equip" : !invContextText.text.Contains("Exit") ? "Exit" : "";
                    invContextText.text += "\n";
                    if (curInvContextSel == 4)
                    {
                        invContextText.text += ">";
                    }
                    invContextText.text += !invContextText.text.Contains("Exit") ? "Exit" : "";

                    if (playerInventory.InventoryEquip[curInvSelection] == true)
                    {
                        invContextText.text = invContextText.text.Replace("Equip", "Unequip");
                    }
                }

                break;

            case menuType.stats:
                if (statsPanel.gameObject.activeInHierarchy == false)
                {
                    statsPanel.gameObject.SetActive(true);
                }
                statsText.text = "";
                switch (curStatsPage)
                {
                case 0:
                    statsText.text += "Level:    " + playerStats.Level + "\n";
                    statsText.text += "Exp To Next Level: " + (playerStats.ExpToNextLv - playerStats.Exp) + "\n";
                    statsText.text += "HP:    " + playerStats.curHP + "/" + playerStats.MaxHP + "\n";
                    statsText.text += "Strength:    " + playerStats.Str + "\n";
                    statsText.text += "Dexterity:    " + playerStats.Dex + "\n";
                    statsText.text += "Intelligence:    " + playerStats.Intl + "\n";
                    statsText.text += "Defense:    " + playerStats.Def + "\n";
                    statsText.text += "Speed:    " + playerEntityManager.speed * 100 + "%";
                    break;

                case 1:
                    statsText.text += "Head: " + (playerEntityManager.EntityArmor[0] != null ? playerEntityManager.EntityArmor[0].itemName:"") + "\n";
                    statsText.text += "Chest: " + (playerEntityManager.EntityArmor[1] != null ? playerEntityManager.EntityArmor[1].itemName : "") + "\n";
                    statsText.text += "Hands: " + (playerEntityManager.EntityArmor[2] != null ? playerEntityManager.EntityArmor[2].itemName : "") + "\n";
                    statsText.text += "Legs: " + (playerEntityManager.EntityArmor[3] != null ? playerEntityManager.EntityArmor[3].itemName : "") + "\n";
                    statsText.text += "Feet: " + (playerEntityManager.EntityArmor[4] != null ? playerEntityManager.EntityArmor[4].itemName : "") + "\n";
                    statsText.text += "Accessory 1: " + (playerEntityManager.EntityArmor[5] != null ? playerEntityManager.EntityArmor[5].itemName : "") + "\n";
                    statsText.text += "Accessory 2: " + (playerEntityManager.EntityArmor[6] != null ? playerEntityManager.EntityArmor[6].itemName : "") + "\n";
                    statsText.text += "Weapons: " + (playerEntityManager.EntityArmor[7] != null ? playerEntityManager.EntityArmor[7].itemName : "Unarmed") + "\n";
                    break;

                default:
                    statsText.text = "You shouldn't be seeing this, it done broke";
                    break;
                }

                break;

            case menuType.others:
                if (othersPanel.gameObject.activeInHierarchy == false)
                {
                    othersPanel.gameObject.SetActive(true);
                }
                break;

            case menuType.ground:
                if (groundPanel.gameObject.activeInHierarchy == false)
                {
                    groundPanel.gameObject.SetActive(true);
                }
                groundText.text = "";
                if (playerEntityManager.ObjOntopOf != null && !playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Buyable)
                {
                    groundText.text = string.Format("There is a {0} at your feet", playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Item.itemName);
                }
                else if (playerEntityManager.ObjOntopOf != null && playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Buyable)
                {
                    groundText.text = string.Format("There is a {0} for sale. It's {1}", playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Item.itemName, playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Item.baseBuyAmt);
                }
                else
                {
                    groundText.text = "There is nothing at your feet";
                }
                if (playerEntityManager.ObjOntopOf != null)
                {
                    groundContextPanel.gameObject.SetActive(true);
                }
                else
                {
                    groundContextPanel.gameObject.SetActive(false);
                }
                if (playerEntityManager.ObjOntopOf != null)
                {
                    groundContextText.text = "";
                    Item itemOnGround = playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Item;
                    if (curGroundContextSel == 0)
                    {
                        groundContextText.text += ">";
                    }
                    groundContextText.text += playerEntityManager.ObjOntopOf.GetComponent <ItemScript>().Buyable&& !groundContextText.text.Contains("Purchase") ?
                                              "Purchase" : itemOnGround.consumable && !groundContextText.text.Contains("Consume") ?
                                              "Consume" : itemOnGround.throwable && !groundContextText.text.Contains("Throw") ?
                                              "Throw" : itemOnGround.useable && !groundContextText.text.Contains("Use") ?
                                              "Use" : itemOnGround.equipable && !groundContextText.text.Contains("Equip") ?
                                              "Equip" : !groundContextText.text.Contains("Exit") ? "Exit" : "";
                    groundContextText.text += "\n";
                    if (curGroundContextSel == 1)
                    {
                        groundContextText.text += ">";
                    }
                    groundContextText.text += itemOnGround.consumable && !groundContextText.text.Contains("Consume") ?
                                              "Consume" : itemOnGround.throwable && !groundContextText.text.Contains("Throw") ?
                                              "Throw" : itemOnGround.useable && !groundContextText.text.Contains("Use") ?
                                              "Use" : itemOnGround.equipable && !groundContextText.text.Contains("Equip") ?
                                              "Equip" : !groundContextText.text.Contains("Exit") ? "Exit" : "";
                    groundContextText.text += "\n";
                    if (curGroundContextSel == 2)
                    {
                        groundContextText.text += ">";
                    }
                    groundContextText.text += itemOnGround.throwable && !groundContextText.text.Contains("Throw") ?
                                              "Throw" : itemOnGround.useable && !groundContextText.text.Contains("Use") ?
                                              "Use" : itemOnGround.equipable && !groundContextText.text.Contains("Equip") ?
                                              "Equip" : !groundContextText.text.Contains("Exit") ? "Exit" : "";
                    groundContextText.text += "\n";
                    if (curGroundContextSel == 3)
                    {
                        groundContextText.text += ">";
                    }
                    groundContextText.text += itemOnGround.useable && !groundContextText.text.Contains("Use") ?
                                              "Use" : itemOnGround.equipable && !groundContextText.text.Contains("Equip") ?
                                              "Equip" : !groundContextText.text.Contains("Exit") ? "Exit" : "";
                    groundContextText.text += "\n";
                    if (curGroundContextSel == 4)
                    {
                        groundContextText.text += ">";
                    }
                    groundContextText.text += itemOnGround.equipable && !groundContextText.text.Contains("Equip") ?
                                              "Equip" : !groundContextText.text.Contains("Exit") ? "Exit" : "";
                    groundContextText.text += "\n";
                    if (curGroundContextSel == 5)
                    {
                        groundContextText.text += ">";
                    }
                    groundContextText.text += !groundContextText.text.Contains("Exit") ? "Exit" : "";
                }
                break;

            case menuType.rest:
                if (restPanel.gameObject.activeInHierarchy == false)
                {
                    restPanel.gameObject.SetActive(true);
                }
                restText.text = "";
                if (curRestSel == 0)
                {
                    restText.text += ">";
                }
                restText.text += "Quick Save\n";
                if (curRestSel == 1)
                {
                    restText.text += ">";
                }
                restText.text += "Quit";
                break;
            }
            #endregion
        }
        else
        {
            if (pauseHUD.gameObject.activeInHierarchy == true)
            {
                pauseHUD.gameObject.SetActive(false);
            }
        }
    }
Пример #9
0
        private void menu_check(object sender, RoutedEventArgs e)
        {
            menuType tmp = (menuType)(int.Parse((sender as MenuItem).Tag.ToString()));
            //MessageBox.Show(tmp.ToString());
            Process myProcess;

            switch (tmp)
            {
            case menuType.MENU_CALIBRATION:
                EvoCalibrationWin wina = new EvoCalibrationWin(_my._MachineInfo);
                wina.Show();
                break;

            case menuType.MENU_IMPORT:
                FunctionFileManage.ImpportDB("mydb.dbs");
                break;

            case menuType.MENU_EXPORT:
                FunctionFileManage.ExportDB("mydb.dbs");
                break;

            case menuType.MENU_COM:
                _my.ComCmd.Execute(513);
                break;

            case menuType.MENU_VISUAL:
                break;

            case menuType.MENU_PIC:
                myProcess = new Process();
                try
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    myProcess.StartInfo.FileName        = "EVO.TOOL.MAKEPIC.exe";
                    myProcess.StartInfo.CreateNoWindow  = true;
                    myProcess.Start();
                }
                catch (Exception e1)
                {
                    Console.WriteLine(e1.Message);
                }
                break;

            case menuType.MENU_USB:
                myProcess = new Process();
                try
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    myProcess.StartInfo.FileName        = "EVO.TOOL.USBFILE.exe";
                    myProcess.StartInfo.CreateNoWindow  = true;
                    myProcess.Start();
                }
                catch (Exception e1)
                {
                    Console.WriteLine(e1.Message);
                }
                break;

            case menuType.MENU_HELP:
                MessageBox.Show("Coming Soon!!!");
                break;

            case menuType.MENU_ABOUT:
                MessageBox.Show("V1.00 supported by Crem", "Infomation");
                break;

            default:
                break;
            }
        }
Пример #10
0
        void writeMenu(menuType direction, bool onFormClosing)
        {
            randomFanart.fanartGames = false;
              randomFanart.fanartMovies = false;
              randomFanart.fanartMoviesScraperFanart = false;
              randomFanart.fanartMovingPictures = false;
              randomFanart.fanartMusic = false;
              randomFanart.fanartMusicScraperFanart = false;
              randomFanart.fanartPictures = false;
              randomFanart.fanartPlugins = false;
              randomFanart.fanartTv = false;
              randomFanart.fanartTVSeries = false;
              randomFanart.fanartScoreCenter = false;

              switchOnOffFHControls();
              assoicateDefaultItems();
              generateXML(direction);
              generateBg(direction);

              if (fanartHandlerUsed)
              {
            generateFanartControls();
            generateBackgroundLoading();
              }

              if (!cbDisableClock.Checked)
            generateClock();

              if (!cbHideFanartScraper.Checked)
            generatefanartScraper();

              if (enableFiveDayWeather.Checked)
            GenerateFiveDayWeather();

              if (summaryWeatherCheckBox.Checked)
              {
            bool itemHasWeather = false;
            foreach (backgroundItem item in bgItems)
            {
              // Check what item to hide weather summary on
              if (item.isWeather)
              {
            itemHasWeather = true;
            basicHomeValues.weatherControl = (int.Parse(item.ids[0]) + 200);
            generateWeathersummary(basicHomeValues.weatherControl);
              }
            }
            // always show weather summary
            if (!itemHasWeather) generateWeathersummary(null);
              }

              if (direction == menuType.horizontal)
              {
            if (!cbDisableExitMenu.Checked)
              generateTopBarH();

            generateMenuGraphicsH();

            if (menuStyle == chosenMenuStyle.graphicMenuStyle)
              generateGraphicCrowdingFixH();
            else
              generateCrowdingFixH();

            if (horizontalContextLabels.Checked)
              GenerateContextLabelsH();
              }
              else if (direction == menuType.vertical)
              {
            if (!cbDisableExitMenu.Checked)
            {
              if (!cbExitStyleNew.Checked)
            generateTopBarV1();
              else
            generateTopBarV();
            }

            generateMenuGraphicsV();
            generateCrowdingFixV();
            GenerateContextLabelsV();
              }

              if (enableRssfeed.Checked && infoserviceOptions.Enabled)
              {
            if (direction == menuType.horizontal)
            {
              generateRSSTicker();
              if (enableTwitter.Checked && infoserviceOptions.Enabled) generateTwitter();
            }
            else if (direction == menuType.vertical)
            {
              generateRSSTickerV();
              if (enableTwitter.Checked && infoserviceOptions.Enabled) generateTwitterV();
            }
              }

              generateMostRecentFilesAndImports("AddImports");

              toolStripStatusLabel1.Text = "Done!";

              if (System.IO.File.Exists(SkinInfo.mpPaths.streamedMPpath + "BasicHome.xml"))
            System.IO.File.Delete(SkinInfo.mpPaths.streamedMPpath + "BasicHome.xml");

              xml = xml.Replace("<!-- BEGIN GENERATED ID CODE-->", "<id>35</id>");
              CheckSum checkSum = new CheckSum();
              writeXMLFile("BasicHome.xml");

              generateMostRecentFilesAndImports("GenImports");
              if (menuStyle == chosenMenuStyle.graphicMenuStyle)
            //generateOverlay(int.Parse(txtMenuPos.Text), 0, basicHomeValues.weatherControl);
            generateOverlay(0, 380, basicHomeValues.weatherControl);
              else
            generateOverlay(int.Parse(txtMenuPos.Text), 765, basicHomeValues.weatherControl);

              changeOutstanding = false;
              getBackupFileTotals();
              if (!onFormClosing)
              {
            DialogResult result = helper.showError("BasicHome.xml Saved Sucessfully \n\n  Backup file has been created \n\nDo you want to Contine Editing", errorCode.infoQuestion);
            if (result == DialogResult.No)
            {
              //reset everything
              //xmlFiles.Items.Clear();
              //cboQuickSelect.Items.Clear();
              itemsOnMenubar.Items.Clear();
              prettyItems.Clear();
              ids.Clear();
              bgItems.Clear();
              menuItems.Clear();
              this.Close();
            }

            // reset item id's as it is possible to generate again.
            foreach (menuItem item in menuItems)
            {
              item.id = menuItems.IndexOf(item);
            }
              }
        }
Пример #11
0
 // Methods for buttons to use when pressed.
 public void NavigatePauseMenu()
 {
     whereAmI = menuType.PAUSE;
     UpdateMenu();
 }
Пример #12
0
 public void NavigateControlMenu()
 {
     whereAmI = menuType.CONTROL_OPTIONS;
     UpdateMenu();
 }
Пример #13
0
 public void NavigateGraphicMenu()
 {
     whereAmI = menuType.GRAPHIC_OPTIONS;
     UpdateMenu();
 }
Пример #14
0
 public void NavigateSettingsMenu()
 {
     whereAmI = menuType.SETTINGS;
     UpdateMenu();
 }
Пример #15
0
        void writeMenu(menuType direction, bool onFormClosing)
        {
            randomFanart.fanartGames = false;
              randomFanart.fanartMovies = false;
              randomFanart.fanartMoviesScraperFanart = false;
              randomFanart.fanartMovingPictures = false;
              randomFanart.fanartMusic = false;
              randomFanart.fanartMusicScraperFanart = false;
              randomFanart.fanartPictures = false;
              randomFanart.fanartPlugins = false;
              randomFanart.fanartTv = false;
              randomFanart.fanartTVSeries = false;
              randomFanart.fanartScoreCenter = false;

              switchOnOffFHControls();
              assoicateDefaultItems();
              generateXML(direction);
              generateBg(direction);

              if (fanartHandlerUsed)
              {
            generateFanartControls();
            generateBackgroundLoading();
              }

              if (!menudef.disableClock)
            generateClock();

              if (!menudef.hideFanartScraper)
            generatefanartScraper();

              if (menudef.enableFiveDayWeather)
            GenerateFiveDayWeather();

              if (menudef.summaryWeatherEnabled && menudef.infoServiceOptions)
              {
            bool itemHasWeather = false;
            foreach (backgroundItem item in bgItems)
            {
              // Check what item to hide weather summary on
              if (item.isWeather)
              {
            itemHasWeather = true;
            basicHomeValues.weatherControl = (int.Parse(item.ids[0]) + 200);
            generateWeathersummary(basicHomeValues.weatherControl);
              }
            }
            // always show weather summary
            if (!itemHasWeather) generateWeathersummary(null);
              }

              if (direction == menuType.horizontal)
              {
            if (!menudef.disableExitMenu)
              generateTopBarH();

            generateMenuGraphicsH();

            if (menuStyle == chosenMenuStyle.graphicMenuStyle)
              generateGraphicCrowdingFixH();
            else
              generateCrowdingFixH();

            if (menudef.horizontalContextLabels)
              GenerateContextLabelsH();
              }
              else if (direction == menuType.vertical)
              {
            if (!menudef.disableExitMenu)
            {
              if (!menudef.exitStyleNew)
            generateTopBarV1();
              else
            generateTopBarV();
            }

            generateMenuGraphicsV();
            generateCrowdingFixV();
            GenerateContextLabelsV();
              }

              if (menudef.rssEnabled && menudef.infoServiceOptions)
              {
            if (direction == menuType.horizontal)
            {
              generateRSSTicker();
              if (menudef.twitterEnabled && menudef.infoServiceOptions) generateTwitter();
            }
            else if (direction == menuType.vertical)
            {
              generateRSSTickerV();
              if (menudef.twitterEnabled && menudef.infoServiceOptions) generateTwitterV();
            }
              }

              generateMostRecentFilesAndImports("AddImports");

              if (System.IO.File.Exists(SkinInfo.mpPaths.streamedMPpath + "BasicHome.xml"))
            System.IO.File.Delete(SkinInfo.mpPaths.streamedMPpath + "BasicHome.xml");

              xml = xml.Replace("<!-- BEGIN GENERATED ID CODE-->", "<id>35</id>");
              writeXMLFile("BasicHome.xml");

              generateMostRecentFilesAndImports("GenImports");
              if (menuStyle == chosenMenuStyle.graphicMenuStyle)
            //generateOverlay(int.Parse(txtMenuPos.Text), 0, basicHomeValues.weatherControl);
            generateOverlay(0, 380, basicHomeValues.weatherControl);
              else
            generateOverlay(int.Parse(menudef.menuPos), 765, basicHomeValues.weatherControl);

              if (!onFormClosing)
              {
            //reset everything
            ids.Clear();
            bgItems.Clear();
            menuItems.Clear();
            // reset item id's as it is possible to generate again.
            foreach (menuItem item in menuItems)
            {
              item.id = menuItems.IndexOf(item);
            }
              }
        }