Пример #1
0
    void OnUpdateListeners(Dictionary <MessageDispatcher.OnReceiveMessage, string> listeners)
    {
        foreach (GenericList target in targets)
        {
            target.Clear <GenericText> ();
        }

        ObjectPool.DestroyChildren <GenericList> (list.Transform);
        targets.Clear();

        foreach (var listener in listeners)
        {
            string target = listener.Key.Target.ToString();
            if (System.Array.Find(excludes, x => target.ToLower().Contains(x)) != null)
            {
                continue;
            }

            GenericList targetList = targets.Find(x => x.Id == target);

            if (targetList == null)
            {
                // Create the new list and parent it
                targetList = ObjectPool.Instantiate <GenericList> ();
                targets.Add(targetList);
                targetList.Parent        = transform;
                targetList.LocalScale    = Vector3.one;
                targetList.LocalPosition = Vector3.zero;

                // Configure the new list
                targetList.Id = target;
                targetList.AddText(target + ":", true);
            }

            targetList.AddText(listener.Value);
        }
    }