Beispiel #1
0
    public override void Launch(EditMain _editmain)
    {
        base.Launch(_editmain);

        creationLibrary              = editMain.GetCreationLibrarySidebar();
        creationLibrary.updateAsset += UpdateAsset;
        UpdateAsset(creationLibrary.GetLastResult());
        creationLibrary.RequestOpen();
        createToolRay.SetLocalRayOriginTransform(emissionAnchor);
        createToolRay.SetTint(editMain.GetAvatarTint());
        createToolPreview.SetTint(editMain.GetAvatarTint());
        editMain.TryEscapeOutOfCameraView();
    }
    public void Setup(CreationLibrarySidebar creationLibrary)
    {
        this.creationLibrary = creationLibrary;
        for (int i = 0; i < ASSET_COUNT; i++)
        {
            int index = i;
            toolbarItems[i].SetSelect(false);
            toolbarItems[i].GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => OnMenuItemClick?.Invoke(index));
        }

        assetObjectsParent = new GameObject("assetObjects").transform;
        assetToolbarAssets = new ActorableSearchResult[ASSET_COUNT];

        moreButton.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() =>
        {
            if (creationLibrary.IsOpenedOrOpening())
            {
                creationLibrary.RequestClose();
            }
            else
            {
                creationLibrary.RequestOpen();
            }
        });
        Util.FindIfNotSet(this, ref assetSearch);

        OnMenuItemClick = SelectIndex;

        assetToolbarRenderables = new GameObject[ASSET_COUNT];
        assetToolbarObjects     = new GameObject[ASSET_COUNT];
        for (int i = 0; i < assetToolbarObjects.Length; i++)
        {
            assetToolbarObjects[i] = new GameObject("new tool item");
            assetToolbarObjects[i].transform.SetParent(assetObjectsParent);
            assetToolbarObjects[i].transform.localPosition = Vector3.zero;
            assetToolbarObjects[i].transform.localRotation = Quaternion.identity;
            assetToolbarObjects[i].transform.localScale    = new Vector3(1f, 1f, 1f);
            assetToolbarObjects[i].SetActive(false);
        }

        //load the toolbar with goodstuff by hand for now
        LoadDefaultAssets();
    }