public override void CreateGameObject(System.Action <MPObject> loadFinish) { XYCoroutineEngine.Execute(LoadRoleObject(string.Format(MapPlacementController.mapRoleObjectResLoadPathStrFormat, apprId), loadFinish)); return; //this.mapGO = ModuleFactory.CreateBaseRole( sn.ToString(), this.roleCfg.roleBone ); if (this.reference.Apprid <= 0) { base.CreateGameObject(loadFinish); return; } BaseObject bco = new BaseObject(ResourceManager.GetRoleConfig(this.reference.Apprid)); //bco.UpdateEquip(); this.mapGO = bco; if (this.mapGO.name != "BaseObject_NoRoleConfig") { this.mapGO.name = sn.ToString(); } GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.transform.parent = this.mapGO.transform; cube.transform.localPosition = Vector3.zero; cube.transform.localEulerAngles = Vector3.zero; cube.transform.localScale = new Vector3(1, 2, 1); BoxCollider bc = this.mapGO.AddComponent(typeof(BoxCollider)) as BoxCollider; bc.size = new Vector3(1, 2, 1); bc.center = new Vector3(0, 1, 0); XYClientCommon.ChangeLayer(this.mapGO, XYDefines.Layer.Player, true); //return this.mapGO; }
void OnLevelWasLoaded() { GameObject[] Terrains = GameObject.FindGameObjectsWithTag("Terrain"); if (Terrains != null) { for (int i = 0; i < Terrains.Length; i++) { Renderer renderer = Terrains[i].GetComponent <Renderer>(); if (!renderer) { continue; } renderer.sharedMaterial.shader = Shader.Find(renderer.sharedMaterial.shader.name); } } Light light = GameObject.FindObjectOfType <Light>(); if (light != null) { light.cullingMask = 0; } var ca = SetupCamera(); var root = GameObject.FindGameObjectWithTag("root"); ReplaceShader(root, string.Empty); var config = root.GetComponent <SceneConfig>(); CloseRender(config.Mainbuilding); CloseRender(config.Other); XYCoroutineEngine.Execute(LoadSceneAsset(config.Mainbuilding)); XYCoroutineEngine.Execute(LoadSceneAsset(config.Other)); AddMapPlacementComponents(ca); }
void BaseSettingWindow(int wndID) { try{ GUILayout.Label(string.Format("{0} ** {1}", curMap.Name, "")); GUILayout.BeginHorizontal(); RenderSettings.fog = GUILayout.Toggle(RenderSettings.fog, "雾"); if (quitConfirm_.OnDraw()) { SceneManager.LoadScene("startMenu"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (saveToJsonConfirm_.OnDraw()) { //SaveToXml( string.Format( "res/data/{0}.map.xml", curMap.ConfigFileName ) ); SaveToJson(string.Format(mapObjectConfigsDailySavePath, curMap.ID, DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute)); SaveToJson(string.Format(mapObjectConfigsSavePath, curMap.ID)); } if (loadFromXmlConfirm_.OnDraw()) { ClearAllData(); XYCoroutineEngine.Execute(LoadFromJson(String.Format(mapObjectConfigsSavePath, curMap.ID))); //LoadFromXml( string.Format( "res/data/{0}.map.xml", curMap.ConfigFileName ) ); } GUILayout.EndHorizontal(); //GUILayout.BeginHorizontal(); //if ( saveToTextConfirm_.OnDraw() ) { // SaveToText(); //} //if ( loadFromTextConfirm_.OnDraw() ) { // ClearAllData(); // LoadFromText(); //} //GUILayout.EndHorizontal(); if (GUILayout.Button("空气墙")) { showAirWall_ = !showAirWall_; XYClientCommon.AirWall.EnableRender(showAirWall_); } //GUILayout.Label( string.Format( "对象统计:{0}/{1}", this.mapObjs_.Count, curMap.ObjCount ) ); GUILayout.Label(string.Format("对象统计:{0}", this.mapObjs_.Count)); if (GUILayout.Button("位置检查")) { CheackInvalidPos(); } if (GUILayout.Button("移除非法物体")) { RemoveInvalidGo(); } GUI.DragWindow(new Rect(0, 0, 10000, 20)); } catch (System.Exception exc) { Debug.Log(exc.Message); Debug.Log(exc.StackTrace); } }
private void Init() { XYDirectory.Init(); XYCoroutineEngine.Load(); XYSingleAssetLoader.Init(); Loader.Init(); TimelineManager.Init(); World.Init(); }
public void CreatEffect(string name, Action <EffectObject> loadFinish, bool isUIEffect) { string path = string.Format("res/effect/{0}.go", name); if (isUIEffect) { path = string.Format("res/effect/ui/{0}.go", name); } XYCoroutineEngine.Execute(LoadEffect(path, loadFinish)); }
public void CreatAniClips(string path, Action <AnimationClip> loadFinish) { aniClipQueue.Enqueue(path); loadFinishQueue.Enqueue(loadFinish); if (curAniWWW == null) { aniClipQueue.Dequeue(); loadFinishQueue.Dequeue(); XYCoroutineEngine.Execute(LoadAniClip(path, loadFinish)); } }
public override void OnBehaviourStart(Playable playable) { //return; roleEffectBehaviour = behaviour as RoleEffectBehaviour; RoleObject obj = World.Instance.GetRoleObj(roleEffectBehaviour.roleData); if (obj != null) { var renders = obj.gameObject.GetComponentsInChildren <SkinnedMeshRenderer>(); XYCoroutineEngine.Execute(DoDissolveEffect(renders.ToList())); } }
private IEnumerator LoadAniClip(string path, Action <AnimationClip> loadFinish) { curAniWWW = TLEditorWww.Create(path); while (!curAniWWW.Finished) { yield return(null); } AnimationClip clip = curAniWWW.GetAsset() as AnimationClip; yield return(null); curAniWWW.Unload(); loadFinish(clip); curAniWWW = null; if (aniClipQueue.Count > 0) { XYCoroutineEngine.Execute(LoadAniClip(aniClipQueue.Dequeue(), loadFinishQueue.Dequeue())); } }
public static IEnumerator LoadLevel(string levelname, MapReference mf) { if (!instance_) { yield break; } isSceneTexLoadComplete = false; instance_.mapref = mf; XYCoroutineEngine.Execute(LoadShader(shaderPath)); while (!instance_.myshaderLoadDone) { yield return(null); } XYCoroutineEngine.Execute(LoadPublic(PublicPath)); while (!instance_.PublicLoadDone) { yield return(null); } XYCoroutineEngine.Execute(LoadNormal(NormalPath)); while (!instance_.NormalLoadDone) { yield return(null); } XYCoroutineEngine.Execute(LoadTexture(TexturePath)); while (!instance_.TextureLoadDone) { yield return(null); } XYCoroutineEngine.Execute(LoadCtrl(CtrlAssets)); while (!isCtrlLoadDone) { yield return(null); } XYCoroutineEngine.Execute(LoadSceneTex(levelname)); while (!isSceneTexLoadComplete) { yield return(null); } XYCoroutineEngine.Execute(LoadScene(levelname)); }
private void NpcPlacementWindow(int winID) { if (mrs_ != null) { scrollPosition_ = GUILayout.BeginScrollView(scrollPosition_); { foreach (MapReference mr in mrs_) { string showName = string.Format("{0}_{1}", mr.ID, mr.Name); if (GUILayout.Button(showName)) { MapPlacementController.curMap = mr; XYCoroutineEngine.Execute(GameManager.LoadLevel(mr.FileName, mr)); } } } GUILayout.EndScrollView(); } GUI.DragWindow(new Rect(0, 0, 1000, 20)); }
void OnLevelWasLoaded() { LevelWasLoaded = false; if (SceneManager.GetActiveScene().name != "AsyncLevelLoader" && SceneManager.GetActiveScene().name != "startMenu") { LevelWasLoaded = true; } var root = GameObject.FindGameObjectWithTag("root"); MapPlacement.MPObject.ReplaceShader(root, string.Empty); var config = root.GetComponent <SceneConfig>(); CloseRender(config.Mainbuilding); CloseRender(config.Other); RenderSettings.fog = false; XYCoroutineEngine.Execute(LoadSceneAsset(config.Mainbuilding)); XYCoroutineEngine.Execute(LoadSceneAsset(config.Other)); }
private void Awake() { instance_ = this; }
private void Awake() { XYDirectory.Init(); XYCoroutineEngine.Load(); SceneManager.sceneLoaded += OnSceneLoaded; }
//private IEnumerator LoadRoleObject(string path, Action<RoleObject> loadFinish) //{ // UnityEngine.Object role = null; // TLEditorWww roleWww = TLEditorWww.Create(path); // roleWww = TLEditorWww.Create(path); // while (!roleWww.Finished) // yield return null; // role = roleWww.GetAsset() as GameObject; // GameManager.ReplaceShader(role, string.Empty); // if (role == null) // Debug.LogError("Error, Load role Failed: " + path); // else // { // Role roleConfig = (role as GameObject).GetComponent<Role>(); // if (roleConfig == null) // Debug.Log("config==null"); // GameObject roleGo = ModelLoader.CreateRole(roleConfig).gameObject; // var performer = roleGo.GetComponent<ActionPerformer>(); // RoleObject roleObj = roleGo.GetComponent<RoleObject>(); // roleObj.needAnimationButtonGui = false; // roleObj.CheckAnimator(); // roleObj.enabled = true; // //roleWww.Unload(); // loadFinish(roleObj); // } //} public void CreatTimeline(string name, Action <RoleObject> loadFinish) { XYCoroutineEngine.Execute(LoadTimeline(string.Format("res/timeline/{0}.timeline", name), loadFinish)); }
public virtual void CreateGameObject(System.Action <MPObject> loadFinish) { XYCoroutineEngine.Execute(LoadRoleObject(string.Format(MapPlacementController.mapRoleObjectResLoadPathStrFormat, apprId), loadFinish)); }
public void CreatAudioClips(string name, Action <AudioClip> loadFinish) { XYCoroutineEngine.Execute(LoadAudioClip(string.Format("res/audio/{0}.audio", name), loadFinish)); }
public void CreatTexture(string name, Action <Texture> loadFinish) { XYCoroutineEngine.Execute(LoadTexture(string.Format("res/ui/tex/{0}.tex", name), loadFinish)); }
public void CreatAction(string actionName, Action <ModelAction> loadFinish) { XYCoroutineEngine.Execute(LoadActionObject(string.Format("res/action/{0}.action", actionName), loadFinish)); }
public static void LoadModel(ObjectModel model) { XYCoroutineEngine.Execute(AsyncLoadModel(model)); }
/// <summary> /// 预加载一些资源和设置 /// </summary> public static void Initialize() { XYCoroutineEngine.Execute(AsyncPreloadRoleConfig(0.25f)); XYCoroutineEngine.Execute(AsyncPreloadEquipConfig(0.25f)); XYCoroutineEngine.Execute(AsyncPreloadRoleBone(0.5f)); }
public static void ClearTimeOut() { XYCoroutineEngine.Execute(DoClearTimeout(false)); }
public static void UnloadUnusedAssets() { XYCoroutineEngine.Execute(AsyncUnloadUnusedAssets()); }
private void Init() { XYDirectory.Init(); XYCoroutineEngine.Load(); XYSingleAssetLoader.Init(); }
public void CreateRoleObject(int apprid, Action <RoleObject> loadFinish) { XYCoroutineEngine.Execute(LoadRoleObject(string.Format("res/role/{0}.role", apprid), loadFinish)); }