Exemple #1
0
        public Hud(Game currentGame, IHudRenderer renderer,
            IRenderer<CommandBar> commandBarRenderer, IRenderer<CommandMainProgram> mainProgramRenderer, IRenderer<CommandFunction> functionOneRenderer, IRenderer<CommandFunction> functionTwoRenderer,
            IHudIconFactory iconFactory)
            : base(currentGame)
        {
            this.renderer = renderer;
            this.iconFactory = iconFactory;
               // HudHeight = 786;
               // HudWidth = 1024;
            CommandBar = new CommandBar(this, commandBarRenderer, iconFactory);
            MainProgram = new CommandMainProgram(this, mainProgramRenderer, iconFactory);
            FunctionOne = new CommandFunction(this, functionOneRenderer, iconFactory);
            FunctionOne.DefaultEmptyIcon = iconFactory.EmptyFunctionOneIcon;
            FunctionOne.AddEmptyIcons(iconFactory);
            FunctionTwo = new CommandFunction(this, functionTwoRenderer, iconFactory);
            FunctionTwo.DefaultEmptyIcon = iconFactory.EmptyFunctionTwoIcon;
            FunctionTwo.AddEmptyIcons(iconFactory);
            Message = new HudMessage();

            IconRelease += MainProgram.SetGrabbedIcon;
            IconRelease += FunctionOne.SetGrabbedIcon;
            IconRelease += FunctionTwo.SetGrabbedIcon;

            IconGrab += CommandBar.GrabIcon;
            IconGrab += MainProgram.GrabIcon;
            IconGrab += FunctionOne.GrabIcon;
            IconGrab += FunctionTwo.GrabIcon;

            Message.FirstLine = "";
            Message.SecondLine = "";
        }
 public void AddEmptyIcons(IHudIconFactory factory)
 {
     for (int i = 0; i < size; i++)
     {
         IconList.Add(DefaultEmptyIcon.Clone());
     }
 }
 public CommandMainProgram(Hud currentHud, IRenderer<CommandMainProgram> renderer, IHudIconFactory factory)
     : base(currentHud)
 {
     this.renderer = renderer;
     IconFactory = factory;
     DefaultEmptyIcon = factory.EmptyIcon;
     for (int i = 0; i < PROGRAM_SIZE; i++)
     {
         IconList.Add(factory.EmptyIcon);
     }
 }
 public CommandBar(Hud currentHud, IRenderer<CommandBar> render, IHudIconFactory factory)
     : base(currentHud)
 {
     this.renderer = render;
     IconList.Add(factory.UpIcon);
     IconList.Add(factory.TurnLeftIcon);
     IconList.Add(factory.TurnRightIcon);
     IconList.Add(factory.JumpIcon);
     IconList.Add(factory.LightIcon);
     IconList.Add(factory.FunctionOneIcon);
     IconList.Add(factory.FunctionTwoIcon);
 }
 public CommandFunction(Hud currentHud, IRenderer<CommandFunction> renderer, IHudIconFactory factory)
     : base(currentHud)
 {
     this.renderer = renderer;
     this.IconFactory = factory;
 }