예제 #1
0
        public ControlDisplay(float w,SpaceShip s)
            : base(0, 0, Root.Instance.UserInterface.Renderer.Size.X, Root.Instance.UserInterface.Renderer.Size.Y, new Layout(2, 4))
        {
            Transparent = true;

            Layout.Widths[0] = Root.Instance.UserInterface.Renderer.Size.X-250;
            Layout.Widths[1] = 250;

            Layout.GetCell(0, 0).Span.Y = 4;

            Layout.Heights[0] = 0.5f;
            WeaponDisplay = new WeaponDisplay(s.Slots);
            Add(WeaponDisplay, 1, 0);

            WeaponManager = new WeaponManager(s);
            Add(WeaponManager, 1, 1);

            Comm = new Chat(s.GetPlayer());
            Add(Comm, 1, 2);

            RadarDisplay rd = new RadarDisplay();
            Add(rd, 1, 3);

            //InfoWindow = new GameInfoDisplay();
            //InfoWindow.Visible = false;
            //Add(InfoWindow,0,0);

            Layout.Update(Size);
        }
예제 #2
0
        void SpawnShip()
        {
            TimeToSpawn = SpawnTime;
            //playership = new TestShip();
            playership = (SpaceShip)Activator.CreateInstance(ShipType);
            PlayerStart ps = GetSpawnLocation();
            if (ps != null)
            {
                playership.Position = ps.AbsolutePosition;
                playership.Orientation = ps.Orientation;
            }

            playership.Owner = Player;
            Root.Instance.Scene.Spawn(playership);
            Control = new SpaceShipControl(playership, cursor);

            MainCamera.Target = playership;
            //FlyByCamera.Attach = playership;

               // if (ControlMenu != null)
            //{
                //Rule.AnnounceEvent -= ControlMenu.Comm.WriteLine;
                Rule.AnnounceEvent -= Log.WriteLine;
                //ControlMenu.Close();
            //}
            //Root.Instance.Gui.windows.Add(ControlMenu = new ControlDisplay(300, playership));
            //playership.Computer.TextMonitor = ControlMenu.Comm;
            //Rule.AnnounceEvent += ControlMenu.Comm.WriteLine;
            Rule.AnnounceEvent += Log.WriteLine;

            if (Display != null)
            {
                Display.Close();
            }

            if (Root.Instance.Gui != null)
            {
                Root.Instance.Gui.windows.Add(Display = new WeaponDisplay(playership.Slots));
                if (Bar != null)
                {
                    Bar.Close();
                }
                Root.Instance.Gui.windows.Add(Bar = new WeaponBar(playership, Display));

                if (Radar != null)
                {
                    Radar.Close();
                }
                Root.Instance.Gui.windows.Add(Radar = new RadarDisplay());
            }
            //ControlMenu.Ship = playership;
            //ControlMenu.Visible=false;
        }
예제 #3
0
        public WeaponBar(SpaceShip s, WeaponDisplay d)
        {
            ship = s;
            display = d;

            icons = new MeshWindow[SpaceShip.WeaponList.Length-1];
            for (int i = 0; i < SpaceShip.WeaponList.Length-1; ++i)
            {
                icons[i] = new MeshWindow(GetIcon(SpaceShip.WeaponList[i]));
                if(ship.CurrentWeapon==i)
                {
                    Style(icons[i], true);
                    currentweapon = i;
                }
                else
                {
                    Style(icons[i], false);
                }
            }

            float pixelsize = 48;

            Layout = new Layout(1, icons.Length);
            Size = new Vector2(pixelsize, icons.Length * pixelsize);
            Position = new Vector2(
                8,
                Root.Instance.UserInterface!=null?(Root.Instance.UserInterface.Renderer.Size.Y / 2 - Size.Y / 2):1000
                );
            Transparent = true;

            for(int i=0;i<icons.Length;++i)
                Add(icons[i],0,i);

            Layout.Update(Size);

            UpdateDisplayPosition();
        }