Esempio n. 1
0
        /// <summary>
        /// 只有两种情况会调用到这个函数
        /// 1.打开GraphEditorWindow(初次打开或者在已经打开的基础上更换GraphAsset)
        /// 2.编译/进入PlayMode而导致的GraphEditorWindow重载
        /// </summary>
        /// <param name="graph"></param>
        public void InitializeGraph(BaseGraph graph)
        {
            if (this.graph != null && graph != this.graph)
            {
                // Save the graph to the disk
                GraphCreateAndSaveHelper.SaveGraphToDisk(this.graph);
                // Unload the graph
                graphUnloaded?.Invoke(this.graph);
            }

            graphLoaded?.Invoke(graph);
            this.graph = graph;

            if (graphView != null)
            {
                rootView.Remove(graphView);
            }

            InitializeWindow(graph);
            rootView.Add(graphView);

            graphView = rootView.Children().FirstOrDefault(e => e is BaseGraphView) as BaseGraphView;

            if (graphView == null)
            {
                Debug.LogError("GraphView has not been added to the BaseGraph root view !");
                return;
            }

            EditorCoroutineUtility.StartCoroutine(graphView.Initialize(graph), this);

            InitializeGraphView(graphView);

            // TOOD: onSceneLinked...

            if (graph.IsLinkedToScene())
            {
                LinkGraphWindowToScene(graph.GetLinkedScene());
            }
            else
            {
                graph.onSceneLinked += LinkGraphWindowToScene;
            }
            //防止在外部调用InitializeGraph时重复执行InitializeGraph
            reloadWorkaround = false;
        }
        static void CheckProgress(Store <AppState> store, string key)
        {
            var token = UnityConnectSession.instance.GetAccessToken();

            if (token.Length == 0)
            {
                CheckLoginStatus(store);
                return;
            }

            key = key ?? store.state.key;
            string baseUrl = GetAPIBaseUrl();

            var uploadRequest = UnityWebRequest.Get($"{baseUrl + QueryProgressEndpoint}?key={key}");

            uploadRequest.SetRequestHeader("Authorization", $"Bearer {token}");
            uploadRequest.SetRequestHeader("X-Requested-With", "XMLHTTPREQUEST");
            var op = uploadRequest.SendWebRequest();

            op.completed += operation =>
            {
#if UNITY_2020
                if ((uploadRequest.result == UnityWebRequest.Result.ConnectionError) ||
                    (uploadRequest.result == UnityWebRequest.Result.ProtocolError))
#else
                if (uploadRequest.isNetworkError || uploadRequest.isHttpError)
#endif
                {
                    AnalyticsHelper.UploadCompleted(UploadResult.Failed);
                    Debug.LogError(uploadRequest.error);
                    StopUploadAction();
                    return;
                }
                var response = JsonUtility.FromJson <GetProgressResponse>(op.webRequest.downloadHandler.text);

                store.Dispatch(new QueryProgressResponseAction {
                    response = response
                });
                if (response.progress == 100 || !string.IsNullOrEmpty(response.error))
                {
                    SaveProjectID(response.projectId);
                    return;
                }
                EditorCoroutineUtility.StartCoroutineOwnerless(RefreshProcessingProgress(1.5f, store));
            };
        }
        static void CheckLoginStatus(Store <AppState> store)
        {
            var token = UnityConnectSession.instance.GetAccessToken();

            if (token.Length != 0)
            {
                store.Dispatch(new LoginAction());
                return;
            }

            if (waitUntilUserLogsInRoutine != null)
            {
                return;
            }

            waitUntilUserLogsInRoutine = EditorCoroutineUtility.StartCoroutineOwnerless(WaitUntilUserLogsIn(2f, store));
        }
Esempio n. 4
0
 public void UploadBuild(ButlerSettings settings)
 {
     IsUploading = true;
     EditorCoroutineUtility.StartCoroutine(ButlerCommandRoutine(settings.ToPushArgs(), (success, error) =>
     {
         IsUploading = false;
         Application.OpenURL(settings.GetURL());
         if (success)
         {
             AppendConsoleMessage?.Invoke("Upload Complete.");
         }
         else
         {
             AppendConsoleMessage?.Invoke(error);
         }
     }), this);
 }
Esempio n. 5
0
        public static void Out(AudioSource source, float fadeTime)
        {
#if UNITASK
            OutInternal(source, fadeTime).Forget();
#elif EDITOR_COROUTINES && UNITY_EDITOR
            if (!Application.isPlaying)
            {
                EditorCoroutineUtility.StartCoroutineOwnerless(OutInternal(source, fadeTime));
            }
            else
            {
                CoroutineRunner.RunCoroutine(OutInternal(source, fadeTime));
            }
#else
            CoroutineRunner.RunCoroutine(OutInternal(source, fadeTime));
#endif
        }
Esempio n. 6
0
//----------------------------------------------------------------------------------------------------------------------

        private void DrawUpdateRenderCacheGUI()
        {
            ShortcutBinding updateRenderCacheShortcut
                = ShortcutManager.instance.GetShortcutBinding(SISEditorConstants.SHORTCUT_UPDATE_RENDER_CACHE);

            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                RenderCachePlayableAssetEditorConfig editorConfig = m_asset.GetEditorConfig();

                bool captureAllFrames = EditorGUILayout.Toggle("Capture All Frames", editorConfig.GetCaptureAllFrames());
                editorConfig.SetCaptureAllFrames(captureAllFrames);

                EditorGUI.BeginDisabledGroup(captureAllFrames);
                ++EditorGUI.indentLevel;


                int captureStartFrame = Math.Max(0, editorConfig.GetCaptureStartFrame());
                int captureEndFrame   = editorConfig.GetCaptureEndFrame();
                if (captureEndFrame < 0)
                {
                    captureEndFrame = TimelineUtility.CalculateNumFrames(TimelineEditor.selectedClip);
                }

                editorConfig.SetCaptureStartFrame(EditorGUILayout.IntField("From", captureStartFrame));
                editorConfig.SetCaptureEndFrame(EditorGUILayout.IntField("To", captureEndFrame));
                --EditorGUI.indentLevel;
                EditorGUI.EndDisabledGroup();

                GUILayout.Space(10);

                if (GUILayout.Button($"Update Render Cache ({updateRenderCacheShortcut})"))
                {
                    PlayableDirector director = TimelineEditor.inspectedDirector;
                    if (null == director)
                    {
                        EditorUtility.DisplayDialog("Streaming Image Sequence",
                                                    "PlayableAsset is not loaded in scene. Please load the correct scene before doing this operation.",
                                                    "Ok");
                        return;
                    }

                    //Loop time
                    EditorCoroutineUtility.StartCoroutine(UpdateRenderCacheCoroutine(director, m_asset), this);
                }
            }
        }
Esempio n. 7
0
    private IEnumerator GetAllSupporters(string req)
    {
        var client = CreateRequest(req, true);

        yield return(client.SendWebRequest());

        JSONNode json = JSON.Parse(client.downloadHandler.text);

        if (!numberOfSupporters.HasValue)
        {
            numberOfSupporters = json["meta"]["pagination"]["total"];
        }
        foreach (JSONNode include in json["included"])
        {
            if (string.IsNullOrEmpty(chroMapperTierID) && include["type"] == "tier" && include["attributes"]["title"] == "ChroMapper")
            {
                chroMapperTierID = include["id"];
            }
            else if (include["type"] == "user")
            {
                userIDToAttributes.Add(include["id"], include["attributes"]);
            }
        }
        foreach (JSONNode member in json["data"])
        {
            yield return(EditorCoroutineUtility.StartCoroutineOwnerless(GetUserInformation(member)));

            supportersProcessed++;

            if (currentSupporterDiscordUsername == "ERR")
            {
                continue;
            }

            modifyingList.AddSupporter(currentSupporterDiscordUsername, currentSupporterIsCMPatron);
            yield return(new EditorWaitForSeconds(3));

            EditorUtility.DisplayProgressBar("Retrieving Patreon Supporters", "Retrieving information on Patreon supporters", (float)supportersProcessed / numberOfSupporters.Value);
        }

        if (json.HasKey("links") && json["links"].HasKey("next"))
        {
            yield return(EditorCoroutineUtility.StartCoroutineOwnerless(GetAllSupporters(json["links"]["next"]))); // oh yeah we're going recursive on this bitch
        }
    }
Esempio n. 8
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            EditorGUI.BeginDisabledGroup(busy || string.IsNullOrEmpty(m_target.apiKey) || string.IsNullOrEmpty(m_target.database_id));

            if (GUILayout.Button("Fetch Schema"))
            {
                var api = new NotionAPI(m_target.apiKey);

                busy = true;

                EditorCoroutineUtility.StartCoroutine(api.GetDatabaseJSON(m_target.database_id, (db) =>
                {
                    Debug.Log(db);
                    Undo.RecordObject(m_target, "Update Schema");
                    var json = JSON.Parse(db);
                    m_target.fieldNames.Clear();
                    m_target.fieldTypes.Clear();
                    foreach (var node in json["properties"])
                    {
                        m_target.fieldNames.Add(node.Key);
                        m_target.fieldTypes.Add(node.Value["type"]);
                    }
                    EditorUtility.SetDirty(m_target);
                    busy = false;
                }), this);
            }

            EditorGUI.EndDisabledGroup();

            EditorGUI.BeginDisabledGroup(busy || m_target.fieldNames == null || m_target.fieldNames.Count == 0);

            if (GUILayout.Button("Create Schema Class"))
            {
                CreateCodeSchemaFile(m_target);
            }

            if (GUILayout.Button("Create Serialized Database Asset"))
            {
                CreateSerializedDatabaseFile(m_target);
            }

            EditorGUI.EndDisabledGroup();
        }
Esempio n. 9
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            var settings = (VersionSettings)target;

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Fetch"))
            {
                EditorCoroutineUtility.StartCoroutine(FetchVersion(settings), this);
            }

            if (GUILayout.Button("Set"))
            {
                EditorCoroutineUtility.StartCoroutine(UpdateVersion(settings), this);
            }
            GUILayout.EndHorizontal();
        }
Esempio n. 10
0
        public void InstallOrUpdate()
        {
            Queue <Package> toUpdate = new Queue <Package>();

            toUpdate = GetAllGitDependencies(toUpdate);
            toUpdate.Reverse();

            Debug.Log("-------------- Packages to install:");
            foreach (Package s in toUpdate)
            {
                Debug.Log(s.packageName);
            }
            Debug.Log("-------------- ");

            //PackageManager.OnPackagesFiltrated += UnityRegistryHelper.Download;

            EditorCoroutineUtility.StartCoroutineOwnerless(FiltratePackages(toUpdate));
        }
Esempio n. 11
0
    public static void Init()
    {
        if (window != null)
        {
            window.Close();
        }

        UpdateGitInfo();

        window          = CreateInstance <AutomatedBuild>();
        window.position = new Rect(Screen.width / 2, Screen.height / 2, 400, 155);
        window.Repaint();
        window.ShowPopup();
        if (periodicUpdateRoutine == null)
        {
            periodicUpdateRoutine = EditorCoroutineUtility.StartCoroutine(instance.PeriodicUpdateGitInfo(), instance);
        }
    }
Esempio n. 12
0
        public static Texture LoadImageAsync(string imageUrl, Texture2D defaultIcon, EditorWindow editor)
        {
            if (string.IsNullOrEmpty(imageUrl))
            {
                Debug.LogWarning($"imageUrl is null or empty");
                return(defaultIcon);
            }

            if (_inMemoryCache.TryGetValue(imageUrl, out var image))
            {
                return(image);
            }

            _inMemoryCache.Add(imageUrl, defaultIcon);

            EditorCoroutineUtility.StartCoroutine(LoadImageInternalAsync(imageUrl, editor), editor);
            return(defaultIcon);
        }
        protected override void Awake()
        {
            if (!inEditor)
            {
#if UNITY_EDITOR
                //base.Awake();
                if (editModeLoop != null) //stops loop in play mode
                {
                    EditorCoroutineUtility.StopCoroutine(editModeLoop);
                    editModeLoop = null;
                }
#endif

                _ETERNAL.I.earlyRecorder.callbackF += MoveToTarget;

                RecordParent();
            }
        }
Esempio n. 14
0
    IEnumerator GameCoreRunner()
    {
        Init();

        //Infinite Game Cycle
        while (isGaming)
        {
            //Spawn Player Shape
            playerShape = new PlayerShape();
            playerShape.shapeCoordinates  = TetrisShapes.GetShapeCoordinates(TetrisShapes.Shape.Random);
            playerShape.shapeCoordinates += new Coordinate(Mathf.RoundToInt(gameSize.x / 2), gameSize.y - 2);
            if (DetectIfCollideWithGameBoard(playerShape.shapeCoordinates))
            {
                yield return(EditorCoroutineUtility.StartCoroutine(GameOverProcess(), ArcadeWindow.instance));

                yield break;
            }

            double t = 0;
            while (playerShape != null)
            {
                t += deltaTime;
                if (t > FallFrequency)
                {
                    t -= FallFrequency;
                    t %= FallFrequency;
                    FallDownPlayer();
                }

                yield return(null);
            }

            BlockState[,] newBlockStates;
            bool isAnyMatchedLines = CheckMatch(out newBlockStates);
            gameBoard = newBlockStates;

            if (isAnyMatchedLines)
            {
                yield return(new EditorWaitForSeconds(1f));

                ClearLine();
            }
        }
    }
Esempio n. 15
0
        public static void In(AudioSource source, float volume, float fadeTime, float delay)
        {
#if UNITASK
            InInternal(source, volume, fadeTime, delay).Forget();
#else
#if EDITOR_COROUTINES && UNITY_EDITOR
            if (Application.isPlaying)
            {
                CoroutineRunner.RunCoroutine(InInternal(source, volume, fadeTime, delay));
            }
            else
            {
                EditorCoroutineUtility.StartCoroutineOwnerless(InInternal(source, volume, fadeTime, delay));
            }
#else
            CoroutineRunner.RunCoroutine(InInternal(source, volume, fadeTime, delay));
#endif
#endif
        }
        private void OnGUI()
        {
            if (Directory.Exists(Application.dataPath + "/Temp/"))
            {
                Directory.Delete(Application.dataPath + "/Temp/", true);
            }

            foreach (string k in download.Keys)
            {
                if (download[k].Filetype.Contains("zip"))
                {
                    if (GUILayout.Button("Download " + k))
                    {
                        WebClient wc = new WebClient();
                        Directory.CreateDirectory(Application.dataPath + "/Temp/");
                        wc.DownloadFile(download[k].RawDownloadLink, Application.dataPath + "/Temp/downloadTex.zip");
                        wc.Dispose();
                        Directory.CreateDirectory(Application.dataPath + "/Materials/Textures");
                        var zf = ZipFile.Read(Application.dataPath + "/Temp/downloadTex.zip");
                        zf.ExtractAll(Application.dataPath + "/Temp");
                        zf.Dispose();
                        string[] textureFiles = Directory.GetFiles(Application.dataPath + "/Temp").Where(x => { return(x.Contains("_")); }).ToArray();

                        string texName = Path.GetFileName(textureFiles[0]).Split('_')[0];
                        string ext     = Path.GetExtension(textureFiles[0]);
                        string res     = Path.GetFileName(textureFiles[0]).Split('_')[1];

                        foreach (string f in textureFiles)
                        {
                            if (!File.Exists(Application.dataPath + "/Materials/Textures/" + Path.GetFileName(f)))
                            {
                                File.Move(f, Application.dataPath + "/Materials/Textures/" + Path.GetFileName(f));
                            }
                        }

                        this.Close();


                        EditorCoroutineUtility.StartCoroutine(StartImport(texName, res, ext), this);
                    }
                }
            }
        }
Esempio n. 17
0
    private void Run()
    {
        while (SystemManager.Instance.Connect)
        {
            Thread.Sleep(33);
            EditorCoroutineUtility.StartCoroutine(DeviceControl(), this);
            if (bWaitThread)
            {
                continue;
            }

            if (nImgFrameIDX >= nMaxImageIndex)
            {
                Init();
                break;
            }
            EditorCoroutineUtility.StartCoroutine(MappingCoroutine(), this);
        }
    }
Esempio n. 18
0
    private void OnGUI()
    {
        maxSize      = new Vector2(250f, 150f);
        minSize      = maxSize;
        titleContent = new GUIContent("Pull Patreon Supporters");

        GUILayout.Label("Patreon Client Access Token:");
        clientSecret = GUILayout.TextField(clientSecret);
        GUILayout.Label("Filtered Patreon Users");
        filteredPatrons     = GUILayout.TextField(filteredPatrons);
        filteredPatreonList = filteredPatrons.Split(',').Select(x => x.Trim());
        clearLists          = GUILayout.Toggle(clearLists, "Clear Existing List");
        GUILayout.Label("Object to Modify");
        modifyingList = (PatreonSupporters)EditorGUILayout.ObjectField(modifyingList, typeof(PatreonSupporters), false);

        if (GUILayout.Button("Pull from Patreon"))
        {
            EditorCoroutineUtility.StartCoroutineOwnerless(Pull());
        }
    }
Esempio n. 19
0
    private static void OnEnable()
    {
        if (!AssetDatabase.IsValidFolder("Assets/Autosave"))
        {
            AssetDatabase.CreateFolder("Assets", "Autosave");
        }
        if (prefs == null)
        {
            prefs = CreateInstance <AutosavePrefs>(); SavePrefs();
        }

        LoadPrefs();

        EditorApplication.playModeStateChanged += OnPlayModeToggle;

        if (saveRoutine == null)
        {
            saveRoutine = EditorCoroutineUtility.StartCoroutineOwnerless(SaveOpenScenesCoroutine());
        }
    }
Esempio n. 20
0
        private static void StopAfter(AudioHandle handle, float time)
        {
            // Select despawn strategy based on what packages are present
#if UNITASK
            StopAfterInternal(handle, time).Forget();
#else
#if EDITOR_COROUTINES && UNITY_EDITOR
            if (Application.isPlaying)
            {
                CoroutineRunner.RunCoroutine(StopAfterInternal(handle, time));
            }
            else
            {
                EditorCoroutineUtility.StartCoroutineOwnerless(StopAfterInternal(handle, time));
            }
#else
            CoroutineRunner.RunCoroutine(StopAfterInternal(handle, time));
#endif
#endif
        }
Esempio n. 21
0
        /// <summary>
        /// Write metadata files into the build directory
        /// </summary>
        /// <param name="outputPath"></param>
        void WriteMetadataFilesAndFinalizeBuild(string outputPath, string buildGUID)
        {
            try
            {
                // The Unity version used
                string versionFilePath = $"{outputPath}/ProjectVersion.txt";
                File.Copy("ProjectSettings/ProjectVersion.txt", versionFilePath, true);

                string guidFilePath = $"{outputPath}/GUID.txt";
                File.WriteAllText(guidFilePath, buildGUID);

                // dependencies.txt: list of "depepedency@version"
                string dependenciesFilePath = $"{outputPath}/dependencies.txt";
                EditorCoroutineUtility.StartCoroutineOwnerless(WritePackagesListAndFinalizeBuild(dependenciesFilePath));
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
        }
Esempio n. 22
0
        public virtual void OnEnable()
        {
            string logoName = EditorGUIUtility.isProSkin ? "travrsal-white-300.png" : "travrsal-300.png";

            Texture2D logoImage = AssetDatabase.LoadAssetAtPath($"Packages/com.wetzold.travrsal.sdk/Editor/Images/{logoName}", typeof(Texture2D)) as Texture2D;

            if (logoImage == null)
            {
                logoImage = AssetDatabase.LoadAssetAtPath($"Assets/SDK/Editor/Images/{logoName}", typeof(Texture2D)) as Texture2D;
            }

            logo = new GUIStyle {
                normal = { background = logoImage }, fixedWidth = 128, fixedHeight = 64
            };

            // perform (cheap) setup tasks
            SetupTags();

            EditorCoroutineUtility.StartCoroutine(FetchUserWorlds(), this);
        }
Esempio n. 23
0
        public static void DownloadTranslationFileFromEditorWindow(BuildType buildType, Action onLoadedEnded)
        {
            switch (buildType)
            {
            case BuildType.Release:
            {
                EditorCoroutineUtility.StartCoroutineOwnerless(StartLoadingFile(LocalizatorSettings.ReleaseTableLink, onLoadedEnded));
            }
            break;

            case BuildType.Development:
            {
                EditorCoroutineUtility.StartCoroutineOwnerless(StartLoadingFile(LocalizatorSettings.DevelopmentTableLink, onLoadedEnded));
            }
            break;

            default:
                break;
            }
        }
Esempio n. 24
0
        void OnTutorialPageCriteriaCompletionStateTested(TutorialPage sender)
        {
            if (currentTutorial == null || currentTutorial.currentPage != sender)
            {
                return;
            }

            foreach (var paragraph in m_Paragraphs)
            {
                paragraph.ResetState();
            }

            if (sender.allCriteriaAreSatisfied && sender.autoAdvanceOnComplete && !sender.hasMovedToNextPage)
            {
                EditorCoroutineUtility.StartCoroutineOwnerless(GoToNextPageAfterDelay());
                return;
            }

            ApplyMaskingSettings(true);
        }
        public void NextTextBlock(string image, string textBlock)
        {
            if (!gameObject.activeInHierarchy)
            {
                Show(true);
            }

            if (typingCoroutine != null)
            {
                Debug.LogError("Should not be pushing a line will "
                               + "other line is not finished displaying");
                StopCoroutine(typingCoroutine);
            }
#if UNITY_EDITOR
            else if (editorCoroutine != null)
            {
                EditorCoroutineUtility.StopCoroutine(editorCoroutine);
            }
#endif

            Sprite sprite = spriteAtlas.GetSprite(image);
            if (sprite != null)
            {
                portrait.sprite = sprite;
            }
            else
            {
                portrait.sprite = missingPortrait;
            }

            continueTextImage.gameObject.SetActive(false);

#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                editorCoroutine = EditorCoroutineUtility.StartCoroutineOwnerless(DisplayText(textBlock));
            }
            else
#endif
            typingCoroutine = StartCoroutine(DisplayText(textBlock));
        }
        private void DrawSnapshotPanel()
        {
            SpiralEditor.BeginPanel("Last snapshot preview");
            SpiralEditor.SetGUIEnabled(false);
            SpiralEditor.DrawObjectField("Snapshot", lastSnapshot, false);
            if (lastSnapshot != null)
            {
                SpiralEditor.BoldLabel($"{lastSnapshot.width}x{lastSnapshot.height}", true);
            }
            SpiralEditor.RestoreGUIEnabled();

            bool snapShotEnabled = GameViewUtils.gameView != null && !waiting;

            SpiralEditor.SetGUIEnabled(snapShotEnabled);
            try
            {
                bool makescreen = SpiralEditor.CenteredButton("Make a photo");
                if (makescreen)
                {
                    EditorCoroutineUtility.StartCoroutine(WaitForEditor(), this);
                }
            }
            catch
            {
                SpiralEditor.EndPanel();
                return;
            } // welcome to the silence null
            SpiralEditor.RestoreGUIEnabled();
            if (!snapShotEnabled)
            {
                if (waiting)
                {
                    SpiralEditor.MessagePanel("Wait...", MessageType.Info);
                }
                else
                {
                    SpiralEditor.MessagePanel("If disabled, try to open or restart GameView", MessageType.Warning);
                }
            }
            SpiralEditor.EndPanel();
        }
Esempio n. 27
0
        public static void DownloadTranslationFile(Action onLoadedEnded)
        {
            switch (LocalizatorSettings.DownloadingType)
            {
            case DownloadingType.ManualInEditor:
            {
                onLoadedEnded?.Invoke();
            }
            break;

            case DownloadingType.AutoInEditor:
            {
#if !UNITY_EDITOR
                onLoadedEnded?.Invoke();
#else
                EditorCoroutineUtility.StartCoroutineOwnerless(StartLoadingFile(LocalizatorSettings.ActualTableLink, onLoadedEnded));
#endif
            }
            break;

            case DownloadingType.AutoOnDevice:
            {
#if UNITY_EDITOR
                onLoadedEnded?.Invoke();
#else
                LoadOnDevice(onLoadedEnded);
#endif
            }
            break;

            case DownloadingType.Always:
            {
#if UNITY_EDITOR
                EditorCoroutineUtility.StartCoroutineOwnerless(StartLoadingFile(LocalizatorSettings.ActualTableLink, onLoadedEnded));
#else
                LoadOnDevice(onLoadedEnded);
#endif
            }
            break;
            }
        }
Esempio n. 28
0
    private IEnumerator Pull()
    {
        var client = CreateRequest("https://www.patreon.com/api/oauth2/api/current_user/campaigns", true);

        if (clearLists)
        {
            modifyingList.HighTierPatrons.Clear();
            modifyingList.RegularPatrons.Clear();
        }

        yield return(client.SendWebRequest());

        JSONNode json       = JSON.Parse(client.downloadHandler.text);
        string   campaignID = json["included"][0]["relationships"]["campaign"]["data"]["id"]; // we're going on a trip, down some JSON that's a rip

        string req = $"https://www.patreon.com/api/oauth2/v2/campaigns/{campaignID}/members?include=currently_entitled_tiers,user&fields%5Buser%5D=social_connections,first_name&fields%5Btier%5D=title";

        yield return(EditorCoroutineUtility.StartCoroutineOwnerless(GetAllSupporters(req)));

        EditorUtility.ClearProgressBar();
    }
Esempio n. 29
0
    private IEnumerator GetUserInformation(JSONNode dataObj)
    {
        currentSupporterIsCMPatron = dataObj["relationships"]["currently_entitled_tiers"]["data"].Linq.Any(x => x.Value["id"] == chroMapperTierID);

        string   userID         = dataObj["relationships"]["user"]["data"]["id"];
        JSONNode userAttributes = userIDToAttributes[userID];

        if (userAttributes.HasKey("social_connections") && userAttributes["social_connections"].HasKey("discord") && !userAttributes["social_connections"]["discord"].IsNull)
        {
            yield return(EditorCoroutineUtility.StartCoroutineOwnerless(ContactAuros(userAttributes["social_connections"]["discord"]["user_id"])));
        }
        else
        {
            currentSupporterDiscordUsername = userAttributes["first_name"];
        }

        if (filteredPatreonList.Contains(currentSupporterDiscordUsername))
        {
            currentSupporterDiscordUsername = "******";
        }
    }
Esempio n. 30
0
    private IEnumerator LoadMap(string filename)
    {
        yield return(EditorCoroutineUtility.StartCoroutine(Cleanup(), this));

        WorldSerialization blob = new WorldSerialization();

        ActionProgressBar.UpdateProgress("Loading Map...", 0f);
        yield return(null);

        yield return(null);

        blob.Load(filename);

        world = World.WorldToTerrain(blob);

        yield return(EditorCoroutineUtility.StartCoroutine(LoadMap(world), this));

        ActionProgressBar.Close();

        Debug.Log("World Loaded!");
    }