Exemple #1
0
        private async void GetDirectorScriptList(int page, int countPerPage, System.Action <bool, string> cbFinish)
        {
            Pagination <DcsDirecorScript> pageResult = null;
            DirectorApi api = new DirectorApi("https://Director." + AccountManager.Instance.RegionCode + ".datamesh.com");

            // 加载数据
            try
            {
                pageResult = await api.ListDcsScripts(
                    AccountManager.Instance.UserCredential.AccessKey,
                    AccountManager.Instance.UserCredential.AccessSecret,
                    "",
                    null,
                    null,
                    page,
                    countPerPage
                    );
            }
            catch (System.Exception e)
            {
                Debug.LogError(e);
                err = e.ToString();
            }


            if (err == null)
            {
                // 处理数据
                totalCount = pageResult.TotalHits;
                Debug.Log("Storage find " + pageResult.TotalHits + " item, Total Page: " + pageResult.TotalPage);

                listResult = new List <BaseDcsResource>();
                if (pageResult.Data != null)
                {
                    for (int i = 0; i < pageResult.Data.Length; i++)
                    {
                        listResult.Add(pageResult.Data[i]);
                    }
                }
            }

            MEHoloEntrance.Instance.Dispatch((param) =>
            {
                isBusy    = false;
                bool succ = (err == null);

                if (cbFinish != null)
                {
                    cbFinish(succ, err);
                }
            });
        }
        protected override void _TurnOn()
        {
            Utility.AppConfig config = Utility.AppConfig.Instance;
            config.LoadConfig(MEHoloConstant.NetworkConfigFile);
            serverHost = Utility.AppConfig.Instance.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Host", "127.0.0.1:8848");
            int.TryParse(Utility.AppConfig.Instance.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Port", "8848"), out serverPort);

            ui.TurnOn();

            Debug.Log("App[" + MEHoloEntrance.Instance.AppID + "] Get Storage From " + serverHost);
            //下面的暂时只能使用https:// 无法去掉
            assetAPI     = new AssetApi(serverHost, serverPort);
            recordingAPI = new RecordingApi(serverHost, serverPort);
            directorAPI  = new DirectorApi(serverHost, serverPort);

            downloadWorker = new BackgroundWorker();
            downloadWorker.StartWorker();
        }