Пример #1
0
        void OnButtonAccept()
        {
            if (exchangeTop.ExchangeResult == ExchangeResult.Ng)
            {
                return;
            }

            BurntimeClassic classic = app as BurntimeClassic;

            // remove items in exchange place from parties
            foreach (Character chr in inventory.ActiveCharacter.GetGroup())
            {
                chr.Items.Remove(exchangeBottom.Grid);
            }
            classic.Game.World.ActiveTraderObj.Items.Remove(exchangeTop.Grid);

            // move items from exchange place to parties
            inventory.ActiveCharacter.GetGroup().MoveItems(exchangeTop.Grid);
            classic.Game.World.ActiveTraderObj.GetGroup().MoveItems(exchangeBottom.Grid);

            exchangeTop.Grid.Clear();
            exchangeBottom.Grid.Clear();

            inventory.OnSelectPage();
            inventoryTrader.OnSelectPage();

            exchangeTop.ExchangeResult = ExchangeResult.Ng;
        }
Пример #2
0
        private void UpdateCampNPCs()
        {
            fighter     = 0;
            technicians = 0;
            doctors     = 0;

            BurntimeClassic classic  = app as BurntimeClassic;
            int             city     = classic.InfoCity;
            Location        location = classic.Game.World.Locations[city];

            foreach (Character npc in location.CampNPC)
            {
                switch (npc.Class)
                {
                case CharClass.Technician:
                    technicians++;
                    break;

                case CharClass.Doctor:
                    doctors++;
                    break;

                case CharClass.Mercenary:
                    fighter++;
                    break;

                default:
                    Burntime.Platform.Log.Warning("info screen: unknown npc class");
                    break;
                }
            }
        }
Пример #3
0
        public override void OnUpdate(float Elapsed)
        {
            BurntimeClassic classic = app as BurntimeClassic;

            classic.ActiveClient = GameClient.NoClient;

            news = classic.GameServer.PopNews();

            if (news != null)
            {
                if (news is DeathNews)
                {
                    app.SceneManager.SetScene("DeathScene", (news as DeathNews).Name);
                }
                else if (news is VictoryNews)
                {
                    app.SceneManager.SetScene("VictoryScene", (news as VictoryNews));
                }
            }
            else
            {
                bool gameOver = true;

                for (int i = 0; i < classic.Clients.Count; i++)
                {
                    if (classic.Clients[i].IsReady)
                    {
                        classic.ActiveClient = classic.Clients[i];
                    }
                    gameOver &= (classic.Clients[i].IsGameOver || classic.Clients[i].State == GameClientState.Dead);
                }

                if (gameOver)
                {
                    app.Server.Stop();
                    app.SceneManager.SetScene("MenuScene");
                }
                else if (classic.ActiveClient.IsReady)
                {
                    ClassicGame game = app.GameState as ClassicGame;
                    game.World.ActivePlayer = classic.ActiveClient.Player;

                    if (!game.World.ActivePlayerObj.OnMainMap)
                    {
                        app.SceneManager.SetScene("LocationScene");
                    }
                    else
                    {
                        app.SceneManager.SetScene("MapScene");
                    }
                }

                if (timer < WAIT_DISPLAY_DELAY)
                {
                    timer += Elapsed;
                }
            }
        }
Пример #4
0
        protected override void OnActivateScene(object parameter)
        {
            BurntimeClassic classic = app as BurntimeClassic;
            int             city    = classic.InfoCity;

            if (classic.Game.World.Locations[city].Danger == null)
            {
                danger.Background = null;
            }
            else
            {
                danger.Background = classic.Game.World.Locations[city].Danger.InfoIcon.ID;
            }

            Location loc = classic.Game.World.Locations[city];

            if (loc.Production != null)
            {
                for (int i = 0; i < loc.AvailableProducts.Length; i++)
                {
                    if (loc.Production.ID == loc.AvailableProducts[i])
                    {
                        productionID = i;
                        break;
                    }
                }

                production.ItemID = classic.Game.Productions[loc.AvailableProducts[productionID]].Produce.ID;
            }
            else
            {
                productionID      = -1;
                production.ItemID = "";
            }

            items.Clear();
            foreach (Room room in loc.Rooms)
            {
                for (int i = 0; i < room.Items.Count; i++)
                {
                    if (items.ContainsKey(room.Items[i].Type))
                    {
                        items[room.Items[i].Type]++;
                    }
                    else
                    {
                        items.Add(room.Items[i].Type, 1);
                    }
                }
            }


            offset = 0;
            RefreshItems();
            UpdateCampNPCs();
        }
Пример #5
0
        protected override void OnActivateScene(object parameter)
        {
            BurntimeClassic game = app as BurntimeClassic;

            Background      = "film_08.pac";
            app.RenderMouse = false;

            txtlines  = 9;
            txtline   = 0;
            txtoffset = 590;
        }
Пример #6
0
        void OnRightClickItemRoom(Framework.States.StateObject state)
        {
            BurntimeClassic classic = app as BurntimeClassic;
            Item            item    = state as Item;
            IItemCollection right   = (classic.InventoryRoom == null) ? (IItemCollection)classic.PickItems : classic.InventoryRoom.Items;

            // eat
            if (item.FoodValue != 0)
            {
                int left = group.Eat(leader, item.FoodValue);

                // remove item only if somebody actually ate
                if (left < item.FoodValue)
                {
                    if (item.Type.Empty != null)
                    {
                        item.MakeEmpty();
                        grid.Update(item);
                    }
                    else
                    {
                        right.Remove(item);
                        grid.Remove(item);
                    }
                }
            }
            // drink
            else if (item.WaterValue != 0)
            {
                int left = group.Drink(leader, item.WaterValue);

                // remove item only if somebody actually drank
                if (left < item.WaterValue)
                {
                    if (item.Type.Empty != null)
                    {
                        item.MakeEmpty();
                        grid.Update(item);
                    }
                    else
                    {
                        right.Remove(item);
                        grid.Remove(item);
                    }
                }
            }
            else //if (inventory.ActiveCharacter.Class == CharClass.Technician)
            {
                construction = classic.Game.Constructions.GetConstruction(inventory.ActiveCharacter, right, item);
                this.item    = item;
                dialog.SetCharacter(inventory.ActiveCharacter, construction.Dialog);
                dialog.Show();
            }
        }
Пример #7
0
        void OnButtonEat()
        {
            eatLastAmount = grid.GetEatValue();
            UpdateText();

            BurntimeClassic classic = app as BurntimeClassic;

            classic.Game.World.ActivePlayerObj.Character.Items.Remove(grid);

            classic.SelectedCharacter.GetGroup().Eat(classic.SelectedCharacter, (int)grid.GetEatValue());
            grid.Clear();
        }
Пример #8
0
        void OnButtonDrink()
        {
            drinkLastAmount = grid.GetDrinkValue();
            UpdateText();

            BurntimeClassic classic = app as BurntimeClassic;

            classic.Game.World.ActivePlayerObj.Character.Items.Remove(grid);

            classic.SelectedCharacter.GetGroup().Drink(BurntimeClassic.Instance.SelectedCharacter, grid.GetDrinkValue());
            grid.Clear();
        }
Пример #9
0
        public MapView(IMapEntranceHandler Handler, Module App)
            : base(App)
        {
            enabled             = true;
            handler             = Handler;
            CaptureAllMouseMove = true;

            font = new GuiFont(BurntimeClassic.FontName, new PixelColor(212, 212, 212));

            BurntimeClassic classic = app as BurntimeClassic;

            DebugView = classic.Settings["debug"].GetBool("show_routes") && classic.Settings["debug"].GetBool("enable_cheats");
        }
Пример #10
0
        void OnButtonHeal()
        {
            int value = grid.GetHealValue();

            BurntimeClassic classic = app as BurntimeClassic;

            inventory.ActiveCharacter.Health += value;

            UpdateText();

            classic.Game.World.ActivePlayerObj.Character.Items.Remove(grid);
            grid.Clear();
        }
Пример #11
0
        public override void OnRender(RenderTarget target)
        {
            BurntimeClassic classic = app as BurntimeClassic;
            int             city    = classic.InfoCity;

            TextHelper txt = new TextHelper(app, "burn");

            Location loc = classic.Game.World.Locations[city];

            titleFont.DrawText(target, new Vector2(193, 7), txt[city], TextAlignment.Center, VerticalTextAlignment.Top);

            if (itemCount[0] != -1)
            {
                font.DrawText(target, new Vector2(188, 120), itemCount[0].ToString());
            }
            if (itemCount[1] != -1)
            {
                font.DrawText(target, new Vector2(188, 160), itemCount[1].ToString());
            }

            // render npc info
            font.DrawText(target, new Vector2(100, 33), txt[396], TextAlignment.Left, VerticalTextAlignment.Top);
            font.DrawText(target, new Vector2(100, 51), txt[397], TextAlignment.Left, VerticalTextAlignment.Top);
            font.DrawText(target, new Vector2(100, 69), txt[398], TextAlignment.Left, VerticalTextAlignment.Top);

            int max = System.Math.Max(font.GetWidth(txt[396]), font.GetWidth(txt[397]));

            max = System.Math.Max(font.GetWidth(txt[398]), max);

            RenderNPCLine(target, new Vector2(110 + max, 29), fighter, fighterImage);
            RenderNPCLine(target, new Vector2(110 + max, 47), technicians, technicianImage);
            RenderNPCLine(target, new Vector2(110 + max, 65), doctors, doctorImage);

            // render resources
            font.DrawText(target, new Vector2(137, 86), txt[399], TextAlignment.Left, VerticalTextAlignment.Top);

            font.DrawText(target, new Vector2(229, 86), txt[406], TextAlignment.Left, VerticalTextAlignment.Top);

            txt.AddArgument("|J", loc.GetFoodProductionValue());
            txt.AddArgument("|D", loc.Source.Water);

            font.DrawText(target, new Vector2(270, 117), txt[421], TextAlignment.Left, VerticalTextAlignment.Top);
            font.DrawText(target, new Vector2(270, 152), txt[422], TextAlignment.Left, VerticalTextAlignment.Top);

            if (loc.Danger != null)
            {
                font.DrawText(target, new Vector2(251, 68), loc.Danger.InfoString, TextAlignment.Center, VerticalTextAlignment.Top);
            }

            txt.ClearArguments();
        }
Пример #12
0
        void OnProductionRight()
        {
            // TODO move to logic
            BurntimeClassic classic = app as BurntimeClassic;
            int             city    = classic.InfoCity;

            Location loc = classic.Game.World.Locations[city];

            if (productionID > 0)
            {
                productionID--;
                loc.Production    = classic.Game.Productions[loc.AvailableProducts[productionID]];
                production.ItemID = loc.Production.Produce.ID;
            }
        }
Пример #13
0
        protected override void OnActivateScene(object parameter)
        {
            BurntimeClassic game = app as BurntimeClassic;

            app.RenderMouse = false;

            name = (string)parameter;

            txtlines  = 9;
            txtline   = 0;
            txtoffset = 600;

            bird.Background.Animation.GoFirstFrame();
            bird.Background.Animation.Start();
        }
Пример #14
0
        protected override void OnActivateScene(object parameter)
        {
            BurntimeClassic classic = app as BurntimeClassic;

            inventory.SetGroup(classic.SelectedCharacter);
            inventoryTrader.SetGroup(classic.Game.World.ActiveTraderObj);
            exchangeTop.Title             = classic.Game.World.ActiveTraderObj.Name;
            exchangeTop.ExchangeResult    = ExchangeResult.Ng;
            exchangeBottom.Title          = classic.Game.World.ActivePlayerObj.Name;
            exchangeBottom.ExchangeResult = ExchangeResult.None;

            temporarySpace.Clear();

            side = InventorySide.None;
        }
Пример #15
0
        void dialog_WindowHide(object sender, EventArgs e)
        {
            if (dialog.Result == ConversationActionType.Yes)
            {
                BurntimeClassic classic = app as BurntimeClassic;
                IItemCollection right   = (classic.InventoryRoom == null) ? (IItemCollection)classic.PickItems : classic.InventoryRoom.Items;

                classic.Game.Constructions.Construct(construction, inventory.ActiveCharacter, right, item, classic.Game);

                inventory.OnSelectPage();

                // grid is not available if inventory is shown while on main map
                if (grid != null)
                {
                    grid.Clear();
                    grid.Add(right);
                }
            }
        }
Пример #16
0
        public RestaurantScene(Module app)
            : base(app)
        {
            Music    = "01_MUS 01_HSC.ogg";
            Position = (app.Engine.GameResolution - new Vector2(320, 200)) / 2;

            BurntimeClassic classic = app as BurntimeClassic;

            inventory                     = new InventoryWindow(app, InventorySide.Left);
            inventory.Position            = new Vector2(2, 5);
            inventory.LeftClickItemEvent += OnLeftClickItemInventory;
            Windows += inventory;

            Button button = new Button(app);

            button.Position  = new Vector2(25, 183);
            button.Text      = app.ResourceManager.GetString("burn?354");
            button.Font      = new GuiFont(BurntimeClassic.FontName, new PixelColor(92, 92, 148));
            button.HoverFont = new GuiFont(BurntimeClassic.FontName, new PixelColor(144, 160, 212));
            button.Command  += OnButtonExit;
            button.SetTextOnly();
            Windows += button;

            button           = new Button(app);
            button.Position  = new Vector2(116, 183);
            button.Text      = app.ResourceManager.GetString("burn?415");
            button.Font      = new GuiFont(BurntimeClassic.FontName, new PixelColor(92, 92, 148));
            button.HoverFont = new GuiFont(BurntimeClassic.FontName, new PixelColor(144, 160, 212));
            button.Command  += OnButtonEat;
            button.SetTextOnly();
            Windows += button;

            grid                     = new ItemGridWindow(app);
            grid.Position            = new Vector2(160, 165);
            grid.Spacing             = new Vector2(4, 4);
            grid.Grid                = new Vector2(4, 1);
            grid.LeftClickItemEvent += OnLeftClickItemGrid;
            Windows                 += grid;

            font = new GuiFont(BurntimeClassic.FontName, new PixelColor(212, 212, 212));
        }
Пример #17
0
        public override void OnRender(RenderTarget target)
        {
            base.OnRender(target);

            target.Layer += 10;

            BurntimeClassic classic = app as BurntimeClassic;

            if (classic.InventoryRoom != null && classic.InventoryRoom.IsWaterSource)
            {
                TextHelper txt = new TextHelper(app, "burn");
                txt.AddArgument("|C", classic.Game.World.ActiveLocationObj.Source.Reserve);
                waterSourceFont.DrawText(target, target.Size, txt[423]);

                Vector2 bar = new Vector2(14, classic.Game.World.ActiveLocationObj.Source.Reserve * 2);

                target.RenderRect(target.Size - new Vector2(2, 10) - bar, bar, new PixelColor(240, 64, 56));
            }

            target.Layer -= 10;
        }
Пример #18
0
        private void PreviousScene()
        {
            BurntimeClassic game = app as BurntimeClassic;

            if (game.ActionAfterImageScene != ActionAfterImageScene.None)
            {
                switch (game.ActionAfterImageScene)
                {
                case ActionAfterImageScene.Trader:
                    app.SceneManager.SetScene("TraderScene", true);
                    break;

                case ActionAfterImageScene.Pub:
                    app.SceneManager.SetScene("PubScene", true);
                    break;
                }
            }
            else
            {
                app.SceneManager.PreviousScene();
            }
        }
Пример #19
0
        void OnLeftClickItemInventory(Framework.States.StateObject state)
        {
            BurntimeClassic classic = app as BurntimeClassic;

            if (classic.InventoryRoom != null)
            {
                if (classic.InventoryRoom.IsWaterSource && classic.InventoryRoom.Items.Count == 8)
                {
                    return;
                }
                if (!classic.InventoryRoom.IsWaterSource && classic.InventoryRoom.Items.Count == 32)
                {
                    return;
                }

                Item item = (Item)state;

                classic.InventoryRoom.Items.Add(item);
                inventory.ActiveCharacter.Items.Remove(item);

                // fill up empty bottles
                if (classic.InventoryRoom.IsWaterSource)
                {
                    classic.Game.World.ActiveLocationObj.Source.RefillItem(item);
                }

                grid.Add(item);
                inventory.Grid.Remove(item);
            }
            else if (classic.PickItems != null)
            {
                classic.PickItems.Add(state as Item);
                inventory.ActiveCharacter.Items.Remove(state as Item);

                grid.Add(state as Item);
                inventory.Grid.Remove(state as Item);
            }
        }
Пример #20
0
        void OnLeftClickItemRoom(Framework.States.StateObject state)
        {
            BurntimeClassic classic = app as BurntimeClassic;

            if (inventory.ActiveCharacter.Items.Count == 6)
            {
                return;
            }

            if (classic.InventoryRoom != null)
            {
                inventory.ActiveCharacter.Items.Add(state as Item);
                classic.InventoryRoom.Items.Remove(state as Item);

                inventory.Grid.Add(state as Item);
                grid.Remove(state as Item);
            }
            else if (classic.PickItems != null)
            {
                inventory.ActiveCharacter.Items.Add(state as Item);

                classic.PickItems.Remove(state as Item);

                inventory.Grid.Add(state as Item);
                grid.Remove(state as Item);
            }

            inventory.Grid.Selection.Clear();
            if (inventory.ActiveCharacter.Weapon != null)
            {
                inventory.Grid.Selection.Add(inventory.ActiveCharacter.Weapon);
            }
            if (inventory.ActiveCharacter.Protection != null)
            {
                inventory.Grid.Selection.Add(inventory.ActiveCharacter.Protection);
            }
        }
Пример #21
0
        protected override void OnActivateScene(object parameter)
        {
            BurntimeClassic classic = app as BurntimeClassic;

            inventory.SetGroup(BurntimeClassic.Instance.SelectedCharacter);

            Background     = classic.InventoryBackground == 22 ? "wirt.pac" : "koch.pac";
            restaurantText = null;

            Windows.Remove(ani);

            if (classic.InventoryBackground != 22)
            {
                ani            = new Image(app);
                ani.Position   = new Vector2(186, 50);
                ani.Background = "koch.ani??p";
                ani.Background.Animation.Speed       = 6.5f;
                ani.Background.Animation.Progressive = false;
                Windows += ani;
            }

            eatLastAmount = -1;
            grid.Clear();
        }
Пример #22
0
        protected override void OnActivateScene(object parameter)
        {
            app.RenderMouse = false;

            BurntimeClassic classic = app as BurntimeClassic;
            ClassicWorld    world   = classic.Game.World;

            maggots = 0;
            rats    = 0;
            snakes  = 0;
            meat    = 0;

            fighter    = 0;
            doctor     = 0;
            technician = 0;

            locations        = 0;
            cities           = 0;
            controlledCities = 0;

            for (int i = 0; i < world.Locations.Count; i++)
            {
                Location l = world.Locations[i];
                // add controlled city
                if (l.IsCity)
                {
                    bool controlled = true;
                    foreach (Location n in l.Neighbors)
                    {
                        if (!n.IsCity && n.Player != world.ActivePlayerObj)
                        {
                            controlled = false;
                            break;
                        }
                    }

                    cities++;
                    if (controlled)
                    {
                        controlledCities++;
                    }
                }

                // add player camp info to stats
                if (l.Player == world.ActivePlayerObj)
                {
                    locations++;

                    for (int j = 0; j < l.Rooms.Count; j++)
                    {
                        maggots += l.Rooms[j].Items.GetCount(classic.Game.ItemTypes["item_maggots"]);
                        rats    += l.Rooms[j].Items.GetCount(classic.Game.ItemTypes["item_rats"]);
                        snakes  += l.Rooms[j].Items.GetCount(classic.Game.ItemTypes["item_snake"]);
                        meat    += l.Rooms[j].Items.GetCount(classic.Game.ItemTypes["item_meat"]);
                    }

                    for (int j = 0; j < l.Characters.Count; j++)
                    {
                        if (l.Characters[j].Player == world.ActivePlayerObj)
                        {
                            switch (l.Characters[j].Class)
                            {
                            case CharClass.Mercenary: fighter++; break;

                            case CharClass.Doctor: doctor++; break;

                            case CharClass.Technician: technician++; break;
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < world.ActivePlayerObj.Group.Count; i++)
            {
                switch (world.ActivePlayerObj.Group[i].Class)
                {
                case CharClass.Mercenary: fighter++; break;

                case CharClass.Doctor: doctor++; break;

                case CharClass.Technician: technician++; break;
                }
            }
        }
Пример #23
0
 public GameCreation(BurntimeClassic App)
 {
     app = App;
 }
Пример #24
0
        protected override void OnActivateScene(object parameter)
        {
            BurntimeClassic game = app as BurntimeClassic;

            Background            = game.ImageScene;
            Size                  = new Vector2(320, 200);
            Position              = (app.Engine.GameResolution - new Vector2(320, 200)) / 2;
            app.RenderMouse       = false;
            handled               = false;
            CaptureAllMouseClicks = true;

            Windows.Remove(ani1);
            Windows.Remove(ani2);
            Windows.Remove(ani3);

            if (game.ImageScene == "film_06.pac")
            {
                Music = "19_MUS 19_HSC.ogg";

                ani1            = new Image(app);
                ani1.Background = "film_06.ani?0-5";
                ani1.Position   = new Vector2(49, 46);
                ani1.Background.Animation.IntervalMargin = 6;
                ani1.Background.Animation.Speed          = 6.5f;
                Windows += ani1;

                ani2            = new Image(app);
                ani2.Background = "film_06.ani?6-15";
                ani2.Position   = new Vector2(179, 96);
                ani2.Background.Animation.Speed = 6.5f;
                Windows += ani2;
            }
            else if (game.ImageScene == "film_05.pac")
            {
                Music = "21_MUS 21_HSC.ogg";

                ani1            = new Image(app);
                ani1.Background = "film_05.ani?0-17?p";
                ani1.Position   = new Vector2(98, 120);
                ani1.Background.Animation.Speed          = 6.5f;
                ani1.Background.Animation.IntervalMargin = 4;
                ani1.Background.Animation.Progressive    = false;
                Windows += ani1;

                ani2            = new Image(app);
                ani2.Background = "film_05.ani?18-19";
                ani2.Position   = new Vector2(77, 89);
                ani2.Background.Animation.Speed            = 6.5f;
                ani2.Background.Animation.IntervalMargin   = 5;
                ani2.Background.Animation.ReverseAnimation = true;
                ani2.Background.Animation.Progressive      = false;
                Windows += ani2;

                ani3            = new Image(app);
                ani3.Background = "film_05.ani?20-21";
                ani3.Position   = new Vector2(106, 59);
                ani3.Background.Animation.Speed       = 6.5f;
                ani3.Background.Animation.Progressive = false;
                Windows += ani3;
            }
            else if (game.ImageScene == "film_10.pac")
            {
                Music = "21_MUS 21_HSC.ogg";

                ani1            = new Image(app);
                ani1.Background = "film_10.ani";
                ani1.Position   = new Vector2(125, 92);
                ani1.Background.Animation.IntervalMargin = 3;
                ani1.Background.Animation.Speed          = 5.0f;
                Windows += ani1;
            }
            else if (game.ImageScene == "film_02.pac")
            {
                Music = "07_MUS 07_HSC.ogg";
            }
            else if (game.ImageScene == "film_03.pac")
            {
                Music = "09_MUS 09_HSC.ogg";
            }
            else if (game.ImageScene == "film_04.pac")
            {
                Music = "05_MUS 05_HSC.ogg";
            }
            else if (game.ImageScene == "film_08.pac")
            {
                Music = "02_MUS 02_HSC.ogg";
            }
        }
Пример #25
0
        public PubScene(Module app)
            : base(app)
        {
            BurntimeClassic classic = app as BurntimeClassic;

            Background = classic.InventoryBackground == 14 ? "bar.pac" : "pub1.pac";
            Music      = "19_MUS 19_HSC.ogg";
            Position   = (app.Engine.GameResolution - new Vector2(320, 200)) / 2;

            if (classic.InventoryBackground == 14)
            {
                Image ani = new Image(app);
                ani.Position   = new Vector2(206, 67);
                ani.Background = "bar.ani??p";
                ani.Background.Animation.IntervalMargin = 6;
                ani.Background.Animation.Progressive    = false;
                Windows += ani;
            }
            else
            {
                Image ani = new Image(app);
                ani.Position   = new Vector2(201, 22);
                ani.Background = "pub1.ani?0-11?p";
                ani.Background.Animation.Speed          = 6.1f;
                ani.Background.Animation.IntervalMargin = 1;
                ani.Background.Animation.Progressive    = false;
                Windows       += ani;
                ani            = new Image(app);
                ani.Position   = new Vector2(237, 28);
                ani.Background = "pub1.ani?12-13";
                ani.Background.Animation.Speed       = 8;
                ani.Background.Animation.Progressive = false;
                Windows       += ani;
                ani            = new Image(app);
                ani.Position   = new Vector2(231, 55);
                ani.Background = "pub1.ani?14-64?p";
                ani.Background.Animation.Speed          = 6.6f;
                ani.Background.Animation.IntervalMargin = 6;
                ani.Background.Animation.Progressive    = false;
                Windows += ani;
            }

            inventory                     = new InventoryWindow(app, InventorySide.Left);
            inventory.Position            = new Vector2(2, 5);
            inventory.LeftClickItemEvent += OnLeftClickItemInventory;
            Windows += inventory;

            Button button = new Button(app);

            button.Position  = new Vector2(25, 183);
            button.Text      = app.ResourceManager.GetString("burn?354");
            button.Font      = new GuiFont(BurntimeClassic.FontName, new PixelColor(92, 92, 148));
            button.HoverFont = new GuiFont(BurntimeClassic.FontName, new PixelColor(144, 160, 212));
            button.Command  += OnButtonExit;
            button.SetTextOnly();
            Windows += button;

            button           = new Button(app);
            button.Position  = new Vector2(116, 183);
            button.Text      = app.ResourceManager.GetString("burn?414");
            button.Font      = new GuiFont(BurntimeClassic.FontName, new PixelColor(92, 92, 148));
            button.HoverFont = new GuiFont(BurntimeClassic.FontName, new PixelColor(144, 160, 212));
            button.Command  += OnButtonDrink;
            button.SetTextOnly();
            Windows += button;

            grid                     = new ItemGridWindow(app);
            grid.Position            = new Vector2(160, 165);
            grid.Spacing             = new Vector2(4, 4);
            grid.Grid                = new Vector2(4, 1);
            grid.LeftClickItemEvent += OnLeftClickItemGrid;
            Windows                 += grid;

            font = new GuiFont(BurntimeClassic.FontName, new PixelColor(212, 212, 212));
        }
Пример #26
0
        public override void OnRender(RenderTarget Target)
        {
            base.OnRender(Target);

            BurntimeClassic classic = app as BurntimeClassic;
        }
Пример #27
0
        protected override void OnActivateScene(object parameter)
        {
            leader = parameter as Character;
            group  = leader.GetGroup();

            BurntimeClassic classic = app as BurntimeClassic;

            inventory.SetGroup(leader);

            if (classic.InventoryBackground == -1)
            {
                Background = "hint2.pac";
            }
            else
            {
                Background = "raum_" + classic.InventoryBackground.ToString() + ".pac";
            }
            Size = new Vector2(320, 200);

            if (grid != null)
            {
                Windows -= grid;
                grid     = null;
            }

            if (classic.InventoryRoom != null)
            {
                Music = classic.InventoryRoom.IsWaterSource ? "22_MUS 22_HSC.ogg" : "04_MUS 04_HSC.ogg";

                grid = new ItemGridWindow(app);
                grid.LockPositions = true;
                grid.DoubleLayered = !classic.InventoryRoom.IsWaterSource;
                grid.Position      = new Vector2(160, classic.InventoryRoom.IsWaterSource ? 128 : 20);
                grid.Spacing       = new Vector2(4, 4);
                grid.Grid          = new Vector2(4, classic.InventoryRoom.IsWaterSource ? 2 : 5);
                grid.Layer++;
                grid.LeftClickItemEvent  += OnLeftClickItemRoom;
                grid.RightClickItemEvent += OnRightClickItemRoom;
                Windows += grid;

                grid.Add(classic.InventoryRoom.Items);

                // group drinks water
                if (classic.InventoryRoom.IsWaterSource)
                {
                    int r = group.Drink(leader, classic.Game.World.ActiveLocationObj.Source.Reserve);
                    classic.Game.World.ActiveLocationObj.Source.Reserve = r;
                }
            }
            else if (classic.PickItems != null)
            {
                Music = "04_MUS 04_HSC.ogg";

                grid          = new ItemGridWindow(app);
                grid.Position = new Vector2(170, 10);
                grid.Spacing  = new Vector2(2, 2);
                grid.Grid     = new Vector2(4, 5);
                grid.Layer++;
                grid.LeftClickItemEvent  += OnLeftClickItemRoom;
                grid.RightClickItemEvent += OnRightClickItemRoom;
                Windows += grid;

                grid.Add(classic.PickItems);
            }
            else
            {
                Music = "04_MUS 04_HSC.ogg";
            }
        }
Пример #28
0
        void OnRightClickItemInventory(Framework.States.StateObject state)
        {
            BurntimeClassic classic = app as BurntimeClassic;

            Item item = state as Item;

            // eat
            if (item.FoodValue != 0)
            {
                int left = group.Eat(leader, item.FoodValue);

                // remove item only if somebody actually ate
                if (left < item.FoodValue)
                {
                    if (item.Type.Empty != null)
                    {
                        item.MakeEmpty();
                        inventory.Grid.Update(item);
                    }
                    else
                    {
                        inventory.ActiveCharacter.Items.Remove(item);
                        inventory.Grid.Remove(item);
                    }
                }
            }
            // drink
            else if (item.WaterValue != 0)
            {
                int left = group.Drink(leader, item.WaterValue);

                // remove item only if somebody actually drank
                if (left < item.WaterValue)
                {
                    if (item.Type.Empty != null)
                    {
                        item.MakeEmpty();
                        inventory.Grid.Update(item);
                    }
                    else
                    {
                        inventory.ActiveCharacter.Items.Remove(item);
                        inventory.Grid.Remove(item);
                    }
                }
            }
            else if (item.Type.Full != null)
            {
                // fill up empty bottles
                if (classic.InventoryRoom != null && classic.InventoryRoom.IsWaterSource)
                {
                    if (item.Type.Full != null && item.Type.Full.WaterValue != 0)
                    {
                        if (classic.Game.World.ActiveLocationObj.Source.Reserve >= item.Type.Full.WaterValue)
                        {
                            classic.Game.World.ActiveLocationObj.Source.Reserve -= item.Type.Full.WaterValue;
                            item.MakeFull();

                            // refresh item
                            inventory.Grid.Remove(item);
                            inventory.Grid.Add(item);
                        }
                    }
                }
            }
            else if (item.IsSelectable)
            {
                inventory.ActiveCharacter.SelectItem(item);
                inventory.Grid.Selection.Clear();
                if (inventory.ActiveCharacter.Weapon != null)
                {
                    inventory.Grid.Selection.Add(inventory.ActiveCharacter.Weapon);
                }
                if (inventory.ActiveCharacter.Protection != null)
                {
                    inventory.Grid.Selection.Add(inventory.ActiveCharacter.Protection);
                }
            }
            else //if (inventory.ActiveCharacter.Class == CharClass.Technician)
            {
                IItemCollection right = (classic.InventoryRoom == null) ? (IItemCollection)classic.PickItems : classic.InventoryRoom.Items;
                construction = classic.Game.Constructions.GetConstruction(inventory.ActiveCharacter, right, item);
                this.item    = item;
                dialog.SetCharacter(inventory.ActiveCharacter, construction.Dialog);
                dialog.Show();
            }
        }