Example #1
0
    void UpdateParentValue(int parentId)
    {
        List <int> children = null;
        Redpoint   parent   = null;

        if (redpoints.TryGetValue(parentId, out parent) && parentChildren.TryGetValue(parentId, out children))
        {
            var parentState = RedPointState.None;
            foreach (var item in children)
            {
                Redpoint child = null;
                if (redpoints.TryGetValue(item, out child))
                {
                    if (child.state.value > parentState)
                    {
                        parentState = child.state.value;
                    }
                }

                if (parentState == RedPointState.Full)
                {
                    break;
                }
            }

            parent.SetState(parentState);
        }
    }
Example #2
0
    public void Register(int parent, int id)
    {
        if (redpoints.ContainsKey(id))
        {
            return;
        }

        var redpoint = new Redpoint(id);

        redpoints[id] = redpoint;

        if (parent > 0)
        {
            List <int> children = null;
            if (!parentChildren.TryGetValue(parent, out children))
            {
                parentChildren[parent] = children = new List <int>();
            }

            if (!children.Contains(id))
            {
                children.Add(id);
            }
        }
    }
Example #3
0
    public void Register(int id)
    {
        if (redpoints.ContainsKey(id))
        {
            return;
        }

        var redpoint = new Redpoint(id);

        redpoints[id] = redpoint;
    }
Example #4
0
    public EnumProperty <RedPointState> GetRedpointState(int id)
    {
        Redpoint redpoint = null;

        if (this.redpoints.TryGetValue(id, out redpoint))
        {
            return(redpoint.state);
        }
        else
        {
            return(null);
        }
    }
Example #5
0
    public IntProperty GetRedpointCount(int id)
    {
        Redpoint redpoint = null;

        if (this.redpoints.TryGetValue(id, out redpoint))
        {
            return(redpoint.count);
        }
        else
        {
            return(null);
        }
    }