/// <summary> /// 创建净数据对象 by吴江 /// </summary> /// <param name="_info"></param> /// <returns></returns> public static PreviewMount CreateDummy(MountInfo _info) { if (_info == null) { return(null); } GameObject newGO = null; if (GameCenter.instance.dummyMobPrefab != null) { newGO = Instantiate(GameCenter.instance.dummyMobPrefab) as GameObject; newGO.name = "Dummy Mount [" + _info.ConfigID + "]"; } else { newGO = new GameObject("Dummy Mount[" + _info.ConfigID + "]"); } newGO.tag = "Player"; PreviewMount mount = newGO.AddComponent <PreviewMount>(); mount.isDummy_ = true; mount.actorInfo = _info; return(mount); }
/// <summary> /// 非经过我同意禁用本接口 by吴江 /// </summary> /// <param name="_info"></param> /// <param name="_callBack"></param> /// <returns></returns> public bool TryPreviewSingelMount(MountInfo _info, System.Action <PreviewMount> _callBack) { if (_info != null) { PreviewMount pp = PreviewMount.CreateDummy(_info); pp.mutualExclusion = false; pp.StartAsyncCreate(_callBack); return(true); } return(false); }
IEnumerator CreateAsync(System.Action <PreviewMount> _callback) { if (isDummy_ == false) { GameSys.LogError("You can only start create Mob in dummy: " + actorInfo.ConfigID); yield break; } // PreviewMount mount = null; MountRendererCtrl myRendererCtrl = null; bool failed = false; pendingDownload = Create(actorInfo, delegate(PreviewMount _mount, EResult _result) { if (_result != EResult.Success) { failed = true; return; } mount = _mount; pendingDownload = null; myRendererCtrl = mount.gameObject.GetComponentInChildrenFast <MountRendererCtrl>(); if (myRendererCtrl != null) { myRendererCtrl.Show(true, true); } }); if (mutualExclusion) { GameCenter.previewManager.PushDownLoadTask(pendingDownload); } while (mount == null || mount.inited == false) { if (failed) { yield break; } yield return(null); } if (mutualExclusion) { GameCenter.previewManager.EndDownLoadTask(pendingDownload); } pendingDownload = null; mount.isDownloading_ = false; if (_callback != null) { _callback(mount); } }
public bool TryPreviewMount(MountInfo _info, UITexture _showLabel, MountAnimFSM.EventType _type = ActorAnimFSM.EventType.Idle) { curShowLabel = _showLabel; CancelAllDownLoad(); if (_info != null) { PreviewMount pp = PreviewMount.CreateDummy(_info); pp.needRandID = _type; pp.StartAsyncCreate(CreateMountCallBack); return(true); } return(false); }
public bool TryPreviewSingelMount(int _configID, UITexture _showLabel, string idleAnimName) { curShowLabel = _showLabel; CancelAllDownLoad(); MountRef refData = ConfigMng.Instance.GetMountRef(_configID); MountInfo info = new MountInfo(refData); if (info != null) { PreviewMount pp = PreviewMount.CreateDummy(info); pp.idleAnimName = idleAnimName; pp.StartAsyncCreate(CreateMountCallBack); return(true); } return(false); }
public bool TryPreviewSingelMount(MountInfo _info, UITexture _showLabel) { curShowLabel = _showLabel; if (curPreviewInfo != null && curPreviewInfo.ConfigID == _info.ConfigID && curPreviewMount != null) { curPreviewInfo = _info; BindRenderAndUI(curShowLabel); return(true); } else { curPreviewInfo = _info; CancelAllDownLoad(); if (_info != null) { PreviewMount pp = PreviewMount.CreateDummy(_info); pp.StartAsyncCreate(CreateMountCallBack); return(true); } return(false); } }
public void CreateMountCallBack(PreviewMount _mob) { //防止有之前延迟的模型加载,再次清理 ClearModel(); curPreviewMount = _mob; GameObject parent = GetModelTransform(_mob.PreviewPosition, _mob.PreviewRotation); if (null != parent) { _mob.transform.parent = parent.transform; _mob.transform.localPosition = new Vector3(0, -_mob.Height / 2f, 0); _mob.transform.localEulerAngles = new Vector3(0, 180f, 0); } _mob.FaceToNoLerp(180f); UIDragObjectRotate3D _UIDragObjectRotate3D = curShowLabel.gameObject.GetComponent <UIDragObjectRotate3D>(); if (_UIDragObjectRotate3D == null) { _UIDragObjectRotate3D = curShowLabel.gameObject.AddComponent <UIDragObjectRotate3D>(); } _UIDragObjectRotate3D.target = _mob; BindRenderAndUI(curShowLabel); }