void Update()
        {
            if (!initialized && Util.MyLocalPlayerObject)
            {
                panel = InventoryPanel.Create(Util.MyLocalPlayerObject.GetInventory(), new Vector3());
                panel.ItemClicked += panel_ItemClicked;

                initialized = true;
            }
        }
    public UIManager()
    {
        pHealthBar = GameObject.Find("HealthBar_Back");

        ManaPanel.S_Initialize();
        pCharPanel = GameObject.FindObjectOfType<CharacterPanel>();
        pInvPanel = GameObject.FindObjectOfType<InventoryPanel>();
        InitPanel(pCharPanel);
        InitPanel(pInvPanel);
    }
示例#3
0
 void OnEnable()
 {
     if (itemLoadoutPanel != null) {
         itemLoadout = itemLoadoutPanel.GetComponent<InventoryPanel>();
         inventory = inventoryPanel.GetComponent<InventoryPanel>();
     }
     if (characterLoadoutPanel != null) {
         characterLoadout = characterLoadoutPanel.GetComponent<InventoryPanel>();
         roster = rosterPanel.GetComponent<InventoryPanel>();
     }
 }
示例#4
0
        TextArea_Vertical Info; // Место для текстовой информации

        public MainWindow()
        {
            #region Подготовка карты и панели меню
            InitializeComponent();
            // Определяем вид разметки окна: область карты слева и меню справа
            Lay = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content);

            // Определяем параметры карты: количество клеток по горизонтали и вертикали, размер клетки,
            // ширина декоративной рамки вокруг карты
            MapInfo = new CellMapInfo(10, 10, 50, 5);

            // Создаем карту и размещаем его в окне программы
            Map = MapCreator.GetUniversalMap(this, MapInfo);
            Lay.Attach(Map, 0);
            Map.DrawGrid(); // выводим сетку

            // Указываем путь к папке с картинками
            Map.Library.ImagesFolder = new PathInfo {
                Path = "..\\..\\images", Type = PathType.Relative
            };

            // Создаем панель инвентаря и размещаем ее в меню
            Items = new InventoryPanel(Map.Library, Map.CellSize);
            Lay.Attach(Items, 1);
            Items.SetBackground(Brushes.Wheat);

            // Создаем текстовую панель и размещаем ее в меню
            Info = new TextArea_Vertical();
            Lay.Attach(Info, 1);

            // определяем функцию, которая будет вызвана при нажатии на клавишу
            Map.Keyboard.SetSingleKeyEventHandler(CheckKey);
            #endregion

            //=======================================================================
            //                         Пример кода

            // добавляем картинку с диска в библиотеку - после этого ее можно вывести на карту сколько угодно раз
            Map.Library.AddPicture("smile", "smile1.png");
            // рисуем ее в двух клетках
            Map.DrawInCell("smile", 2, 4);
            Map.DrawInCell("smile", 4, 9);


            //=======================================================================
            // Со следующей строки пишем свой код :)
            //-----------------------------------------------------------------------
        }
        public void TryDoor(EnvironmentGameState destination)
        {
            if (InventoryPanel.CurrentlySelectedItem() != null)
            {
                ActionLogManager.LogActionStatic("It wasn't necessary.");
                return;
            }

            for (int i = 0; i < doors.Count; i++)
            {
                if (doors[i].destinationEnvironment == destination)
                {
                    ServiceLocator.GetService <AudioManager>().PlayOneShot(doors[i].travelSound);
                    doors[i].destinationEnvironment.LoadEnvironment();
                }
            }
        }
示例#6
0
    // Since most stations have their own inventory used in their operations
    // each station can call this to generate an inventory panel for itself
    public InventoryPanel AddInventoryPanel(Inventory inventory)
    {
        GameObject inventoryPanelPrefab = GameplayManager.instance.inventoryPanelPrefab;
        GameObject inventoryPanel       = Instantiate(inventoryPanelPrefab);

        inventoryPanel.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform, false);
        InventoryPanel panel = inventoryPanel.GetComponent <InventoryPanel>();

        panel.inventory = inventory;
        panel.AddCallbacks();

        Vector3 inventoryPoint = transform.position + new Vector3(0.5f, -0.5f);
        Vector3 targetPos      = Camera.main.WorldToScreenPoint(inventoryPoint);

        inventoryPanel.transform.position = targetPos;
        return(panel);
    }
示例#7
0
    /// <summary>
    /// Equips the item.
    /// </summary>
    /// <param name="obj">The GameObject (Player) that wants to execute this action.</param>
    /// <returns>Returns true if the item was equipped successfully, false otherwise.</returns>
    public override bool Execute(GameObject obj)
    {
        invPanel = GameObject.FindGameObjectWithTag("InventoryPanel").GetComponent <InventoryPanel>();
        eqPanel  = GameObject.FindGameObjectWithTag("EquipmentPanel").GetComponent <EquipmentPanel>();
        EquipmentManager equipManager = eqPanel.Manager;
        UsableItem       useItem      = toEquip as UsableItem;
        EquippableItem   equipItem    = toEquip as EquippableItem;

        if (equipItem != null)
        {
            EquippableItem currentlyEquipped = equipManager.DeEquip(equipItem.Slot);
            Debug.Log(equipItem);
            invPanel.ManagedInventory.RemoveItem(toEquip);
            if (currentlyEquipped == null || invPanel.ManagedInventory.AddItem(currentlyEquipped) == null)
            {
                // eqPanel.Manager = equipManager;
                equipManager.Equip(equipItem); // this should not fail
                return(true);
            }
            else
            {
                invPanel.ManagedInventory.AddItem(equipItem);
                equipManager.Equip(currentlyEquipped);
                return(false);
            }
        }
        else if (useItem != null)
        {
            bool yay = false;
            for (int i = 0; i < equipManager.GetHotbarItemsSize(); i++)
            {
                yay = equipManager.AddHotBarItem(useItem, i);
                if (yay)
                {
                    invPanel.ManagedInventory.RemoveItem(useItem);
                    break;
                }
            }
            return(yay);
        }
        else
        {
            throw new UnityException("WTF are you trying to equip my man");
        }
    }
示例#8
0
    private void Awake()
    {
        // Singelton
        sharedInstance = this;
        // Get a referece for all of the slots
        // TODO Maybe: we can do something like slot number and instantiate the slots here

        int i = 0;

        foreach (Transform child in transform)
        {
            slots[i] = (child.gameObject.GetComponent <InventorySlot>());
            i++;
        }

        inventorySelectedSlot = Instantiate(inventorySelectedSlot);
        SelectInventorySlot(selectedSlot);
    }
示例#9
0
    public void TryUnlock()
    {
        Item equippedItem = InventoryPanel.CurrentlySelectedItem();

        if (equippedItem == null)
        {
            ActionLogManager.LogActionStatic(typicalResponse);
        }
        else if (equippedItem != requiredItem)
        {
            ActionLogManager.LogActionStatic("It didn't have any effect.");
        }
        else
        {
            InventoryPanel.UnEquipStatic();
            ServiceLocator.GetService <Inventory>().RemoveItem(requiredItem);
            action.Invoke();
        }
    }
    //----------------------
    //PUBLIC METHODS
    //----------------------

    public void Initialize()
    {
        //Find and assign
        InvPanel         = GameObject.FindGameObjectWithTag("InventoryPanel").GetComponent <InventoryPanel>();
        CharPanel        = GameObject.FindGameObjectWithTag("CharacterPanel").GetComponent <CharacterPanel>();
        FinLevelPanel    = GameObject.FindGameObjectWithTag("FinishedLevelPanel").GetComponent <FinishLevelPanel>();
        NotificationText = GameObject.FindGameObjectWithTag("PickupText").GetComponent <Text>();

        //Initialize
        InvPanel.Initialize();
        CharPanel.Initialize();
        FinLevelPanel.Initialize();

        //Hide the panels
        InvPanel.gameObject.SetActive(false);
        CharPanel.gameObject.SetActive(false);
        FinLevelPanel.gameObject.SetActive(false);
        NotificationText.gameObject.SetActive(false);
    }
示例#11
0
 public void PutPanelAtMouse()
 {
     Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
     RaycastHit hit;
     if (Physics.Raycast(ray, out hit, 4f))
     {
         if ((hit.collider.GetComponent<Panel>() != null) || (hit.collider.GetComponent<Chunck>() != null))
         {
             Vector3 worldPos = hit.point + hit.normal * 0.5f;
             Coordinates cGlobal = panelPreview.WorldPosToPanelPos(worldPos);
             NoelSkumGame.Instance.AddPanel(cGlobal, this.panelPreview.Reference);
             InventoryPanel next = Inventory.Instance.FindSamePanel(this.equiped);
             this.UseEquip();
             if (next != null)
             {
                 Debug.Log("Another object found. Keep going.");
                 next.EquipObject();
             }
         }
     }
 }
示例#12
0
        void UpdateUI()
        {
            int length = InventoryPanel.Controls.Count;

            for (int i = 0; i < length; i++)
            {
                if (i < inv.items.Count)  // If there is an item to add
                {
                    MessageBox.Show("Added" + InventoryPanel.GetControlFromPosition(0, 0));
                    //InventoryPanel.Controls.Add()
                    //Add image\icon\button\etc in the table
                }
                else
                {
                    MessageBox.Show("Removed" + InventoryPanel.GetControlFromPosition(0, 0));

                    // Otherwise clear the slot
                    //leave slot empty
                }
            }
        }
示例#13
0
        public override void Use(GameManager gameManager)
        {
            if (gameManager.DisplayManager.CurrentInteractPanel != null)
            {
                return;
            }

            base.Use(gameManager);

            if (_panel == null)
            {
                _panel = NGUITools.AddChild(gameManager.UiRoot.gameObject, InteractPanelPrefab).GetComponent <InventoryPanel>();
                _panel.Init(GameManager, _inventory);
                _panel.OnSlotsValueChanged += OnSlotsValueChanged;
                _panel.Hide();
            }
            if (!_panel.IsShowing)
            {
                StartCoroutine(_panel.ShowDelay(0.2f));
            }
        }
示例#14
0
    void Start()
    {
        // Add inventory panels for the table and for customer salad
        if (tableInventory != null)
        {
            tablePanel = AddInventoryPanel(tableInventory);
        }
        if (saladInventory != null)
        {
            saladPanel = AddInventoryPanel(saladInventory);
        }

        gameManager = GameplayManager.instance;

        // Setup callbacks, place inventory HUD elements in correct position, set up the station
        statusBar.onTimerCompleteCallback += HandleTimeUp;
        saladPanel.AddCallbacks();
        saladPanel.transform.position = Camera.main.WorldToScreenPoint(saladPoint.position);
        salads = gameManager.salads;
        ResetStation(0f, 5f);
    }
示例#15
0
    /// <summary>
    /// Checks whether the player can equip the item
    /// </summary>
    /// <param name="obj">The Player's GameObject that wants to execute this action.</param>
    /// <returns>Return false if the item cannot be equipped, or if there is no item in the slot.</returns>
    public override bool Validate(GameObject obj)
    {
        bool equipItem = Input.GetButtonDown("EquipItem");

        if (equipItem)
        {
            GameObject UICanvas = GameObject.FindGameObjectWithTag("UICanvas");
            UIBehavior uib      = UICanvas.GetComponent <UIBehavior>();
            if (!uib.inventoryPanel.activeSelf)
            {
                return(false);
            }
            else
            {
                invPanel = GameObject.FindGameObjectWithTag("InventoryPanel").GetComponent <InventoryPanel>();
                toEquip  = invPanel.GetSelectedItem().clone();
                return(toEquip != null && (toEquip is EquippableItem || toEquip is UsableItem) && toEquip.SetYet());
            }
        }
        else
        {
            return(false);
        }
    }
示例#16
0
        public MainWindow()
        {
            UGameObjectBase.game = game;
            Behavior.game        = game;
            InitializeComponent();
            Lay      = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content);
            MapInfo  = new CellMapInfo(50, 31, 30, 5);
            game.Map = MapCreator.GetUniversalMap(this, MapInfo);
            game.Map.Mouse.SetMouseSingleLeftClickHandler(game.setMovementGoalByClick);
            Lay.Attach(game.Map, 0);
            //game.Map.DrawGrid();
            unitsPanel = new InventoryPanel(game.Map.Library, game.Map.CellSize);

            Lay.Attach(unitsPanel, 1);
            unitsPanel.SetBackground(Brushes.Wheat);
            game.Map.SetMapBackground(Brushes.Black);

            info = new TextArea_Vertical();
            Lay.Attach(info, 1);
            info.AddTextBlock("Resources");

            AddPictures();
            unitsPanel.AddItem("allyLightTank", "tank1", "Light Tank");
            unitsPanel.SetMouseClickHandler(CheckInventoryClick);
            unitsPanel.AddItem("allyMediumTank", "MediumTank", "Medium Tank");
            unitsPanel.AddItem("scavenger", "scavenger", "scavenger");
            game.timer.AddAction(ShowResources, 1000);

            game.AddBase(game.Map.XAbsolute / 2, game.Map.YAbsolute / 2, "base");
            // game.CreateTank("scavenger", 500, 500);
            // game.AddObject("SimpleFlyer", new GOParams { X = game.Map.XAbsolute, Y = game.Map.YAbsolute });
            //game.CreateTank("enemyLightTank", 1300, 500);

            // game.CreateTank("Baneblade",100, 200);
            game.CreateTank("enemyLightTank", 5, 500);
        }
示例#17
0
    void Awake()
    {
        instance = this;

        dragItemIcon = transform.GetChild(1).GetComponent <Image>();
    }
示例#18
0
 // Use this for initialization
 void Start()
 {
     ip = GetComponent <InventoryPanel> ();
 }
示例#19
0
        internal static void Postfix(InventoryPanel __instance, ref bool __result)
        {
            System.Console.WriteLine("===========================================");
            System.Console.WriteLine("Fix null refrence exception when consuming last potion");
            System.Console.WriteLine("===========================================");
            __result = true;
            if (!__instance.IsActive() || !__instance.receiveInput || __instance.blockInput)
            {
                __result = false;
                return;
            }

            if (!InventoryPanel.currentSelectedSlot)
            {
                return;
            }


            InventorySlotGUI component = InventoryPanel.currentSelectedSlot.GetComponent <InventorySlotGUI>();

            if (!component.itemStack || !component.itemStack.Consumable)
            {
                return;
            }


            Consumable consumable = component.itemStack.Consumable;

            if (!consumable.SendConsumeEvent())
            {
                component.PlayWrongAnimation();
                return;
            }


            component.PlaySelectedAnimation(Constants.GetFloat("inventorySlotPressPunchValue"));
            BagInventorySlotGUI component2 = InventoryPanel.currentSelectedSlot.GetComponent <BagInventorySlotGUI>();

            if (component2)
            {
                if (component2.itemStack.Quantity == 0)
                {
                    HeroMerchant.Instance.heroMerchantInventory.SetItem(null, component2.slotIndex);
                }
                else
                {
                    HeroMerchant.Instance.heroMerchantInventory.RefreshSlotAt(component2.slotIndex);
                }
            }
            else
            {
                EquipmentInventorySlotGUI component3 = InventoryPanel.currentSelectedSlot.GetComponent <EquipmentInventorySlotGUI>();
                if (component3)
                {
                    if (component3.type == HeroMerchantInventory.EquipmentSlot.Potion)
                    {
                        if (component3.itemStack.Quantity > 0)
                        {
                            component3.UpdateItem();
                            HUDManager.Instance.SetPotionQuantity(component3.itemStack.Quantity);
                        }
                        else
                        {
                            HeroMerchant.Instance.heroMerchantInventory.SetEquippedItemByType(null, HeroMerchantInventory.EquipmentSlot.Potion);
                            HUDManager.Instance.SetEmptyConsumableIcon();
                        }
                    }
                }
                else
                {
                    ChestSlotGUI component4 = InventoryPanel.currentSelectedSlot.GetComponent <ChestSlotGUI>();
                    if (component4)
                    {
                        component4.UpdateItem();
                    }
                }
            }


            // Check ItemRegistry to see if this is a custom item
            ConsumableItemMaster consumableItemMaster = ItemRegister.GetItem <ConsumableItemMaster>(component.item.name);

            if (consumableItemMaster is null)
            {
                consumableItemMaster = component.item as ConsumableItemMaster;
            }


            bool isGuidenceEffect = (consumableItemMaster?.consumableEffectName is null) ? false : consumableItemMaster.consumableEffectName.Contains("Guidance");

            if (isGuidenceEffect)
            {
                DOVirtual.DelayedCall(0.1f, delegate
                {
                    GUIManager.Instance.DisableCurrentPanel();
                }, true);
            }
        }
示例#20
0
 internal static bool Prefix(InventoryPanel __instance)
 {
     return(false);
 }
示例#21
0
 // Use this for initialization
 void Start()
 {
     Instance = this;
     GameData.OnDataInit(Init);
 }
示例#22
0
        /// <summary>
        /// Implementação de <see cref="IGameUI.ToggleInventory"/>
        /// </summary>
        public void ToggleInventory()
        {
            InventoryIsOpen ^= true;

            InventoryPanel.SetActive(InventoryIsOpen);
        }
示例#23
0
 public override void Update()
 {
     InventoryPanel.HandleInventory();
     StatusPanel.HandleStatus();
 }
示例#24
0
        public MainWindow()
        {
            InitializeComponent();
            Lay     = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content);
            MapInfo = new CellMapInfo(38, 20, 50, 5);
            map     = MapCreator.GetUniversalMap(this, MapInfo);
            Lay.Attach(map, 0);
            Inventory = new InventoryPanel(map.Library, 50, 14);
            Lay.Attach(Inventory, 1);
            Helper.map = map;
            map.Library.ImagesFolder = new PathInfo {
                Path = "..\\..\\images", Type = PathType.Relative
            };
            map.Library.AddPicture("wall", "wall.png");
            map.Library.AddPicture("fire", "Fire0.png");
            map.Library.AddPicture("Gem0", "gem_green.png");
            map.Library.AddPicture("Gem1", "gem_blue.png");
            map.Library.AddPicture("Gem2", "gem_red.png");
            map.Library.AddPicture("stones", "stones.jpg");
            map.Library.AddPicture("ghost0", "GHOST.png");
            map.Library.AddPicture("ghost1", "GHOST1.png");
            map.Library.AddPicture("ghost2", "GHOST2.png");
            map.Library.AddPicture("gate closed", "gate_closed.png");
            map.Library.AddPicture("chest", "Chest.png");
            for (int I = 0; I <= 3; I++)
            {
                for (int j = 0; j <= 3; j++)
                {
                    map.Library.AddPicture("Portal" + I.ToString() + j.ToString(), "Portal" + I.ToString() + j.ToString() + ".png");
                }
            }
            string[] exp     = new string[11];
            string[] Fire    = new string[10];
            string[] Portal0 = new string[4];
            string[] Portal1 = new string[4];
            string[] Portal2 = new string[4];
            string[] Portal3 = new string[4];
            for (int i = 0; i <= 10; i++)
            {
                exp[i] = "exp" + i.ToString();
                map.Library.AddPicture(exp[i], exp[i] + ".png");
            }
            for (int i = 0; i <= 9; i++)
            {
                Fire[i] = "Fire" + i.ToString();
                map.Library.AddPicture(Fire[i], Fire[i] + ".png");
            }
            for (int i = 0; i <= 3; i++)
            {
                Portal0[i] = "Portal0" + i.ToString();
                Portal1[i] = "Portal1" + i.ToString();
                Portal2[i] = "Portal2" + i.ToString();
                Portal3[i] = "Portal3" + i.ToString();
            }

            map.Library.AddPicture("fon", "Fon.jpg");
            map.SetMapBackground("stones");
            Inventory.AddItem("Lives", "Fire0");
            Inventory.SetBackground(Brushes.Transparent);
            AnimationDefinition a = new AnimationDefinition();

            a.AddEqualFrames(50, exp);
            a.LastFrame = "exp10";
            map.Library.AddAnimation("Explosion", a);
            AnimationDefinition b = new AnimationDefinition();

            b.AddEqualFrames(80, Fire);
            b.LastFrame = "Fire9";
            map.Library.AddAnimation("Fire", b);
            AnimationDefinition c = new AnimationDefinition();

            c.AddEqualFrames(80, Portal0);
            c.LastFrame = "Portal03";
            map.Library.AddAnimation("Portal0", c);
            AnimationDefinition d = new AnimationDefinition();

            d.AddEqualFrames(80, Portal1);
            d.LastFrame = "Portal13";
            map.Library.AddAnimation("Portal1", d);
            AnimationDefinition f = new AnimationDefinition();

            f.AddEqualFrames(80, Portal2);
            f.LastFrame = "Portal23";
            map.Library.AddAnimation("Portal2", f);
            AnimationDefinition e = new AnimationDefinition();

            e.AddEqualFrames(80, Portal3);
            e.LastFrame = "Portal33";
            map.Library.AddAnimation("Portal3", e);
            Helper.PlayerRun = Helper.PlayerWalk * 2;
            //map.Library.AddContainer("wall", "wall");
            //map.ContainerSetSize("wall", 50, 50);
            //map.ContainerSetCoordinate("wall", WallX, WallY);
            CreateGems();
            CreatePlayer();
            CreateWalls(20, 500, 50, 1020);
            CreateWalls(975, 20, 1860, 50);
            CreateWalls(1880, 530, 50, 975);
            CreateWalls(950, 978, 1815, 50);
            CreateWalls(500, 500, 250, 250);
            for (int i = 0; i < 3; i++)
            {
                CreateEnemy();
            }
            CreateContainers("Chest", 101, "chest");
            map.ContainerSetCoordinate("Chest", 1000, 700);
            CreatePortals(0, 100, 200);
            CreatePortals(1, 800, 900);
            CreatePortals(2, 1000, 500);
            CreatePortals(3, 1800, 300);
            //map.Library.AddContainer("fon", "wall", ContainerType.TiledImage);
            //map.ContainerSetSize("fon", 50, 500);
            //map.ContainerSetTileSize("fon", 50, 50);
            //map.ContainerSetCoordinate("fon",25, 25);
            Player.SetCoordinates(80, 80);
            timer.AddAction(CheckKey, 10);
            timer.AddAction(MoveEnemies, 10);
            timer.AddAction(PlayerPlusEnemy, 10);
            //Done:Доделать движение: устранить эффект перепрыгивания стены, вернув координаты в исходное состояние; добавить 2 кнопки.
            //Dont know how:Сделать функцию, которая принимает все параметры контейнера и создает его, чтобы в основной программе можно было создать контейнер в одну строчку.
            //Done:Сделать так, чтобы после сбора кристалла он появлялся в случайном месте, но не ближе 100 пикселей к игроку.
            //Создать класс для кристала.
            //* Продумать механику игры.
        }
示例#25
0
 void Awake()
 {
     inventoryPanel  = transform.parent.gameObject;
     inventoryScript = inventoryPanel.GetComponent <InventoryPanel>();
 }
示例#26
0
 void Awake()
 {
     itemIcon  = transform.GetChild(0).GetComponent <Image>();
     panel     = charPanel.panel;
     inventory = panel.inventory;
 }
示例#27
0
    void Start()
    {
        PropertiesPanel.GameManager = GameManager;
        foreach (var panel in InventoryPanels)
        {
            panel.OnClickAsObservable().Subscribe(e =>
            {
                if (e.data is InventoryCargoEventData cargoEvent)
                {
                    var item = cargoEvent.CargoBay.Occupancy[cargoEvent.Position.x, cargoEvent.Position.y];
                    if (item != null)
                    {
                        if (e.clickCount == 2)
                        {
                            var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
                            if (otherPanel.CanDropItem(item))
                            {
                                otherPanel.DropItem(item);
                                AkSoundEngine.PostEvent("Equip", gameObject);
                                cargoEvent.CargoBay.Remove(item);
                                panel.RefreshCells();
                                otherPanel.RefreshCells();
                            }
                            else
                            {
                                AkSoundEngine.PostEvent("UI_Fail", gameObject);
                            }
                        }
                        else
                        {
                            if (_selectedPanel != null)
                            {
                                if (_selectedPanel.CellInstances.ContainsKey(_selectedPosition))
                                {
                                    foreach (var v in _selectedItemData.Shape.Coordinates)
                                    {
                                        var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
                                        _selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2);
                                    }
                                }
                            }
                            _selectedPanel    = panel;
                            _selectedPosition = cargoEvent.Position;
                            PropertiesPanel.Inspect(item);
                            _selectedPanel    = panel;
                            _selectedPosition = cargoEvent.CargoBay.Cargo[item];
                            _selectedItem     = item;
                            _selectedItemData = item.Data.Value;
                            foreach (var v in _selectedItemData.Shape.Coordinates)
                            {
                                var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
                                _selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2, true);
                            }
                            AkSoundEngine.PostEvent("UI_Success", gameObject);
                        }
                    }
                }
                else if (e.data is InventoryEntityEventData entityEvent)
                {
                    var item = entityEvent.Entity.GearOccupancy[entityEvent.Position.x, entityEvent.Position.y];
                    if (item != null)
                    {
                        if (e.clickCount == 2)
                        {
                            var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
                            if (otherPanel.CanDropItem(item.EquippableItem))
                            {
                                if (!entityEvent.Entity.Active)
                                {
                                    if (entityEvent.Entity.TryUnequip(item) != null)
                                    {
                                        otherPanel.DropItem(item.EquippableItem);
                                        AkSoundEngine.PostEvent("Unequip", gameObject);
                                        panel.RefreshCells();
                                        otherPanel.RefreshCells();
                                    }
                                    else
                                    {
                                        AkSoundEngine.PostEvent("UI_Fail", gameObject);
                                    }
                                }
                                else
                                {
                                    AkSoundEngine.PostEvent("UI_Fail", gameObject);
                                }
                            }
                        }
                        else
                        {
                            if (_selectedPanel != null)
                            {
                                if (_selectedPanel.CellInstances.ContainsKey(_selectedPosition))
                                {
                                    foreach (var v in _selectedItemData.Shape.Coordinates)
                                    {
                                        var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
                                        _selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2);
                                    }
                                }
                            }

                            PropertiesPanel.Inspect(item);
                            _selectedPanel    = panel;
                            _selectedPosition = item.Position;
                            _selectedItem     = item.EquippableItem;
                            _selectedItemData = GameManager.ItemManager.GetData(item.EquippableItem);
                            foreach (var v in _selectedItemData.Shape.Coordinates)
                            {
                                var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
                                _selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2, true);
                            }
                            AkSoundEngine.PostEvent("UI_Success", gameObject);
                        }
                    }
                }
            });

            panel.OnBackgroundClick.Subscribe(data =>
            {
                if (GameManager.CurrentEntity == null)
                {
                    return;                                    // Only show ship settings if there's a ship, duh!
                }
                PropertiesPanel.Clear();
                PropertiesPanel.AddField("Shutdown Threshold",
                                         () => GameManager.CurrentEntity.Settings.ShutdownPerformance,
                                         f => GameManager.CurrentEntity.Settings.ShutdownPerformance = f,
                                         0,
                                         1);
            });
        }
    }
示例#28
0
            protected override bool OnPerform()
            {
                if ((HudController.Instance != null) && (GameUtils.IsOnVacation()))
                {
                    HudModel model = HudController.Instance.mHudModel as HudModel;
                    if (model != null)
                    {
                        if (model.MinuteChanged != null)
                        {
                            foreach (Delegate del in model.MinuteChanged.GetInvocationList())
                            {
                                TimeControl control = del.Target as TimeControl;
                                if (control != null)
                                {
                                    TimeControlEx.sThs = control;

                                    model.MinuteChanged -= TimeControlEx.sThs.OnMinuteChanged;
                                    model.MinuteChanged -= TimeControlEx.OnMinuteChanged;
                                    model.MinuteChanged += TimeControlEx.OnMinuteChanged;

                                    break;
                                }
                            }
                        }
                    }
                }

                InventoryPanel inventory = InventoryPanel.sInstance;

                if ((inventory != null) && (inventory.Visible))
                {
                    if (inventory.mTimeAlmanacButton != null)
                    {
                        if (GameUtils.IsFutureWorld())
                        {
                            inventory.mTimeAlmanacButton.Visible = (GameStates.TravelHousehold == Household.ActiveHousehold);
                        }

                        if (inventory.mTimeAlmanacButton.Visible)
                        {
                            inventory.mTimeAlmanacButton.Click -= inventory.OnClickTimeAlmanac;
                            inventory.mTimeAlmanacButton.Click -= FutureDescendantServiceEx.OnClickTimeAlmanac;
                            inventory.mTimeAlmanacButton.Click += FutureDescendantServiceEx.OnClickTimeAlmanac;
                        }
                    }
                }

                EditTownPuck puck = EditTownPuck.Instance;

                if (puck != null)
                {
                    if (puck.mReturnToLiveButton != null)
                    {
                        puck.mReturnToLiveButton.Click -= puck.OnReturnToLive;
                        puck.mReturnToLiveButton.Click -= OnReturnToLive;
                        puck.mReturnToLiveButton.Click += OnReturnToLive;
                    }
                }

                EditTownInfoPanel panel = EditTownInfoPanel.Instance;

                if (panel != null)
                {
                    if ((panel.mActionButtons != null) && (panel.mActionButtons.Length > 8) && (panel.mActionButtons[0x8] != null))
                    {
                        panel.mActionButtons[0x8].Click -= panel.OnChangeTypeClick;
                        panel.mActionButtons[0x8].Click -= OnChangeTypeClick;
                        panel.mActionButtons[0x8].Click += OnChangeTypeClick;
                    }
                }

                OptionsDialog options = OptionsDialog.sDialog;

                if (options != null)
                {
                    if (GameUtils.IsInstalled(ProductVersion.EP8))
                    {
                        Button testButton = options.mSeasonWindow.GetChildByID(0xdf085c3, true) as Button;
                        if ((testButton != null) && (!testButton.Enabled))
                        {
                            using (BaseWorldReversion reversion = new BaseWorldReversion())
                            {
                                foreach (Button weather in options.mEnabledWeatherButtons.Values)
                                {
                                    weather.Enabled = true;
                                }

                                if (options.mFahrenheitRadio != null)
                                {
                                    options.mFahrenheitRadio.Enabled = true;
                                }

                                if (options.mCelciusRadio != null)
                                {
                                    options.mCelciusRadio.Enabled = true;
                                }

                                options.SetupSeasonControls(false, ref options.mOldSeasonData);
                            }
                        }
                    }
                }

                FutureDescendantService instance = FutureDescendantServiceEx.GetInstance();

                if (Sims3.UI.Responder.Instance.InLiveMode && Traveler.Settings.mDisableDescendants && instance.mEventListeners.Count > 0)
                {
                    instance.CleanUpEventListeners();
                }

                return(true);
            }
示例#29
0
 private void Awake()
 {
     instance = this; print(instance.description);
 }
示例#30
0
 /// <summary>
 /// Invenmtory panel是常驻类型,若不存在,则载入;开启与关闭只进行显示与隐藏操作
 /// </summary>
 void InventoryClick()
 {
     if (inventory == null)
     {
         Facade.ShowPanel <InventoryPanel>(Utility.UI.GetUIFullRelativePath("InventoryPanel"), panel =>
                                           { panel.gameObject.name = "InventoryPanel"; panel.gameObject.SetActive(true); inventory = panel; });
         return;
     }
     if (inventory.gameObject.activeSelf)
     {
         inventory.HidePanel();
     }
     else
     {
         inventory.ShowPanel();
     }
 }
    private void AddInventory(ItemType item)
    {
        InventoryPanel p = Instantiate(inventoryPrefab, inventoryParent).GetComponent <InventoryPanel>();

        p.SetContent(itemTypes, characterData, ItemTypeOptions);
    }
示例#32
0
 private void Awake()
 {
     Instance = this;
     gameObject.SetActive(false);
 }
示例#33
0
 public virtual void Initialize(InventoryPanel inventoryPanel)
 {
     itemCanvas          = GetComponentInChildren <Canvas>();
     this.inventoryPanel = inventoryPanel;
     itemImage.gameObject.SetActive(false);
 }
示例#34
0
    private void Init()
    {
        closeButton.onClick.AddListener(this.Close);

        statsPanel = GetComponentInChildren<StatsPanel>();
        statsPanel.Init();
        crewPanel = GetComponentInChildren<CrewPanel>();
        crewPanel.Init();
        equipmentPanel = GetComponentInChildren<EquipmentPanel>();
        equipmentPanel.Init();
        itemInfoPanel = GetComponentInChildren<ItemInfoPanel>();
        inventoryPanel = GetComponentInChildren<InventoryPanel>();
        popupPanel = GetComponentInChildren<PopupPanel>();

        crewPanel.SelectDefaultCrewMember();
    }