Пример #1
0
    //设置多个模式的RedDotVo
    private static void SetMultiModeRedDotVo(RedDotVo redDotVo)
    {
        for (int i = 0; i < redDotVo.byCiteList.Count; i++)
        {
            RedDotEnum        multiModeKey      = redDotVo.byCiteList[i];
            Action <RedDotVo> multiModeFun      = redDotFunDic[multiModeKey];
            RedDotVo          multiModeRedDotVo = redDotVoDic[multiModeKey];

            RedDotEnum[] array = multiModeKeyList[multiModeKey];
            bool         state = false;
            int          num   = 0;
            for (int j = 0; j < array.Length; j++)
            {
                RedDotVo vo = redDotVoDic[array[j]];
                num += vo.num;
                if (j == 0)
                {
                    state = vo.state;
                }
                else
                {
                    state = state && vo.state;
                }
            }
            multiModeRedDotVo.num   = num;
            multiModeRedDotVo.state = state;
            multiModeFun.Invoke(multiModeRedDotVo);
        }
    }
Пример #2
0
    void RefreshRedDot(RedDotEnum e)
    {
        RedDotManage.Execute(e);
        RedDotVo vo = RedDotManage.GetRedDotVo(e);

        Debug.LogError("红点刷新:" + e.ToString());
        Debug.LogError(vo.state);
        Debug.LogError("************************");
    }
Пример #3
0
    public static void Register(RedDotEnum key, Action <RedDotVo> fun, params RedDotEnum[] array)
    {
        redDotFunDic.Add(key, fun);
        RedDotVo redDotVo = new RedDotVo();

        redDotVoDic.Add(key, redDotVo);
        if (array.Length > 0)
        {
            multiModeKeyList.Add(key, array);
        }
        for (int i = 0; i < array.Length; i++)
        {
            redDotVoDic[array[i]].byCiteList.Add(key);
        }
    }
Пример #4
0
 public static void Execute(RedDotEnum key)
 {
     if (multiModeKeyList.ContainsKey(key))
     {
         RedDotEnum[] array = multiModeKeyList[key];
         for (int i = 0; i < array.Length; i++)
         {
             Execute(array[i]);
         }
     }
     else
     {
         Action <RedDotVo> fun      = redDotFunDic[key];
         RedDotVo          redDotVo = redDotVoDic[key];
         fun.Invoke(redDotVo);
         SetMultiModeRedDotVo(redDotVo);
     }
 }
Пример #5
0
 public static RedDotVo GetRedDotVo(RedDotEnum key)
 {
     return(redDotVoDic[key]);
 }