Exemple #1
0
    /// <summary>
    ///     Displays the Objects tab
    /// </summary>
    /// <param name="objects">List of GameObjects to include in the Item List Tab</param>
    /// <param name="tile">Tile to include in the Item List Tab</param>
    /// <param name="position">Position of objects</param>
    public static void ShowItemListTab(IEnumerable <GameObject> objects, LayerTile tile, Vector3 position)
    {
        var tab = Instance.ClientTabs[ClientTabType.ItemList];

        if (!UITileList.Instance)
        {
            UITileList.Instance = tab.GetComponentsInChildren <UITileList>(true)[0];
        }

        if (!Instance.itemListTabExists)
        {
            Instance.UnhideTab(ClientTabType.ItemList);
        }

        UITileList.ClearItemPanel();
        UITileList.UpdateTileList(objects, tile, position);

        if (!UITileList.IsEmpty())
        {
            Instance.SelectTab(ClientTabType.ItemList);
        }
        if (!Instance.rolledOut)
        {
            Instance.OpenTabWindow();
        }
    }
Exemple #2
0
    private bool IsUnderFloorTile(GameObject obj)
    {
        LayerTile tile = UITileList.GetTileAtPosition(obj.WorldPosClient());

        // Layer 22 is the 'Floor' layer
        return(tile != null && tile.LayerType != LayerType.Base && obj.layer == 22);
    }
Exemple #3
0
    private bool CheckAltClick()
    {
        if (KeyboardInputManager.IsAltPressed())
        {
            //Check for items on the clicked position, and display them in the Item List Tab, if they're in reach
            //and not FOV occluded
            Vector3 position = MousePosition;
            position.z = 0f;
            if (!lightingSystem.enabled || lightingSystem.IsScreenPointVisible(CommonInput.mousePosition))
            {
                if (PlayerManager.LocalPlayerScript.IsInReach(position))
                {
                    List <GameObject> objects = UITileList.GetItemsAtPosition(position);
                    //remove hidden wallmounts
                    objects.RemoveAll(obj =>
                                      obj.GetComponent <WallmountBehavior>() != null &&
                                      obj.GetComponent <WallmountBehavior>().IsHiddenFromLocalPlayer());
                    LayerTile tile = UITileList.GetTileAtPosition(position);
                    ControlTabs.ShowItemListTab(objects, tile, position);
                }
            }

            UIManager.SetToolTip = $"clicked position: {Vector3Int.RoundToInt(position)}";
            return(true);
        }
        return(false);
    }
Exemple #4
0
 public void Button_Item()
 {
     //Interact with item. In case we picked up the item, it should no longer be on the list
     if (PlayerManager.LocalPlayerScript.inputController.Interact(tileItem.transform))
     {
         UITileList.RemoveTileListItem(transform.gameObject);
     }
     ;
 }
    private bool IsUnderFloorTile(GameObject obj)
    {
        LayerTile tile = UITileList.GetTileAtPosition(obj.WorldPos());

        if (tile.LayerType != LayerType.Base && obj.layer < 1)
        {
            return(true);
        }
        return(false);
    }
Exemple #6
0
    private List <GameObject> GetRightClickableObjects()
    {
        Vector3 position = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);

        position.z = 0f;
        List <GameObject> objects = UITileList.GetItemsAtPosition(position);

        //special case, remove wallmounts that are transparent
        objects.RemoveAll(IsHiddenWallmount);

        return(objects);
    }
 private void CheckAltClick()
 {
     if (Input.GetMouseButtonDown(0) && (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)))
     {
         //Check for items on the clicked possition, and display them in the Item List Tab, if they're in reach
         var position = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         if (PlayerManager.LocalPlayerScript.IsInReach(position))
         {
             List <GameObject> tiles = UITileList.GetItemsAtPosition(position);
             ControlTabs.ShowItemListTab(tiles);
         }
     }
 }
Exemple #8
0
        /// <summary>
        ///     Check if the Item List Tab needs to be updated or closed
        /// </summary>
        public static void CheckItemListTab()
        {
            if (!Instance.itemListTabExists)
            {
                return;
            }

            UITileList.UpdateItemPanelList();
            if (!PlayerManager.LocalPlayerScript.IsInReach(UITileList.GetListedItemsLocation()))
            {
                HideItemListTab();
            }
        }
 ///     Check if the Item List Tab needs to be updated or closed
 public static void CheckItemListTab()
 {
     if (!Instance.itemListTabExists)
     {
         return;
     }
     if (!PlayerManager.LocalPlayerScript || !PlayerManager.LocalPlayerScript.IsInReach(UITileList.GetListedItemsLocation(), false))
     {
         Instance.HideTab(ClientTabType.ItemList);
         return;
     }
     UITileList.UpdateItemPanelList();
 }
Exemple #10
0
 public void Button_Item()
 {
     //clicking on tile does nothing
     if (tile && item == null)
     {
         return;
     }
     //Interact with item. In case we picked up the item, it should no longer be on the list
     if (PlayerManager.LocalPlayerScript.mouseInputController.Interact(item.transform, false))
     {
         UITileList.RemoveTileListItem(transform.gameObject);
     }
     ;
 }
Exemple #11
0
        /// <summary>
        /// Check if the Item List Tab needs to be updated or closed
        /// </summary>
        public static void CheckItemListTab()
        {
            if (!Instance.itemListTabExists)
            {
                return;
            }

            UITileList.UpdateItemPanelList();
            //Slightly lower reach because distance from player to tile is shorter than from player to object. (Ends up allowing 2 floor tile reach otherwise)
            if (!PlayerManager.LocalPlayerScript.IsInReach(UITileList.GetListedItemsLocation(), 1.5f))
            {
                HideItemListTab();
            }
        }
Exemple #12
0
    private List <GameObject> GetRightClickableObjects()
    {
        Vector3 position = Camera.main.ScreenToWorldPoint(CommonInput.mousePosition);

        position.z = 0f;
        List <GameObject> objects = UITileList.GetItemsAtPosition(position);

        //special case, remove wallmounts that are transparent
        objects.RemoveAll(IsHiddenWallmount);

        //Objects that are under a floor tile should not be available
        objects.RemoveAll(IsUnderFloorTile);

        return(objects);
    }
Exemple #13
0
        /// <summary>
        /// Hides the Item List Tab
        /// </summary>
        public static void HideItemListTab()
        {
            if (!Instance.itemListTabExists)
            {
                return;
            }

            SlideOptionsAndMoreTabs(Vector3.left);

            Instance.ItemListTab.gameObject.SetActive(false);
            Instance.Button_Stats();
            Instance.itemListTabExists = false;
            Instance.ItemListTab.GetComponentInChildren <Text>().text = "Objects";
            UITileList.ClearItemPanel();
        }
 private void CheckAltClick()
 {
     if (UnityEngine.Input.GetMouseButtonDown(0) &&
         (UnityEngine.Input.GetKey(KeyCode.LeftAlt) || UnityEngine.Input.GetKey(KeyCode.RightAlt)))
     {
         //Check for items on the clicked possition, and display them in the Item List Tab, if they're in reach
         Vector3 position = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);
         position.z = 0f;
         if (PlayerManager.LocalPlayerScript.IsInReach(position))
         {
             List <GameObject> objects = UITileList.GetItemsAtPosition(position);
             LayerTile         tile    = UITileList.GetTileAtPosition(position);
             ControlTabs.ShowItemListTab(objects, tile, position);
         }
     }
 }
Exemple #15
0
 void Update()
 {
     if (Input.GetMouseButtonDown(1))
     {
         Vector3 position = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);
         position.z = 0f;
         //gets Items on the position of the mouse
         List <GameObject> objects = UITileList.GetItemsAtPosition(position);
         //Generates menus
         Generate(objects);
         //Logger.Log ("yo", Category.UI);
         if (options.Count > 0)
         {
             RadialMenuSpawner.ins.SpawnRadialMenu(options);
         }
     }
 }
    private List <GameObject> GetRightClickableObjects(Vector3 mousePosition)
    {
        if (lightingSystem.enabled && !lightingSystem.IsScreenPointVisible(mousePosition))
        {
            return(null);
        }

        var position = MouseUtils.MouseToWorldPos();
        var objects  = UITileList.GetItemsAtPosition(position);

        //special case, remove wallmounts that are transparent
        objects.RemoveAll(IsHiddenWallmount);

        //Objects that are under a floor tile should not be available
        objects.RemoveAll(IsUnderFloorTile);

        return(objects);
    }
    private bool CheckAltClick()
    {
        if (UnityEngine.Input.GetKey(KeyCode.LeftAlt) || UnityEngine.Input.GetKey(KeyCode.RightAlt))
        {
            //Check for items on the clicked possition, and display them in the Item List Tab, if they're in reach
            Vector3 position = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);
            position.z = 0f;
            if (PlayerManager.LocalPlayerScript.IsInReach(position))
            {
                List <GameObject> objects = UITileList.GetItemsAtPosition(position);
                LayerTile         tile    = UITileList.GetTileAtPosition(position);
                ControlTabs.ShowItemListTab(objects, tile, position);
            }

            UIManager.SetToolTip = $"clicked position: {Vector3Int.RoundToInt(position)}";
            return(true);
        }
        return(false);
    }
        private void CheckAltClick()
        {
            Event e = Event.current;

            if (e.type != EventType.Used && e.button == 0 && (UnityEngine.Input.GetKey(KeyCode.LeftAlt) || UnityEngine.Input.GetKey(KeyCode.RightAlt)))
            {
                //Check for items on the clicked possition, and display them in the Item List Tab, if they're in reach
                Vector3 position = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);
                position.z = 0f;
                if (PlayerManager.LocalPlayerScript.IsInReach(position))
                {
                    List <GameObject> objects = UITileList.GetItemsAtPosition(position);
                    LayerTile         tile    = UITileList.GetTileAtPosition(position);
                    ControlTabs.ShowItemListTab(objects, tile, position);
                }

                UIManager.SetToolTip = $"clicked position: {Vector3Int.RoundToInt(position)}";
                e.Use();
            }
        }
Exemple #19
0
        /// <summary>
        ///     Displays the Objects tab
        /// </summary>
        /// <param name="objects">List of GameObjects to include in the Item List Tab</param>
        /// <param name="tile">Tile to include in the Item List Tab</param>
        /// <param name="position">Position of objects</param>
        public static void ShowItemListTab(IEnumerable <GameObject> objects, LayerTile tile, Vector3 position)
        {
            //If window exists, player is perhaps alt-clicking at another tile. Only slide tabs if Item List Tab doesn't already exist.
            if (Instance.itemListTabExists)
            {
                UITileList.ClearItemPanel();
            }
            else
            {
                SlideOptionsAndMoreTabs(Vector3.right);
            }

            UITileList.UpdateTileList(objects, tile, position);

            if (!UITileList.IsEmpty())
            {
                Instance.ItemListTab.GetComponentInChildren <Text>().text = tile ? tile.name : "Objects";
                Instance.ItemListTab.gameObject.SetActive(true);
                Instance.Button_Item_List();
                Instance.itemListTabExists = true;
            }
        }
        /// <summary>
        ///     Displays the Objects tab
        /// </summary>
        /// <param name="objects">List of GameObjects to include in the Item List Tab</param>
        /// <param name="tile">Tile to include in the Item List Tab</param>
        /// <param name="position">Position of objects</param>
        public static void ShowItemListTab(List <GameObject> objects, LayerTile tile, Vector3 position)
        {
            //If window exists, player is perhaps alt-clicking at another tile. Only slide tabs if Item List Tab doesn't already exist.
            if (Instance.itemListTabExists)
            {
                UITileList.ClearItemPanel();
            }
            else
            {
                SlideOptionsAndMoreTabs(Vector3.right);
            }

            UITileList.AddTileToItemPanel(tile, position);
            foreach (GameObject itemObject in objects)
            {
                UITileList.AddObjectToItemPanel(itemObject);
            }

            Instance.ItemListTab.GetComponentInChildren <Text>().text = tile.name;
            Instance.ItemListTab.gameObject.SetActive(true);
            Instance.Button_Item_List();
            Instance.itemListTabExists = true;
        }