コード例 #1
0
        public InterfaceElements(Grid grGame, StatsGrid grStats,
                                 ChoiceDialog dlgDefeat, ChoiceDialog dlgVictory)
        {
            InterfaceElements.grStats    = grStats;
            InterfaceElements.dlgDefeat  = dlgDefeat;
            InterfaceElements.dlgVictory = dlgVictory;

            bulletsCounter = new BulletsCounter()
            {
                Foreground = interfaceForeground
            };

            timer = new Timer(START_REM_TIME)
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom,
                Margin     = new Thickness(25, 0, 25, 15),
                Foreground = interfaceForeground
            };

            killsCounter = new KillsCounter()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Top,
                Margin     = new Thickness(25, 25, 25, 0),
                Foreground = interfaceForeground
            };

            InterfaceElContainer container = new InterfaceElContainer(bulletsCounter)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom
            };

            Grid.SetZIndex(container, 2);
            grGame.Children.Add(container);

            container = new InterfaceElContainer(killsCounter, timer)
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Bottom,
                Height = 200
            };
            Grid.SetZIndex(container, 2);
            grGame.Children.Add(container);
        }
コード例 #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.controlBulletsCounter = ((ShootingRange.classes.Interface.BulletsCounter)(target));
                return;

            case 2:
                this.curBullets = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.totalBullets = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }