示例#1
0
    public SelectorItem CreateSelectorItem(InteractiveObject interactiveObject)
    {
        Debug.Assert(!string.IsNullOrEmpty(interactiveObject.GetId()));
        Debug.Assert(!SelectorItems.ContainsKey(interactiveObject.GetId()));

        SelectorItem selectorItem = Instantiate(SelectorItemPrefab).GetComponentInChildren <SelectorItem>();

        selectorItem.SublistContent.SetActive(false);
        if (interactiveObject is ISubItem subItem)
        {
            InteractiveObject parent = subItem.GetParentObject();
            if (parent != null && parent.SelectorItem != null)
            {
                selectorItem.transform.SetParent(parent.SelectorItem.SublistContent.transform);
                parent.SelectorItem.AddChild(selectorItem);
            }
            else
            {
                throw new RequestFailedException("Trying to create subitem without parent item in list. This should not had happened, please report");
            }
        }
        else
        {
            selectorItem.transform.SetParent(ContentAlphabet.transform);
        }
        selectorItem.CollapsableButton.interactable = false;
        //selectorItem.gameObject.SetActive(false);
        selectorItem.SetText(interactiveObject.GetName());
        selectorItem.SetObject(interactiveObject, 0, iteration);
        SelectorItems.Add(interactiveObject.GetId(), selectorItem);
        if (ContainerAlphabet.activeSelf && ((GameManager.Instance.GetGameState() == GameStateEnum.SceneEditor && SceneManager.Instance.Valid) ||
                                             (GameManager.Instance.GetGameState() == GameStateEnum.ProjectEditor && ProjectManager.Instance.Valid))) // only sort when project / scene is fully loaded
        {
            SwitchToAlphabet(false);
        }

        selectorItem.transform.localScale = Vector3.one;
        selectorItem.CollapsableButton.gameObject.SetActive(!ContainerAim.activeSelf);
        return(selectorItem);
    }
示例#2
0
 public virtual void UpdateObjectName(string newUserId)
 {
     Data.Name = newUserId;
     SelectorItem.SetText(newUserId);
 }
示例#3
0
 public virtual void ActionUpdateBaseData(IO.Swagger.Model.BareAction action)
 {
     Data.Name = action.Name;
     SelectorItem.SetText(action.Name);
 }