초기커밋
This commit is contained in:
119
GameServer/Global/Ugq/UgqApiHelper.cs
Normal file
119
GameServer/Global/Ugq/UgqApiHelper.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using ServerCore; using ServerBase;
|
||||
using StackExchange.Redis;
|
||||
|
||||
|
||||
using UGQDatabase.Models;
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public static class UgqApiHelper
|
||||
{
|
||||
public static UgqUICategoryGradeType convertSearchCategoryTypeToUICategoryGradeType(UgqSearchCategoryType searchCategoryType)
|
||||
{
|
||||
switch (searchCategoryType)
|
||||
{
|
||||
case UgqSearchCategoryType.None:
|
||||
case UgqSearchCategoryType.SpotLight:
|
||||
return global::UgqUICategoryGradeType.None;
|
||||
|
||||
case UgqSearchCategoryType.GradeAmateur:
|
||||
return global::UgqUICategoryGradeType.Amateur;
|
||||
|
||||
case UgqSearchCategoryType.GradeRisingStar:
|
||||
return global::UgqUICategoryGradeType.RisingStar;
|
||||
|
||||
case UgqSearchCategoryType.GradeMaster:
|
||||
return global::UgqUICategoryGradeType.Master;
|
||||
|
||||
default:
|
||||
return global::UgqUICategoryGradeType.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> makeDictionaryFromSearchQuestBoard(Int32 pageNumber, UgqUICategoryGradeType gradeType,
|
||||
UgqSearchType searchType, string searchText, UgqSortType sortType, LanguageType languageType, Int32 pageSize)
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("pageNumber", pageNumber.ToString());
|
||||
dict.Add("pageSize", pageSize.ToString());
|
||||
dict.Add("gradeType", gradeType.ToString());
|
||||
dict.Add("searchType", searchType.ToString());
|
||||
dict.Add("searchText", WebUtility.UrlEncode(searchText));
|
||||
dict.Add("sortType", sortType.ToString());
|
||||
dict.Add("accept-language", languageType.ToString());
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> makeDictionaryForUgqQuestId(UInt32 questId, UInt32 questRevision)
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("questId", questId.ToString());
|
||||
dict.Add("revision", questRevision.ToString());
|
||||
//dict.Add("accept-language", languageType.ToString());
|
||||
return dict;
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> makeDictionaryForUgqByState(UInt32 questId, UInt32 questRevision, QuestContentState state)
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("questId", questId.ToString());
|
||||
dict.Add("revision", questRevision.ToString());
|
||||
dict.Add("state", state.ToString());
|
||||
return dict;
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> makeDictionaryForQuestId(UInt32 questId, LanguageType languageType)
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("questId", questId.ToString());
|
||||
dict.Add("accept-language", languageType.ToString());
|
||||
return dict;
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> makeDictionaryFromLanguageType(LanguageType languageType)
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("accept-language", languageType.ToString());
|
||||
return dict;
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> makeDictionaryFromLanguageTypeWithMediaType(LanguageType languageType)
|
||||
{
|
||||
//languageType이 숫자로 되어 있어서 이걸 언어 스트링으로 바꿔줘야 되는데. 방법을 아직 모르겠다 ,우선 분기처리
|
||||
// 왜 int도 아니고 enum도 아니고, 숫자로 표시?
|
||||
var typestr = LanguageType.En.ToString();
|
||||
|
||||
if (0 == (int)languageType || (int)languageType == 2)
|
||||
{
|
||||
typestr = LanguageType.En.ToString();
|
||||
}
|
||||
if (1 == (int)languageType)
|
||||
{
|
||||
typestr = LanguageType.Ko.ToString();
|
||||
}
|
||||
if (4 == (int)languageType)
|
||||
{
|
||||
typestr = LanguageType.Ja.ToString();
|
||||
}
|
||||
|
||||
Dictionary<string, string> dict = new();
|
||||
dict.Add("accept-language", typestr);
|
||||
dict.Add("mediaType", "application/json");
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user