Exemplo n.º 1
0
    public void Setup()
    {
        Util.FindIfNotSet(this, ref hudManager);
        creationLibrary = Instantiate(creationLibraryPrefab, rectTransform);
        logicSidebar    = Instantiate(logicPrefab, rectTransform);
        terrainSidebar  = Instantiate(terrainToolSettingsPrefab, rectTransform);

        creationLibrary.Setup(this);
        logicSidebar.Setup(this);
        terrainSidebar.Setup(this);
    }
Exemplo n.º 2
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();
    }
Exemplo n.º 3
0
    static void ImportActor(CommandTerminal.CommandArg[] args)
    {
        CreationLibrarySidebar inst = GameObject.FindObjectOfType <CreationLibrarySidebar>();

        if (inst == null)
        {
            GameBuilderConsoleCommands.Log($"Please open the custom actor library (via Creation Library) before using this command.");
            return;
        }
        string path = GameBuilderConsoleCommands.JoinTailToPath(args);

        if (path != null)
        {
            inst.ImportFromPath(path);
        }
    }
Exemplo n.º 4
0
    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();
    }