Beispiel #1
0
        public virtual void OnSetType(CardViz viz)
        {
            Element           t    = Settings.GetResourcesManager().typeElement;
            CardVizProperties type = viz.GetProperty(t);

            type.text.text = typeName;
        }
Beispiel #2
0
        public CardVizProperties GetProperty(Element e)
        {
            CardVizProperties result = null;

            for (int i = 0; i < properties.Length; i++) // TODO: Dictionary
            {
                if (properties[i].element == e)
                {
                    result = properties[i];
                    break;
                }
            }

            return(result);
        }
Beispiel #3
0
        public void LoadCard(Card c)
        {
            if (c == null)
            {
                return;
            }

            card = c;

            c.cardType.OnSetType(this);

            for (int i = 0; i < c.properties.Length; i++)
            {
                CardProperties cp = c.properties[i];

                CardVizProperties p = GetProperty(cp.element);

                if (p == null)
                {
                    continue;
                }

                if (cp.element is ElementInt)
                {
                    p.text.text = cp.intValue.ToString();
                }
                else if (cp.element is ElementText)
                {
                    p.text.text = cp.stringValue;
                }
                else if (cp.element is ElementImage)
                {
                    p.image.sprite = cp.sprite;
                }
            }
        }