void StateAndColorSetter(BALL_STATE bState) { //ボールの色と状態を代入する ballState = bState; //spRenderer.color = ballColor[(int)bState]; spRenderer.color = CustomColorTheme.GetColors()[(int)bState]; }
// 色がランダムな時に再度色を変更するボタン by tada public void OnReChangeColorButtonClicked() { if (!isChanging) { Sequence seq = DOTween.Sequence() .OnStart(() => { isChanging = true; ReChangeButton.rectTransform.DOPunchScale(Vector3.one * 0.1f, 0.2f); }) .AppendCallback(() => { colorThemeUi.DOFade(0, fadeTime).SetEase(Ease.InSine); colorThemeUi.transform.DOLocalMoveX(-20, fadeTime).SetRelative().SetEase(Ease.InSine); }) .AppendInterval(fadeTime) .AppendCallback(() => { CustomColorTheme.ChangeTheme(themeIndex); UpdateColorUi(); colorThemeUi.transform.DOLocalMoveX(40f, 0).SetRelative(); colorThemeUi.DOFade(1, fadeTime).SetEase(Ease.OutSine); colorThemeUi.transform.DOLocalMoveX(-20, fadeTime).SetRelative().SetEase(Ease.OutSine); // 矢印を更新 UpdateArrowUI(); }) .AppendInterval(fadeTime) .OnComplete(() => { isChanging = false; }); } }
public static void Play(eEffectType type, Vector3 pos, int colorIndex) { // 強引に... GameObject obj; if (type == eEffectType.Bubble) { obj = poolBubble.GetInstance(); } else { obj = poolBurst.GetInstance(); } if (obj == null) { return; } ParticleSystem eff = obj.GetComponent <ParticleSystem>(); eff.transform.position = pos; eff.startColor = CustomColorTheme.GetColors()[colorIndex]; eff.Play(); }
private void OnDestroy() { // 色変更の登録を破棄 if (CustomColorTheme.Instance != null) { CustomColorTheme.UnRegisterMethod(SetColors); } }
private void Start() { // 色を変更 SetColors(CustomColorTheme.GetColors()); // 色変更の登録 CustomColorTheme.RegisterMethod(SetColors); }
public void WhenValueIsMissingThemeIsNotSet(BaseTheme?baseTheme, Color?primaryColor, Color?secondaryColor) { //Arrange var bundledTheme = new CustomColorTheme(); //Act bundledTheme.BaseTheme = baseTheme; bundledTheme.PrimaryColor = primaryColor; bundledTheme.SecondaryColor = secondaryColor; //Assert Assert.Throws <InvalidOperationException>(() => bundledTheme.GetTheme()); }
public void WhenAllValuesAreSetThemeIsSet() { //Arrange var bundledTheme = new CustomColorTheme(); //Act bundledTheme.BaseTheme = BaseTheme.Light; bundledTheme.PrimaryColor = Colors.Fuchsia; bundledTheme.SecondaryColor = Colors.Lime; //Assert ITheme theme = bundledTheme.GetTheme(); Assert.Equal(Colors.Fuchsia, theme.PrimaryMid.Color); Assert.Equal(Colors.Lime, theme.SecondaryMid.Color); Assert.Equal(Theme.Light.MaterialDesignBody, theme.Body); }
public static ResourceDictionary AddMaterialDesign(this ResourceDictionary resourceDictionary, bool add = true) { addCache = add; if (add) { var colorTheme = new CustomColorTheme() { BaseTheme = BaseTheme.Light, PrimaryColor = (Color)ColorConverter.ConvertFromString("#01579b"), SecondaryColor = Brushes.DarkGreen.Color }; var thisAssembly = typeof(Extensions).Assembly; resourceDictionary.MergedDictionaries.Add(colorTheme); resourceDictionary.AddXamlResource(@"Views\DefaultViews.xaml", thisAssembly); resourceDictionary.AddXamlResource(@"AppStyles\Default.xaml", thisAssembly); } return(resourceDictionary); }
private static void InitializeUI(ThemeData data) { Application.Current.Resources.MergedDictionaries.Clear(); var styleDictionary = new ResourceDictionary { Source = new Uri( "pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml", UriKind.Absolute) }; var customStyleDictionary = new ResourceDictionary { Source = new Uri("pack://application:,,,/REFame.PasswordManagement.Styles;component/TabControlStyles.xaml", UriKind.Absolute) }; Color color = Color.Black; if (data.PrimaryColor != null) { color = Color.FromName(data.PrimaryColor); } if (data.Theme == BaseTheme.Inherit) { data.Theme = BaseTheme.Light; } var theme = new CustomColorTheme { BaseTheme = data.Theme, PrimaryColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B), SecondaryColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B) }; Application.Current.Resources.MergedDictionaries.Add(styleDictionary); Application.Current.Resources.MergedDictionaries.Add(theme); Application.Current.Resources.MergedDictionaries.Add(customStyleDictionary); }
public void UpdateColorUi() { theme = CustomColorTheme.GetColors(); redIm.color = theme.BallColorRed; blueIm.color = theme.BallColorBlue; greenIm.color = theme.BallColorGreen; fieldIm.color = theme.FieldColor + new Color(1.0f, 1.0f, 1.0f) * 0.2f; colorText.color = theme.TextColor; colorText.text = theme.ThemeName; leftText.color = theme.TextColor; scoreText.color = theme.TextColor; scoreBackBoard.color = theme.WallColor - new Color(0f, 0f, 0f, 0.2f); //scoreBackBoard.color = new Color(1.0f, 1.0f, 1.0f, 1.8f) - theme.TextColor; unlockedText.color = theme.TextColor; bow.color = theme.BallColorBlue; leftTargetScore.color = theme.TextColor; rightTargetScore.color = theme.TextColor; Color tmp = theme.BallColorBlue; tmp.a = 0.25f; backBow.color = tmp; }
public void UpdateArrowUI() { int themeNum = CustomColorTheme.GetThemeNum(); // 左のロックはいらない LeftLock.gameObject.SetActive(false); ReChangeButton.gameObject.SetActive(false); // 左端 if (themeIndex == 0) { // 右の矢印しか表示しない LeftButton.gameObject.SetActive(false); LeftLock.gameObject.SetActive(false); RightButton.gameObject.SetActive(true); RightLock.gameObject.SetActive(targetIndex == 1); return; } else if (themeIndex == themeNum - 1) // 右端 { // 左の矢印しか表示しない RightButton.gameObject.SetActive(false); RightLock.gameObject.SetActive(false); LeftButton.gameObject.SetActive(true); ReChangeButton.gameObject.SetActive(true); return; } // そのほか RightButton.gameObject.SetActive(true); LeftButton.gameObject.SetActive(true); // 右ロックの有無 RightLock.gameObject.SetActive(themeIndex == targetIndex - 1); }
// Start is called before the first frame update void Start() { scoreSeq = DOTween.Sequence(); //初期化 unlockedText.gameObject.SetActive(false); UpdateColorUi(); left = Score.score; stackScore = PlayerPrefs.GetInt("Score", 0); themeIndex = CustomColorTheme.GetThemeIndex(); PlayerPrefs.SetInt("Score", stackScore + left); //ターゲットスコアの計算 for (int i = 0; i < targetScore.Length; i++) { if (targetScore[i] > stackScore) { targetIndex = i; leftTargetScore.text = targetScore[i - 1].ToString(); rightTargetScore.text = targetScore[i].ToString(); break; } } if (stackScore < targetScore[targetScore.Length - 1]) { //text表示 BowMove(); } else { targetIndex = targetScore.Length; leftTargetScore.text = targetScore[targetIndex - 2].ToString(); rightTargetScore.text = targetScore[targetIndex - 1].ToString(); } // by tada UpdateArrowUI(); }
// 色を変更 public void Play(Ball.BALL_STATE state) { eff.startColor = CustomColorTheme.GetColors()[(int)state]; eff.Play(); }
// Start is called before the first frame update void Start() { titleFrame.color = CustomColorTheme.GetColors().FieldColor + new Color(1.0f, 1.0f, 1.0f) * 0.2f; }