Пример #1
0
 public static void LoadMarketById(int[] categoryArray, Action <float> updateCallback = null, Action successCallback = null, Action <string> errorCallback = null)
 {
     StaticCoroutine.DoCoroutine(CategoriesServices.LoadMarketById(categoryArray, updateCallback, successCallback, errorCallback));
 }
Пример #2
0
    static public StaticCoroutine instance;     //the instance of our class that will do the work



    void Awake()         //called when an instance awakes in the game
    {
        instance = this; //set our static reference to our newly initialized instance
    }
 static void OnUnpause()
 {
     //Wait because the game does that too
     StaticCoroutine.Start(UnPauseWait());
 }
Пример #4
0
    public static void send(string msg)
    {
        string query = "?data=" + msg;

        StaticCoroutine.DoCoroutine(GetToServer(query));
    }
Пример #5
0
 public void OnDisable()
 {
     UnObserveEvents();
     CancelHooverOver = null;
     StaticCoroutine.StopCoroutines(runningCoroutine);
 }
Пример #6
0
 void Die()
 {
     mInstance = null;
     Destroy(gameObject);
 }
Пример #7
0
    public static void PlayWith(AudioSource src, Clip clip, Delegates.ShallowDelegate next)
    {
        src.PlayOneShot(clips[clip]);

        StaticCoroutine.Start(FollowPlay(clips[clip], next));
    }
Пример #8
0
 public void StartSetting()
 {
     StaticCoroutine.StopCoroutines(_coroutine);
     _coroutine = StaticCoroutine.StartCoroutine(SetMyScreenPosition(InGameObjectPosition));
 }
Пример #9
0
 public void Stop() => StaticCoroutine.StopCoroutines(_coroutine);
Пример #10
0
 public override void DoAction(Actor actor)
 {
     StaticCoroutine.Start(ChopVegetables(((ChefActor)actor).chef, ((ChefActor)actor).chefTransform.value));
 }
Пример #11
0
 // this method can be called to load a sprite ressource from the url. onComplete should be executed once the download is completed.
 // you can use http://benno-lueders.de/img/victory_yoda.jpg for testing.
 public static void LoadSpriteRessource(string url, Action <Sprite> onComplete)
 {
     StaticCoroutine.RunCoroutine(LoadSpriteRoutine(url, onComplete));
 }
Пример #12
0
 public void UploadByPut(string url, string method, Dictionary <string, string> header, UploadHandler uploadHandler, Action <string> actionResult)
 {
     StaticCoroutine.StartCoroutine(_UploadByPut(url, method, header, uploadHandler, actionResult));
 }
Пример #13
0
 public void UploadByPut(string url, byte[] contentBytes, Action <bool> actionResult)
 {
     StaticCoroutine.StartCoroutine(_UploadByPut(url, contentBytes, actionResult, ""));
 }
Пример #14
0
 public void Delete(string url, Action <string> actionResult)
 {
     StaticCoroutine.StartCoroutine(_Delete(url, actionResult));
 }
Пример #15
0
 public void Post(string serverURL, WWWForm lstformData, Action <UnityWebRequest> actionResult)
 {
     StaticCoroutine.StartCoroutine(_Post(serverURL, lstformData, actionResult));
 }
Пример #16
0
 public static void InjectPotion(BodyPart bodyPart, string type, float amount, float seconds, int goldCost)
 {
     StaticCoroutine.Start(InjectPotionCoroutine(bodyPart, type, amount, seconds, goldCost));
 }
Пример #17
0
 void Awake()
 {
     instance = this;
 }
Пример #18
0
    static void VersionCheck(CommandArg[] args)
    {
        var url = "https://itch.io/api/1/x/wharf/latest?target=tsny/project-lonestar&channel_name=win";

        StaticCoroutine.StartCoroutine(VersionChecker.GetVersions(url, null, true));
    }
Пример #19
0
 void OnApplicationQuit()
 {
     mInstance = null;
 }
Пример #20
0
            public IEnumerator CreateTextureAsync(bool linear, Action <Texture2D, TextureOrientation> onFinish, string mimeType, Action <float> onProgress = null)
            {
                Texture2D          tex         = new Texture2D(2, 2, TextureFormat.ARGB32, true, linear);
                bool               loaded      = false;
                TextureOrientation orientation = new TextureOrientation();

                //With GLTF, the mimeType stores the path, let's correct that mistake
                if (!string.IsNullOrEmpty(mimeType))
                {
                    if (File.Exists(mimeType))
                    {
                        path     = mimeType;
                        mimeType = "image/" + Path.GetExtension(path).Remove(0, 1);
                    }
                }

                //Use KtxUnity plugin to load ktx/ktx2/basis textures
                if (mimeType == "image/ktx" || mimeType == "image/ktx2" || mimeType == "image/basis")
                {
#if !KTX
                    Debug.LogError("GLTFImage.cs CreateTextureAsync() KTX and basis texture support is not enabled, try enabling 'KTX' scripting define symbol in project settings and make sure KtxUnity plugin is in your project");
                    yield break;
#else
                    NativeArray <byte> data = new NativeArray <byte>(bytes, KtxNativeInstance.defaultAllocator);

                    TextureBase textureBase = null;

                    if (mimeType == "image/ktx" || mimeType == "image/ktx2")
                    {
                        textureBase = new KtxTexture();
                    }
                    else if (mimeType == "image/basis")
                    {
                        textureBase = new BasisUniversalTexture();
                    }

                    textureBase.onTextureLoaded += (Texture2D texture, KtxUnity.TextureOrientation ktxOrientation) =>
                    {
                        orientation.IsXFlipped = ktxOrientation.IsXFlipped();
                        orientation.IsYFlipped = ktxOrientation.IsYFlipped();
                        tex = texture;

                        //Rename the texture if we have a valid path variable (not available with .glb)
                        if (!string.IsNullOrEmpty(path))
                        {
                            tex.name = Path.GetFileNameWithoutExtension(path);
                        }
                        //
                        if (tex.name == "material1_normal")
                        {
                            Debug.Log("OnTextureLoaded() " + tex.name + "[ " + tex.width + " x " + tex.height + " ] Flipped[ " + orientation.IsXFlipped + " : " + orientation.IsYFlipped + " ]");
                        }
                        //
                        loaded = true;
                    };

                    yield return(StaticCoroutine.Start(textureBase.LoadBytesRoutine(data, true)));

                    data.Dispose();
#endif
                }
                else                 //Load .jpg, .jpeg, .png textures
                {
                    orientation.IsXFlipped = false;
                    orientation.IsYFlipped = false;
                    tex.LoadImage(bytes);
                    loaded = true;
                }

                yield return(new WaitUntil(() =>
                {
                    /*
                     * if( tex.name == "material1_basecolor" )
                     *      Debug.Log( "WaitUntil() " + tex.name + "[ loaded = " + loaded + " ][ " + tex.width + " x " + tex.height + " ]" );
                     */
                    return loaded;
                }));

                if (tex != null)
                {
                    //Rename the texture if we have a valid path variable (not available with .glb)
                    if (!string.IsNullOrEmpty(path))
                    {
                        tex.name = Path.GetFileNameWithoutExtension(path);
                    }

                    /*
                     * if( tex.name == "material1_basecolor" )
                     *      Debug.Log( "OnFinish() Transcoded " + tex.name + "[" + mimeType + "][ " + bytes.Length + " ][ " + tex.width + " x " + tex.height + " ]" );
                     */
                    onFinish(tex, orientation);
                }
                else
                {
                    Debug.Log("OnFinish() Unable To Transcode " + tex.name + "[" + mimeType + "][ " + bytes.Length + " ]");
                }
            }     //END CreateTextureAsync()
Пример #21
0
 public void VictoryCheck()
 {
     StaticCoroutine.Start(VictoryCheckCoroutine());
 }
Пример #22
0
 /// <summary> Runs task followed by OnCompleted </summary>
 public IEnumerator RunSynchronously()
 {
     task.RunSynchronously();
     yield return(StaticCoroutine.Start(OnCoroutine()));
 }
Пример #23
0
 // Handle level win
 public static void LevelWin()
 {
     StaticCoroutine.Start(WaitNow());
 }
Пример #24
0
        private static IEnumerator LoadAsync(string json, string filepath, byte[] bytefile, long binChunkStart, ImportSettings importSettings, Action <GameObject, AnimationClip[]> onFinished, Action <float> onProgress = null)
        {
            // Threaded deserialization
            Task <GLTFObject> deserializeTask = new Task <GLTFObject>(() => JsonConvert.DeserializeObject <GLTFObject>(json));

            deserializeTask.Start();
            while (!deserializeTask.IsCompleted)
            {
                yield return(null);
            }
            GLTFObject gltfObject = deserializeTask.Result;

            CheckExtensions(gltfObject);

            // directory root is sometimes used for loading buffers from containing file, or local images
            string directoryRoot = filepath != null?Directory.GetParent(filepath).ToString() + "/" : null;

            importSettings.shaderOverrides.CacheDefaultShaders();

            // Setup import tasks
            List <ImportTask> importTasks = new List <ImportTask>();

            GLTFBuffer.ImportTask bufferTask = new GLTFBuffer.ImportTask(gltfObject.buffers, filepath, bytefile, binChunkStart);
            importTasks.Add(bufferTask);
            GLTFBufferView.ImportTask bufferViewTask = new GLTFBufferView.ImportTask(gltfObject.bufferViews, bufferTask);
            importTasks.Add(bufferViewTask);
            GLTFAccessor.ImportTask accessorTask = new GLTFAccessor.ImportTask(gltfObject.accessors, bufferViewTask);
            importTasks.Add(accessorTask);
            GLTFImage.ImportTask imageTask = new GLTFImage.ImportTask(gltfObject.images, directoryRoot, bufferViewTask);
            importTasks.Add(imageTask);
            GLTFTexture.ImportTask textureTask = new GLTFTexture.ImportTask(gltfObject.textures, imageTask);
            importTasks.Add(textureTask);
            GLTFMaterial.ImportTask materialTask = new GLTFMaterial.ImportTask(gltfObject.materials, textureTask, importSettings);
            importTasks.Add(materialTask);
            GLTFMesh.ImportTask meshTask = new GLTFMesh.ImportTask(gltfObject.meshes, accessorTask, bufferViewTask, materialTask, importSettings);
            importTasks.Add(meshTask);
            GLTFSkin.ImportTask skinTask = new GLTFSkin.ImportTask(gltfObject.skins, accessorTask);
            importTasks.Add(skinTask);
            GLTFNode.ImportTask nodeTask = new GLTFNode.ImportTask(gltfObject.nodes, meshTask, skinTask, gltfObject.cameras);
            importTasks.Add(nodeTask);

            // Ignite
            for (int i = 0; i < importTasks.Count; i++)
            {
                yield return(StaticCoroutine.Start(TaskSupervisor(importTasks[i], onProgress)));
            }

            // Wait for all tasks to finish
            while (!importTasks.All(x => x.IsCompleted))
            {
                yield return(null);
            }

            // Fire onFinished when all tasks have completed
            GameObject root = nodeTask.Result.GetRoot();

            GLTFAnimation.ImportResult[] animationResult = gltfObject.animations.Import(accessorTask.Result, nodeTask.Result, importSettings);
            AnimationClip[] animations = new AnimationClip[0];
            if (animationResult != null)
            {
                animations = animationResult.Select(x => x.clip).ToArray();
            }
            if (onFinished != null)
            {
                onFinished(nodeTask.Result.GetRoot(), animations);
            }

            // Close file streams
            foreach (var item in bufferTask.Result)
            {
                item.Dispose();
            }
        }
 public ReturnCoroutine(IEnumerator coroutine)
 {
     _coroutine = StaticCoroutine.Start(Start(coroutine));
 }
Пример #26
0
    public void Damage(int amount)
    {
        health -= amount;

        StaticCoroutine.DoCoroutine(GameMaster.flashScreenRed());
    }
Пример #27
0
 static void AfterInfiniteModeFailWait()
 {
     //Wait for 2 seconds in real time just like the game does
     //This is necessary because the postfix on this just runs instantly for whatever reason
     StaticCoroutine.Start(AfterFailWait());
 }
Пример #28
0
 /// <summary>
 /// Deactivates a game object after a period of time to be reused later.
 /// </summary>
 /// <param name="gameObject">The game object to deactivate.</param>
 /// <param name="seconds">The number of seconds to wait for before deactivating object.</param>
 public static void Destroy(GameObject gameObject, float seconds)
 {
     StaticCoroutine.StartCR(DestroyAfterTime(gameObject, seconds));
 }
Пример #29
0
 public static void GetListCategories(Action successCallback = null, Action <string> errorCallback = null)
 {
     StaticCoroutine.DoCoroutine(CategoriesServices.GetList(successCallback, errorCallback));
 }
 void Awake()
 { 
     instance = this; 
 }
Пример #31
0
 void Awake()
 {
     //called when an instance awakes in the game
     instance = this; //set our static reference to our newly initialized instance
 }
Пример #32
0
 public void GetAudioClip(string url, Action <AudioClip> actionResult, AudioType audioType = AudioType.WAV)
 {
     StaticCoroutine.StartCoroutine(_GetAudioClip(url, actionResult, audioType));
 }