示例#1
0
        private void AddNewInventoryButton_Click(object sender, RoutedEventArgs e)
        {
            InventoryWindow window = new InventoryWindow();

            window.Closed += Window_Closed;
            window.Show();
        }
示例#2
0
        public InventoryScene(Module app)
            : base(app)
        {
            Background = "hint2.pac";
            Size       = new Vector2(320, 200);
            Position   = (app.Engine.GameResolution - new Vector2(320, 200)) / 2;

            inventory                      = new InventoryWindow(app, InventorySide.Left);
            inventory.Position             = new Vector2(2, 5);
            inventory.LeftClickItemEvent  += OnLeftClickItemInventory;
            inventory.RightClickItemEvent += OnRightClickItemInventory;
            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;

            waterSourceFont = new GuiFont(BurntimeClassic.FontName, new PixelColor(72, 72, 76));

            dialog          = new DialogWindow(app);
            dialog.Position = new Vector2(33, 20);
            dialog.Hide();
            dialog.Layer      += 55;
            dialog.WindowHide += new EventHandler(dialog_WindowHide);
            Windows           += dialog;
        }
示例#3
0
        public static void Initialize()
        {
            // Initialize game window, set's the Global.CurrentScreen
            var gameWindow = new GameWindow(Constants.GameWindowWidth, Constants.GameWindowHeight);

            Add(gameWindow);

            // Initialize map
            var map = new MapWindow(Constants.Map.Width, Constants.Map.Height);

            Add(map);
            map.Initialize();

            // Initialize dialog window
            var dialogWindow = new DialogWindow(Constants.Map.Width, 6);

            Add(dialogWindow);

            // Initialize game over window
            var gameOverWindow = new GameOverWindow(Constants.GameWindowWidth, Constants.GameWindowHeight);

            Add(gameOverWindow);

            // Initialize inventory
            var inventory = new InventoryWindow(Constants.GameWindowWidth / 3, 15);

            Add(inventory);
            inventory.Initialize();

            var fovWindow = new FovWindow(Constants.GameWindowWidth / 3, 12);

            Add(fovWindow);

            IsInitialized = true;
        }
示例#4
0
 // Use this for initialization
 void Start()
 {
     selectedText = GameObject.Find("SelectedItemText").GetComponent<Text>();
     BasePlayer player = GameObject.FindGameObjectWithTag("Player").GetComponent<BasePlayer>();
     playerInventory = player.GetInventory();
     inventoryWindow = GameObject.Find("InventoryWindow").GetComponent<InventoryWindow>();
 }
示例#5
0
    //Rect inventory_rect, equipment_rect;
    public void Show()
    {
        GUI.skin = skin;
        Rect inventory_toggle = new Rect(0, (Screen.height / 2) - 100, 20, 100),
             equipment_toggle = new Rect(0, (Screen.height / 2), 20, 100);

        InventoryWindow inventory_window = player.transform.GetComponent <InventoryWindow> ();
        EquipmentWindow equipment_window = player.transform.GetComponent <EquipmentWindow> ();

        if (inventory_window)
        {
            GUI.color = Color.green;
        }
        else
        {
            GUI.color = Color.red;
        }
        if (GUI.Button(inventory_toggle, "I"))
        {
            Toggle <InventoryWindow> ();
        }
        if (equipment_window)
        {
            GUI.color = Color.green;
        }
        else
        {
            GUI.color = Color.red;
        }
        if (GUI.Button(equipment_toggle, "E"))
        {
            Toggle <EquipmentWindow> ();
        }
    }
示例#6
0
        public override void Initialize()
        {
            base.Initialize();

            //Loads inventory template
            var reflectionManager = IoCManager.Resolve <IReflectionManager>();
            var type = reflectionManager.LooseGetType(_templateName);

            DebugTools.Assert(type != null);
            _inventory = (Inventory)Activator.CreateInstance(type);

            //Creates godot control class for inventory
            _window = new InventoryWindow(this);
            _window.CreateInventory(_inventory);

            if (Owner.TryGetComponent(out _sprite))
            {
                foreach (var mask in _inventory.SlotMasks.OrderBy(s => _inventory.SlotDrawingOrder(s)))
                {
                    if (mask == Slots.NONE)
                    {
                        continue;
                    }
                    _sprite.LayerMapReserveBlank(mask);
                }
            }

            // Component state already came in but we couldn't set anything visually because, well, we didn't initialize yet.
            foreach (var(slot, entity) in _slots)
            {
                _setSlot(slot, entity);
            }
        }
        private void BtnOpenInventory_Click(object sender, RoutedEventArgs e)
        {
            InventoryWindow window = new InventoryWindow();

            window.Show();
            window.Focus();
        }
        private void do_view(object sender, RoutedEventArgs e)
        {
            if (this.state is null)
            {
                return;
            }
            Guid?guid = this.inventory_list.SelectedValue as Guid?;

            if ((guid is null) || (!this.state.inventories.inventories.ContainsKey(guid.Value)))
            {
                return;
            }
            InventoryWindow dialog_window = new InventoryWindow(this.save_state, this.state, guid.Value)
            {
                Owner = Window.GetWindow(this)
            };

            dialog_window.Owner = Window.GetWindow(this);
            dialog_window.ShowDialog();
            if (this.change_callback is null)
            {
                return;
            }
            List <EntryAction> actions = dialog_window.get_actions();

            if ((actions is null) || (actions.Count <= 0))
            {
                return;
            }
            this.change_callback(actions);
        }
示例#9
0
        public MultiplayerClient(TrueCraftUser user)
        {
            User         = user;
            Client       = new TcpClient();
            PacketReader = new PacketReader();
            PacketReader.RegisterCorePackets();
            PacketHandlers = new PacketHandler[0x100];
            Handlers.PacketHandlers.RegisterHandlers(this);
            World     = new ReadOnlyWorld();
            Inventory = new InventoryWindow(null);
            var repo = new BlockRepository();

            repo.DiscoverBlockProviders();
            World.World.BlockRepository = repo;
            World.World.ChunkProvider   = new EmptyGenerator();
            Physics    = new PhysicsEngine(World.World, repo);
            SocketPool = new SocketAsyncEventArgsPool(100, 200, 65536);
            connected  = 0;
            cancel     = new CancellationTokenSource();
            Health     = 20;
            var crafting = new CraftingRepository();

            CraftingRepository = crafting;
            crafting.DiscoverRecipes();
        }
示例#10
0
        //--- Inventory ---

        public void ShowInventory()
        {
            _inventoryWindow = new InventoryWindow();

            _inventoryWindow.Show();
            _mainVM.CloseNinjawindow();
        }
示例#11
0
    protected override void OnEnable()
    {
        if (Inventory == null)
        {
            InventoryWindow.SetActive(false);
            return;
        }
        if (currentSlotCount > Inventory.InventorySlotCount)
        {
            for (int i = Inventory.InventorySlotCount; i < currentSlotCount; i++)
            {
                Destroy(InventorySlotsUI[i].transform.parent.gameObject);
            }
            InventorySlotsUI.RemoveRange(Inventory.InventorySlotCount, currentSlotCount - Inventory.InventorySlotCount);
        }
        else if (currentSlotCount < Inventory.InventorySlotCount)
        {
            for (int i = currentSlotCount; i < Inventory.InventorySlotCount; i++)
            {
                InventorySlotsUI.Add(Instantiate(inventorySlotPrefab, Vector3.zero, Quaternion.identity, gameObject.transform).GetComponentInChildren <InventorySlotUI>());
                InventorySlotsUI[i].SlotIndex   = i;
                InventorySlotsUI[i].InventoryUI = this;
            }
        }
        currentSlotCount = Inventory.InventorySlotCount;

        rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, Mathf.CeilToInt((float)currentSlotCount / 3) * 120);
        UpdateInventorySlotsUI();
        Inventory.SlotUpdatedEvent += OnSlotUpdatedEvent;
    }
示例#12
0
        //Init
        public Menu(Canvas gameCanvas)
        {
            mGameCanvas = gameCanvas;

            mMenuContainer = new ImagePanel(gameCanvas, "MenuContainer");
            mMenuContainer.ShouldCacheToTexture = true;

            mInventoryBackground = new ImagePanel(mMenuContainer, "InventoryContainer");
            mInventoryButton     = new Button(mInventoryBackground, "InventoryButton");
            mInventoryButton.SetToolTipText(Strings.GameMenu.items);
            mInventoryButton.Clicked += InventoryButton_Clicked;

            mSpellsBackground = new ImagePanel(mMenuContainer, "SpellsContainer");
            mSpellsButton     = new Button(mSpellsBackground, "SpellsButton");
            mSpellsButton.SetToolTipText(Strings.GameMenu.spells);
            mSpellsButton.Clicked += SpellsButton_Clicked;

            mCharacterBackground = new ImagePanel(mMenuContainer, "CharacterContainer");
            mCharacterButton     = new Button(mCharacterBackground, "CharacterButton");
            mCharacterButton.SetToolTipText(Strings.GameMenu.character);
            mCharacterButton.Clicked += CharacterButton_Clicked;

            mQuestsBackground = new ImagePanel(mMenuContainer, "QuestsContainer");
            mQuestsButton     = new Button(mQuestsBackground, "QuestsButton");
            mQuestsButton.SetToolTipText(Strings.GameMenu.quest);
            mQuestsButton.Clicked += QuestBtn_Clicked;

            mFriendsBackground = new ImagePanel(mMenuContainer, "FriendsContainer");
            mFriendsButton     = new Button(mFriendsBackground, "FriendsButton");
            mFriendsButton.SetToolTipText(Strings.GameMenu.friends);
            mFriendsButton.Clicked += FriendsBtn_Clicked;

            mPartyBackground = new ImagePanel(mMenuContainer, "PartyContainer");
            mPartyButton     = new Button(mPartyBackground, "PartyButton");
            mPartyButton.SetToolTipText(Strings.GameMenu.party);
            mPartyButton.Clicked += PartyBtn_Clicked;

            mGuildBackground = new ImagePanel(mMenuContainer, "GuildContainer");
            mGuildButton     = new Button(mGuildBackground, "GuildButton");
            mGuildButton.SetToolTipText(Strings.Guilds.Guild);
            mGuildButton.Clicked += GuildBtn_Clicked;

            mMenuBackground = new ImagePanel(mMenuContainer, "MenuContainer");
            mMenuButton     = new Button(mMenuBackground, "MenuButton");
            mMenuButton.SetToolTipText(Strings.GameMenu.Menu);
            mMenuButton.Clicked += MenuButtonClicked;

            mMenuContainer.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());

            //Assign Window References
            mPartyWindow     = new PartyWindow(gameCanvas);
            mFriendsWindow   = new FriendsWindow(gameCanvas);
            mInventoryWindow = new InventoryWindow(gameCanvas);
            mSpellsWindow    = new SpellsWindow(gameCanvas);
            mCharacterWindow = new CharacterWindow(gameCanvas);
            mQuestsWindow    = new QuestsWindow(gameCanvas);
            mMapItemWindow   = new MapItemWindow(gameCanvas);
            mGuildWindow     = new GuildWindow(gameCanvas);
        }
示例#13
0
 public PlayerEntity(string username) : base()
 {
     Username     = username;
     Food         = 20;
     Inventory    = new InventoryWindow();
     Abilities    = new PlayerAbilities(this);
     SelectedSlot = InventoryWindow.HotbarIndex;
 }
示例#14
0
	void Start () {
		foreach (var window in InventoryManager.manager.windows) {
			if (window.windowName == windowName) {
				inventory = window;
				break;
			}
		}
		initialColor = GetComponent<Renderer>().material.color;
	}
示例#15
0
        public override void ExposeData(EntitySerializer serializer)
        {
            base.ExposeData(serializer);

            Window          = new InventoryWindow(this);
            OpenMenuCommand = InputCommand.FromDelegate(() => { Window.AddToScreen(); Window.Open(); });
            serializer.DataField(ref TemplateName, "Template", "HumanInventory");
            Window.CreateInventory(TemplateName);
        }
示例#16
0
        public PlayerEntity(Difficulty difficulty)
        {
            Inventory = new InventoryWindow();
            for (int i = 0; i < Inventory.Length; i++)
            {
                Inventory[i] = ItemStack.EmptyStack;
            }
            SelectedSlot = InventoryWindow.HotbarIndex;
            bedUseTimer  = new Timer(state =>
            {
                if (BedTimerExpired != null)
                {
                    BedTimerExpired(this, null);
                }
            });
            BedPosition       = -Vector3.One;
            Health            = 20;
            Food              = 20;
            Abilities         = new PlayerAbilities(this);
            ItemInMouse       = ItemStack.EmptyStack;
            Difficulty        = difficulty;
            TerrainCollision += OnTerrainCollision;
            FoodTickTimer     = new Timer(discarded =>
            {
                if (Food > 17 && Health < 20 && Health != 0)     // TODO: HealthMax constant?
                {
                    Health++;
                }
                if (Food == 0 && GameMode != GameMode.Creative)
                {
                    switch (Difficulty)
                    {
                    case Difficulty.Hard:
                        if (Health > 0)
                        {
                            Health--;
                        }
                        break;

                    case Difficulty.Normal:
                        if (Health > 1)
                        {
                            Health--;
                        }
                        break;

                    default:
                        if (Health > 10)
                        {
                            Health--;
                        }
                        break;
                    }
                }
            }, null, 80 * Level.TickLength, 80 * Level.TickLength);
        }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
示例#18
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
示例#19
0
 /// <summary>
 /// Set current window <see cref="vInventoryWindow"/> call automatically when Enabled
 /// </summary>
 /// <param name="inventoryWindow"></param>
 internal void SetCurrentWindow(InventoryWindow inventoryWindow)
 {
     if (!windows.Contains(inventoryWindow))
     {
         windows.Add(inventoryWindow);
         if (currentWindow != null)
         {
             currentWindow.gameObject.SetActive(false);
         }
         currentWindow = inventoryWindow;
     }
 }
示例#20
0
        public TraderScene(Module App)
            : base(App)
        {
            Background = "hint1.pac";
            Music      = "10_MUS 10_HSC.ogg";
            Position   = (app.Engine.GameResolution - new Vector2(320, 200)) / 2;

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

            inventoryTrader                      = new InventoryWindow(App, InventorySide.Right);
            inventoryTrader.Position             = new Vector2(154, 5);
            inventoryTrader.LeftClickItemEvent  += OnLeftClickItemTrader;
            inventoryTrader.RightClickItemEvent += OnRightClickItemTrader;
            Windows += inventoryTrader;

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

            acceptButton           = new Button(App);
            acceptButton.Position  = new Vector2(170, 183);
            acceptButton.Text      = app.ResourceManager.GetString("burn?353");
            acceptButton.Font      = new GuiFont(BurntimeClassic.FontName, new PixelColor(92, 92, 148));
            acceptButton.HoverFont = new GuiFont(BurntimeClassic.FontName, new PixelColor(144, 160, 212));
            acceptButton.Command  += OnButtonAccept;
            acceptButton.SetTextOnly();
            Windows += acceptButton;

            exchangeTop = new ExchangeWindow(App);
            inventoryTrader.Grid.Mask = exchangeTop.Grid;
            Windows += exchangeTop;

            exchangeBottom      = new ExchangeWindow(App);
            inventory.Grid.Mask = exchangeBottom.Grid;
            Windows            += exchangeBottom;

            temporarySpace                      = new ItemGridWindow(App);
            temporarySpace.Position             = new Vector2(156, 0);
            temporarySpace.Spacing              = new Vector2(0, 1);
            temporarySpace.Grid                 = new Vector2(1, 6);
            temporarySpace.LeftClickItemEvent  += OnClickTemporarySpace;
            temporarySpace.RightClickItemEvent += OnClickTemporarySpace;
            Windows += temporarySpace;
        }
示例#21
0
    private static void Initialize()
    {
        if (resourcesWindow == null)
        {
            buttonHeight = Screen.height / 8;

            resourcesWindow  = new ResourcesWindow();
            structuresWindow = new StructuresWindow();

            inventoryWindow = new InventoryWindow();
            blueprintWindow = new BlueprintWindow();
        }
    }
示例#22
0
        public static InventoryWindow GenerateInventoryWindow(Skin skin, Scene scene, Vector2 position, float width, float height)
        {
            Stage stage = (scene as MainScene).UICanvas.Stage;

            //removes window if it exists
            InventoryWindow.RemoveInventory(scene);

            //Creates new window after removing old one
            InventoryWindow inventoryWindow = new InventoryWindow(skin, position, width, height);

            stage.AddElement(inventoryWindow);
            return(inventoryWindow);
        }
示例#23
0
        public DoctorScene(Module app)
            : base(app)
        {
            Background = "arzt.pac";
            Music      = "03_MUS 03_HSC.ogg";
            Position   = (app.Engine.GameResolution - new Vector2(320, 200)) / 2;

            Image ani = new Image(app);

            ani.Position   = new Vector2(211, 65);
            ani.Background = "arzt.ani??p";
            ani.Background.Animation.Speed          = 6.5f;
            ani.Background.Animation.IntervalMargin = 4;
            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?369");
            button.Font      = new GuiFont(BurntimeClassic.FontName, new PixelColor(92, 92, 148));
            button.HoverFont = new GuiFont(BurntimeClassic.FontName, new PixelColor(144, 160, 212));
            button.Command  += OnButtonHeal;
            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));
        }
    public void ShowWindow()
    {
        if (window != null)
        {
            return;
        }

        window = BaseWindow.LoadWindow("InventoryWindow") as InventoryWindow;
        if (window != null)
        {
            window.OnWindowHide += OnWindowHide;
            window.id            = BaseWindow.WindowId.Inventory;
            window.Show();
        }
    }
示例#25
0
    public void OnPointerDown(PointerEventData eventData)
    {
        InventoryWindow inventoryWindow = GameObject.Find("InventoryWindow").GetComponent <InventoryWindow>();

        if (inventoryWindow.dragged)
        {
            if (this.name != "Empty")
            {
                inventoryWindow.SwapItem(this.gameObject);
            }
            else
            {
                this.transform.name = inventoryWindow.AddItemToSlot(this.gameObject);
                this.transform.GetChild(0).gameObject.SetActive(true);
            }
        }
    }
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            CurrencyRankInventoryContainerViewModel item = FrameworkElementHelpers.GetDataContext <CurrencyRankInventoryContainerViewModel>(sender);

            if (item.Inventory != null)
            {
                InventoryWindow window = new InventoryWindow(item.Inventory);
                window.Closed += Window_Closed;
                window.Show();
            }
            else
            {
                CurrencyWindow window = new CurrencyWindow(item.Currency);
                window.Closed += Window_Closed;
                window.Show();
            }
        }
示例#27
0
        public override void Activate()
        {
            base.Activate();

            gameMap         = FindObjectOfType <GameMap>();
            log             = FindObjectOfType <MessageLog>();
            mouseManager    = FindObjectOfType <MouseManager>();
            inventoryWindow = GameplayUI.Instance.InventoryWindow;

            mouseManager.TileSelected.AddListener(OnTileSelected);
            mouseManager.EntitySelected.AddListener(OnEntitySelected);

            inventoryWindow.ItemSelected.AddListener(OnInventoryItemSelected);
            inventoryWindow.ItemDropped.AddListener(OnInventoryItemDropped);

            targetingSubState.TargetSelected.AddListener(OnTargetSelected);
        }
示例#28
0
        public PlayingScreen()
        {
            Game.Player = new Player(Coord.NONE);

            MapConsole = new MapConsole(100, 100, Game.GameWidth, Game.GameplayAreaHeight);
            Children.Add(MapConsole);

            GameUI = new GameUI(Game.GameWidth, Game.GameUIHeight);
            Children.Add(GameUI);

            MenuWindow = new MenuWindow();
            Children.Add(MenuWindow);

            InventoryWindow =
                new InventoryWindow(Game.GameWidth / 2, Game.GameHeight - Game.GameUIHeight, new Point(Game.GameWidth / 2, 0));
            Children.Add(InventoryWindow);
        }
示例#29
0
    protected override bool OnOpen(params object[] args)
    {
        if (args == null || args.Length < 2)
        {
            return(false);
        }
        Type = (OpenType)args[0];
        WarehouseManager.Instance.SetManagedWarehouse(args[1] as IWarehouseKeeper);
        switch (Type)
        {
        case OpenType.Store:
            if (args.Length > 2)
            {
                OtherWindow  = args[2] as InventoryWindow;
                otherOpenBef = OtherWindow.IsOpen;
                if (!otherOpenBef)
                {
                    OtherWindow.Open();
                }
                else
                {
                    otherHiddenBef = OtherWindow.IsHidden;
                }
                if (otherHiddenBef)
                {
                    WindowsManager.HideWindow(OtherWindow, false);
                }
                OtherWindow.onClose += () => CloseBy(OtherWindow);
                break;
            }
            else
            {
                return(false);
            }

        case OpenType.Making:
            break;

        case OpenType.Preview:
            break;

        default:
            return(false);
        }
        return(base.OnOpen(args));
    }
示例#30
0
 public RemoteClient(IMultiplayerServer server, NetworkStream stream)
 {
     NetworkStream   = stream;
     MinecraftStream = new MinecraftStream(new TrueCraft.Core.Networking.BufferedStream(NetworkStream));
     PacketQueue     = new ConcurrentQueue <IPacket>();
     LoadedChunks    = new List <Coordinates2D>();
     Server          = server;
     Inventory       = new InventoryWindow(server.CraftingRepository);
     InventoryWindow.WindowChange += HandleWindowChange;
     SelectedSlot  = InventoryWindow.HotbarIndex;
     CurrentWindow = InventoryWindow;
     ItemStaging   = ItemStack.EmptyStack;
     KnownEntities = new List <IEntity>();
     Disconnected  = false;
     EnableLogging = server.EnableClientLogging;
     NextWindowID  = 1;
 }
示例#31
0
 public ChestWindow(InventoryWindow inventory, bool doubleChest = false)
 {
     DoubleChest = doubleChest;
     if (doubleChest)
     {
         WindowAreas = new[]
         {
             new WindowArea(ChestIndex, 54, 9, 3),                     // Chest
             new WindowArea(DoubleMainIndex, 27, 9, 3),                // Main inventory
             new WindowArea(DoubleHotbarIndex, 9, 9, 1)                // Hotbar
         }
     }
     ;
     else
     {
         WindowAreas = new[]
         {
             new WindowArea(ChestIndex, 27, 9, 3),                    // Chest
             new WindowArea(MainIndex, 27, 9, 3),                     // Main inventory
             new WindowArea(HotbarIndex, 9, 9, 1)                     // Hotbar
         }
     };
     inventory.MainInventory.CopyTo(MainInventory);
     inventory.Hotbar.CopyTo(Hotbar);
     Copying = false;
     inventory.WindowChange += (sender, e) =>
     {
         if (Copying)
         {
             return;
         }
         if (e.SlotIndex >= InventoryWindow.MainIndex &&
             e.SlotIndex < InventoryWindow.MainIndex + inventory.MainInventory.Length ||
             e.SlotIndex >= InventoryWindow.HotbarIndex &&
             e.SlotIndex < InventoryWindow.HotbarIndex + inventory.Hotbar.Length)
         {
             inventory.MainInventory.CopyTo(MainInventory);
             inventory.Hotbar.CopyTo(Hotbar);
         }
     };
     foreach (var area in WindowAreas)
     {
         area.WindowChange += (s, e) => OnWindowChange(new WindowChangeEventArgs(
                                                           (s as WindowArea).StartIndex + e.SlotIndex, e.Value));
     }
 }
示例#32
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            CurrencyRankInventoryContainer item = (CurrencyRankInventoryContainer)button.DataContext;

            if (item.Inventory != null)
            {
                InventoryWindow window = new InventoryWindow(item.Inventory);
                window.Closed += Window_Closed;
                window.Show();
            }
            else
            {
                CurrencyWindow window = new CurrencyWindow(item.Currency);
                window.Closed += Window_Closed;
                window.Show();
            }
        }
示例#33
0
	void Start() {
		parentWindow = GetComponentInParent<InventoryWindow>();
		SearchForSlots();
		// Adding the initial item
		foreach(var slot in slots) {
			var initial = slot.initialItem;
			if (initial.itemName != "none") {
				slot.AssignItem = InventoryManager.manager.RetrieveItem(initial.itemName,initial.amount,slot);
			}
		}

		if (isNormalContainer) {
			if(GetComponent<InventoryWindow>() != null) {
				GetComponent<InventoryWindow>().RegisterContainer(this);
			}
			else if(GetComponentInParent<InventoryWindow>() != null) {
				GetComponentInParent<InventoryWindow>().RegisterContainer(this);
			}
		}
	}