コード例 #1
0
        private void Start()
        {
            inputField      = ComponentById <InputField>("ID_Input");
            outputText      = ComponentById <Text>("ID_Output");
            outputText.text = "Poly Toolkit v" + PtSettings.Version.ToString() + "\n" +
                              "Type 'help' for a list of commands.\n\n";

            ComponentById <Button>("ID_ClearButton").onClick.AddListener(() => { outputText.text = ""; });
            ComponentById <Button>("ID_RunButton").onClick.AddListener(SubmitCurrentCommand);
            ComponentById <Button>("ID_CopyButton").onClick.AddListener(() => {
                GUIUtility.systemCopyBuffer = outputText.text;
            });
            ComponentById <Button>("ID_ToggleTransparencyButton").onClick.AddListener(ToggleTransparency);
            userProfileImage = ComponentById <Image>("ID_UserProfileImage");
            userProfileImage.gameObject.SetActive(false);
            imageDisplay = ComponentById <Image>("ID_ImageDisplay");
            imageDisplay.gameObject.SetActive(false);

            // Subscribe to Unity log messages so we can show them.
            Application.logMessageReceivedThreaded += HandleLogThreaded;

            // Initialize Poly. We do this explicit initialization rather than have a PolyToolkitManager on the
            // scene because we want to use a specific API key that's not the one that's configured in PtSettings
            // (since we want to keep PtSettings uninitialized for the user to fill in).
            PolyApi.Init(new PolyAuthConfig(API_KEY, CLIENT_ID, CLIENT_SECRET));
        }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        if (!PolyApi.IsInitialized)
        {
            PolyApi.Init(authConfig, new PolyCacheConfig());
        }

        if (!Authenticator.IsInitialized)
        {
            Authenticator.Initialize(authConfig);
        }

        TestImport(kAssetIdFromPoly);
    }
コード例 #3
0
 /// <summary>
 /// Because Poly doesn't live in the Editor/ space (and couldn't, since it uses GameObjects and
 /// MonoBehaviours), it will die every time the user enters or exits play mode. This means
 /// that all of its state and objects will get wiped. So we have to check if it needs initialization
 /// every time we need to use it.
 /// </summary>
 public void EnsurePolyIsReady()
 {
     if (!PolyApi.IsInitialized)
     {
         PtDebug.Log("ABM: Initializing Poly.");
         // We need to set a service name for our auth config because we want to keep our auth credentials
         // separate in a different "silo", so they don't get confused with the runtime credentials
         // the user might be using in their project. Regular users would not set a service name, so they
         // use the default silo.
         authConfig.serviceName = "PolyToolkitEditor";
         PolyApi.Init(authConfig, cacheConfig);
         waitingForSilentAuth = true;
         //PolyApi.Authenticate(interactive: false, callback: (PolyStatus status) => {
         //  waitingForSilentAuth = false;
         //  OnSignInFinished(/* wasInteractive */ false, status);
         //});
     }
 }
コード例 #4
0
ファイル: PolyModule.cs プロジェクト: PushyPixels/EditorXR
 public void LoadModule()
 {
     PolyApi.Init(new PolyAuthConfig(Encoding.UTF8.GetString(Convert.FromBase64String(k_APIKey)), "", ""));
 }
コード例 #5
0
 void Awake()
 {
     PolyApi.Init(new PolyAuthConfig(Encoding.UTF8.GetString(Convert.FromBase64String(k_APIKey)), "", ""));
     m_Container = ObjectUtils.CreateEmptyGameObject("Poly Prefabs", transform).transform;
 }