Beispiel #1
0
 private void Start()
 {
     if (avatar.IsLocal)
     {
         var hasSavedSettings = false;
         if (SaveTextureSetting)
         {
             hasSavedSettings = LoadSettings();
         }
         if (!hasSavedSettings && RandomTextureOnSpawn)
         {
             SetTexture(Textures.Get(UnityEngine.Random.Range(0, Textures.Count)));
         }
     }
 }
Beispiel #2
0
        private void UpdateOptions()
        {
            var optionCount = Mathf.Min(entriesPerPage * maxPages, catalogue.Count);

            pagePanel.SetPageCount(optionCount / entriesPerPage);

            int controlI = 0;

            for (int optionI = 0; optionI < optionCount; controlI++, optionI++)
            {
                if (controls.Count <= controlI)
                {
                    controls.Add(InstantiateControl());
                }

                controls[controlI].Bind(SetTexture, catalogue.Get(optionI));
            }

            while (controls.Count > controlI)
            {
                Destroy(controls[controlI].gameObject);
                controls.RemoveAt(controlI);
            }

            var startOptionI = pagePanel.page * entriesPerPage;
            var endOptionI   = pagePanel.page * entriesPerPage + entriesPerPage - 1;

            for (int i = 0; i < controls.Count; i++)
            {
                controls[i].gameObject.SetActive(i >= startOptionI && i <= endOptionI);
            }
        }
Beispiel #3
0
        void Update()
        {
            if (Manager.LocalAvatar != null)
            {
                var Textured = Manager.LocalAvatar.GetComponent <TexturedAvatar>();
                if (Textured != null)
                {
                    if (Textures != Textured.Textures)
                    {
                        Textures = Textured.Textures;

                        while (Controls.Count < Textures.Count)
                        {
                            Controls.Add(GameObject.Instantiate(ControlPrefab, Container.transform).GetComponent <AvatarSkinMenuControl>());
                        }
                        while (Controls.Count > Textures.Count)
                        {
                            Destroy(Controls[0].gameObject);
                            Controls.RemoveAt(0);
                        }
                        for (int i = 0; i < Textures.Count; i++)
                        {
                            Controls[i].Bind(this, Textures.Get(i));
                        }
                    }

                    PreviewAvatar.Textures = Textured.Textures;
                    PreviewAvatar.SetTexture(Textured.GetTexture());
                }
            }
        }