private List <RightClickMenuItem> Generate(List <GameObject> objects)
    {
        if (objects == null || objects.Count == 0)
        {
            return(null);
        }
        var result = new List <RightClickMenuItem>();

        foreach (var curObject in objects)
        {
            var subMenus = new List <RightClickMenuItem>();

            //check for any IRightClickable components and gather their options
            var rightClickables      = curObject.GetComponents <IRightClickable>();
            var rightClickableResult = new RightClickableResult();
            if (rightClickables != null)
            {
                foreach (var rightClickable in rightClickables)
                {
                    rightClickableResult.AddElements(rightClickable.GenerateRightClickOptions());
                }
            }
            //add the menu items generated so far
            subMenus.AddRange(rightClickableResult.AsOrderedMenus(rightClickOptionOrder));

            //check for any components that have an attributed method. These are added to the end in whatever order,
            //doesn't matter since it's only for development.
            if (KeyboardInputManager.Instance.CheckKeyAction(KeyAction.ShowAdminOptions, KeyboardInputManager.KeyEventType.Hold))
            {
                foreach (var attributedType in attributedTypes)
                {
                    var components = curObject.GetComponents(attributedType.ComponentType);
                    foreach (var component in components)
                    {
                        //only add the item if the concrete type matches
                        if (component.GetType() == attributedType.ComponentType)
                        {
                            //create menu items for these components
                            subMenus.AddRange(CreateSubMenuOptions(attributedType, component));
                        }
                    }
                }

                if (!string.IsNullOrEmpty(PlayerList.Instance.AdminToken))
                {
                    subMenus.Add(VariableViewerOption.AsMenu(() =>
                    {
                        RequestBookshelfNetMessage.Send(curObject);
                    }));
                }
            }

            if (subMenus.Count > 0)
            {
                result.Add(CreateObjectMenu(curObject, subMenus));
            }
        }

        return(result);
    }
Esempio n. 2
0
    public void ValueSetUp()
    {
        ListTop = 0;
        if (IsUnInitialised)
        {
            IsUnInitialised = false;
            for (uint i = 0; i < 3; i++)
            {
                SingleBookshelf SingleBookEntry = Instantiate(UISingleBookshelf) as SingleBookshelf;
                SingleBookEntry.transform.SetParent(DynamicPanel.transform);
                SingleBookEntry.transform.localScale = Vector3.one;
                BookshelfList.Add(SingleBookEntry);
                BookshelfList[(int)i].gameObject.SetActive(false);
            }
        }

        for (uint i = 0; i < 3; i++)
        {
            if (_BookShelfView.HeldShelfIDs.Length > (i))
            {
                BookshelfList[(int)i].gameObject.SetActive(true);
                WaitingOn.Add(_BookShelfView.HeldShelfIDs[i].ID);
                IDToLocation[_BookShelfView.HeldShelfIDs[i].ID] = i;
                RequestBookshelfNetMessage.Send(_BookShelfView.HeldShelfIDs[i].ID, false,
                                                ServerData.UserID, PlayerList.Instance.AdminToken);
                ListBottom = i;
            }
            else
            {
                BookshelfList[(int)i].gameObject.SetActive(false);
            }
        }
    }
Esempio n. 3
0
 public void Refresh()
 {
     if (_BookShelfView.HeldShelfIDs.Length > 0)
     {
         RequestBookshelfNetMessage.Send(_BookShelfView.HeldShelfIDs[0].ID, true);
     }
 }
Esempio n. 4
0
 public void Refresh()
 {
     if (_BookShelfView != null && _BookShelfView.HeldShelfIDs.Length > 0)
     {
         RequestBookshelfNetMessage.Send(_BookShelfView.HeldShelfIDs[0].ID, true,
                                         ServerData.UserID, PlayerList.Instance.AdminToken);
     }
 }
Esempio n. 5
0
 public void GoToObscuringBookshelf()
 {
     if (_BookShelfView != null)
     {
         RequestBookshelfNetMessage.Send(_BookShelfView.ID, true,
                                         ServerData.UserID, PlayerList.Instance.AdminToken);
     }
 }
Esempio n. 6
0
    public static RequestBookshelfNetMessage Send(ulong _BookshelfID, bool _IsNewBookshelf = false)
    {
        RequestBookshelfNetMessage msg = new RequestBookshelfNetMessage();

        msg.BookshelfID    = _BookshelfID;
        msg.IsNewBookshelf = _IsNewBookshelf;

        msg.Send();
        return(msg);
    }
Esempio n. 7
0
    public static RequestBookshelfNetMessage Send(GameObject _TheObjectToView, string adminId, string adminToken)
    {
        RequestBookshelfNetMessage msg = new RequestBookshelfNetMessage();

        msg.TheObjectToView = _TheObjectToView.NetId();
        msg.AdminId         = adminId;
        msg.AdminToken      = adminToken;
        msg.Send();
        return(msg);
    }
Esempio n. 8
0
    public static RequestBookshelfNetMessage Send(ulong _BookshelfID, bool _IsNewBookshelf, string adminId, string adminToken)
    {
        RequestBookshelfNetMessage msg = new RequestBookshelfNetMessage();

        msg.BookshelfID    = _BookshelfID;
        msg.IsNewBookshelf = _IsNewBookshelf;
        msg.AdminId        = adminId;
        msg.AdminToken     = adminToken;
        msg.Send();
        return(msg);
    }
Esempio n. 9
0
 public void PageUp()
 {
     if (ListTop != 0)
     {
         BookshelfList[2].BookShelfView = BookshelfList[1].BookShelfView;
         BookshelfList[1].BookShelfView = BookshelfList[0].BookShelfView;
         ListTop--;
         ListBottom--;
         WaitingOn.Add(_BookShelfView.HeldShelfIDs[(int)ListTop].ID);
         IDToLocation[_BookShelfView.HeldShelfIDs[ListTop].ID] = 0;
         RequestBookshelfNetMessage.Send(_BookShelfView.HeldShelfIDs[ListTop].ID);
     }
 }
Esempio n. 10
0
 public void PageDown()
 {
     if (!(_BookShelfView.HeldShelfIDs.Length <= (ListBottom + 1)))
     {
         BookshelfList[0].BookShelfView = BookshelfList[1].BookShelfView;
         BookshelfList[1].BookShelfView = BookshelfList[2].BookShelfView;
         ListTop++;
         ListBottom++;
         WaitingOn.Add(_BookShelfView.HeldShelfIDs[(int)ListBottom].ID);
         IDToLocation[_BookShelfView.HeldShelfIDs[ListBottom].ID] = 2;
         RequestBookshelfNetMessage.Send(_BookShelfView.HeldShelfIDs[ListBottom].ID);
     }
 }
Esempio n. 11
0
 public void PageUp()
 {
     if (ListTop != 0)
     {
         BookshelfList[2].BookShelfView = BookshelfList[1].BookShelfView;
         BookshelfList[1].BookShelfView = BookshelfList[0].BookShelfView;
         ListTop--;
         ListBottom--;
         WaitingOn.Add(_BookShelfView.HeldShelfIDs[(int)ListTop].ID);
         IDToLocation[_BookShelfView.HeldShelfIDs[ListTop].ID] = 0;
         RequestBookshelfNetMessage.Send(_BookShelfView.HeldShelfIDs[ListTop].ID,
                                         false, ServerData.UserID, PlayerList.Instance.AdminToken);
     }
 }
Esempio n. 12
0
 public void PageDown()
 {
     if (_BookShelfView != null && _BookShelfView.HeldShelfIDs != null && !(_BookShelfView.HeldShelfIDs.Length <= (ListBottom + 1)))
     {
         BookshelfList[0].BookShelfView = BookshelfList[1].BookShelfView;
         BookshelfList[1].BookShelfView = BookshelfList[2].BookShelfView;
         ListTop++;
         ListBottom++;
         WaitingOn.Add(_BookShelfView.HeldShelfIDs[(int)ListBottom].ID);
         IDToLocation[_BookShelfView.HeldShelfIDs[ListBottom].ID] = 2;
         RequestBookshelfNetMessage.Send(_BookShelfView.HeldShelfIDs[ListBottom].ID, false,
                                         ServerData.UserID, PlayerList.Instance.AdminToken);
     }
 }
Esempio n. 13
0
 public void OpenBookshelf()
 {
     RequestBookshelfNetMessage.Send(_IDANName.ID, true);
 }
Esempio n. 14
0
 public void GoToObscuringBookshelf()
 {
     RequestBookshelfNetMessage.Send(_BookShelfView.ID, true);
 }
Esempio n. 15
0
 public void OpenBookshelf()
 {
     RequestBookshelfNetMessage.Send(_IDANName.ID, true, ServerData.UserID, PlayerList.Instance.AdminToken);
 }
Esempio n. 16
0
 public void OpenShelf()
 {
     RequestBookshelfNetMessage.Send(Shelf.ID, true);
 }