Beispiel #1
0
        public void AddRectEmpty(List <Vector2[]> pos)
        {
            if (pos.Count == 0)
            {
                return;
            }

            m_rectInfo.Clear();
            m_RectWorldPos.Clear();
            m_RectWorldPos.AddRange(pos);
            lerpTime = 0f;
            tempLeftPos.Clear();
            tempRightPos.Clear();
            for (int i = 0; i < pos.Count; i++)
            {
                Vector2[] emptyPos = GuidNewTools.GetEmptyPos(pos[i], m_maskRoot);
                m_rectInfo.Add(new Vector4(emptyPos[0].x - emptyPos[1].x / 2f, emptyPos[0].y - emptyPos[1].y / 2f, emptyPos[0].x + emptyPos[1].x / 2f, emptyPos[0].y + emptyPos[1].y / 2f));
                if (m_animType == MaskAnimType.ToInner)
                {
                    OnReflashCircleMask(new Vector4(m_LeftBottom.x, m_LeftBottom.y, m_RightTop.x, m_RightTop.y), 1);
                    OnReflashCircleMask(Vector4.zero, 0);
                    tempLeftPos.Add(m_LeftBottom);
                    tempRightPos.Add(m_RightTop);
                }
                else
                {
                    tempLeftPos.Add(emptyPos[0]);
                    tempRightPos.Add(emptyPos[0]);
                }
            }
            this.m_maskCanHide = true;
            TimeModule.Instance.SetTimeout(OnRectInnerAnim, 0.02f, true);
            //TimeModule.Instance.SetTimeInterval(OnRectInnerAnim,0.02f);
            //Vector2 centerPos =
        }
Beispiel #2
0
        public void AddCircle(List <Vector2[]> pos)
        {
            if (pos.Count == 0)
            {
                return;
            }
            this.m_CircleWorldPos.Clear();
            for (int i = 0; i < pos.Count; i++)
            {
                m_CircleWorldPos.Add(GuidNewTools.GetWorldCirclePos(pos[i]));
            }
            Vector2[] emptyPos = GuidNewTools.GetEmptyPos(pos[0], m_maskRoot);
            float     Radius   = Mathf.Min(emptyPos[1].x, emptyPos[1].y) / 2f;

            this.m_circleInfo = new Vector4(emptyPos[0].x, emptyPos[0].y, Radius, 0f);
            if (m_animType == MaskAnimType.ToInner)
            {
                this.tempRadius = Screen.width / 2f;
                this.maxRadius  = Radius;
            }
            else
            {
                this.tempRadius = 0f;
                this.maxRadius  = Radius;
            }
            this.startCircleTime = 0f;
            //TimeModule.Instance.SetTimeout(TickCircle,0.03f,true);
            TimeModule.Instance.SetTimeInterval(TickCircle, 0.02f);
        }
        public override void OnExecute()
        {
            base.OnExecute();
            GameEvents.MainGameEvents.OnGameOver += OnGameOver;
            TimeModule.Instance.SetTimeout(() => {
                List <SceneItemEntity> sceneItem = GameEvents.MainGameEvents.GetSceneItemEntityList.SafeInvoke(1);
                if (sceneItem != null && sceneItem.Count > 0)
                {
                    Vector3 entityPos = sceneItem[0].EntityPosition;
                    GUIFrame frame    = GuidNewModule.Instance.GetFrameByResName(UIDefine.UI_GUID);
                    entityPos         = CameraUtility.WorldPointInCanvasRectTransform(entityPos, frame.LogicHandler.Canvas.gameObject);
                    Vector2[] corn    = new Vector2[4];
                    float w           = 10f;
                    float h           = 10f;
                    if (sceneItem[0].EntityData.itemID == 11197)
                    {
                        w            = 20f;
                        h            = 50f;
                        entityPos.y += 40f;
                    }
                    corn[0] = new Vector2(entityPos.x - w, entityPos.y - h);
                    corn[1] = new Vector2(entityPos.x - w, entityPos.y + h);
                    corn[2] = new Vector2(entityPos.x + w, entityPos.y + h);
                    corn[3] = new Vector2(entityPos.x + w, entityPos.y - h);
                    if (!isComplete)
                    {
                        GameEvents.UI_Guid_Event.OnShowMask.SafeInvoke(new List <Vector2[]> {
                            corn
                        }, new List <MaskEmptyType> {
                            MaskEmptyType.Rect
                        }, MaskAnimType.ToInner, "aa", false);
                        GUIFrame guidFrame = GuidNewModule.Instance.GetFrameByResName(UIDefine.UI_GUID);
                        if (guidFrame != null)
                        {
                            Vector2[] emptyPos = GuidNewTools.GetEmptyPos(corn, guidFrame.FrameRootTransform);
                            emptyPos[0]       += Vector2.left * 20f;
                            emptyPos[0]       += Vector2.up * 30f;
                            //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, 0);
                        }

                        GameEvents.UI_Guid_Event.OnMaskClick += OnMaskClick;
                    }
                    else
                    {
                        OnDestory();
                    }

                    return;
                }
                OnDestory();
            }, 1f);
            //GameEvents.MainGameEvents.RequestHintSceneItemList.SafeInvoke(5);
        }
        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 === ");
            }
        }