public static void LoadSkybox(string _package, string _file , OnLoadReadyDelegate _onReady , OnLoadObjectSuccessDelegate _onSuccess , OnErrorDelegate _onError) { if (string.IsNullOrEmpty(_package)) { _onError("package is null"); return; } if (string.IsNullOrEmpty(_file)) { _onError("file is null"); return; } _onReady(); CoroutineMgr.Start(asyncLoadBundle(_package, _file, (_res) => { Log.Debug("ResourceMgr", "load skybox [{0}] finish...", _file); CameraMgr.ApplySkybox(_res as Material); _onSuccess(_res); }, _onError)); }
public static void UseUGCSkybox(string _file) { UGCMgr.Res res = UGCMgr.Find(_file); Editor.Image img = (fsm.current as Editor.Image); img.skybox = res.data as Material; CameraMgr.ApplySkybox(res.data as Material); }
public void DoEnter() { //preload assets foreach (Asset asset in assets.Values) { // asset has format like as .wav if (asset.file.Contains(".")) { byte[] data = UGCMgr.Take(asset.file); if (null == data) { this.LogError("Missing asset, group:{0} package:{1} file:{2} ", asset.group, asset.package, asset.file); continue; } if (asset.group.Equals("skybox")) { Material skybox = UGCMgr.BuildSkybox(data); CameraMgr.ApplySkybox(skybox); } } else { Object obj = ResourceMgr.FindFromPreload(asset.package, asset.file); if (null == obj) { this.LogError("Missing asset, group:{0} package:{1} file:{2} ", asset.group, asset.package, asset.file); continue; } if (asset.group.Equals("agent")) { GameObject clone = ResourceMgr.CloneGameObject(asset.package, asset.file, asset.guid); agents.Add(asset.guid); clone.transform.position = new Vector3(asset.px, asset.py, asset.pz); clone.transform.rotation = Quaternion.Euler(asset.rx, asset.ry, asset.rz); clone.transform.localScale = new Vector3(asset.sx, asset.sy, asset.sz); if (asset.gaze) { ReticleHandler handler = clone.AddComponent <ReticleHandler>(); handler.path = asset.slate; handler.trigger = asset.gazeAlias; EventTrigger et = clone.AddComponent <EventTrigger>(); EventTrigger.Entry entryEnter = new EventTrigger.Entry(); entryEnter.eventID = EventTriggerType.PointerEnter; entryEnter.callback.AddListener((data) => { handler.onPointerEnter(); }); et.triggers.Add(entryEnter); EventTrigger.Entry entryExit = new EventTrigger.Entry(); entryExit.eventID = EventTriggerType.PointerExit; entryExit.callback.AddListener((data) => { handler.onPointerExit(); }); et.triggers.Add(entryExit); EventTrigger.Entry entryClick = new EventTrigger.Entry(); entryClick.eventID = EventTriggerType.PointerClick; entryClick.callback.AddListener((data) => { handler.onPointerClick(); }); et.triggers.Add(entryClick); Collider collider = clone.GetComponent <Collider>(); if (null != collider) { collider.enabled = true; } } } else if (asset.group.Equals("skybox")) { CameraMgr.ApplySkybox(obj as Material); } } } //hide all triggers TriggerMgr.ToggleAllTrigger(false); //show trigger in current slate foreach (string trigger in triggers) { TriggerMgr.ToggleTrigger(trigger, true); } // execute startup blocks foreach (string guid in blocks) { Block block = BlockMgr.FindBlock(guid); if (block.action.Equals("Entry:Startup")) { block.Execute(); } } }
public static void UseSkybox(Material _skybox) { Editor.Image img = (fsm.current as Editor.Image); img.skybox = _skybox; CameraMgr.ApplySkybox(_skybox); }