コード例 #1
0
ファイル: CTaskView.cs プロジェクト: isoundy000/wzry-1
    public void AddRedDot(int index, enRedDotPos redDotPos)
    {
        CUIListElementScript elemenet = this.tablistScript.GetElemenet(index);

        if (elemenet != null)
        {
            CUICommonSystem.AddRedDot(elemenet.gameObject, redDotPos, 0);
        }
    }
コード例 #2
0
ファイル: SysEntryForm.cs プロジェクト: wujiangu/wanshiwu0.1
 public void AddRedDotEx(enSysEntryID sysEntryId, enRedDotPos redDotPos, int alertNum = 0)
 {
     if (this.m_Btns != null)
     {
         GameObject obj2;
         this.m_Btns.TryGetValue((int)sysEntryId, out obj2);
         CUICommonSystem.AddRedDot(obj2, redDotPos, alertNum);
     }
 }
コード例 #3
0
        public static void AddRedDot(GameObject target, enRedDotPos dotPos = enRedDotPos.enTopRight, int alertNum = 0)
        {
            if (target == null || target.transform == null)
            {
                return;
            }
            CUIRedDotSystem.DelRedDot(target);
            GameObject gameObject;

            if (alertNum == 0)
            {
                gameObject = (Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/redDot", false, false)) as GameObject);
            }
            else
            {
                gameObject = (Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/redDotBig", false, false)) as GameObject);
            }
            Transform transform = gameObject.transform;

            transform.gameObject.name = CUIRedDotSystem.s_redDotName;
            CUIMiniEventScript component = transform.GetComponent <CUIMiniEventScript>();

            component.m_onDownEventParams.tag = 0;
            if (alertNum != 0 && transform.Find("Text") != null)
            {
                Text component2 = transform.Find("Text").GetComponent <Text>();
                component2.text = alertNum.ToString();
            }
            transform.SetParent(target.transform, false);
            transform.SetAsLastSibling();
            RectTransform rectTransform = transform as RectTransform;
            Vector2       anchorMin     = default(Vector2);
            Vector2       anchorMax     = default(Vector2);
            Vector2       pivot         = default(Vector2);

            switch (dotPos)
            {
            case enRedDotPos.enTopLeft:
                anchorMin.x = 0f;
                anchorMin.y = 1f;
                anchorMax.x = 0f;
                anchorMax.y = 1f;
                pivot.x     = 0f;
                pivot.y     = 1f;
                break;

            case enRedDotPos.enTopCenter:
                anchorMin.x = 0.5f;
                anchorMin.y = 1f;
                anchorMax.x = 0.5f;
                anchorMax.y = 1f;
                pivot.x     = 0.5f;
                pivot.y     = 1f;
                break;

            case enRedDotPos.enTopRight:
                anchorMin.x = 1f;
                anchorMin.y = 1f;
                anchorMax.x = 1f;
                anchorMax.y = 1f;
                pivot.x     = 1f;
                pivot.y     = 1f;
                break;

            case enRedDotPos.enMiddleLeft:
                anchorMin.x = 0f;
                anchorMin.y = 0.5f;
                anchorMax.x = 0f;
                anchorMax.y = 0.5f;
                pivot.x     = 0f;
                pivot.y     = 0.5f;
                break;

            case enRedDotPos.enMiddleCenter:
                anchorMin.x = 0.5f;
                anchorMin.y = 0.5f;
                anchorMax.x = 0.5f;
                anchorMax.y = 0.5f;
                pivot.x     = 0.5f;
                pivot.y     = 0.5f;
                break;

            case enRedDotPos.enMiddleRight:
                anchorMin.x = 1f;
                anchorMin.y = 0.5f;
                anchorMax.x = 1f;
                anchorMax.y = 0.5f;
                pivot.x     = 1f;
                pivot.y     = 0.5f;
                break;

            case enRedDotPos.enBottomLeft:
                anchorMin.x = 0f;
                anchorMin.y = 0f;
                anchorMax.x = 0f;
                anchorMax.y = 0f;
                pivot.x     = 0f;
                pivot.y     = 0f;
                break;

            case enRedDotPos.enBottomCenter:
                anchorMin.x = 0.5f;
                anchorMin.y = 0f;
                anchorMax.x = 0.5f;
                anchorMax.y = 0f;
                pivot.x     = 0.5f;
                pivot.y     = 0f;
                break;

            case enRedDotPos.enBottomRight:
                anchorMin.x = 1f;
                anchorMin.y = 0f;
                anchorMax.x = 1f;
                anchorMax.y = 0f;
                pivot.x     = 1f;
                pivot.y     = 0f;
                break;
            }
            rectTransform.pivot            = pivot;
            rectTransform.anchorMin        = anchorMin;
            rectTransform.anchorMax        = anchorMax;
            rectTransform.anchoredPosition = default(Vector2);
        }
コード例 #4
0
ファイル: LobbyUISys.cs プロジェクト: wujiangu/wanshiwu0.1
 public void AddRedDotEx(enSysEntryID sysEntryId, enRedDotPos redDotPos, int alertNum = 0)
 {
     this.m_SysEntryForm.AddRedDotEx(sysEntryId, redDotPos, alertNum);
 }
コード例 #5
0
ファイル: LobbyUISys.cs プロジェクト: wujiangu/wanshiwu0.1
 public void AddRedDot(enSysEntryID sysEntryId, enRedDotPos redDotPos = 2)
 {
     this.m_SysEntryForm.AddRedDot(sysEntryId, redDotPos, 0);
 }
コード例 #6
0
ファイル: CUIRedDotSystem.cs プロジェクト: isoundy000/wzry-1
        public static void AddRedDot(GameObject target, enRedDotPos dotPos = 2, int alertNum = 0)
        {
            if ((target != null) && (target.transform != null))
            {
                DelRedDot(target);
                Transform  transform = null;
                GameObject obj2      = null;
                if (alertNum == 0)
                {
                    obj2 = UnityEngine.Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/redDot", false, false)) as GameObject;
                }
                else
                {
                    obj2 = UnityEngine.Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/redDotBig", false, false)) as GameObject;
                }
                transform = obj2.transform;
                transform.gameObject.name = s_redDotName;
                transform.GetComponent <CUIMiniEventScript>().m_onDownEventParams.tag = 0;
                if ((alertNum != 0) && (transform.Find("Text") != null))
                {
                    transform.Find("Text").GetComponent <Text>().text = alertNum.ToString();
                }
                transform.SetParent(target.transform, false);
                transform.SetAsLastSibling();
                RectTransform transform2 = transform as RectTransform;
                Vector2       vector     = new Vector2();
                Vector2       vector2    = new Vector2();
                Vector2       vector3    = new Vector2();
                switch (dotPos)
                {
                case enRedDotPos.enTopLeft:
                    vector.x  = 0f;
                    vector.y  = 1f;
                    vector2.x = 0f;
                    vector2.y = 1f;
                    vector3.x = 0f;
                    vector3.y = 1f;
                    break;

                case enRedDotPos.enTopCenter:
                    vector.x  = 0.5f;
                    vector.y  = 1f;
                    vector2.x = 0.5f;
                    vector2.y = 1f;
                    vector3.x = 0.5f;
                    vector3.y = 1f;
                    break;

                case enRedDotPos.enTopRight:
                    vector.x  = 1f;
                    vector.y  = 1f;
                    vector2.x = 1f;
                    vector2.y = 1f;
                    vector3.x = 1f;
                    vector3.y = 1f;
                    break;

                case enRedDotPos.enMiddleLeft:
                    vector.x  = 0f;
                    vector.y  = 0.5f;
                    vector2.x = 0f;
                    vector2.y = 0.5f;
                    vector3.x = 0f;
                    vector3.y = 0.5f;
                    break;

                case enRedDotPos.enMiddleCenter:
                    vector.x  = 0.5f;
                    vector.y  = 0.5f;
                    vector2.x = 0.5f;
                    vector2.y = 0.5f;
                    vector3.x = 0.5f;
                    vector3.y = 0.5f;
                    break;

                case enRedDotPos.enMiddleRight:
                    vector.x  = 1f;
                    vector.y  = 0.5f;
                    vector2.x = 1f;
                    vector2.y = 0.5f;
                    vector3.x = 1f;
                    vector3.y = 0.5f;
                    break;

                case enRedDotPos.enBottomLeft:
                    vector.x  = 0f;
                    vector.y  = 0f;
                    vector2.x = 0f;
                    vector2.y = 0f;
                    vector3.x = 0f;
                    vector3.y = 0f;
                    break;

                case enRedDotPos.enBottomCenter:
                    vector.x  = 0.5f;
                    vector.y  = 0f;
                    vector2.x = 0.5f;
                    vector2.y = 0f;
                    vector3.x = 0.5f;
                    vector3.y = 0f;
                    break;

                case enRedDotPos.enBottomRight:
                    vector.x  = 1f;
                    vector.y  = 0f;
                    vector2.x = 1f;
                    vector2.y = 0f;
                    vector3.x = 1f;
                    vector3.y = 0f;
                    break;
                }
                transform2.pivot            = vector3;
                transform2.anchorMin        = vector;
                transform2.anchorMax        = vector2;
                transform2.anchoredPosition = new Vector2();
            }
        }