private bool CreateAnim() { if (effectGameObject != null) { return(false); } DestroyAnim(); ComplexObjectPool.NewObject(EffectPath, go => { if (null == go) { return; } effectGameObject = go; go.transform.parent = Effect.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.transform.localRotation = Quaternion.Euler(0, 0, 0); }); return(true); }
private void PlaySkillEffect(IEvent ievent) { var e = ievent as UIEvent_EquipSkillEffect; if (e == null) { return; } DestroyEraEffect(); ComplexObjectPool.NewObject("Effect/UI/UI_jineng.prefab", go => { if (null == go) { return; } //var renderQueue = go.GetComponent<ChangeRenderQueue>(); //if (renderQueue == null) //{ // renderQueue = go.AddComponent<ChangeRenderQueue>(); //} //renderQueue.CustomRenderQueue = 4000; effectGameObject = go; go.transform.parent = SkillItems[e.Index].EquipEffectObj.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.transform.localRotation = Quaternion.Euler(0, 0, 0); }); }
private void ShowModel(string perfabPath) //"res/firstcharget/a.prefab" { //var modelPath = Resource.GetModelPath(perfabPath); if (TModel != null) { ComplexObjectPool.Release(TModel); TModel = null; } UniqueResourceId = GetNextUniqueResourceId(); var resId = UniqueResourceId; ComplexObjectPool.NewObject(perfabPath, go => { if (resId != UniqueResourceId) { return; } TModel = go; go.transform.parent = UIModel.transform; go.transform.localPosition = Vector3.zero; go.gameObject.SetLayerRecursive(LayerMask.NameToLayer(GAMELAYER.UI)); go.gameObject.SetRenderQueue(ModelRenderQueue); Drag.Target = go.transform; }); }
private void CreateNewPage(string FlyPrefab, int IconId, Vector3 From, bool OnTop, Action <GameObject> CallBack) { ComplexObjectPool.NewObject(FlyPrefab, go => { if (go == null) { return; } var frame = go.GetComponent <BookIconFrame>(); frame.IconId = IconId; var pgo = new GameObject(); pgo.SetLayerRecursive(LayerMask.NameToLayer(GAMELAYER.UI)); pgo.name = "flybookpage"; var panel = pgo.AddComponent <UIPanel>(); panel.depth = OnTop ? 2 : 0; pgo.transform.SetParent(UIManager.Instance.GetUIRoot(UIType.TYPE_BASE).transform); pgo.transform.localPosition = Vector3.zero; pgo.transform.localScale = Vector3.one; pgo.transform.localRotation = Quaternion.identity; go.transform.SetParent(pgo.transform); go.transform.localPosition = From; go.transform.localScale = Vector3.one; if (CallBack != null) { CallBack(pgo); } else { Logger.Error("Callback must not null!!!"); } }); }
//飞向玩家身上 public void FlyToPlayer() { //先把特效关掉 if (mEffect) { ComplexObjectPool.Release(mEffect); mEffect = null; } if (null != mController) { mController.ShowModel(false); mController.ShowEffect(true); } var myPos = ObjManager.Instance.MyPlayer.Position; var dir = (Position - myPos).normalized; mControlPoint = Position + dir * Random.Range(ControlPointOffsetDistanceMin, ControlPointOffsetDistanceMax); mControlPoint.y += Random.Range(ControlPointOffsetHeightMin, ControlPointOffsetHeightMax); mControlPointMoveSpeed = ControlPointSpeed; mMoveSpeed = MoveSpeed; mControlPointReached = false; mState = DropItemState.FlyToPlayer; }
protected override void LoadModelAsync(Action callback = null) { var tableModel = Table.GetCharModel(TableCharacter.CharModelID); var modelPath = Resource.GetModelPath(tableModel.ResPath); UniqueResourceId = GetNextUniqueResourceId(); var resId = UniqueResourceId; ComplexObjectPool.NewObject(modelPath, model => { if (resId != UniqueResourceId) { ComplexObjectPool.Release(model); return; } if (State == ObjState.Deleted) { ComplexObjectPool.Release(model); return; } SetModel(model); mAnimationController.Animation = mModel.animation; mAnimationController.Animation.Stop(); SetScale((float)tableModel.Scale); if (null != callback) { callback(); } }); }
private void CreateCharRadar(RararCharDataModel data) { var id = data.CharacterId; ComplexObjectPool.NewObject("UI/MainUI/CharCursor.prefab", o => { if (data.CharType != 0) { var charObj = ObjManager.Instance.FindCharacterById(id); if (charObj == null || charObj.Dead) { ComplexObjectPool.Release(o, false, false); return; } } var oTransform = o.transform; //oTransform.parent = CharCursor.transform; oTransform.SetParentEX(CharCursor.transform); oTransform.localScale = Vector3.one; if (!o.activeSelf) { o.SetActive(true); } var i = o.GetComponent <ListItemLogic>(); i.Item = data; var r = o.GetComponent <BindDataRoot>(); r.Source = data; itemLogicDict[data.CharacterId] = i; }, null, null, false, false, false); }
private void CreateTextLabel(string value) { var obj = ComplexObjectPool.NewObjectSync("UI/ChatMain/ChatLableNode.prefab"); if (obj == null) { return; } var objTransform = obj.transform; //objTransform.parent = BackGround.transform; objTransform.SetParentEX(BackGround.transform); obj.gameObject.collider.enabled = false; obj.SetActive(true); var label = obj.GetComponent <UILabel>(); var sbstr = ""; var text = ""; label.fontSize = FontSize; NGUIText.fontSize = label.fontSize; NGUIText.finalSize = label.fontSize; NGUIText.dynamicFont = label.trueTypeFont; if (mPositionX > MaxLineWidth) { ChangeLine(); } NGUIText.regionWidth = MaxLineWidth - mPositionX; NGUIText.maxLines = 10000; NGUIText.pixelDensity = 1.0f; NGUIText.regionHeight = 10000; NGUIText.finalLineHeight = label.fontSize; NGUIText.fontScale = 1.0f; NGUIText.WrapText(value, out sbstr, false, true); var index = sbstr.IndexOf("\n"); if (index > -1) { text = sbstr.Substring(0, index); } else { text = sbstr; } SetLableStroke(label); SetLableColor(label, text); objTransform.localPosition = new Vector3(mPositionX, mPositionY, 0); objTransform.localScale = Vector3.one; //positionX += label.width; AddPositionX(label.width); sbstr = sbstr.Remove(0, text.Length); if (sbstr.Length > 0) { ChangeLine(); sbstr = sbstr.Replace("\n", ""); CreateTextLabel(sbstr); } }
private void ShowItemTip(int itemId, int count) { ComplexObjectPool.NewObject("UI/Hint/ItemTip", go => { if (null == Instance) { ComplexObjectPool.Release(go); return; } if (false == IsWorking) { ComplexObjectPool.Release(go); return; } go.transform.parent = gameObject.GetComponent <UIPanel>().transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); go.transform.localRotation = Quaternion.identity; go.SetActive(false); go.SetActive(true); var Logic = go.GetComponent <GainItemCtrler>(); Logic.SetItemIcon(itemId, count); }); }
// 给人物换装 public void ChangePart(string part, string model, EquipModelViewRecord record, bool sync) { SetPartModel(part, model); // 如果还没有加载完基础模型,则等待 if (_body == null || _loading > 0) { _avatarLoadQueue.Enqueue(new KeyValuePair <string, WaitingResource>(part, new WaitingResource { ModelPath = model, ModelViewRecord = record })); return; } //AvatarData adata = DataMgr.Instance.GetAvatarData(avatarId); _loading++; ComplexObjectPool.NewObject(model, obj => { _loading--; if (GetPartModel(part) != model) { ComplexObjectPool.Release(obj); TryContinue(); return; } if (null != obj) { ChangePart(obj, part, record, sync); } TryContinue(); }, null, null, sync); }
private void OnEvent_PlayAnim(IEvent ievent) { var e = ievent as Event_EraPlayAnim; if (e == null) { return; } DestroyAnim(); ComplexObjectPool.NewObject("Effect/Books/MFS_gaizhang.prefab", go => { if (null == go) { return; } effectGameObject = go; go.transform.parent = StampGameObject; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.transform.localRotation = Quaternion.Euler(0, 0, 0); }); }
//销毁 public virtual void Destroy() { OptList <EffectController> .List.Clear(); gameObject.GetComponentsInChildren(OptList <EffectController> .List); { var __array3 = OptList <EffectController> .List; var __arrayLength3 = __array3.Count; for (var __i3 = 0; __i3 < __arrayLength3; ++__i3) { var effect = __array3[__i3]; { effect.trans.parent = null; EffectManager.Instance.StopEffect(effect.Id); //ComplexObjectPool.Release(effect.gameObject); } } } ComplexObjectPool.Release(mModel); mModel = null; StopAllCoroutines(); ComplexObjectPool.Release(gameObject); State = ObjState.Deleted; UniqueResourceId = 0; }
private void CreateCharRadar(MapRadarDataModel data, string prefab) { var id = data.CharacterId; ComplexObjectPool.NewObject(prefab, o => { if (data.CharType != 0) { var charObj = ObjManager.Instance.FindCharacterById(id); if (charObj == null || charObj.Dead) { ComplexObjectPool.Release(o); return; } } var oTransform = o.transform; oTransform.SetParentEX(CharCursor.transform); oTransform.localScale = Vector3.one; o.SetActive(true); var i = o.GetComponent <ListItemLogic>(); i.Item = data; var r = o.GetComponent <BindDataRoot>(); r.Source = data; itemLogicDict[data.CharacterId] = i; }); }
private void OnDestroy() { #if !UNITY_EDITOR try { #endif Instance = null; PlayCG.Instance.Reset(); UIManager.Instance.Destroy(); //ObjManager.Instance.RemoveAllObj(); ObjManager.Instance.Reset(); ComplexObjectPool.Destroy(); GuideManager.Instance.StopGuiding(); EventDispatcher.Instance.RemoveEventListener(DungeonCompleteEvent.EVENT_TYPE, OnDungeonComplete); #if !UNITY_EDITOR } catch (Exception ex) { Logger.Error(ex.ToString()); } #endif }
//飞到目标点结束 private IEnumerator DropOverStay() { // 当掉落落地时,特效 if (mTableData != null && mTableData.Quality > 0 && !mEffect) { var resource = Table.GetClientConfig(600 + mTableData.Quality); if (!string.IsNullOrEmpty(resource.Value)) { CreateQualityEffect(resource.Value, o => { if (DropItemState.StayOnGround != mState && DropItemState.Droping != mState) { ComplexObjectPool.Release(o); mEffect = null; } }); } } yield return(new WaitForSeconds(DropOverDelayTime)); mState = DropItemState.StayOnGround; PlayDropSound(); }
private void CreateVoiceLabel(CharInfoNode node) { //var objres = ResourceManager.PrepareResourceSync<GameObject>("UI/ChatMain/ChatVoiceCell.prefab"); //var obj = Instantiate(objres) as GameObject; var obj = ComplexObjectPool.NewObjectSync("UI/ChatMain/ChatVoiceCell.prefab"); if (obj == null) { return; } mVoiceCell = obj.GetComponent <ChatVoiceCellLogic>(); if (mVoiceCell == null) { return; } mVoiceCell.SetChatInfo(FontSize, mChatMessageData.Seconds, MaxLineWidth); //mVoiceCell.ChatMessageData = mChatMessageData; mVoiceCell.Seconds = mChatMessageData.Seconds; mVoiceCell.SoundData = mChatMessageData.SoundData; var objTransform = obj.transform; //objTransform.parent = BackGround.transform; objTransform.SetParentEX(BackGround.transform); obj.SetActive(true); objTransform.localScale = Vector3.one; objTransform.localPosition = new Vector3(mPositionX, mPositionY, 0); mTotalLength = MaxLineWidth; mPositionX = 10; AddVoiceLabel(); }
public void ResetMessage() { xPos = 10; yPos = -10; updateCollider = true; ColliderList.Clear(); ChatNodeList.Clear(); isFace = false; var trans = Content.transform; BackGround.height = 45; Content.height = 40; WidgetList.Clear(); for (var i = trans.childCount - 1; i >= 0; i--) { var t = trans.GetChild(i); if (t.name.Contains("ChatLableNode") || t.name.Contains("ChatFaceNode") || t.name.Contains("ChatVoiceCell")) { t.gameObject.SetActive(false); ComplexObjectPool.Release(t.gameObject); //Destroy(t.gameObject); } } }
private void CreateVoiceLabel(CharInfoNode node) { var obj = ComplexObjectPool.NewObjectSync("UI/ChatMain/ChatVoiceCell.prefab"); if (obj == null) { return; } obj.SetActive(true); voiceCell = obj.GetComponent <ChatVoiceCellLogic>(); if (voiceCell == null) { return; } voiceCell.SetChatInfo(FontSize, chatDataMsg.Seconds, MaxWidth); voiceCell.Seconds = chatDataMsg.Seconds; voiceCell.SoundData = chatDataMsg.SoundData; var objTransform = obj.transform; //objTransform.parent = Content.transform; objTransform.SetParentEX(Content.transform); objTransform.localScale = Vector3.one; objTransform.localPosition = new Vector3(xPos, yPos, 0); obj.SetActive(true); AddXPos(200); xPos = 10; AddVoiceLabel(); }
public void DestroyModel() { if (null != Model) { ComplexObjectPool.Release(Model); Model = null; } }
private void DestroyEraEffect() { if (effectGameObject != null) { ComplexObjectPool.Release(effectGameObject); effectGameObject = null; } }
//删除品质特效 private void DestroyQualityEffect() { if (mEffect) { ComplexObjectPool.Release(mEffect); mEffect = null; } }
private void DestroyModel() { if (TModel != null) { ComplexObjectPool.Release(TModel); TModel = null; } }
private void DestroyAnim() { if (effectGameObject != null) { ComplexObjectPool.Release(effectGameObject, true); effectGameObject = null; } }
private void ShowModel(string perfabPath, int index) //"res/firstcharget/a.prefab" { //var modelPath = Resource.GetModelPath(perfabPath); if (TModel != null) { ComplexObjectPool.Release(TModel); TModel = null; } UniqueResourceId = GetNextUniqueResourceId(); var resId = UniqueResourceId; ComplexObjectPool.NewObject(perfabPath, go => { if (resId != UniqueResourceId) { ComplexObjectPool.Release(go); return; } if (UIModel == null) { return; } TModel = go; go.transform.parent = UIModel.transform; go.transform.localPosition = Vector3.zero; go.gameObject.SetLayerRecursive(LayerMask.NameToLayer(GAMELAYER.UI)); go.gameObject.SetRenderQueue(ModelRenderQueue); Drag.Target = go.transform; if (index == 2) { for (int i = 1100; i <= 1101; i++) { var tbSkillUpgrading = Table.GetSkillUpgrading(i); if (null == tbSkillUpgrading) { return; } var ValueList = tbSkillUpgrading.Values; if (ValueList.Count < 3) { return; } var x = ValueList[0]; var y = ValueList[1]; var z = ValueList[2]; if (i == 1100) { go.transform.localRotation = Quaternion.Euler(x, y, z); } else { go.transform.localScale = new Vector3(x, y, z); } } } }); }
private void CheckStage(float dt) { if (BoardAction == null) { return; } if (Record == null) { return; } BoardAction.Duration += dt; if (BoardAction.Duration >= BoardAction.MaxTime) { switch (BoardAction.ActionStage) { case DamageBoardActionStage.Stage1: { BoardAction.ActionStage = DamageBoardActionStage.Stage2; BoardAction.Duration = 0.0f; BoardAction.ScaleChg = 0.0f; BoardAction.AlphaChg = 0.0f; BoardAction.Speed = Vector2.zero; BoardAction.Accelerate = Vector2.zero; BoardAction.MaxTime = StayTime / 1000f; } break; case DamageBoardActionStage.Stage2: { BoardAction.ActionStage = DamageBoardActionStage.Stage3; BoardAction.Duration = 0.0f; BoardAction.ScaleChg = Record.EndFontSize2 / 1000.0f; BoardAction.AlphaChg = -255.0f / (Record.MoveTime2 / 1000.0f); BoardAction.Speed = new Vector2(Record.SpeedX2, Record.SpeedY2); BoardAction.Accelerate = new Vector2(Record.AddSpeedX2, Record.SpeedY2); BoardAction.MaxTime = Record.MoveTime2 / 1000.0f; } break; case DamageBoardActionStage.Stage3: { if (BoardAction.ShowType == BoardShowType.Fight) { DamageBoardManager.Instace.ActiveCount--; } ComplexObjectPool.Release(gameObject, false, false); BoardAction.ActionStage = DamageBoardActionStage.Invaild; } break; case DamageBoardActionStage.Invaild: break; default: throw new ArgumentOutOfRangeException(); } } }
public void DestroyModel() { mState = State.Deleted; if (null != mModel) { ComplexObjectPool.Release(mModel); mModel = null; } }
public void CreateObj(int dataId, int colorId) { if (mObjElf != null) { mObjElf.Destroy(); mObjElf = null; } if (dataId == -1) { return; } var angle = gameObject.transform.rotation.eulerAngles.y; angle += 90.0f; var temp = Owner.Position; temp.x += (float)Math.Cos(angle) * Radius; temp.z += (float)Math.Sin(angle) * Radius; NavMeshHit hit; if (NavMesh.Raycast(Owner.Position, temp, out hit, -1)) { temp = hit.position; } InitBaseData initData = new InitOtherPlayerData { ObjId = 0, DataId = dataId, X = temp.x, Y = temp.y, Z = temp.z, DirX = 1, DirZ = 0, Name = "", RobotId = 0ul }; var go = ComplexObjectPool.NewObjectSync(Resource.PrefabPath.Elf); var elf = go.GetComponent <ObjElf>(); elf.Init(initData, () => { mObjElf = elf; mObjElf.OnElfMoveOver = OnElfMoveOver; mObjElf.DoIdle(); var character = gameObject.GetComponent <ObjCharacter>(); if (character) { mObjElf.SetMoveSpeed(character.GetMoveSpeed() + 0.08f); ObjFakeCharacter.ChangeColor(mObjElf.GetModel(), colorId); } }); go.SetActive(true); }
private void RemoveCharRadar(ulong id) { ListItemLogic obj; if (itemLogicDict.TryGetValue(id, out obj)) { ComplexObjectPool.Release(obj.gameObject); itemLogicDict.Remove(id); } }
private void RemoveCharRadar(RararCharDataModel data) { ListItemLogic obj; if (itemLogicDict.TryGetValue(data.CharacterId, out obj)) { ComplexObjectPool.Release(obj.gameObject, false, false); itemLogicDict.Remove(data.CharacterId); } }
public void StopEffect(int id) { EffectNode node; if (!mEffectDic.TryGetValue(id, out node)) { return; } ComplexObjectPool.Release(node.Value); mEffectDic.Remove(id); }