//鱼被捕获调用接口,弹出金币 public void FishCatched(Fish fish, CatchedData cd) { if (fish.IsBossFish()) { GlobalAudioMgr.Instance.PlayOrdianryMusic(Audio.OrdianryMusic.catch_bossfish); } m_GoldEffect.ShowGoldEffect(cd, fish); KonnoTool.ShowBossCatched(SceneRuntime.WorldToNGUI(fish.Position), cd.GoldNum); if (fish.IsBossFish()) { //BossFish彩蛋特效 m_GoldEffect.ShowBossFishSpecailEft(cd, fish); } //卡片掉落 ushort nReward = fish.GetDropReward(); if (nReward != 0) { tagRewardOnce pReward; if (!FishConfig.Instance.m_RewardConfig.RewardMap.TryGetValue(nReward, out pReward)) { return; } for (int i = 0; i < pReward.RewardItemVec.Count; i++) { tagItemConfig itemConfig; uint uItemid = pReward.RewardItemVec[i].ItemID; if (!FishConfig.Instance.m_ItemInfo.m_ItemMap.TryGetValue(uItemid, out itemConfig)) { continue; } if (itemConfig.ItemTypeID == EItemType.IT_Currey)//钻石特殊处理 { m_GoldEffect.ShowDiamond(cd, fish); } else//其他卡片 { if (SceneRuntime.SceneLogic.PlayerMgr.GetPlayer(cd.ClientSeat) == null) { continue; } Vector2 vecPos = SceneRuntime.SceneLogic.PlayerMgr.GetPlayer(cd.ClientSeat).Launcher.LauncherPos; SceneRuntime.SceneLogic.LogicUI.MoveDropCard(SceneRuntime.WorldToNGUI(fish.Position), new Vector3(vecPos.x, vecPos.y, 0), (ushort)uItemid); } } } }
public void Init(ushort id, byte type, float scl, float time, float actionSpeed, bool actionUnite, float speed, PathLinearInterpolator interp) { ResFishData fd = FishResManager.Instance.GetFishData(type); if (fd == null) { Debug.Log("不存在的鱼模型:" + type.ToString()); return; } m_CatchSeat = 0xff; m_bCatched = false; m_Delay = false; m_Scaling = scl; m_FishID = id; m_FishType = type; m_PathCtrl = new PathController(); m_PathCtrl.ResetController(interp, speed, time, fd.ClipLength[(byte)FishClipType.CLIP_CHAOFENG]); m_Model = (GameObject)GameObject.Instantiate(FishResManager.Instance.GetFishObj(type)); m_ModelTransform = m_Model.GetComponent <Transform>(); m_ModelTransform.position = FishInitPos; m_Anim = m_Model.GetComponent <Animator>(); m_OrgRot = m_ModelTransform.localRotation; m_Model.name = m_FishID.ToString(); SetScaling(scl); m_Renderer = m_ModelTransform.GetChild(0).gameObject.GetComponent <Renderer>(); if (m_Renderer == null) { m_Renderer = m_ModelTransform.GetChild(1).gameObject.GetComponent <Renderer>(); } m_Anim.speed = actionSpeed; if (!actionUnite) { m_Anim.Play(YouYongHashName, 0, Utility.Range(0.0f, 1.0f)); } if (IsBossFish()) { m_bgsoundDelay = 2; GlobalAudioMgr.Instance.StopBgMusic(); GlobalAudioMgr.Instance.PlayOrdianryMusic(Audio.OrdianryMusic.m_bosscoming); KonnoTool.ShowBossComingWindow(); } }
/// <summary> /// Reset the position of all child objects based on the order of items in the list. /// </summary> protected virtual void ResetPosition(List <Transform> list) { mReposition = false; // Epic hack: Unparent all children so that we get to control the order in which they are re-added back in // EDIT: Turns out this does nothing. //for (int i = 0, imax = list.Count; i < imax; ++i) // list[i].parent = null; int x = 0; int y = 0; int maxX = 0; int maxY = 0; Transform myTrans = transform; // Re-add the children in the same order we have them in and position them accordingly for (int i = 0, imax = list.Count; i < imax; ++i) { Transform t = list[i]; // See above //t.parent = myTrans; Vector3 pos = t.localPosition; float depth = pos.z; if (arrangement == Arrangement.CellSnap) { if (cellWidth > 0) { pos.x = Mathf.Round(pos.x / cellWidth) * cellWidth; } if (cellHeight > 0) { pos.y = Mathf.Round(pos.y / cellHeight) * cellHeight; } } else { pos = (arrangement == Arrangement.Horizontal) ? new Vector3(cellWidth * x, -cellHeight * y, depth) : new Vector3(cellWidth * y, -cellHeight * x, depth); } if (animateSmoothly && Application.isPlaying) { SpringPosition sp = SpringPosition.Begin(t.gameObject, pos, 15f); sp.updateScrollView = true; sp.ignoreTimeScale = true; } else { t.localPosition = pos; } maxX = Mathf.Max(maxX, x); maxY = Mathf.Max(maxY, y); if (++x >= maxPerLine && maxPerLine > 0) { x = 0; ++y; } KonnoTool.SetV3ZToZero(t); } // Apply the origin offset if (pivot != UIWidget.Pivot.TopLeft) { Vector2 po = NGUIMath.GetPivotOffset(pivot); float fx, fy; if (arrangement == Arrangement.Horizontal) { fx = Mathf.Lerp(0f, maxX * cellWidth, po.x); fy = Mathf.Lerp(-maxY * cellHeight, 0f, po.y); } else { fx = Mathf.Lerp(0f, maxY * cellWidth, po.x); fy = Mathf.Lerp(-maxX * cellHeight, 0f, po.y); } for (int i = 0; i < myTrans.childCount; ++i) { Transform t = myTrans.GetChild(i); SpringPosition sp = t.GetComponent <SpringPosition>(); if (sp != null) { sp.target.x -= fx; sp.target.y -= fy; } else { Vector3 pos = t.localPosition; pos.x -= fx; pos.y -= fy; t.localPosition = pos; } } } }