Exemplo n.º 1
0
 public static void AddUISystem(UIWorldUISystem newUISystem)
 {
     if (m_instance == null)
     {
         Debug.Log("No UI World Canvas Manager has been initialized");
         return;
     }
     m_instance.m_addUISystem(newUISystem);
 }
Exemplo n.º 2
0
    private void m_addUISystem(UIWorldUISystem newUISystem)
    {
        if (currentUICheckFunctions.ContainsKey(newUISystem))
        {
            return;
        }

        currentUICheckFunctions[newUISystem] = newUISystem.AcceptFunction;

        System.Type targetType = newUISystem.TargetObjectType;
        if (targetType == null && newUISystem.TargetObjectTypeStr.Length > 0)
        {
            targetType = System.Type.GetType(newUISystem.TargetObjectTypeStr);
        }
        if (targetType == null)
        {
            Debug.Log("Could not load UI for target type: " + newUISystem.TargetObjectTypeStr);
            return;
        }

        if (!typeCount.ContainsKey(targetType))
        {
            typeCount[targetType]              = 0;
            checkedTypes[targetType]           = new List <UIWorldUISystem>();
            allAccountedForObjects[targetType] = new List <Object>();
        }
        checkedTypes[targetType].Add(newUISystem);
        foreach (Object o in allAccountedForObjects[targetType])
        {
            if (o != null)
            {
                MonoBehaviour mb = (MonoBehaviour)o;
                if (mb.gameObject != null)
                {
                    newUISystem.AcceptFunction(mb.gameObject);
                }
            }
        }
    }