示例#1
0
        static void OpenFilePanel( )
        {
            var fname = EditorUtility.OpenFilePanel("Please select a file", E.i.opendir, "");

            if (!string.IsNullOrEmpty(fname))
            {
                using (var st = new StreamReader(fname)) {
                    var lst = new List <string>();
                    var sss = st.ReadToEnd();
                    if (!string.IsNullOrEmpty(sss))
                    {
                        var ss = sss.Split('\n');
                        for (int i = 0; i < ss.Length; i++)
                        {
                            var s = ss[i];
                            s = s.TrimEnd('\r');
                            if (!string.IsNullOrEmpty(s))
                            {
                                lst.Add(s);
                            }
                        }
                    }
                    E.AddURLs(lst.ToArray());
                    GitHubDownloadWindow.Repaint();
                }
            }
        }
        public static void updateThreadSync()
        {
            curTime = Time.realtimeSinceStartup;
            float deltaTime = (float)(curTime - lastTime);

            lastTime = curTime;

            m_watiTime -= deltaTime;
            if (m_watiTime < 0)
            {
                m_watiTime = 0.1250f;

                m_count++;
                if (12 <= m_count)
                {
                    m_count = 0;
                }
                GitHubDownloadWindow.Repaint();
            }
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        static void DrawGUI()
        {
            E.Load();
            if (s_styles == null)
            {
                s_styles = new Styles();
            }

            if (E.i.gitUrls == null)
            {
                E.i.gitUrls = new List <E.GitURL>();
                s_changed   = true;
            }
            //if( s_rl == null ) {
            //	s_rl = MakeRL();
            //}

            EditorGUI.BeginChangeCheck();

            GUILayout.Label("Enter URL");
            using (new GUILayout.HorizontalScope()) {
                EditorGUI.BeginChangeCheck();
                var _t = EditorGUILayout.TextField(E.i.adb_exe);
                if (EditorGUI.EndChangeCheck())
                {
                    E.i.adb_exe = _t;
                }
                var r = GUILayoutUtility.GetRect(new GUIContent(s_styles.ol_plus), GUIHelper.Styles.iconButton);
                r.y += 3;
                if (GUIHelper.IconButton(r, s_styles.ol_plus))
                {
                    var a = CheckURL(E.i.adb_exe);
                    if (!string.IsNullOrEmpty(a))
                    {
                        E.AddURLs(a);
                        GitHubDownloadWindow.Repaint();
                    }
                }
                r    = GUILayoutUtility.GetRect(new GUIContent(s_styles.Favorite), GUIHelper.Styles.iconButton);
                r.y += 3;
                if (GUIHelper.IconButton(r, s_styles.Favorite))
                {
                    OpenFilePanel();
                }
            }

            GUILayout.Space(8);

            int delIndex = -1;

            var    ss   = E.i.gitUrls.Select(x => Helper.ParseURL(x.url)).ToArray();
            string name = string.Empty;

            for (var i = 0; i < ss.Length; i++)
            {
                var s = ss[i];

                if (name != s[0])
                {
                    if (name != string.Empty)
                    {
                        GUILayout.EndVertical();
                    }
                    GUILayout.BeginVertical( );
                    name = s[0];
                    GUILayout.Label(s[0], EditorStyles.boldLabel);
                }

                using (new GUILayout.HorizontalScope(EditorStyles.helpBox)) {
                    GUILayout.Label(s[1]);
                    if (GUIHelper.IconButton(s_styles.IconInfo))
                    {
                        GitHubView.Open($"{Path.GetDirectoryName( E.i.gitUrls[ i ].url )}/{Path.GetFileNameWithoutExtension( E.i.gitUrls[ i ].url )}");
                    }
                    if (GUIHelper.IconButton(s_styles.IconSetting))
                    {
                        GitURLConfig.Open(E.i.gitUrls[i]);
                    }
                    if (GUIHelper.IconButton(s_styles.ol_minus))
                    {
                        delIndex = i;
                    }
                }
            }
            GUILayout.EndVertical();

            if (0 <= delIndex)
            {
                E.i.gitUrls.RemoveAt(delIndex);
                s_changed = true;
            }


            if (EditorGUI.EndChangeCheck() || s_changed)
            {
                E.Save();
            }

            GUILayout.Space(8f);
        }