Exemplo n.º 1
0
 public void ShowNewFlag(GameObject obj, enNewFlagKey flagKey)
 {
     if (obj != null)
     {
         Transform transform = obj.transform.Find("redDotNew");
         if (transform != null)
         {
             transform.gameObject.CustomSetActive(false);
             if (!PlayerPrefs.HasKey(flagKey.ToString()))
             {
                 transform.gameObject.CustomSetActive(true);
             }
         }
     }
 }
Exemplo n.º 2
0
 public void HideNewFlag(GameObject obj, enNewFlagKey flagKey)
 {
     if (obj != null)
     {
         Transform transform = obj.transform.Find("redDotNew");
         if (transform != null)
         {
             string key = flagKey.ToString();
             if (!PlayerPrefs.HasKey(key))
             {
                 PlayerPrefs.SetString(key, NewFlagSetStr);
                 PlayerPrefs.Save();
                 transform.gameObject.CustomSetActive(false);
             }
         }
     }
 }
Exemplo n.º 3
0
 public void DelNewFlag(GameObject obj, enNewFlagKey flagKey, bool immediately = true)
 {
     if (obj)
     {
         Transform newFlag = this.GetNewFlag(obj);
         if (newFlag)
         {
             string key = flagKey.ToString();
             if (!PlayerPrefs.HasKey(key))
             {
                 PlayerPrefs.SetString(key, CUINewFlagSystem.NewFlagSetStr);
                 PlayerPrefs.Save();
                 if (immediately)
                 {
                     newFlag.parent = null;
                     newFlag.gameObject.CustomSetActive(false);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 public void DelNewFlag(GameObject obj, enNewFlagKey flagKey, bool immediately = true)
 {
     if (obj)
     {
         Transform transform = obj.transform.Find("redDotNew(Clone)");
         if (transform == null)
         {
             transform = obj.transform.Find("redDot(Clone)");
         }
         if (transform)
         {
             string key = flagKey.ToString();
             if (!PlayerPrefs.HasKey(key))
             {
                 PlayerPrefs.SetString(key, CUINewFlagSystem.NewFlagSetStr);
                 PlayerPrefs.Save();
                 if (immediately)
                 {
                     Object.Destroy(transform.gameObject);
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
        public void AddNewFlag(GameObject obj, enNewFlagKey flagKey, enNewFlagPos newFlagPos = enNewFlagPos.enTopRight, float scale = 1f, float offsetX = 0f, float offsetY = 0f, enNewFlagType newFlagType = enNewFlagType.enNewFlag)
        {
            if (obj == null)
            {
                return;
            }
            Transform x   = obj.transform.Find("redDotNew");
            string    key = flagKey.ToString();

            if (x != null)
            {
                if (flagKey > enNewFlagKey.New_None && flagKey < enNewFlagKey.New_Count && !PlayerPrefs.HasKey(key))
                {
                    this.DelNewFlag(obj, flagKey, true);
                    return;
                }
            }
            else if (flagKey > enNewFlagKey.New_None && flagKey < enNewFlagKey.New_Count && !PlayerPrefs.HasKey(key))
            {
                string text = string.Empty;
                if (newFlagType == enNewFlagType.enNewFlag)
                {
                    text = "redDotNew";
                }
                else
                {
                    text = "redDot";
                }
                GameObject gameObject = Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/" + text, false, false)) as GameObject;
                if (gameObject == null)
                {
                    return;
                }
                gameObject.transform.SetParent(obj.transform, false);
                gameObject.transform.SetAsLastSibling();
                RectTransform rectTransform = gameObject.transform as RectTransform;
                Vector2       anchorMin     = default(Vector2);
                Vector2       anchorMax     = default(Vector2);
                Vector2       pivot         = default(Vector2);
                switch (newFlagPos)
                {
                case enNewFlagPos.enTopLeft:
                    anchorMin.x = 0f;
                    anchorMin.y = 1f;
                    anchorMax.x = 0f;
                    anchorMax.y = 1f;
                    pivot.x     = 0f;
                    pivot.y     = 1f;
                    break;

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

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

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

                case enNewFlagPos.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 enNewFlagPos.enMiddleRight:
                    anchorMin.x = 1f;
                    anchorMin.y = 0.5f;
                    anchorMax.x = 1f;
                    anchorMax.y = 0.5f;
                    pivot.x     = 1f;
                    pivot.y     = 0.5f;
                    break;

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

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

                case enNewFlagPos.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;
                if (scale != 1f)
                {
                    rectTransform.localScale = new Vector3(scale, scale, scale);
                }
                rectTransform.anchoredPosition = new Vector2(offsetX, offsetY);
            }
        }
Exemplo n.º 6
0
 public bool IsHaveNewFlagKey(enNewFlagKey newFlagKey)
 {
     return(PlayerPrefs.HasKey(newFlagKey.ToString()));
 }