예제 #1
0
        public override void OnInitialize()
        {
            base.OnInitialize();

            Height.Set(height, 0f);
            Width.Set(width, 0f);

            button = new UITexture("levelplus/Textures/UI/Circle", true);

            button.SetPadding(0);
            button.Left.Set(0f, 0f);
            button.Top.Set(0f, 0f);
            button.Width.Set(width, 0f);
            button.Height.Set(height, 0f);

            switch (type)
            {
            case Stat.CONSTITUTION:
                button.backgroundColor = Color.LimeGreen;     //green
                break;

            case Stat.STRENGTH:
                button.backgroundColor = Color.Red;     //red
                break;

            case Stat.INTELLIGENCE:
                button.backgroundColor = Color.Blue;     //blue
                break;

            case Stat.CHARISMA:
                button.backgroundColor = Color.Purple;     //purple
                break;

            case Stat.DEXTERITY:
                button.backgroundColor = Color.Yellow;     //yellow
                break;

            case Stat.MOBILITY:
                break;

            case Stat.EXCAVATION:
                break;

            case Stat.ANIMALIA:
                break;

            case Stat.LUCK:
                break;

            case Stat.MYSTICISM:
                break;

            default:
                break;
            }

            points = new UIText("0"); //text for showing values
            points.Width.Set(width, 0f);
            points.Height.Set(height, 0f);
            points.Top.Set(height / 2 - points.MinHeight.Pixels / 2, 0f); //center the text, because I'm not a heathen
            this.OnClick += new MouseEvent(pointSpend);


            button.Append(points);
            base.Append(button);
        }