コード例 #1
0
        public void OnEditName(string s)
        {
            if (ignoreEditOnce)
            {
                ignoreEditOnce = false;
                return;
            }

            btnSave.interactable      = input.text.Length == 0 || (input.text.Length > 0 && input.text.IndexOfAny(Path.GetInvalidFileNameChars()) < 0);
            input.textComponent.color = btnSave.interactable ? valid : invalid;
            bWrnInvalidName           = !btnSave.interactable;
            DirectoryInfo d = new DirectoryInfo(CVSPPresetManager.Directory);

            FileSystemInfo[] fileSystemInfo = d.GetFileSystemInfos();
            if (d.Exists &&
                fileSystemInfo
                .FirstOrDefault(q => q is FileInfo && Path.GetFileNameWithoutExtension(q.Name) == input.text && q.Extension == ".xml")
                != null)
            {
                bWrnFileExists = true;
            }
            else
            {
                bWrnFileExists = false;
            }
            if (wrnFileExists == null)
            {
                wrnFileExists  = CVSPUIManager.Localize("#LOC_CVSP_WrnFileExists");
                wrnInvalidName = CVSPUIManager.Localize("#LOC_CVSP_WrnInvalidName");
            }
        }
コード例 #2
0
        void Start()
        {
            if (thicknessInput != null)
            {
                thicknessInput.text = "0.01";
                //StartCoroutine(AddListenerCoroutine());
                FindVertexInfos();
                foreach (var item in vertexInfos)
                {
                    AddListener(item);
                }
                btnCancleDeletion.onClick.AddListener(OnCancleDeletion);
                btnClose.onClick.AddListener(OnClose);
                btnConfirm.onClick.AddListener(OnConfirm);
                thicknessInput.onEndEdit.AddListener(OnValidateThicknessInput);
                if (PickTip.Length == 0)
                {
                    PickTip = CVSPUIManager.Localize("#LOC_CVSP_PickingVertexTip");
                    IdleTip = CVSPUIManager.Localize("#LOC_CVSP_CreatePanelIdleTip");
                }
                gameObject.SetActive(false);

                vertexMarkers = new ScreenMarker[4];
                for (int i = 0; i < vertexMarkers.Length; vertexMarkers[i].id = i++)
                {
                    ;
                }
            }
        }
コード例 #3
0
 private void StartSearch(char c)
 {
     title.text    = CVSPUIManager.Localize("#LOC_CVSP_SEARCH_FOR") + ' ';
     searchString += c;
     title.text   += searchString;
     searchEnabled = true;
     OpenDirectory(searchString + "*");
 }
コード例 #4
0
 private void AddSearchChar(char c)
 {
     searchString += c;
     if (searchString.Length > 16)
     {
         searchString = searchString.Substring(0, 16);
     }
     title.text = CVSPUIManager.Localize("#LOC_CVSP_SEARCH_FOR") + ' ' + searchString;
     OpenDirectory(searchString + "*");
 }
コード例 #5
0
        private bool OpenDirectory(string searchS = "*")
        {
            DirectoryInfo d = new DirectoryInfo(currentPath);

            if (d.Exists)
            {
                Clear();
                if (currentPath.Length > TxeturePath.Length)
                {
                    //子文件夹
                    btnBack.gameObject.SetActive(true);
                }
                else
                {
                    btnBack.gameObject.SetActive(false);
                }
                var f = d.GetFileSystemInfos(searchS);
                foreach (var info in f)
                {
                    if (info is DirectoryInfo)
                    {
                        var g = Instantiate(folderItemPrefab);
                        g.SetActive(true);
                        g.GetComponentInChildren <Text>().text = info.Name;
                        g.transform.SetParent(fileList.transform, false);
                    }
                }
                foreach (var info in f)
                {
                    if (info is FileInfo)
                    {
                        if (IsTexture(info.Name))
                        {
                            var g = Instantiate(fileItemPrefab);
                            g.SetActive(true);
                            g.GetComponentInChildren <Text>().text = info.Name;
                            g.transform.SetParent(fileList.transform, false);
                        }
                    }
                }
                return(true);
            }
            else
            {
                errorMsg = CVSPUIManager.Localize("#LOC_CVSP_TEXTURE_DIRECTORY_NOT_FOUND");
            }
            return(false);
        }
コード例 #6
0
 public void OpenDialog(string path, string title, bool asNormal)
 {
     readme.enabled     = asNormal;
     selectingNormalMap = asNormal;
     chkBoxConvertNormal.gameObject.SetActive(selectingNormalMap);
     currentPath   = path;
     searchEnabled = false;
     if (OpenDirectory())
     {
         searchString    = string.Empty;
         titleString     = CVSPUIManager.Localize("#LOC_CVSP_SELECT") + ' ' + title;
         this.title.text = titleString;
         CVSPUIManager.Instance.Close();
     }
     gameObject.SetActive(true);
 }
コード例 #7
0
 void Start()
 {
     link   = CVSPUIManager.Localize(link);
     unlink = CVSPUIManager.Localize(unlink);
     if (name.EndsWith("0"))
     {
         toggle0 = this;
         toggle.SetIsOnWithoutNotify(default0);
         text.text = default0 ? unlink : link;
     }
     else
     {
         toggle1 = this;
         toggle.SetIsOnWithoutNotify(default1);
         text.text = default1 ? unlink : link;
     }
 }
コード例 #8
0
 void Update()
 {
     if (Input.anyKey)
     {
         if (Input.anyKeyDown)
         {
             if (Input.GetKeyDown(KeyCode.F5))
             {
                 EndSearch();
                 OpenDirectory();
             }
             if (!searchEnabled)
             {
                 foreach (char c in Input.inputString)
                 {
                     if (c != '\b')
                     {
                         if (c != '\n' && c != '\r') // enter/return/backspace
                         {
                             StartSearch(c);
                             break;
                         }
                     }
                     else
                     {
                         OnBackClick();
                     }
                 }
             }
             else
             {
                 foreach (char c in Input.inputString)
                 {
                     if (c == '\b') // has backspace/delete been pressed?
                     {
                         if (searchString.Length != 0)
                         {
                             searchString = searchString.Substring(0, searchString.Length - 1);
                             title.text   = CVSPUIManager.Localize("#LOC_CVSP_SEARCH_FOR") + ' ' + searchString;
                             if (searchString.Length == 0)
                             {
                                 EndSearch();
                             }
                         }
                     }
                     else if ((c == '\n') || (c == '\r')) // enter/return
                     {
                         EndSearch();
                     }
                     else
                     {
                         AddSearchChar(c);
                     }
                 }
             }
         }
         if (Time.unscaledTime - lastScrollTime > 0.1f)
         {
             if ((Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.UpArrow)) && fileList.transform.childCount > 2)
             {
                 Transform listTransform = fileList.transform;
                 bool      moveUp        = Input.GetKey(KeyCode.UpArrow);
                 index = Mathf.Clamp(index, 2, listTransform.childCount - 1);
                 GameObject curr = EventSystem.current.currentSelectedGameObject;
                 if (!selectedFileName || !curr /*|| !selectedFileName.transform.IsChildOf(curr.transform)*/)
                 {
                     if (moveUp)
                     {
                         index = listTransform.childCount - 1;
                     }
                     else
                     {
                         index = 2;
                     }
                 }
                 else
                 {
                     if (moveUp)
                     {
                         index = index > 2 ? index - 1 : 2;
                     }
                     else
                     {
                         index = index == listTransform.childCount - 1 ? index : index + 1;
                     }
                 }
                 selectedFileName = listTransform.GetChild(index).GetComponentInChildren <Text>();
                 Button button = selectedFileName.GetComponentInParent <Button>();
                 button.Select();
                 if (!movingSelectedToVisible)
                 {
                     StartCoroutine(BringSelectedToVisible());
                 }
             }
             lastScrollTime = Time.unscaledTime;
         }
         else if ((Input.GetKeyUp(KeyCode.DownArrow) || Input.GetKeyUp(KeyCode.UpArrow)) && selectedFileName)
         {
             Button button = selectedFileName.GetComponentInParent <Button>();
             button.Select();
             button.onClick.Invoke();
         }
     }
 }