Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        string[]      avaliableLocators = UISystem.Singleton.GetLocators();
        List <string> locatorsList      = new List <string>();

        locatorsList.AddRange(avaliableLocators);

        if (locatorsList.Count == 0)
        {
            EditorGUILayout.LabelField("UI Content Locators List is Empty!!!");
        }
        else
        {
            int index = 0;

            if (!locatorsList.Contains(Target.UIContentLocator))
            {
                Target.UIContentLocator = avaliableLocators[0];
                index = 0;
            }
            else
            {
                index = locatorsList.IndexOf(Target.UIContentLocator);
            }

            int[] popUpList = new int[avaliableLocators.Length];
            for (int i = 0; i < popUpList.Length; i++)
            {
                popUpList[i] = i;
            }

            index = EditorGUILayout.IntPopup("UIContentLocator", index, avaliableLocators, popUpList);
            Target.UIContentLocator = avaliableLocators[index];
        }

        UIResourceImage ri = UISystem.Singleton.GetResourceImage(Target.UIContentLocator);

        EditorGUILayout.LabelField("Content Type:" + ri.ContentType.ToString());

        EditorGUILayout.Space();
        if (ri.ContentType == UIContentType.OnOffCommand)
        {
            Target.componentType = (UIComponentType)EditorGUILayout.EnumPopup("TargetComponentType", Target.componentType);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        resourceImage = UISystem.Singleton.GetResourceImage(UIContentLocator);

        mText   = GetComponent <Text>();
        mImage  = GetComponent <Image>();
        mCanvas = GetComponent <Canvas>();
        var renderer = GetComponent <MeshRenderer>();

        if (renderer != null)
        {
            mMaterial      = renderer.material;
            currentPicture = mMaterial.mainTexture as Texture2D;
        }
    }