コード例 #1
0
ファイル: Assets.cs プロジェクト: Hertzole/unity-sdk
        void PopulateAssets(string search = null)
        {
            LootLockerSDKAdminManager.DebugMessage("Getting assets..");

            currentView = LootLockerView.Loading;

            LootLockerSDKAdminManager.GetAssets((response) =>
            {
                LootLockerSDKAdminManager.GetContexts((contextResponse) =>
                {
                    if (contextResponse.success)
                    {
                        Contexts     = contextResponse.Contexts;
                        ContextNames = Contexts.Select(x => x.name).ToArray();
                        LootLockerSDKAdminManager.DebugMessage("Successful got all contexts: " + contextResponse.text);
                    }
                    else
                    {
                        LootLockerSDKAdminManager.DebugMessage("failed to get all contexts: " + contextResponse.Error, true);
                    }

                    if (response.success)
                    {
                        assetsResponse = response;
                        currentView    = LootLockerView.Assets;
                        Repaint();
                        LootLockerSDKAdminManager.DebugMessage("Successful got all assets: " + response.text);
                    }
                    else
                    {
                        LootLockerSDKAdminManager.DebugMessage("failed to get all assets: " + response.Error, true);
                    }
                });
            }, search);
        }
コード例 #2
0
        void PopulateFiles()
        {
            Debug.Log("Getting files..");
            LootLockerSDKAdminManager.GetFiles(LootLocker.Admin.Requests.LootLockerFileFilterType.none, (response) =>
            {
                Debug.Log("files on complete");
                if (response.success)
                {
                    LootLockerSDKAdminManager.GetAssets((assetssResponse) =>
                    {
                        LootLockerSDKAdminManager.GetContexts((contextResponse) =>
                        {
                            if (contextResponse.success)
                            {
                                Contexts     = contextResponse.Contexts;
                                ContextNames = Contexts.Select(x => x.name).ToArray();
                                Debug.Log("Successful got all contexts: " + contextResponse.text);
                            }
                            else
                            {
                                Debug.LogError("failed to get all contexts: " + contextResponse.Error);
                            }

                            if (assetssResponse.success)
                            {
                                assetsResponse = assetssResponse;
                                Debug.Log("Successful got all assets: " + response.text);
                            }
                            else
                            {
                                Debug.LogError("failed to get all assets: " + response.Error);
                            }
                        });
                    });

                    getFilesResponse = response;
                    currentView      = LootLockerView.Files;
                    Repaint();
                    Debug.Log("Successful got all files: " + response.text);
                }
                else
                {
                    Debug.LogError("failed to get all files: " + response.Error);
                }

                // getFilesResponse = new GetFilesResponse()
                // {
                //     success = true,
                //     files = new File[]
                //     {
                //         new File()
                //         {
                //             name = "testName1",
                //             id = 2,
                //         },
                //         new File()
                //         {
                //             name = "testName2",
                //             id = 3,
                //             tags = new string[]{"tag1" , "tag2" , "tag3" },
                //         },
                //         new File()
                //         {
                //             name = "testName3",
                //             id = 4,
                //         },
                //         new File()
                //         {
                //             name = "testName4",
                //             id = 5,
                //             tags = new string[]{"tag1" , "tag2"  },
                //         },
                //         new File()
                //         {
                //             name = "testName5",
                //             id = 6,
                //         },

                //     }
                // };

                // currentView = View.Files;
                // Repaint();
                // DestroyImmediate(ServerAPI.Instance.gameObject);
                // ServerAPI.ResetManager();
                // Debug.Log("Successful got all files: " + response.text);
            });
        }