Ejemplo n.º 1
0
        private void CreateBulletTab()
        {
            Texture2D texture2;
            Texture2D texture3;
            texture2 = mContentManager.Load<Texture2D>("textures\\UI\\block1_switched_off");
            texture3 = mContentManager.Load<Texture2D>("textures\\UI\\block1_active");
            Button bulletSwitch = new Button(mSpriteBatch, texture2, texture3);
            bulletSwitch.Position = new Vector2(10, 390);
            bulletSwitch.Click += bullet_Click;
            mControls.Add(bulletSwitch);
            mButtonsPerTab[3].Add(bulletSwitch);

            texture2 = mContentManager.Load<Texture2D>("textures\\UI\\block1_switched_off");
            texture3 = mContentManager.Load<Texture2D>("textures\\UI\\block1_active");
             bulletSwitch = new Button(mSpriteBatch, texture2, texture3);
            bulletSwitch.Position = new Vector2(100, 390);
            bulletSwitch.Click += bulletA_Click;
            mControls.Add(bulletSwitch);
            mButtonsPerTab[3].Add(bulletSwitch);
        }
Ejemplo n.º 2
0
        private void CreateControls()
        {
            mControls = new List<UIControl>();
            mButtonsPerTab = new List<UIControl>[TAB_COUNT];
            for (int i = 0; i < TAB_COUNT; i++)
            {
                mButtonsPerTab[i] = new List<UIControl>();
            }
            mTabs = new List<Switcher>(TAB_COUNT);

            Texture2D texture = mContentManager.Load<Texture2D>("Textures\\UI\\container");
            Background background = new Background(texture, mSpriteBatch);
            background.Position = new Vector2(0, 360);
            mControls.Add(background);

            Texture2D texture3;
            texture = mContentManager.Load<Texture2D>("textures\\UI\\build_switched_on");
            texture3 = mContentManager.Load<Texture2D>("textures\\UI\\build_active");
            Button BButton = new Button(mSpriteBatch, texture, texture3);
            BButton.Position = new Vector2(745, 20);
            BButton.Click += BButton_BuildClick;
            mControls.Add(BButton);

            CreateTabs();
            CreateBlockTab();
            CreateGunTab();
            CreateBulletTab();
            CreateUpgradesTab();

            for (int i = 0; i < TAB_COUNT; i++)
            {
                for (int j = 0; j < mButtonsPerTab[i].Count; j++)
                {
                    mButtonsPerTab[i][j].Visible = false;
                }
            }
            SetTabActive(0);
            texture = mContentManager.Load<Texture2D>("Textures\\UI\\cursor");
            Cursor cursor = new Cursor(texture, mSpriteBatch);
            mCursor = cursor;
            cursor.Visible = false;
            mControls.Add(cursor);
        }