Example #1
0
    // Use this for initialization
    void Start()
    {
        curTheme = 0;
        for (int i = 0; i < ThemeCollection.getThemes().Count; i++)
        {
            Transform rt = (Transform)Instantiate(model, new Vector3(0, basedistance * i), Quaternion.identity);
            rt.SetParent(transform, false);
            rt.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -basedistance * (i + 1));
            if (i <= SavenLoad.setting.point / 9)
            {
                rt.GetComponent <Image>().sprite        = ThemeCollection.getThemes()[i].image;
                rt.GetComponentInChildren <Text>().text = "";
            }
            else
            {
                rt.GetComponent <Image>().sprite        = lockedTheme;
                rt.GetComponentInChildren <Text>().text = 9 * i + " MISSIONS";
            }

            /*	rt.GetComponent<Image>().sprite = ThemeCollection.getThemes()[i].image;
             *      rt.GetComponentInChildren<Text>().text = "";
             *      rt.name = "theme_icon"+i;*/
        }
        Transform slt = (Transform)Instantiate(selectedSprite, new Vector3(0, 0), Quaternion.identity);

        slt.SetParent(transform, false);
        slt.GetComponent <Image> ().color = new Color(0, 0, 0, 140);
        slt.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -basedistance * (SavenLoad.setting.activedTheme + 1));
        slt.name = "SelectedTheme";
        ((RectTransform)transform).anchoredPosition = new Vector2(0, basedistance * (SavenLoad.setting.activedTheme + 0.5f) - ((RectTransform)transform).rect.height / 2);

        //slt.GetComponent<Image>().sprite = theme.image;
    }
Example #2
0
        public static void RegisterThemes(ThemeCollection themes, BundleCollection bundles)
        {
            themes.Bundles = bundles;

            themes.Add(new Theme("default"));
            themes.Add(new Theme("bjroyster"));
            themes.Add(new Theme("bjr too"));
        }
Example #3
0
    public static void UnlockTheme(int index)
    {
        GameObject rt = GameObject.Find("theme_icon" + index);

        if (rt != null)
        {
            rt.GetComponent <Image>().sprite = ThemeCollection.getThemes()[index].image;
        }
    }
    // Use this for initialization
    void Start()
    {
        SavenLoad.Load();
        GameObject.Find("ButtonSound").GetComponent <AudioSource> ().volume = SavenLoad.setting.volume;
        GameObject.Find("UnlockSound").GetComponent <AudioSource> ().volume = SavenLoad.setting.volume;
        GameObject.Find("BgSound").GetComponent <AudioSource> ().volume     = SavenLoad.setting.volumeMusic;

        ThemeCollection.getThemes();
        Invoke("ProcessToMain", 0.75f);
    }
Example #5
0
        public FixedSizeTests()
        {
            var themes = new ThemeCollection();

            themes["default"] = new Theme();

            styleConfigurator = new ThemeStyler(themes);

            contentLayoutEngine = new ContentLayoutEngineLogger(
                new ContentLayoutEngine(
                    CommonMocks.FontProvider().Object));
        }
Example #6
0
        static ThemeInfo()
        {
            ArrayList list = new ArrayList();

            // get the themes for each community
            foreach(CommunityInfo community in CommunityInfo.Collection)
                foreach(string themeName in GetThemes(community))
                    list.Add(new ThemeInfo(community.ID, themeName));

            // get the default themes
            foreach(string themeName in GetDefaultThemes())
                list.Add(new ThemeInfo(themeName));

            // add to the collection
            _collection = new ThemeCollection(list.ToArray(typeof(ThemeInfo)) as ThemeInfo[]);
        }
        /// <summary>
        /// Deserializes the theme.
        /// </summary>
        /// <returns>
        /// <see cref="ThemeCollection"/>
        /// </returns>
        public ThemeCollection Deserialize()
        {
            try
            {
                ThemeCollection itemsDeserialized = new ThemeCollection();
                XmlSerializer xs = new XmlSerializer(typeof(ThemeCollection));

                using (Stream stream = Application.GetResourceStream(new Uri(STR_ThemeColorsCollectionXML, UriKind.Relative)).Stream)
                {
                    itemsDeserialized = (ThemeCollection)xs.Deserialize(stream);
                }

                return itemsDeserialized;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
Example #8
0
    // Use this for initialization
    public void Start()
    {
        List <GameObject> list1 = new List <GameObject> (GameObject.FindGameObjectsWithTag("Spot"));
        List <GameObject> list2 = new List <GameObject> (GameObject.FindGameObjectsWithTag("Icon"));
        List <GameObject> list3 = new List <GameObject> (GameObject.FindGameObjectsWithTag("Highlight"));

        list3.AddRange(GameObject.FindGameObjectsWithTag("Line"));
        list3.AddRange(GameObject.FindGameObjectsWithTag("Button"));
        list3.AddRange(GameObject.FindGameObjectsWithTag("Colored Text"));
        List <GameObject> list4 = new List <GameObject> (GameObject.FindGameObjectsWithTag("Background"));
        List <GameObject> list5 = new List <GameObject> (GameObject.FindGameObjectsWithTag("DotBg"));

        list5.AddRange(GameObject.FindGameObjectsWithTag("IconBg"));
        Theme loaded = ThemeCollection.getThemes()[SavenLoad.setting.activedTheme];

        foreach (GameObject g in list1)
        {
            //
            g.GetComponent <SpriteRenderer>().sprite = loaded.dot;
        }
        foreach (GameObject g in list2)
        {
            ChangeColor(g, loaded.color1);
        }
        foreach (GameObject g in list3)
        {
            ChangeColor(g, loaded.color2);
        }
        foreach (GameObject g in list4)
        {
            ChangeColor(g, loaded.color3);
        }
        foreach (GameObject g in list5)
        {
            ChangeColor(g, loaded.color4);
        }
        GameObject logo = GameObject.Find("GameLogo");

        if (logo != null)
        {
            logo.GetComponent <Image> ().sprite = Resources.Load <Sprite> ("m" + loaded.imgName);
        }
    }
        private void ReadModel()
        {
            var settingsModel = _modelService.LoadModel <SettingsModel>(_settingsFileName);

            _model = settingsModel ?? new SettingsModel();
            if (settingsModel != null)
            {
                _themeService.SetResource(settingsModel.SelectedTheme);
                _selectedTheme = ThemeCollection.Single(t => t.Key == settingsModel.SelectedTheme);
                RaisePropertyChanged(nameof(SelectedTheme));

                _stringsService.SetResource(settingsModel.SelectedLanguage);
                _selectedLanguage = settingsModel.SelectedLanguage;
                RaisePropertyChanged(nameof(SelectedLanguage));

                _localImageFolder = settingsModel.ImageFolder;
                RaisePropertyChanged(nameof(LocalImageFolder));
            }
        }
Example #10
0
        public void ApplyDefaultTheme()
        {
            var             fontProvider = CommonMocks.FontProvider("default");
            ThemeCollection themes       = new ThemeCollection
            {
                ["default"] = Theme.CreateDefaultTheme(),
                ["xyz"]     = CreateTestTheme(),
            };

            ThemeStyler styler = new ThemeStyler(themes);

            (var widget, var element) = CommonMocks.Widget("widget");

            element.Object.Display.ParentFont = fontProvider.Object.Default;

            styler.Apply(element.Object, "xyz");

            element.Object.Style.Update();
            element.Object.Display.Style.Padding.Left.Should().Be(14);
            element.Object.Style.Font.Color.Should().Be(Color.Yellow);
        }
Example #11
0
        private void Image_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ThemeCollection curCollection = ((Image)sender).Tag as ThemeCollection;

            if (curCollection != null)
            {
                switch (curCollection.ItemThemeType)
                {
                case ThemeType.SystemEmbedded:
                    MPL.Utility.ApplyDefaultTheme(App.Current, curCollection.ThemeName, curCollection.ThemeFile);
                    break;

                case ThemeType.Toolkit:
                    ThemeManager.ApplyTheme(curCollection.ThemeName);
                    break;

                case ThemeType.Default:
                    MPL.Utility.ApplyTheme(App.Current, curCollection.ThemeFile);
                    break;
                }
            }
        }
Example #12
0
 static ThemeTable()
 {
     Themes = new ThemeCollection();
     ThemesLocation = "~/content/themes/";
 }
Example #13
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButton(0) && !gameMaster.paused)
     {
         Vector3      v   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         RaycastHit2D hit = Physics2D.Raycast(v, Vector2.zero);
         if (hit.collider != null && hit.transform.position != previousSpot && hit.transform.tag == "Spot")
         {
             hit.transform.gameObject.GetComponent <Animator>().SetInteger("Animation", ThemeCollection.getThemes()[SavenLoad.setting.activedTheme].animation);
             AddSpot(hit.transform.position);
             currentLine += hit.transform.name;
         }
         v.z = 0;
         render.SetPosition(2 * count - 2, v);
     }
     else if (Input.GetMouseButtonUp(0) && currentLine != "" && !gameMaster.paused)
     {
         //call Game Master here
         gameMaster.checkAns(currentLine);
         //Cancel line
         count       = 1;
         currentLine = "";
         render.SetVertexCount(1);
         previousSpot = new Vector3(0.1f, 0.1f, -1);
     }
     if (currentLine == "")
     {
         foreach (GameObject t in GameObject.FindGameObjectsWithTag("Highlight"))
         {
             t.GetComponent <SpriteRenderer>().enabled = false;
         }
     }
 }