Esempio n. 1
0
        public void SetCurrentTexture(TextureButton textureButton)
        {
            if (currentButton != null)
            {
                currentButton.SetActivated(false);
            }

            currentButton = textureButton;
            textureButton.SetActivated(true);
        }
Esempio n. 2
0
        public void SetCurrentTexture(TextureButton textureButton)
        {
            if (CurrentTB != null)
            {
                CurrentTB.SetActivated(false);
            }

            CurrentTB = textureButton;
            CurrentTB.SetActivated(true);
        }
Esempio n. 3
0
        public void UpdateShot()
        {
            if (CurrentPath == "")
            {
                inPathText.text = "Root";
            }
            else
            {
                inPathText.text = CurrentPath;
            }

            if (currentButton != null)
            {
                currentButton.SetActivated(false);
            }

            currentButton = null;

            string[] localArr;

            if (CurrentPath == "")
            {
                string localSTR = System.IO.Directory.GetCurrentDirectory();


                localArr = System.IO.Directory.GetDirectories(localSTR);

                for (int i = 0; i < localArr.Length; ++i)
                {
                    localArr[i] = localArr[i].Remove(0, localSTR.Length + 1);
                }
            }
            else
            {
                localArr = System.IO.Directory.GetDirectories(CurrentPath);
            }



            if (FoldersList.Capacity < localArr.Length)
            {
                FoldersList.Capacity = localArr.Length;
            }

            int localI = 0;

            foldersTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, localArr.Length * FBSample.myRectTransform.rect.height + 30);

            for (; localI < localArr.Length; ++localI)
            {
                if (localI >= FoldersList.Count)
                {
                    FoldersList.Add(Instantiate <FolderButton>(FBSample));
                    FoldersList[localI].myTL = this;
                    FoldersList[localI].myRectTransform.SetParent(foldersTransform);
                    FoldersList[localI].myRectTransform.localScale = Vector3.one;
                }
                else
                {
                    FoldersList[localI].gameObject.SetActive(true);
                }


                FoldersList[localI].UpdateFolder(localArr[localI]);
                FoldersList[localI].myRectTransform.anchoredPosition = new Vector2(0, -10 - localI * FoldersList[localI].myRectTransform.rect.height);
            }

            for (; localI < FoldersList.Count; ++localI)
            {
                FoldersList[localI].gameObject.SetActive(false);
            }

            localI = 0;


            if (CurrentPath == "")
            {
                localArr = System.IO.Directory.GetFiles(System.IO.Directory.GetCurrentDirectory(), "*.png");
            }
            else
            {
                localArr = System.IO.Directory.GetFiles(CurrentPath, "*.png");
            }



            int m = Mathf.FloorToInt(ImageTransform.rect.width / (TBSample.myRectTransform.rect.width + 25));

            ImageTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, Mathf.Ceil(((float)localArr.Length) / m) * (TBSample.myRectTransform.rect.height + 25) + 25);

            int localm = 0;
            int localn = 0;

            if (TexturesList.Capacity < localArr.Length)
            {
                TexturesList.Capacity = localArr.Length;
            }

            for (; localI < localArr.Length; ++localI)
            {
                if (localI >= TexturesList.Count)
                {
                    TexturesList.Add(Instantiate <TextureButton>(TBSample));
                    TexturesList[localI].myTH = this;
                    TexturesList[localI].transform.SetParent(ImageTransform);
                    TexturesList[localI].myRectTransform.localScale = Vector3.one;
                }
                else
                {
                    TexturesList[localI].gameObject.SetActive(true);
                }

                TexturesList[localI].UpdateImage(localArr[localI]);
                TexturesList[localI].myRectTransform.anchoredPosition = new Vector2((TBSample.myRectTransform.rect.width + 25) * localm + 25, -(TBSample.myRectTransform.rect.height + 25) * localn - 25);

                if (++localm >= m)
                {
                    localm = 0;
                    localn++;
                }
            }

            for (; localI < TexturesList.Count; ++localI)
            {
                TexturesList[localI].gameObject.SetActive(false);
            }
        }
Esempio n. 4
0
 public void SetCurrentImage(TextureButton inButton)
 {
 }
Esempio n. 5
0
        protected void UpdateShot()
        {
            if (CurrentTB != null)
            {
                CurrentTB.SetActivated(false);
            }

            CurrentTB = null;

            List <TextureData> localD = LevelCreatorManager.Instance.myTextures;

            int m = Mathf.FloorToInt(TexturesContent.rect.width / (TBSample.myRectTransform.rect.width + 25));

            TexturesContent.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, Mathf.Ceil(((float)localD.Count + 2) / m) * (TBSample.myRectTransform.rect.height + 25) + 25);

            int localI = 0;
            int localm = 1;
            int localn = 0;



            for (; localI < localD.Count; ++localI)
            {
                if (++localm >= m)
                {
                    localm = 0;
                    localn++;
                }

                if (localI >= TexturesList.Count)
                {
                    TexturesList.Add(Instantiate <TextureButton>(TBSample));
                    TexturesList[localI].myTH = this;
                    TexturesList[localI].transform.SetParent(TexturesContent);
                    TexturesList[localI].myRectTransform.localScale = Vector3.one;
                }
                else
                {
                    TexturesList[localI].gameObject.SetActive(true);
                }

                TexturesList[localI].UpdateImage(localI);
                TexturesList[localI].myRectTransform.anchoredPosition = new Vector2((TBSample.myRectTransform.rect.width + 25) * localm + 25, -(TBSample.myRectTransform.rect.height + 25) * localn - 25);

                if (TexturesList[localI].myTextureData.Hash == myTextureDataHandler.GetTextureData().Hash)
                {
                    CurrentTB = TexturesList[localI];
                    CurrentTB.SetActivated(true);
                }
            }

            for (; localI < TexturesList.Count; ++localI)
            {
                TexturesList[localI].gameObject.SetActive(false);
            }

            if (CurrentTB == null)
            {
                if (SimpleWhiteBoxButton.myTextureData.Hash == myTextureDataHandler.GetTextureData().Hash)
                {
                    CurrentTB = SimpleWhiteBoxButton;
                }
                else if (SimpleWhiteCircleButton.myTextureData.Hash == myTextureDataHandler.GetTextureData().Hash)
                {
                    CurrentTB = SimpleWhiteCircleButton;
                }

                if (CurrentTB != null)
                {
                    CurrentTB.SetActivated(true);
                }
            }
        }