Пример #1
0
    public static void OpenWindow_Circle(GameObject UIObj, int nRadius, string strText, string TextLocation,
                                         int nMotionType             = 0, bool bIsBoxEnable = false, bool bIsMaskEnable = false, bool bIsForever = false,
                                         OnShowGuide deleOnShowGuide = null, OnShowGuide afterShowGuide = null, bool isHasGuideFrame = false, bool bIsFocusAnim = true, Action onClickBlackCallback = null)
    {
        if (PlayerPreferenceData.NewPlayerGuideClose)
        {
            return;
        }
        if (null == UIObj)
        {
            LogModule.DebugLog(UIObj + "UIobj is null!!!");
            return;
        }
        Debug.LogWarning("FTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        GuideSpriteType sprType = GuideSpriteType.NoFrame;

        if (isHasGuideFrame)
        {
            sprType = GuideSpriteType.Circle;
        }
        //TextLocation = "center";
        m_CurPlayerGuideInfo.Init(UIObj, nRadius, nRadius, strText, TextLocation,
                                  nMotionType, bIsBoxEnable, bIsMaskEnable, bIsForever, bIsFocusAnim, sprType, deleOnShowGuide, afterShowGuide, 0f, 0f, onClickBlackCallback);
        //PlayerGuideInfo curInfo = new PlayerGuideInfo(UIObj, nRadius, nRadius, strText, TextLocation, nMotionType, bIsBoxEnable, bIsMaskEnable, bIsForever, GuideSpriteType.Circle);
        IsOpenFlag = true;

        UIManager.ShowUI(UIInfo.NewPlayerGuidRoot, OnOpenWindow);
    }
Пример #2
0
 public PlayerGuideInfo(GameObject UIObj, int nWidth, int nHeight, string strText, string TextLocation, int nMotionType, bool bIsBoxEnable, bool bIsMaskEnable, bool bIsForever, GuideSpriteType eGuideSpriteType, OnShowGuide deleOnShowGuide, float offsetX = 0, float offsetY = 0)
 {
     _UIObj           = UIObj;
     _nWidth          = nWidth;
     _nHeight         = nHeight;
     _strText         = strText;
     _TextLocation    = TextLocation;
     _nMotionType     = nMotionType;
     _bIsBoxEnable    = bIsBoxEnable;
     _bIsMaskEnable   = bIsMaskEnable;
     _bIsForever      = bIsForever;
     _GuideSpriteType = eGuideSpriteType;
     _deleOnShowGuide = deleOnShowGuide;
     _offsetX         = offsetX;
     _offsetY         = offsetY;
 }
Пример #3
0
 public void Init(GameObject UIObj, int nWidth, int nHeight, string strText, string TextLocation, int nMotionType,
                  bool bIsBoxEnable, bool bIsMaskEnable, bool bIsForever, bool bIsFocusAnim,
                  GuideSpriteType eGuideSpriteType, OnShowGuide deleOnShowGuide, OnShowGuide afterShowGuide, float offsetX = 0, float offsetY = 0, Action onClickBlackCallback = null)
 {
     _UIObj                = UIObj;
     _nWidth               = nWidth;
     _nHeight              = nHeight;
     _strText              = strText;
     _TextLocation         = TextLocation;
     _nMotionType          = nMotionType;
     _bIsBoxEnable         = bIsBoxEnable;
     _bIsMaskEnable        = bIsMaskEnable;
     _bIsForever           = bIsForever;
     _bIsFocusAnim         = bIsFocusAnim;
     _GuideSpriteType      = eGuideSpriteType;
     _deleOnShowGuide      = deleOnShowGuide;
     _afterShowGuide       = afterShowGuide;
     _offsetX              = offsetX;
     _offsetY              = offsetY;
     _onClickBlackCallback = onClickBlackCallback;
 }
Пример #4
0
    /// <summary>
    /// 更新文字提示的位置
    /// </summary>
    void UpdateRemindLabelPos(string strText, string TextLocation, GuideSpriteType eType)
    {
        if (strText == "")
        {
            m_RemindLabel.gameObject.SetActive(false);
            m_RemindBackground.gameObject.SetActive(false);
            m_OptDec.gameObject.SetActive(false);
            m_FTECenterTxt.gameObject.SetActive(false);
        }
        else if (TextLocation == "center")
        {
            // FTE center text
            m_RemindLabel.gameObject.SetActive(false);
            m_RemindBackground.gameObject.SetActive(false);
            m_OptDec.gameObject.SetActive(false);
            m_FTECenterTxt.gameObject.SetActive(true);
            m_FTECenterTxt.text     = strText;
            m_FTECenterTxtBg.height = strText.Length > 10 ? 83 : 63;
            //m_FTECenterTxt.transform.position = UICamera.currentCamera.ScreenToWorldPoint(new Vector3(Screen.width / 2f, Screen.height * 0.75f));
        }
        else
        {
            m_FTECenterTxt.gameObject.SetActive(false);
            m_RemindLabel.gameObject.SetActive(true);
            m_RemindBackground.gameObject.SetActive(true);
            m_OptDec.gameObject.SetActive(true);

            m_RemindLabel.text = strText;
            m_RemindLabel.GetComponent <UILabel>().AssumeNaturalSize();

//            int nWidth = m_RemindLabel.GetComponent<UILabel>().GetComponent<UIWidget>().width;
//            int nHeight = m_RemindLabel.GetComponent<UILabel>().GetComponent<UIWidget>().height;

            //m_RemindBackground.GetComponent<UISprite>().GetComponent<UIWidget>().width = nWidth + 10;
            //m_RemindBackground.GetComponent<UISprite>().GetComponent<UIWidget>().height = nHeight + 20;

            // 描述文字偏移
            int Xoffset  = 0;
            int Yoffset  = 0;
            int Distance = 20;

            int nGridWidth  = eType == GuideSpriteType.Rectangle ? m_NewPlayerGuid.width : m_NewPlayerGuidCircle.width;
            int nGridHeight = eType == GuideSpriteType.Rectangle ? m_NewPlayerGuid.height : m_NewPlayerGuidCircle.height;

            GameObject GridObj = eType == GuideSpriteType.Rectangle ? m_NewPlayerGuid.gameObject : m_NewPlayerGuidCircle.gameObject;

            switch (TextLocation)
            {
            case "top":
                Xoffset = (int)GridObj.transform.localPosition.x;
                Yoffset = (int)GridObj.transform.localPosition.y + nGridHeight / 2 + m_RemindBackground.height / 2 + Distance;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 0, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, 80, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 90));
                break;

            case "bottom":
                Xoffset = (int)GridObj.transform.localPosition.x;
                Yoffset = (int)GridObj.transform.localPosition.y - nGridHeight / 2 - m_RemindBackground.height / 2 - Distance;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 0, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, -70, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, -90));
                break;

            case "left":
                Xoffset = (int)GridObj.transform.localPosition.x - nGridWidth / 2 - m_RemindBackground.width / 2 - Distance - 30;
                Yoffset = (int)GridObj.transform.localPosition.y;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 180, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, 0, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                break;

            case "right":
                Xoffset = (int)GridObj.transform.localPosition.x + nGridWidth / 2 + m_RemindBackground.width / 2 + Distance;
                Yoffset = (int)GridObj.transform.localPosition.y;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 0, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, 0, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                break;

            case "topleft":
                Xoffset = (int)GridObj.transform.localPosition.x - nGridWidth / 2 - m_RemindBackground.width / 2 - Distance;
                Yoffset = (int)GridObj.transform.localPosition.y + Distance;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 180, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, 0, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                break;

            case "topright":
                Xoffset = (int)GridObj.transform.localPosition.x + nGridWidth / 2 + m_RemindBackground.width / 2 + Distance;
                Yoffset = (int)GridObj.transform.localPosition.y + Distance;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 0, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, 0, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                break;

            case "bottomleft":
                Xoffset = (int)GridObj.transform.localPosition.x - nGridWidth / 2 - m_RemindBackground.width / 2 - Distance;
                Yoffset = (int)GridObj.transform.localPosition.y - Distance;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 180, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, 0, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                break;

            case "bottomright":
                Xoffset = (int)GridObj.transform.localPosition.x + nGridWidth / 2 + m_RemindBackground.width / 2 + Distance;
                Yoffset = (int)GridObj.transform.localPosition.y - Distance;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 0, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, 0, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                break;

            default:     // 默认,左偏移
                Xoffset = (int)GridObj.transform.localPosition.x - nGridWidth / 2 - m_RemindBackground.width / 2 - Distance;
                Yoffset = (int)GridObj.transform.localPosition.y;
                m_RemindBackground.transform.localPosition  = new Vector3(0, 0, 0);
                m_RemindBackground.transform.localRotation  = Quaternion.Euler(new Vector3(0, 180, 0));
                m_RemindArrowParent.transform.localPosition = new Vector3(0, 0, 0);
                m_RemindArrowParent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                break;
            }
            m_RemindObj.transform.localPosition = new Vector3(Xoffset, Yoffset, 0);
            //m_RemindLabel.transform.localPosition = new Vector3(Xoffset, Yoffset, 0);
            //m_RemindBackground.transform.localPosition = new Vector3(Xoffset, Yoffset, 0);
        }
    }
Пример #5
0
    void UpdateBoxMask(GameObject UIObj, int nWidth, int nHeight, bool bIsBoxEnable, bool bIsMaskEnable, bool bIsFocusAnim, GuideSpriteType eGuideSpriteType, Action onClickBlackCallback)
    {
        // 指引框
        if (m_NewPlayerGuid == null || m_NewPlayerGuidCircle == null)
        {
            LogModule.DebugLog("NewPlayerGuidLogic---Error: m_NewPlayerGuid is null");
            return;
        }

        if (false == bIsBoxEnable)
        {
            m_NewPlayerGuid.gameObject.SetActive(false);
            m_NewPlayerGuidCircle.gameObject.SetActive(false);
        }
        else
        {
            // 方框
            if (eGuideSpriteType == GuideSpriteType.Rectangle)
            {
                m_NewPlayerGuid.gameObject.SetActive(true);
                m_NewPlayerGuid.GetComponent <BoxCollider>().enabled = true;
                m_NewPlayerGuidCircle.gameObject.SetActive(false);

                m_NewPlayerGuid.GetComponent <UISprite>().GetComponent <UIWidget>().width  = nWidth;
                m_NewPlayerGuid.GetComponent <UISprite>().GetComponent <UIWidget>().height = nHeight;
                m_NewPlayerGuid.alpha = 1f;
                m_NewPlayerGuid.GetComponent <UISprite>().enabled = !(nWidth == 0 && nHeight == 0);
            }
            else if (eGuideSpriteType == GuideSpriteType.Circle)
            {
                m_NewPlayerGuid.gameObject.SetActive(false);
                m_NewPlayerGuidCircle.gameObject.SetActive(true);

                m_NewPlayerGuidCircle.GetComponent <UISprite>().GetComponent <UIWidget>().width  = nWidth;
                m_NewPlayerGuidCircle.GetComponent <UISprite>().GetComponent <UIWidget>().height = nWidth;
            }
            else if (eGuideSpriteType == GuideSpriteType.NoFrame)
            {
                m_NewPlayerGuid.gameObject.SetActive(true);
                m_NewPlayerGuid.GetComponent <BoxCollider>().enabled = false;
                m_NewPlayerGuidCircle.gameObject.SetActive(false);
                m_NewPlayerGuid.alpha = 0;
                m_NewPlayerGuid.GetComponent <UISprite>().GetComponent <UIWidget>().width  = nWidth + 10;
                m_NewPlayerGuid.GetComponent <UISprite>().GetComponent <UIWidget>().height = nHeight + 10;
            }
        }

        // 蒙版
        if (false == bIsMaskEnable)
        {
            m_BoxColliderLeft.gameObject.SetActive(false);
            m_BoxColliderRight.gameObject.SetActive(false);
            m_BoxColliderBottom.gameObject.SetActive(false);
            m_BoxColliderTop.gameObject.SetActive(false);
        }
        else
        {
            m_BoxColliderLeft.gameObject.transform.localPosition   = new Vector3(-750 - nWidth / 2, -750 + nHeight / 2, 0);
            m_BoxColliderRight.gameObject.transform.localPosition  = new Vector3(750 + nWidth / 2, 750 - nHeight / 2, 0);
            m_BoxColliderTop.gameObject.transform.localPosition    = new Vector3(-750 + nWidth / 2, 750 + nHeight / 2, 0);
            m_BoxColliderBottom.gameObject.transform.localPosition = new Vector3(750 - nWidth / 2, -750 - nHeight / 2, 0);

            // 设置focus Animation
            for (int i = 0; i < 4; i++)
            {
                focusTwPos[i].from = focusTrans[i].localPosition;
            }
            focusTwPos[0].to = new Vector3(nWidth / 2f + 0.5f, nHeight / 2f);
            focusTwPos[1].to = new Vector3(-nWidth / 2f, nHeight / 2f + 1f);
            focusTwPos[2].to = new Vector3(-nWidth / 2f - 1f, -nHeight / 2f);
            focusTwPos[3].to = new Vector3(nWidth / 2f, -nHeight / 2f - 1f);
            EventDelegate.Add(focusTwAlpha.onFinished, focusTweenFinishHandler);
        }
        m_IsMaskEnable         = bIsMaskEnable;
        m_IsFocusAnim          = bIsFocusAnim;
        m_onClickBlackCallback = onClickBlackCallback;
    }