public void AddMonitor(TextureHolderBase textureHolderBase)
        {
            var go = GameObject.Instantiate(prefab) as GameObject;

            go.transform.SetParent(contentSizeFitter.transform, false);
            var component = go.GetComponent <MonitorView>();

            component.Init(textureHolderBase.gameObject.name, textureHolderBase, gridLayoutGroup.cellSize);
            component.ClickEvent += OnSelected;
            MonitorViews.Add(component);
        }
示例#2
0
        public void Init(string label, TextureHolderBase textureHolder, Vector2 size)
        {
            var rectTransform = GetComponent <RectTransform>();

            this.label.text    = label;
            rawImage.texture   = textureHolder.GetTexture();
            this.textureHolder = textureHolder;
            this.size          = size;
            textureHolder.TextureInitializedEvent += TextureOwner_ChangeTextureEvent;

            Fit();
        }
示例#3
0
 private void TextureOwner_ChangeTextureEvent(TextureHolderBase sender, Texture texture)
 {
     rawImage.texture = textureHolder.GetTexture();
     Fit();
 }