public void PickRedHeart(RedHeartEle heartEle, int dropNum) { int addCount = Global.gApp.gSystemMgr.GetNpcMgr().AddRedHeart(m_TaskItem.lockRedHeartIndex, dropNum, heartEle.transform.position); if (addCount > 0) { m_RedHeartList.Remove(heartEle); Destroy(heartEle.gameObject); if (m_RedHeartList.Count == 0) { PlayAnim(0); NpcRedHeartItemDTO workerItemDTO = Global.gApp.gSystemMgr.GetNpcMgr().GetRedHeartByIndex(m_TaskItem.lockWorkerIndex); if (workerItemDTO != null) { if (workerItemDTO.dropDiamondNum > 0) { PlayAnim(0); SetAnimTime(99999); return; } } else { SetAnimTime(0.1f); } } } }
private void PlayIdle() { PlayAnim(0); // 有红心 以及 有 钻石的时候 不能再移动 NpcRedHeartItemDTO heartItemDTO = Global.gApp.gSystemMgr.GetNpcMgr().GetRedHeartByIndex(m_TaskItem.lockRedHeartIndex); if (heartItemDTO != null) { if (heartItemDTO.dropHeartNum > 0) { SetAnimTime(99999); return; } } NpcRedHeartItemDTO workerItemDTO = Global.gApp.gSystemMgr.GetNpcMgr().GetRedHeartByIndex(m_TaskItem.lockWorkerIndex); if (workerItemDTO != null) { if (workerItemDTO.dropDiamondNum > 0) { SetAnimTime(99999); return; } } if (m_TaskItem.state == NpcState.UnReceived) { SetAnimTime(99999); } }
public void FreshDropRedHeartData() { NpcRedHeartItemDTO heartItemDTO = Global.gApp.gSystemMgr.GetNpcMgr().GetRedHeartByIndex(m_TaskItem.lockRedHeartIndex); if (heartItemDTO != null) { int curHeartCount = heartItemDTO.dropHeartNum; Global.gApp.gSystemMgr.GetNpcMgr().DtFreshDropRedHeartInfo(heartItemDTO); if (curHeartCount != heartItemDTO.dropHeartNum) { FreshDropRedHeart(); } } }
private void FreshDropRedHeart() { NpcRedHeartItemDTO heartItemDTO = Global.gApp.gSystemMgr.GetNpcMgr().GetRedHeartByIndex(m_TaskItem.lockRedHeartIndex); if (heartItemDTO != null) { int dropCount = heartItemDTO.dropHeartNum; if (dropCount > 0) { PlayIdle(); } float dtDeg = Mathf.PI / dropCount; float radio = 1.2f; CampsiteUI campsiteUI = Global.gApp.gUiMgr.GetPanelCompent <CampsiteUI>(Wndid.CampsiteUI); Canvas parentCanvas = campsiteUI.GetComponentInParent <Canvas>(); RectTransform adaptParentRectTsf = parentCanvas.GetComponent <RectTransform>(); Transform heartParentNode = campsiteUI.GetRedHeartNodeTsf(); for (int i = 0; i < dropCount; i++) { RedHeartEle redHeartEle; if (m_RedHeartList.Count < (i + 1)) { GameObject redHeartGo = Global.gApp.gResMgr.InstantiateObj(Wndid.ReadHeart); redHeartEle = redHeartGo.GetComponent <RedHeartEle>(); m_RedHeartList.Add(redHeartEle); redHeartEle.transform.SetParent(heartParentNode, false); } else { redHeartEle = m_RedHeartList[i]; } float posX = radio * Mathf.Cos(dtDeg * i); float posY = radio * Mathf.Sin(dtDeg * i); redHeartEle.SetInfo(this, 1); Vector3 worldPos = transform.position + new Vector3(posX, posY, 0); redHeartEle.SetPos(worldPos, adaptParentRectTsf); } while (dropCount < m_RedHeartList.Count) { int curIndex = m_RedHeartList.Count - 1; Destroy(m_RedHeartList[curIndex].gameObject); m_RedHeartList.RemoveAt(curIndex); } } }
public void FreshWorkerDrop() { NpcRedHeartItemDTO workerWorkItemDTO = Global.gApp.gSystemMgr.GetNpcMgr().GetRedHeartByIndex(m_TaskItem.lockWorkerIndex); if (workerWorkItemDTO != null && workerWorkItemDTO.dropDiamondNum > 0) { PlayIdle(); if (m_WorkerRewardNode == null) { GameObject go = Global.gApp.gResMgr.InstantiateObj(Wndid.WorkerRewardNode); m_WorkerRewardNode = go.GetComponent <WorkerRewardNode>(); m_WorkerRewardNode.Init(this, GetTaskUINode(), workerWorkItemDTO.dropDiamondNum); } } else { DestroyWorkerRewardNode(); } }
public void AddHeartInfo(NpcRedHeartItemDTO npcRedHeartItemDTO, Vector3 effectPos) { m_CurTime = 0; Global.gApp.gMsgDispatcher.Broadcast <int, int, Vector3>(MsgIds.ShowRewardGetEffect, SpecialItemIdConstVal.RED_HEART, 1, effectPos); m_AddHeartInfo.Add(npcRedHeartItemDTO); }