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)); }
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()); }
public static void send(string msg) { string query = "?data=" + msg; StaticCoroutine.DoCoroutine(GetToServer(query)); }
public void OnDisable() { UnObserveEvents(); CancelHooverOver = null; StaticCoroutine.StopCoroutines(runningCoroutine); }
void Die() { mInstance = null; Destroy(gameObject); }
public static void PlayWith(AudioSource src, Clip clip, Delegates.ShallowDelegate next) { src.PlayOneShot(clips[clip]); StaticCoroutine.Start(FollowPlay(clips[clip], next)); }
public void StartSetting() { StaticCoroutine.StopCoroutines(_coroutine); _coroutine = StaticCoroutine.StartCoroutine(SetMyScreenPosition(InGameObjectPosition)); }
public void Stop() => StaticCoroutine.StopCoroutines(_coroutine);
public override void DoAction(Actor actor) { StaticCoroutine.Start(ChopVegetables(((ChefActor)actor).chef, ((ChefActor)actor).chefTransform.value)); }
// 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)); }
public void UploadByPut(string url, string method, Dictionary <string, string> header, UploadHandler uploadHandler, Action <string> actionResult) { StaticCoroutine.StartCoroutine(_UploadByPut(url, method, header, uploadHandler, actionResult)); }
public void UploadByPut(string url, byte[] contentBytes, Action <bool> actionResult) { StaticCoroutine.StartCoroutine(_UploadByPut(url, contentBytes, actionResult, "")); }
public void Delete(string url, Action <string> actionResult) { StaticCoroutine.StartCoroutine(_Delete(url, actionResult)); }
public void Post(string serverURL, WWWForm lstformData, Action <UnityWebRequest> actionResult) { StaticCoroutine.StartCoroutine(_Post(serverURL, lstformData, actionResult)); }
public static void InjectPotion(BodyPart bodyPart, string type, float amount, float seconds, int goldCost) { StaticCoroutine.Start(InjectPotionCoroutine(bodyPart, type, amount, seconds, goldCost)); }
void Awake() { instance = this; }
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)); }
void OnApplicationQuit() { mInstance = null; }
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()
public void VictoryCheck() { StaticCoroutine.Start(VictoryCheckCoroutine()); }
/// <summary> Runs task followed by OnCompleted </summary> public IEnumerator RunSynchronously() { task.RunSynchronously(); yield return(StaticCoroutine.Start(OnCoroutine())); }
// Handle level win public static void LevelWin() { StaticCoroutine.Start(WaitNow()); }
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)); }
public void Damage(int amount) { health -= amount; StaticCoroutine.DoCoroutine(GameMaster.flashScreenRed()); }
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()); }
/// <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)); }
public static void GetListCategories(Action successCallback = null, Action <string> errorCallback = null) { StaticCoroutine.DoCoroutine(CategoriesServices.GetList(successCallback, errorCallback)); }
void Awake() { //called when an instance awakes in the game instance = this; //set our static reference to our newly initialized instance }
public void GetAudioClip(string url, Action <AudioClip> actionResult, AudioType audioType = AudioType.WAV) { StaticCoroutine.StartCoroutine(_GetAudioClip(url, actionResult, audioType)); }