コード例 #1
0
        private static void GetTutorial(string lessonId, Action <List <TutorialProgressStatus> > action)
        {
            var userId  = UnityConnectProxy.GetUserId();
            var getLink = @"/v1/users/" + userId + @"/lessons";
            var address = HostAddress + getLink;
            var req     = MakeGetLessonsRequest(address, lessonId);

            SendWebRequest(req, (UnityWebRequest r) =>
            {
                if (!IsRequestSuccess(r))
                {
                    return;
                }
                var lessonResponses = TutorialProgressStatus.ParseResponses(r.downloadHandler.text);
                action(lessonResponses);
            });
        }
コード例 #2
0
        public static void LogTutorialStatusUpdate(string lessonId, string lessonStatus)
        {
            var userId  = UnityConnectProxy.GetUserId();
            var getLink = @"/v1/users/" + userId + @"/lessons";
            var address = HostAddress + getLink;

            var jsonData = RegisterLessonRequest.GetJSONString(lessonStatus, userId, lessonId);
            var req      = UnityWebRequest.Post(address, jsonData);
            var data     = System.Text.Encoding.UTF8.GetBytes(jsonData);

            req.uploadHandler = new UploadHandlerRaw(data);

            req.SetRequestHeader("Content-Type", "application/json");
            req.SetRequestHeader("Authorization", "Bearer " + UnityConnectProxy.GetAccessToken());

            SendWebRequest(req, r =>
            {
                if (!IsRequestSuccess(r))
                {
                    return;
                }
            });
        }