public static void GoAsset() { LoadingJobData jobData = new LoadingJobData (); List<AssetBundleData> assetBundles = new List<AssetBundleData> (); assetBundles.Add (new AssetBundleData ("hellgatemaster", "asset", typeof(TextAsset))); jobData.assetBundles = assetBundles; jobData.finishedDelegate = delegate (List<object> obj, LoadingJobController job) { TextAsset text = Util.GetListObject<TextAsset> (obj); HellgateAssetData data = JsonUtil.FromJson<HellgateAssetData> (text.text); assetBundles = new List<AssetBundleData> (); for (int i = 0; i < data._Sprite.Length; i++) { assetBundles.Add (new AssetBundleData ("hellgateasset", data._Sprite [i], typeof(Sprite))); } for (int i = 0; i < data.Prefab.Length; i++) { assetBundles.Add (new AssetBundleData ("hellgateasset", data.Prefab [i])); } job.PutExtra ("title", "AssetBundle"); job.nextSceneName = "HellgateAsset"; job.LoadAssetBundle (assetBundles); }; SceneManager.Instance.LoadingJob (jobData); }
public static void GoQuest() { LoadingJobData jobData = new LoadingJobData (); List<AssetBundleData> assetBundles = new List<AssetBundleData> (); assetBundles.Add (new AssetBundleData ("hellgatemaster", "quest", typeof(TextAsset))); jobData.finishedDelegate = delegate(List<object> obj, LoadingJobController job) { TextAsset text = Util.GetListObject<TextAsset> (obj); HellgateQuestDataEx data = JsonUtil.FromJson<HellgateQuestDataEx> (text.text); assetBundles = new List<AssetBundleData> (); assetBundles.Add (new AssetBundleData ("hellgatequest", data._User.Prefab)); for (int i = 0; i < data._Missile.Count; i++) { assetBundles.Add (new AssetBundleData ("hellgatequest", data._Missile [i].Prefab)); } job.PutExtra ("data", data); job.nextSceneName = "HellgateQuest"; job.LoadAssetBundle (assetBundles); }; jobData.assetBundles = assetBundles; jobData.status = MainMenuStatus.Destroy; jobData.assetBundleAllUnload = true; SceneManager.Instance.LoadingJob (jobData, false); }
public static void GoNotification() { LoadingJobData jobData = new LoadingJobData ("HellgateNotification"); jobData.PutExtra ("title", "Notification\nPlease Mobile test."); SceneManager.Instance.LoadingJob (jobData); }
/// <summary> /// Loadings the job. /// </summary> /// <param name="data">Data.</param> /// <param name="active">Active.</param> /// <param name="deactive">Deactive.</param> public virtual void LoadingJob(LoadingJobData data, SceneCallbackDelegate active = null, SceneCallbackDelegate deactive = null) { isLoadingJob = true; LoadingJob(data, data.popUp, active, delegate(SSceneController ctrl) { isLoadingJob = false; if (deactive != null) { deactive(ctrl); } }); }
public static void GoHttp() { List<HttpData> https = new List<HttpData> (); https.Add (new HttpData ("info", "json")); LoadingJobData data = new LoadingJobData (); data.https = https; data.finishedDelegate = delegate(List<object> obj, LoadingJobController job) { WWW www = Util.GetListObject<WWW> (obj); HellgateHttpData sprites = JsonUtil.FromJson<HellgateHttpData> (www.text); List<AssetBundleData> assetbundles = new List<AssetBundleData> (); for (int i = 0; i < sprites._Sprite.Length; i++) { assetbundles.Add (new AssetBundleData ("hellgatehttp", sprites._Sprite [i], typeof(Sprite))); } job.nextSceneName = "HellgateHttp"; job.LoadAssetBundle (assetbundles); }; data.lEvent = delegate(LoadingJobStatus status, LoadingJobController job) { if (status == LoadingJobStatus.HttpTimeover) { // Time over. SceneManager.Instance.Close (); SceneManager.Instance.PopUp ("Replay ?", PopUpType.YesAndNo, delegate(PopUpYNType type) { if (type == PopUpYNType.Yes) { SceneManager.Instance.LoadingJob (data); } }); } else if (status == LoadingJobStatus.HttpError) { SceneManager.Instance.Close (); SceneManager.Instance.PopUp ("Network Error.", PopUpType.Ok, delegate(PopUpYNType type) { SceneManager.Instance.Reboot (); }); } }; data.PutExtra ("title", "Http"); SceneManager.Instance.LoadingJob (data); }
/// <summary> /// Loadings the job. /// </summary> /// <param name="data">Data.</param> /// <param name="popUp">If set to <c>true</c> pop up.</param> /// <param name="active">Active.</param> /// <param name="deactive">Deactive.</param> public virtual void LoadingJob(LoadingJobData data, bool popUp, SceneCallbackDelegate active = null, SceneCallbackDelegate deactive = null) { if (LoadingJobSceneName == "") { HDebug.LogWarning("The default loading job scene is not set"); return; } data.popUp = popUp; if (popUp) { if (!data.active) { shieldAlpha = 0f; } PopUp(LoadingJobSceneName, data, active, deactive); } else { Screen(LoadingJobSceneName, data, active, deactive); } }
public void OnClickSound() { string[] sounds = new string[] { "bgm2", "sound1", "sound2" }; List<AssetBundleData> assetBundles = new List<AssetBundleData> (); for (int i = 0; i < sounds.Length; i++) { AssetBundleData aBD = new AssetBundleData ("hellgatesound"); aBD.type = typeof(AudioClip); aBD.objName = sounds [i]; assetBundles.Add (aBD); } LoadingJobData jobData = new LoadingJobData (); jobData.assetBundles = assetBundles; jobData.finishedDelegate = delegate(List<object> obj, LoadingJobController job) { List<AudioClip> clips = obj.GetListObjects<AudioClip> (); for (int i = 0; i < clips.Count; i++) { if (clips [i].name == "bgm2") { SoundManager.Instance.AddBGM (clips [i]); } else { SoundManager.Instance.AddSound (clips [i]); } } SoundManager.Instance.PlayBGM ("bgm2"); SceneManager.Instance.Close (delegate() { SceneManager.Instance.PopUp ("The bgm and menu sound has been set.", PopUpType.Ok); }); }; SceneManager.Instance.LoadingJob (jobData); }
public static void GoMain() { string[] sprites = new string[] { "DarkGrey_Box128x128Measured", "DarkGrey_TrimmedBox128x128", "DarkGrey_Angle128x128", "LightGrey_Box128x128Measured", "LightGrey_TrimmedBox128x128", "LightGrey_Angle128x128", "Orange_Box128x128Measured", "Orange_TrimmedBox128x128", "Orange_Angle128x128" }; LoadingJobData jobData = new LoadingJobData ("HellgateMain"); List<AssetBundleData> assetBundles = new List<AssetBundleData> (); for (int i = 0; i < sprites.Length; i++) { AssetBundleData aBD = new AssetBundleData ("hellgatemain"); aBD.type = typeof(Sprite); aBD.objName = sprites [i]; assetBundles.Add (aBD); } jobData.assetBundles = assetBundles; jobData.PutExtra ("title", "Main"); SceneManager.Instance.LoadingJob (jobData); }
public override void OnSet(object data) { base.OnSet(data); jobData = null; if ((jobData = data as LoadingJobData) != null) { if (jobData.assetBundleAllUnload) { AssetBundleManager.Instance.AllUnload(); } if (!jobData.active) { GameObject gObj = gameObject; foreach (Transform trans in gObj.GetComponentInChildren <Transform> ()) { if (trans == gObj.transform) { continue; } trans.gameObject.SetActive(jobData.active); } } nextSceneName = jobData.nextSceneName; datas = new List <object> (); httpData = new Dictionary <string, object> (); assetBundleData = new Dictionary <string, object> (); index = 0; Request(); } }
public static void GoDatabase() { LoadingJobData jobData = new LoadingJobData ("HellgateDatabase"); jobData.PutExtra ("title", "Database"); SceneManager.Instance.LoadingJob (jobData); }
/// <summary> /// Loadings the job. /// </summary> /// <param name="data">Data.</param> /// <param name="active">Active.</param> /// <param name="deactive">Deactive.</param> public virtual void LoadingJob(LoadingJobData data, SceneCallbackDelegate active = null, SceneCallbackDelegate deactive = null) { isLoadingJob = true; LoadingJob (data, data.popUp, active, delegate(SSceneController ctrl) { isLoadingJob = false; if (deactive != null) { deactive (ctrl); } }); }
/// <summary> /// Loadings the job. /// </summary> /// <param name="data">Data.</param> /// <param name="popUp">If set to <c>true</c> pop up.</param> /// <param name="active">Active.</param> /// <param name="deactive">Deactive.</param> public virtual void LoadingJob(LoadingJobData data, bool popUp, SceneCallbackDelegate active = null, SceneCallbackDelegate deactive = null) { if (LoadingJobSceneName == "") { HDebug.LogWarning ("The default loading job scene is not set"); return; } data.popUp = popUp; if (popUp) { if (!data.active) { shieldAlpha = 0f; } PopUp (LoadingJobSceneName, data, active, deactive); } else { Screen (LoadingJobSceneName, data, active, deactive); } }
public override void OnSet(object data) { base.OnSet (data); jobData = null; if ((jobData = data as LoadingJobData) != null) { if (jobData.assetBundleAllUnload) { AssetBundleManager.Instance.AllUnload (); } if (!jobData.active) { GameObject gObj = gameObject; foreach (Transform trans in gObj.GetComponentInChildren<Transform> ()) { if (trans == gObj.transform) { continue; } trans.gameObject.SetActive (jobData.active); } } nextSceneName = jobData.nextSceneName; datas = new List<object> (); httpData = new Dictionary<string, object> (); assetBundleData = new Dictionary<string, object> (); index = 0; Request (); } }
public void OnClickScreen2() { LoadingJobData jobData = new LoadingJobData ("HellgateScreen2"); jobData.PutExtra ("title", "Screen2"); SceneManager.Instance.LoadingJob (jobData); }
public void OnClickScreen1() { LoadingJobData jobData = new LoadingJobData ("HellgateScreen1"); jobData.status = MainMenuStatus.Hide; jobData.PutExtra ("title", "Screen1"); SceneManager.Instance.LoadingJob (jobData, false); }
public void OnClickPopUp1() { LoadingJobData jobData = new LoadingJobData ("HellgatePopUp1"); jobData.PutExtra ("label", "PopUp Test\nAlpha = 0"); jobData.nextScenePopUp = true; jobData.shieldAlpha = 0; SceneManager.Instance.LoadingJob (jobData); }