/// <summary> /// Sets the theme of the game based on the enum state /// </summary> /// <param name="theme"></param> public void SetTheme(int theme) { m_currentTheme = (ETheme)theme; Sprite[] selection = m_themeBasic; switch ((ETheme)theme) { case ETheme.BASIC: selection = m_themeBasic; break; case ETheme.NATURE: selection = m_themeNature; break; case ETheme.SPACE: selection = m_themeSpace; break; } if (m_currentIndex > selection.Length) { m_currentIndex = selection.Length - 1; } this.GetComponent <Image>().sprite = selection[m_currentIndex]; }
public DeleteSlideMasterStep(SlideMaster slideMaster, ESlideMaster eSlide, ETheme etheme, int index) { SlideMaster = slideMaster; ETheme = etheme; Index = index; ESlideMaster = eSlide; }
void SetUpTheme(ETheme newTheme) { m_theme = newTheme; m_background.sprite = m_themeBackgrounds[(int)newTheme]; m_foreground.sprite = m_themeForegrounds[(int)newTheme]; }
public static void LoadBlankTheme() { foreach (ETheme item in (Application.Current as IAppGlobal).ThemesCollection) { if (item.ThemeName == "BlankTheme") { Global.BeginInit(); ETheme _cloneTheme = new ETheme(); _cloneTheme = item.Clone() as ETheme; _cloneTheme.Name = item.Name; _cloneTheme.TagName = "This Presenter"; _cloneTheme.ThemeName = item.ThemeName; _cloneTheme.ID = ObjectElementsHelper.RandomString(10); _cloneTheme.Colors = (Application.Current as IAppGlobal).OfficeColors[1]; _cloneTheme.SelectedFont = (Application.Current as IAppGlobal).OfficeFonts[1]; (Application.Current as IAppGlobal).LocalThemesCollection.Add(_cloneTheme); (Application.Current as IAppGlobal).DocumentControl.SelectedTheme = _cloneTheme; (Application.Current as IAppGlobal).DocumentControl.SelectedColors = _cloneTheme.Colors; (Application.Current as IAppGlobal).DocumentControl.SelectedFont = _cloneTheme.SelectedFont; (Application.Current as IAppGlobal).SelectedTheme.SelectedFont = _cloneTheme.SelectedFont; DesignTabControlViewModel.ThemeDesign.SelectedIndex = 0; Global.EndInit(); } } }
public AddSlideMasterStep(SlideBase oldSlideMaster, SlideMaster newSlideMaster, ETheme newTheme, ETheme oldTheme) { OldSlideMaster = oldSlideMaster; NewSlideMaster = newSlideMaster; NewTheme = newTheme; OldTheme = oldTheme; }
//#region Commands public static List <ETheme> GetThemesCollection() { List <ETheme> _result = new List <ETheme>(); foreach (string fileName in Directory.GetFiles("Themes/")) { //Task.Factory.StartNew(() => //{ // EThemes eThemes = new EThemes(); // eThemes = themesData.Open(fileName); // eThemes.Name = Path.GetFileNameWithoutExtension(fileName); // eThemes.TagName = "Office"; // eThemes.ThumbnailIcon = new BitmapImage(new Uri(eThemes.MainTheme.Thumbnail.Path)); // foreach (ETheme item in eThemes.Variants) // { // item.ThumbnailBitmap = new BitmapImage(new Uri(item.Thumbnail.Path)); // } // _result.Add(eThemes); //}); ETheme eTheme = new ETheme(); eTheme = themesData.FirstLoad(fileName); eTheme.Name = Path.GetFileNameWithoutExtension(fileName); eTheme.ID = ObjectElementsHelper.RandomString(10); eTheme.TagName = "Office"; eTheme.ThemeName = Path.GetFileNameWithoutExtension(fileName); eTheme.FilePath = fileName; _result.Add(eTheme); } return(_result); }
public static void SetTheme(ETheme theme) { if (themes[theme] != Current) { Current = themes[theme]; Changed?.Invoke(); } }
/// <exception cref="T:System.Exception">при невалидном ID пользователя</exception> public ProgramTheme(ETheme theme, int id) { if (id < 1) { throw new Exception("THEME ID SET ERROR"); } Theme = theme; UserID = id; }
public static ListItem GetListItem(ETheme type, bool selected) { var item = new ListItem(GetText(type), GetValue(type)); if (selected) { item.Selected = true; } return(item); }
/// <summary> /// Lấy chủ đề /// </summary> /// <param name="design"></param> /// <param name="count"></param> /// <returns></returns> public ETheme GetETheme(pp.Design design, int count) { ETheme etheme = new ETheme(); etheme.Name = design.Name; etheme.ID = ObjectElementsHelper.RandomString(10); etheme.ThemeName = design.Name; EColorManagment eColorManagment = new EColorManagment(); eColorManagment = GetEColorManagment(design.SlideMaster.Theme.ThemeColorScheme); etheme.Colors = eColorManagment; etheme.SelectedFont = GetFontTheme(design.SlideMaster.Theme.ThemeFontScheme); ESlideMaster eSlideMaster = new ESlideMaster(); eSlideMaster.ThemesName = etheme.Name; eSlideMaster.Name = etheme.Name; eSlideMaster.MainLayer = new PageLayer(); SlideMasterPart slideMasterPart = GetSlideMasterPart(count); eSlideMaster.MainLayer.Background = GetFillColorSlideMaster(design.SlideMaster.Background.Fill, slideMasterPart.SlideMaster?.CommonSlideData, slideMasterPart); eSlideMaster.ID = ObjectElementsHelper.RandomString(12); foreach (pp.Shape shape in design.SlideMaster.Shapes) { eSlideMaster.MainLayer.Children.Add(GetShape(shape, shape.Type, design.SlideMaster.TimeLine, slideMasterPart)); } SetIsBackgroundShape(eSlideMaster.MainLayer); int countLayoutMaster = 0; foreach (pp.CustomLayout layout in design.SlideMaster.CustomLayouts) { SlideLayoutPart slideLayoutPart = GetSlideLayoutPart(countLayoutMaster++, slideMasterPart); ELayoutMaster eLayoutMaster = new ELayoutMaster(); eLayoutMaster.ID = ObjectElementsHelper.RandomString(13); eLayoutMaster.MainLayer = new PageLayer(); eLayoutMaster.MainLayer.Background = GetFillColorSlideMaster(layout.Background.Fill, slideLayoutPart.SlideLayout?.CommonSlideData, slideLayoutPart); if (eLayoutMaster.MainLayer.Background == null) { eLayoutMaster.MainLayer.Background = eSlideMaster.MainLayer.Background; } foreach (pp.Shape shape in layout.Shapes) { eLayoutMaster.MainLayer.Children.Add(GetShape(shape, shape.Type, design.SlideMaster.TimeLine, slideLayoutPart)); } SetIsBackgroundShape(eLayoutMaster.MainLayer); eLayoutMaster.SlideName = layout.Name; eLayoutMaster.LayoutName = layout.Name; eLayoutMaster.IsHideBackground = layout.DisplayMasterShapes != MsoTriState.msoTrue; eSlideMaster.LayoutMasters.Add(eLayoutMaster); } etheme.SlideMasters.Add(eSlideMaster); return(etheme); }
public static string GetValue(ETheme type) { if (type == ETheme.Default) { return("Default"); } if (type == ETheme.Google) { return("Google"); } throw new Exception(); }
public static bool Equals(ETheme type, string typeStr) { if (string.IsNullOrEmpty(typeStr)) { return(false); } if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower())) { return(true); } return(false); }
public static string GetText(ETheme type) { if (type == ETheme.Default) { return("默认风格"); } if (type == ETheme.Google) { return("Google风格"); } throw new Exception(); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { var tmp = Application.Current.Resources; if (currentTheme == ETheme.Default) { var ttt = tmp.MergedDictionaries[3].Source = new Uri(string.Format("../../resources/Styles/BlackTheme.xaml"), UriKind.Relative); currentTheme = ETheme.Black; } else { var ttt = tmp.MergedDictionaries[3].Source = new Uri(string.Format("../../resources/Styles/DefaultStyle.xaml"), UriKind.Relative); currentTheme = ETheme.Default; } }
// Start is called before the first frame update void Start() { ETheme theme = ETheme.BASIC; int player1 = 0; int player2 = 0; if (PlayerPrefs.HasKey("AirHockeyTheme")) { theme = (ETheme)PlayerPrefs.GetInt("AirHockeyTheme"); player1 = PlayerPrefs.GetInt("AirHockeyPlayer1Puck"); player2 = PlayerPrefs.GetInt("AirHockeyPlayer2Puck"); } DebugLog("Theme: " + theme + " Player 1: " + player1 + " Player2: " + player2); SetUpTheme(theme, player1, player2); }
public static string GetText(ETheme type) { if (type == ETheme.Default) { return("Ĭ�Ϸ��"); } else if (type == ETheme.Google) { return("Google���"); } else { throw new Exception(); } }
public static ETheme GetEnumType(string typeStr) { ETheme retval = ETheme.Default; if (Equals(ETheme.Default, typeStr)) { retval = ETheme.Default; } else if (Equals(ETheme.Google, typeStr)) { retval = ETheme.Google; } return(retval); }
public void SetTheme(ETheme theme) { switch (theme) { case ETheme.Dark: DarkTheme(); break; case ETheme.HighContrast: HighContrastTheme(); break; case ETheme.Light: LightTheme(); break; } }
private void BtSwitchTheme_Click(object sender, EventArgs e) { OwnTheme = true; switch (_theme) { case ETheme.Dark: _theme = ETheme.HighContrast; break; case ETheme.HighContrast: _theme = ETheme.Light; break; case ETheme.Light: _theme = ETheme.Dark; break; } SwitchTheme(_theme); }
private void SwitchTheme(ETheme theme) { switch (theme) { case ETheme.Dark: rtf.BackColor = Color.FromArgb(255, 40, 40, 40); rtf.ForeColor = Color.FromArgb(255, 255, 255, 255); break; case ETheme.Light: rtf.BackColor = Color.FromArgb(255, 255, 255, 255); rtf.ForeColor = Color.FromArgb(255, 0, 0, 0); break; case ETheme.HighContrast: rtf.BackColor = Color.FromArgb(255, 10, 10, 10); rtf.ForeColor = Color.FromArgb(255, 255, 255, 255); break; } }
private void gunaTileButtonApplySettings_Click(object sender, EventArgs e) { List <ProgramTheme> themes; ETheme ChoosedTheme = switchTheme.Checked ? ETheme.Dark : ETheme.Light; Color TR = circlePictureBoxTR.BackColor; Color TL = circlePictureBoxTL.BackColor; Color BR = circlePictureBoxBR.BackColor; Color BL = circlePictureBoxBL.BackColor; Color Font = labelFontColor.LinkColor; try { using (FileStream file = new FileStream($"{Directory.GetCurrentDirectory()}\\ThemeModel\\ThemeSettings.json", FileMode.OpenOrCreate)) { DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(List <ProgramTheme>)); themes = jsonSerializer.ReadObject(file) as List <ProgramTheme>; } } catch (Exception ex) { themes = new List <ProgramTheme>(); } themes.Remove(themes.Find(x => x.UserID == userID)); themes.Add(new ProgramTheme(ChoosedTheme, userID) { BottomLeft = BL, BottomRight = BR, TopLeft = TL, TopRight = TR, FontColor = Font }); File.WriteAllText($"{Directory.GetCurrentDirectory()}\\ThemeModel\\ThemeSettings.json", ""); using (FileStream file = new FileStream($"{Directory.GetCurrentDirectory()}\\ThemeModel\\ThemeSettings.json", FileMode.OpenOrCreate)) { DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(List <ProgramTheme>)); jsonSerializer.WriteObject(file, themes); } MetroMessageBox.Show(this, "The program will be reloaded", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Restart(); }
public static List <ETheme> GetFullThemesCollection() { List <ETheme> _result = new List <ETheme>(); foreach (string fileName in Directory.GetFiles("Themes/")) { if (Path.GetExtension(fileName) == ".athmx") { ETheme eTheme = new ETheme(); eTheme = themesData.OpenETheme(fileName); eTheme.Name = Path.GetFileNameWithoutExtension(fileName); eTheme.ID = ObjectElementsHelper.RandomString(10); eTheme.TagName = "Office"; eTheme.ThemeName = Path.GetFileNameWithoutExtension(fileName); eTheme.FilePath = fileName; eTheme.IsLoaded = false; _result.Add(eTheme); } } return(_result); }
public void CycleThroughThemes(int offset) { if ((int)(m_currentTheme + offset) > 2) { m_currentTheme = (ETheme)0; } else if ((int)(m_currentTheme + offset) < 0) { m_currentTheme = (ETheme)2; } else { m_currentTheme += offset; } SetTheme((int)m_currentTheme); AH_SetUpMenu.instance.ChoosePuck((int)m_currentTheme); foreach (var item in m_children) { item.CycleThroughSelections(0); } }
void SetUpTheme(ETheme theme, int player1, int player2) { if (m_puck) { m_puck.sprite = m_pucks[(int)theme]; } if (m_background) { m_background.sprite = m_backgrounds[(int)theme]; } if (m_foreground) { m_foreground.sprite = m_foregrounds[(int)theme]; } if (m_particleParent) { Instantiate <GameObject>(m_particleEffects[(int)theme], m_particleParent); } switch (theme) { case ETheme.BASIC: m_player1.sprite = m_paddles[player1]; m_player2.sprite = m_paddles[player2]; break; case ETheme.SPACE: m_player1.sprite = m_paddles[player1 + 3]; // offset of space theme in array m_player2.sprite = m_paddles[player2 + 3]; break; case ETheme.NATURE: m_player1.sprite = m_paddles[player1 + 6]; // offset of nature theme in array m_player2.sprite = m_paddles[player2 + 6]; break; } }
public void SetOwnTheme(ETheme theme) { _theme = theme; SwitchTheme(_theme); }
public static bool Equals(string typeStr, ETheme type) { return(Equals(type, typeStr)); }
public ThisPresenterSlideMasterStep(ESlideMaster oldESlideMaster, ESlideMaster newESlideMaster, ETheme eTheme) { OldESlideMaster = oldESlideMaster; NewESlideMaster = newESlideMaster; ETheme = eTheme; }