Esempio n. 1
0
        public void SelectResourcesEntry(object input, Image entryImage)
        {
            int hierarchyChildCount = contentRect.transform.childCount;

            for (int i = 0; i < hierarchyChildCount; i++)
            {
                ResourcesEntry entry = contentRect.GetChild(i).GetComponent <ResourcesEntry>();
                entry.resourcesReferences.button.image.color = resourcesGraphicsDefault.entryColor;
            }
            entryImage.color = resourcesGraphicsSelected.entryColor;
            if (inspector != null)
            {
                Debug.Log("Set Inspector to Resource: " + input.ToString());
                //inspector.ChangeInspectorContext(input);
            }
        }
Esempio n. 2
0
 public void NextResource(object obj)
 {
     if (!globals.CheckTypeIgnoreList(obj.GetType().ToString()))
     {
         GameObject spawn = Instantiate(resourcesEntryPrefab, contentRect.transform, false) as GameObject;
         spawn.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, currentSpawnPosition);
         string title = obj.ToString();
         int    l     = title.IndexOf("(");
         if (l > 0)
         {
             title = title.Substring(0, l);
         }
         string type  = obj.GetType().ToString().Replace("UnityEngine.", "");
         string label = title + "(" + type + ")";
         spawn.name = label;
         ResourcesEntry entry = spawn.GetComponent <ResourcesEntry>();
         entry.resourcesReferences.label.text = spawn.name;
         entry.resourcesReferences.contentRect.anchoredPosition = Vector2.zero;
         entry.resourcesReferences.button.onClick.AddListener(delegate { this.SelectResourcesEntry(obj, entry.resourcesReferences.button.image); });
         currentSpawnPosition -= entryHeight;
     }
 }