뒤끝펑션 함수들 관리 관련 질문입니다

고객님의 문의에 답변하는 직원은 고객 여러분의 가족 중 한 사람일 수 있습니다.
고객의 언어폭력(비하, 조롱, 욕설, 협박, 성희롱 등)으로부터 직원을 보호하기 위해
관련 법에 따라 수사기관에 필요한 조치를 요구할 수 있으며, 형법에 의해 처벌 대상이 될 수 있습니다.

커뮤니티 이용 정책에 위배되는 게시물을 작성할 경우, 별도 안내 없이 게시물 삭제 또는 커뮤니티 이용이 제한될 수 있습니다.

문의 응대 : 평일 오전 10시 ~ 오후 6시
문의를 남기실 경우 다음 항목을 작성해 주세요.
정보가 부족하거나 응대시간 외 문의하는 경우 확인 및 답변이 지연될 수 있습니다.

  • 뒤끝 SDK 버전 :
  • 프로젝트명 :
  • 스테이터스 코드 :
  • 에러 코드 :
  • 에러 메시지 :

뒤끝 탬플릿에서 Function.cs 스크립트 안에 작성하도록 되어있는데요,

만약 함수를 여러개 작성해야하는경우 스크립트를 어떻게 늘릴 수 있나요? ( 늘릴 수 있나요? )

만약 늘릴 수 있다면, 늘어난 함수들을 수정했을 때 빌드를 스크립트별로 하나씩 해야하나요? 아니면 프로젝트 단위로

한번에 업로드 되나요?

펑션 스크립트 관리 관련하여 가이드가 있으면 링크도 부탁드리겠습니다

안녕하세요 개발자님,
뒤끝펑션의 스크립트 관리에 대한 가이드 문서는 제공되지 않고 있습니다.

유니티에서 뒤끝펑션으로 요청을 보낼 때 보내는 인자에 따라 다른 동작을 하도록 작성하여 이용해 주시면 됩니다.

string functionName = Backend.Content["functionName"].ToString();
switch(functionName) {
    case "GameDataInsert" :
         GameDataInsert();
    break;
    case "GetChart" :
         GetChart();
    break;
}

함수 관리의 경우 BFunc 클래스를 partial로 변경하여
다른 스크립트 BFunc_GameData.cs, BFunc_Chart.cs 등에서도 BFunc 클래스의 함수를 추가할 수 있도록 설정하는 방법을 추천드립니다.

네 가이드 감사합니다

만약에 BFunc_xx.cs 스크립트를 여러개 만들어서 관리하는 경우
배포를 해야할 때 모든 .cs 스크립트들이 한번에 배포 되나요? 아니면 수정한 스크립트들 별개로 하나씩 배포 해야 하나요?

뒤끝펑션 내부에 있는 모든 스크립트가 한번에 zip 형태로 압축되어 등록이 되고,
그 중에서 BFunc 클래스의 Stream Function 함수가 호출됩니다.

앞서 답변드렸던 스크립트 관련 추가 예시 공유드립니다.

using Amazon.Lambda.Core;
using BackEnd;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Collections.Generic;
using LitJson;

[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]

namespace BackendFunction {
    public class Data
    {
        public int atk { get; set; }
        public int def { get; set; }
    }
	public partial class BFunc {
		public Stream Function(Stream stream, ILambdaContext context) {
			string returnValue = string.Empty;
			DateTime startTime = DateTime.Now;
			string totalTime = string.Empty;
			try {
				// Initialize BackendFunction API
				Backend.Initialize(ref stream);

				string functionType = Backend.Content["functionType"].ToString();

				switch (functionType) {
					case "Create": {
							Insert(ref returnValue);
							break;
						}
					case "Read": {
							Get(ref returnValue);
							break;
						}

					case "Update": {
							Update(ref returnValue);
							break;
						}
					case "Delete": {
							Delete(ref returnValue);
							break;
						}
					case "CRUD": {
							Insert(ref returnValue);
							Get(ref returnValue);
							Update(ref returnValue);
							Delete(ref returnValue);
							break;
						}
                    case "Chart" : {
                            ChartManager.GetChart(ref returnValue);
                            break;
                        }
                    case "ClearChart" : {
                            ChartManager.GetChartClear(ref returnValue);
                            break;
                        }
                    case "BuyItem" : {
                            ChartManager.GetChart(ref returnValue);
                            BuyItem(ref returnValue);
							Insert(ref returnValue);
                            break;
                        }
					default: {
							returnValue += ReturnErrorObject("functionType is not valid").ToString();
							break;
						}

				}
			}
			catch (Exception e) {
				totalTime = (DateTime.Now - startTime).TotalMilliseconds + "ms";
				return ReturnErrorObject($"totalTimeException " + e.ToString());
			}

			totalTime = (DateTime.Now - startTime).TotalMilliseconds + "ms";
			return Backend.StringToStream($"{totalTime}ms\n" + returnValue);
		}

		static Stream ReturnErrorObject(string err) {
			JObject error = new JObject();
			error.Add("error", err);

			return Backend.JsonToStream(error.ToString());
		}
	}
}




CRUD.cs

using Amazon.Lambda.Core;
using BackEnd;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Collections.Generic;
using LitJson;

namespace BackendFunction {

	public partial class BFunc {
		public void Insert(ref string returnValue) {

		}

		public void Get(ref string returnValue) {

		}

		public void Update(	ref string returnValue) {

		}

		public void Delete(	ref string returnValue) {

		}
	}
}

감사합니다!!! :)

좋아요 1