コード例 #1
0
    public void AutoSetSelected(AssetStoreManager assetStoreManager)
    {
        if (this.Dirty)
        {
            return;
        }
        IList <Package> allPackages = assetStoreManager.packageDataSource.GetAllPackages();

        if (allPackages.Count == 0)
        {
            return;
        }
        if (this.SelectedPackage == null)
        {
            this.SelectedPackage = allPackages[0];
            return;
        }
        Package package = allPackages.FirstOrDefault <Package>((Package x) => x.Id == this.SelectedPackage.Id);

        if (package == null)
        {
            return;
        }
        this.SelectedPackage = package;
    }
コード例 #2
0
    private static void OnLoggedIn(string errorMessage)
    {
        if (errorMessage != null)
        {
            if (errorMessage.StartsWith("Cancelled"))
            {
                DebugUtils.Log("Closing package manager because login cancelled");
                ((AssetStoreManager)EditorWindow.GetWindow(typeof(AssetStoreManager), false, "Package Upload")).Close();
            }
            else
            {
                DebugUtils.LogError(string.Concat("Error logging in: ", errorMessage));
            }
            return;
        }
        Console.WriteLine("Asset Store Upload Tool logged in. V5.0.0");
        AssetStoreManager window = (AssetStoreManager)EditorWindow.GetWindow(typeof(AssetStoreManager), false, "Package Upload");

        if (AssetStoreManager.isOpen)
        {
            window.Focus();
        }
        else
        {
            AssetStoreManager.isOpen = true;
            window.Init();
            window.Show();
        }
    }
コード例 #3
0
 private static void Launch()
 {
     if (Application.webSecurityEnabled)
     {
         bool flag = EditorUtility.DisplayDialog("Web player platform active", "You are currently using the Web Player platform. To upload Asset Store packages please switch platform to PC and Mac standalone in File -> Build Settings...", "Switch my Active Platform.", "Cancel");
         if (!flag)
         {
             return;
         }
         try
         {
             Assembly   assembly = Assembly.Load("UnityEditor");
             Type       type     = assembly.GetType("UnityEditor.EditorUserBuildSettings");
             MethodInfo method   = type.GetMethod("SwitchActiveBuildTarget");
             method.Invoke(null, new object[]
             {
                 EditorUserBuildSettings.selectedStandaloneTarget
             });
         }
         catch
         {
             DebugUtils.LogError("Unable to invoke UnityEditor.EditorUserBuildSettings");
         }
     }
     EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(AssetStoreClient.Update));
     EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, new EditorApplication.CallbackFunction(AssetStoreClient.Update));
     AssetStoreManager.Login("Login to fetch current list of published packages");
 }
コード例 #4
0
    private static void AssetStoreLogout()
    {
        DebugUtils.Log("Logged out of Asset Store");
        AssetStoreManager assetStoreManager = (AssetStoreManager)EditorWindow.GetWindow(typeof(AssetStoreManager), false, "Package Upload");

        assetStoreManager.Close();
        AssetStoreClient.Logout();
    }
コード例 #5
0
    private void ShowUploadSucessfull()
    {
        EditorUtility.DisplayDialog("Upload successful!", "The package content has been successfully uploaded. To finish the submission, visit the Publisher Portal and confirm that all information about your package is accurate.", "Ok");
        this.ClearLocalState();
        AssetStoreManager window = (AssetStoreManager)EditorWindow.GetWindow(typeof(AssetStoreManager), false, "Package Upload");

        window.SendEvent(EditorGUIUtility.CommandEvent("refresh"));
    }
コード例 #6
0
    private void ShowUploadSucessfull()
    {
        EditorUtility.DisplayDialog("Upload successful", "The package has been uploaded please visit the Publisher Administration to submit this version for review.", "Ok");
        this.ClearLocalState();
        DebugUtils.Log("Closing package manager after successful submission");
        AssetStoreManager assetStoreManager = (AssetStoreManager)EditorWindow.GetWindow(typeof(AssetStoreManager), false, "AssetStoreMgr");

        assetStoreManager.Close();
    }
コード例 #7
0
 private static void Launch()
 {
     EditorApplication.update -= new EditorApplication.CallbackFunction(AssetStoreClient.Update);
     EditorApplication.update += new EditorApplication.CallbackFunction(AssetStoreClient.Update);
     if (!AssetStoreManager.isOpen)
     {
         AssetStoreManager.Login("To upload packages, please log in to your Asset Store Publisher account.");
     }
 }
コード例 #8
0
 private static void Login(string whyMessage, string errorMessage)
 {
     if (LoginWindow.IsLoggedIn)
     {
         AssetStoreManager.OnLoggedIn(null);
     }
     else
     {
         LoginWindow.ShowLoginWindow(whyMessage, errorMessage, new LoginWindow.LoginCallback(AssetStoreManager.OnLoggedIn));
     }
 }
コード例 #9
0
 private void RefreshPackages()
 {
     this.Account.mStatus = AssetStorePublisher.Status.Loading;
     AssetStoreAPI.GetMetaData(this.Account, this.m_PackageDataSource, (string errMessage) => {
         if (errMessage == null)
         {
             this.m_PackageController.AutoSetSelected(this);
             this.Repaint();
             return;
         }
         Debug.LogError(string.Concat("Error fetching metadata: ", errMessage));
         LoginWindow.Logout();
         AssetStoreManager.Login("To upload packages, please log in to your Asset Store Publisher account.");
         this.Repaint();
     });
 }
コード例 #10
0
    private static void OnLoggedIn(string errorMessage)
    {
        if (errorMessage != null)
        {
            if (!errorMessage.StartsWith("Cancelled"))
            {
                DebugUtils.LogError("Error logging in: " + errorMessage);
            }
            else
            {
                DebugUtils.Log("Closing package manager because login cancelled");
                AssetStoreManager assetStoreManager = (AssetStoreManager)EditorWindow.GetWindow(typeof(AssetStoreManager), false, "Package Upload");
                assetStoreManager.Close();
            }
            return;
        }
        Console.WriteLine("Asset Store Upload Tool logged in. V4.0.7");
        AssetStoreManager assetStoreManager2 = (AssetStoreManager)EditorWindow.GetWindow(typeof(AssetStoreManager), false, "Package Upload");

        assetStoreManager2.Init();
        assetStoreManager2.Show();
    }
コード例 #11
0
 private void RenderDebug()
 {
     if (AssetStoreManager.sDbgButtons)
     {
         GUILayout.FlexibleSpace();
         GUILayout.Label("Debug: ", AssetStoreManager.Styles.ToolbarLabel, new GUILayoutOption[0]);
         if (GUILayout.Button("FileSelector", EditorStyles.toolbarButton, new GUILayoutOption[0]))
         {
             FileSelector.Show("/", new List <string>(), delegate(List <string> newList)
             {
                 foreach (string current in newList)
                 {
                     DebugUtils.Log(current);
                 }
             });
         }
         if (GUILayout.Button("Reload", EditorStyles.toolbarButton, new GUILayoutOption[0]))
         {
             AssetStoreAPI.GetMetaData(this.Account, this.m_PackageDataSource, delegate(string errMessage)
             {
                 if (errMessage != null)
                 {
                     Debug.LogError("Error fetching metadata: " + errMessage);
                     LoginWindow.Logout();
                     AssetStoreManager.Login("Login to fetch current list of published packages");
                     base.Repaint();
                     return;
                 }
                 this.m_PackageController.AutoSetSelected(this);
                 base.Repaint();
             });
         }
         if (GUILayout.Button("Logout", EditorStyles.toolbarButton, new GUILayoutOption[0]))
         {
             AssetStoreClient.Logout();
         }
     }
 }
コード例 #12
0
    public void AutoSetSelected(AssetStoreManager assetStoreManager)
    {
        if (this.Dirty)
        {
            return;
        }
        this.SelectedPackage = null;
        List <Package>  list        = new List <Package>();
        IList <Package> allPackages = assetStoreManager.packageDataSource.GetAllPackages();

        foreach (Package current in allPackages)
        {
            list.Add(current);
        }
        list.RemoveAll((Package pc) => string.IsNullOrEmpty(pc.RootGUID) || pc.RootGUID != AssetStorePackageController.GetLocalRootGUID(pc));
        if (list.Count == 1)
        {
            this.SelectedPackage = list[0];
            return;
        }
        if (list.Count == 0)
        {
            foreach (Package current2 in allPackages)
            {
                list.Add(current2);
            }
        }
        list.RemoveAll((Package pc) => pc.RootPath == null || (Application.dataPath != pc.ProjectPath && !Directory.Exists(Application.dataPath + pc.RootPath)));
        if (list.Count == 1)
        {
            this.SelectedPackage = list[0];
            return;
        }
        if (list.Count == 0)
        {
            return;
        }
        foreach (Package current3 in list)
        {
            if (current3.RootPath != null && Directory.Exists(Application.dataPath + current3.RootPath) && Application.dataPath == current3.ProjectPath)
            {
                this.SelectedPackage = current3;
                return;
            }
        }
        if (this.SelectedPackage != null)
        {
            return;
        }
        foreach (Package current4 in list)
        {
            if (current4.RootPath != null && Directory.Exists(Application.dataPath + current4.RootPath))
            {
                this.SelectedPackage = current4;
                return;
            }
        }
        if (this.SelectedPackage != null)
        {
            return;
        }
        foreach (Package current5 in list)
        {
            if (current5.ProjectPath != null && current5.ProjectPath == Application.dataPath)
            {
                this.SelectedPackage = current5;
                break;
            }
        }
    }
コード例 #13
0
    private void RenderMenu()
    {
        GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
        GUILayout.FlexibleSpace();
        this.RenderToolbar();
        GUILayout.EndHorizontal();
        bool flag = false;

        if (LoginWindow.IsLoggedIn)
        {
            if (this.Account.mStatus == AssetStorePublisher.Status.NotLoaded)
            {
                this.Account.mStatus = AssetStorePublisher.Status.Loading;
                AssetStoreAPI.GetMetaData(this.Account, this.m_PackageDataSource, (string errMessage) => {
                    if (errMessage == null)
                    {
                        this.m_PackageController.AutoSetSelected(this);
                        this.Repaint();
                        return;
                    }
                    Debug.LogError(string.Concat("Error fetching metadata: ", errMessage));
                    LoginWindow.Logout();
                    AssetStoreManager.Login("To upload packages, please log in to your Asset Store Publisher account.", "Account is not registered as a Publisher. \nPlease create a Publisher ID.");
                    this.Repaint();
                });
            }
            if (this.Account.mStatus == AssetStorePublisher.Status.NotLoaded || this.Account.mStatus == AssetStorePublisher.Status.Loading)
            {
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.Space(10f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.Label(GUIUtil.StatusWheel, new GUILayoutOption[0]);
                GUILayout.Label("Fetching account information", new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                this.Repaint();
            }
            else
            {
                bool flag1 = GUI.enabled;
                if (this.Account.mStatus != AssetStorePublisher.Status.Existing)
                {
                    GUI.enabled = false;
                }
                GUI.enabled = flag1;
                flag        = true;
            }
        }
        else
        {
            if (!LoginWindow.IsVisible)
            {
                LoginWindow.Login("To upload packages, please log in to your Asset Store Publisher account.", new LoginWindow.LoginCallback(AssetStoreManager.OnLoggedIn), GUIUtil.RectOnRect(360f, 180f, base.position));
            }
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label(GUIUtil.StatusWheel, new GUILayoutOption[0]);
            GUILayout.Label("Please login", new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
        if (!flag && this.m_PackageController.SelectedPackage != null)
        {
            this.m_PackageController.SelectedPackage = null;
        }
    }
コード例 #14
0
    private void RenderMenu()
    {
        GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
        GUILayout.FlexibleSpace();
        this.RenderDebug();
        GUILayout.EndHorizontal();
        bool flag = false;

        if (!LoginWindow.IsLoggedIn)
        {
            if (!LoginWindow.IsVisible)
            {
                LoginWindow.Login("Please re-login to asset store in order to fetch publisher details", new LoginWindow.LoginCallback(AssetStoreManager.OnLoggedIn), GUIUtil.RectOnRect(360f, 140f, base.position));
            }
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label(GUIUtil.StatusWheel, new GUILayoutOption[0]);
            GUILayout.Label("Please login", new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
        else
        {
            if (this.Account.mStatus == AssetStorePublisher.Status.NotLoaded)
            {
                this.Account.mStatus = AssetStorePublisher.Status.Loading;
                AssetStoreAPI.GetMetaData(this.Account, this.m_PackageDataSource, delegate(string errMessage)
                {
                    if (errMessage != null)
                    {
                        Debug.LogError("Error fetching metadata: " + errMessage);
                        LoginWindow.Logout();
                        AssetStoreManager.Login("Login to fetch current list of published packages");
                        base.Repaint();
                        return;
                    }
                    this.m_PackageController.AutoSetSelected(this);
                    base.Repaint();
                });
            }
            if (this.Account.mStatus == AssetStorePublisher.Status.NotLoaded || this.Account.mStatus == AssetStorePublisher.Status.Loading)
            {
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.Space(10f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.Label(GUIUtil.StatusWheel, new GUILayoutOption[0]);
                GUILayout.Label("Fetching account information", new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                base.Repaint();
            }
            else
            {
                bool enabled = GUI.enabled;
                if (this.Account.mStatus != AssetStorePublisher.Status.Existing)
                {
                    GUI.enabled = false;
                }
                GUI.enabled = enabled;
                flag        = true;
            }
        }
        if (!flag && this.m_PackageController.SelectedPackage != null)
        {
            this.m_PackageController.SelectedPackage = null;
        }
    }