public override void OnExecute() { base.OnExecute(); if (m_type == 0) { GUIFrame frame = GuidNewModule.Instance.GetFrameByResName(frameName); Transform tran = frame.FrameRootTransform.Find(itemName); RectTransform srcRect = tran.GetComponent <RectTransform>(); Vector2[] cornPos = GuidTools.getCornPos(srcRect, this.lessPixel); GUIFrame frameGuid = GuidNewModule.Instance.GetFrameByResName(UIDefine.UI_GUID); Transform maskRoot = frameGuid.FrameRootTransform.Find("guid/mask"); leftBottomPos = maskRoot.InverseTransformPoint(cornPos[0]); rightTopPos = maskRoot.InverseTransformPoint(cornPos[2]); } else { Vector4 rectInfo = GameEvents.UI_Guid_Event.OnGetCurrentMaskInfo(1); leftBottomPos = Vector2.left * rectInfo.x + Vector2.up * rectInfo.y; rightTopPos = Vector2.left * rectInfo.z + Vector2.up * rectInfo.w; } Vector2 centerPos = new Vector2((leftBottomPos.x + rightTopPos.x) / 2f, (leftBottomPos.y + rightTopPos.y) / 2f); minPos.x = centerPos.x - Screen.width; minPos.y = centerPos.y - Screen.height; maxPos.x = centerPos.x + Screen.width; maxPos.y = centerPos.y + Screen.height; GuidNewModule.Instance.PushFunction(this); }
public override void OnExecute() { base.OnExecute(); List <Vector2[]> maskPos = new List <Vector2[]>(); for (int i = 0; i < frameName.Length; i++) { GUIFrame frame = GuidNewModule.Instance.GetFrameByResName(frameName[i]); if (frame == null) { continue; } Transform tran = frame.FrameRootTransform.Find(itemName[i]); if (tran == null) { Debug.LogError("guid mask itemName error " + itemName[i]); continue; } RectTransform srcRect = tran.GetComponent <RectTransform>(); Vector2[] cornPos = GuidTools.getCornPos(srcRect, lessPixel[i]); maskPos.Add(cornPos); } GameEvents.UI_Guid_Event.OnShowMask.SafeInvoke(maskPos, emptyType, MaskAnimType.ToOut, "", false); if (clickNum > 1) { GameEvents.UI_Guid_Event.OnMaskEnableClick.SafeInvoke(false); } GameEvents.UI_Guid_Event.OnMaskClick += OnMaskClick; }
public override void OnLoadRes() { base.OnLoadRes(); GUIFrame frame = GuidNewModule.Instance.GetFrameByResName(frameName); if (frame == null) { return; } Transform tran = frame.FrameRootTransform.Find(itemName); if (tran == null) { return; } if (this.m_tick) { GuidNewModule.Instance.RemoveFunction(this); } //Vector4 m_tempVec = new Vector4(Screen); //GameEvents.UI_Guid_Event.OnReflashCircleMask.SafeInvoke(tempVec, 1); GameEvents.UI_Guid_Event.OnMaskClick += OnMaskClick; RectTransform srcRect = tran.GetComponent <RectTransform>(); Action act = () => { if (this.m_isClearing) { return; } Vector2[] cornPos = GuidTools.getCornPos(srcRect, this.lessPixel); GameEvents.UI_Guid_Event.OnShowMask.SafeInvoke(new List <Vector2[]> { cornPos }, new List <MaskEmptyType> { emptyType }, animType, eventName, isScene == 2); if (this.m_rotation >= 0) { GUIFrame guidFrame = GuidNewModule.Instance.GetFrameByResName(UIDefine.UI_GUID); if (guidFrame != null) { Vector2[] emptyPos = GuidNewTools.GetEmptyPos(cornPos, guidFrame.FrameRootTransform); //Vector2 center = new Vector2((emptyPos[2].x + cornPos[0].x) / 2f, (cornPos[1].y + cornPos[0].y) / 2f); GameEvents.UI_Guid_Event.OnLoadEffect.SafeInvoke(20000, "UI_xinshouyindao_shou.prefab", emptyPos[0], Vector2.one, m_rotation); } } }; if (srcRect.sizeDelta.x > 0) { if (this.delayTimeTT > 0) { TimeModule.Instance.SetTimeout(act, this.delayTimeTT); } else { act(); } } else { TimeModule.Instance.SetTimeout(act, 0.8f); Debug.Log("mask time out === "); } }