Пример #1
0
        public Panel SetProperty(PanelPropertyName propertyName, System.Object data, PanelPropertyType propertyType = PanelPropertyType.none)
        {
            //Debug.Log(string.Format("[Panel][SetProperty] propertyName = '{0}' | this.panelProperties[0].propertyName = '{1}'", propertyName, this.panelProperties[0].propertyName));
            PanelProperty pp = this.panelProperties.FirstOrDefault(p => p.propertyName == propertyName);

            if (pp == null)
            {
                pp = this.AddProperty(propertyName, propertyType, data);
            }
            pp.ApplyData(data, propertyType);
            return(this);
        } // SetProperty
Пример #2
0
        private PanelProperty AddProperty(PanelPropertyName propertyName, PanelPropertyType propertyType, System.Object data)
        {
            PanelProperty property = new PanelProperty()
            {
                propertyName = propertyName,
                propertyType = propertyType,
                propertyData = data
            };

            this.panelProperties.Add(property);
            return(property);
        }
Пример #3
0
        public void ApplyData(System.Object data, PanelPropertyType propertyType)
        {
            Debug.Log(string.Format("[PanelProperty][ApplyData] Property Name '{0}', Property type is '{1}'", this.propertyName, propertyType));
            this.propertyData = data;
            if (propertyType == PanelPropertyType.none)
            {
                this.DisableElement();
            }
            else if (propertyType == PanelPropertyType.text)
            {
                this.SetText((string)data);
            }
            else if (propertyType == PanelPropertyType.button)
            {
                this.SetButton((string)data);
            }
            else
            {
#if PANELS_DEBUG_ON
                Debug.LogWarning(string.Format("[PanelProperty][ApplyData] Warning! Property '{0}' is not allowed yet", propertyType));
#endif
            }
        } // ApplyData