Ejemplo n.º 1
0
        private void OnEnable()
        {
            Reference = (GitRepoInfo)target;

            if (Reference == null)
            {
                return;
            }

            m_SPShowDeveloperPanel      = serializedObject.FindProperty("showDeveloperPanel");
            m_SPShowLocalRepositoryInfo = serializedObject.FindProperty("showLocalRepositoryInfo");
            m_SPNameOfFile     = serializedObject.FindProperty("nameOfFile");
            m_SPDownloadURL    = serializedObject.FindProperty("downloadURL");
            m_SPRemoteGitInfos = serializedObject.FindProperty("remoteGitInfos");
            m_SPGitInfos       = serializedObject.FindProperty("gitInfos");
        }
Ejemplo n.º 2
0
        private void Initialization()
        {
            IS_IN_DEVELOPMENT_MODE = IsRepositoryInAssetFolder("com.faith.packagemanager");

            m_SelectedPackageIndex = 0;

            if (IS_IN_DEVELOPMENT_MODE)
            {
                GitRepositoryInfo = (GitRepoInfo)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(AssetDatabase.FindAssets("GitRepositoryInfo", new string[] { "Assets/com.faith.packagemanager" }) [0]), typeof(GitRepoInfo));

                m_IconForTickMark = GetTexture("Icon_TickMark", "Assets/com.faith.packagemanager");
                m_IconForDownload = GetTexture("Icon_Download", "Assets/com.faith.packagemanager");
                m_IconForUpdate   = GetTexture("Icon_Update", "Assets/com.faith.packagemanager");
            }
            else
            {
                GitRepositoryInfo = (GitRepoInfo)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(AssetDatabase.FindAssets("GitRepositoryInfo", new string[] { "Packages/com.faith.packagemanager" }) [0]), typeof(GitRepoInfo));

                m_IconForTickMark = GetTexture("Icon_TickMark", "Packages/com.faith.packagemanager");
                m_IconForDownload = GetTexture("Icon_Download", "Packages/com.faith.packagemanager");
                m_IconForUpdate   = GetTexture("Icon_Update", "Packages/com.faith.packagemanager");
            }

            if (Application.internetReachability != NetworkReachability.NotReachable)
            {
                GitRepositoryInfo.CheckForUpdate();
            }


            UpdatePackageLoadedInfo();

            m_BackgroundTextureOfHeader = new Texture2D(1, 1);
            m_BackgroundTextureOfHeader.SetPixel(
                0,
                0,
                new Color(
                    0.8352942f,
                    0.8352942f,
                    0.8352942f,
                    1f)
                );
            m_BackgroundTextureOfHeader.Apply();

            m_BackgroundTextureOfPackageList = new Texture2D(1, 1);
            m_BackgroundTextureOfPackageList.SetPixel(
                0,
                0,
                m_ColorForPackageInfo
                );
            m_BackgroundTextureOfPackageList.Apply();

            m_BackgroundTextureOfPackageDescription = new Texture2D(1, 1);
            m_BackgroundTextureOfPackageDescription.SetPixel(
                0,
                0,
                m_ColorForPackageInfo
                );
            m_BackgroundTextureOfPackageDescription.Apply();

            m_BackgroundTextureOfFooter = new Texture2D(1, 1);
            m_BackgroundTextureOfFooter.SetPixel(
                0,
                0,
                new Color(
                    0.8352942f,
                    0.8352942f,
                    0.8352942f,
                    1f)
                );
            m_BackgroundTextureOfFooter.Apply();

            m_DefaultGUIBackgroundColor = GUI.backgroundColor;

            m_DefaultGUIStyleForButtonInPackageList = new GUIStyle()
            {
                fontSize  = 13,
                alignment = TextAnchor.MiddleLeft
            };
            Texture2D t_DefaultBackgroundTexture = new Texture2D(1, 1);

            t_DefaultBackgroundTexture.SetPixel(1, 1, m_ColorForPackageInfo);
            t_DefaultBackgroundTexture.Apply();
            m_DefaultGUIStyleForButtonInPackageList.normal.background = t_DefaultBackgroundTexture;
            m_DefaultGUIStyleForButtonInPackageList.normal.textColor  = Color.black;

            m_OnSelectedGUIStyleForButtonInPackageList = new GUIStyle()
            {
                richText  = true,
                fontSize  = 13,
                alignment = TextAnchor.MiddleLeft
            };
            Texture2D t_OnSelectedBackgroundTexture = new Texture2D(1, 1);

            t_OnSelectedBackgroundTexture.SetPixel(1, 1, m_OnSelectedGUIBackgroundColorForButtonInPackageList);
            t_OnSelectedBackgroundTexture.Apply();
            m_OnSelectedGUIStyleForButtonInPackageList.normal.background = t_OnSelectedBackgroundTexture;
            m_OnSelectedGUIStyleForButtonInPackageList.normal.textColor  = Color.white;
        }