초기커밋
This commit is contained in:
26
UGQApiServer/Converter/ConverterCommon.cs
Normal file
26
UGQApiServer/Converter/ConverterCommon.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using UGQDatabase.Models;
|
||||
|
||||
namespace UGQApiServer.Converter;
|
||||
|
||||
public static class ConverterCommon
|
||||
{
|
||||
public static List<string> buildLanguages(TextEntity titleText)
|
||||
{
|
||||
List<string> languages = new List<string>();
|
||||
|
||||
if (string.IsNullOrEmpty(titleText.En) == false)
|
||||
languages.Add("en");
|
||||
|
||||
if (string.IsNullOrEmpty(titleText.Kr) == false)
|
||||
languages.Add("kr");
|
||||
|
||||
if (string.IsNullOrEmpty(titleText.Jp) == false)
|
||||
languages.Add("jp");
|
||||
|
||||
if (languages.Count == 0)
|
||||
languages.Add("en");
|
||||
|
||||
return languages;
|
||||
}
|
||||
|
||||
}
|
||||
179
UGQApiServer/Converter/InGameConverter.cs
Normal file
179
UGQApiServer/Converter/InGameConverter.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using ServerCommon;
|
||||
using ServerCommon.UGQ.Models;
|
||||
using UGQApiServer.Storage;
|
||||
using UGQApiServer.UGQData;
|
||||
using UGQDataAccess.Repository.Models;
|
||||
using UGQDatabase.Models;
|
||||
|
||||
namespace UGQApiServer.Converter;
|
||||
|
||||
|
||||
public enum ImageUrlType
|
||||
{
|
||||
TitleImg,
|
||||
BannerImg,
|
||||
}
|
||||
|
||||
public static class InGameConverter
|
||||
{
|
||||
static IStorageService _storageService = null!;
|
||||
static UGQMetaData _ugqMetadata = null!;
|
||||
|
||||
public static void init(IStorageService storageService, UGQMetaData ugqMetadata)
|
||||
{
|
||||
_storageService = storageService;
|
||||
_ugqMetadata = ugqMetadata;
|
||||
}
|
||||
|
||||
|
||||
static BoolType ToProto(this bool value)
|
||||
{
|
||||
return (value == true) ? BoolType.True : BoolType.False;
|
||||
}
|
||||
|
||||
public static string GetLangText(this TextEntity entity, LangEnum langEnum)
|
||||
{
|
||||
string text = string.Empty;
|
||||
switch(langEnum)
|
||||
{
|
||||
case LangEnum.Ko:
|
||||
text = entity.Kr;
|
||||
break;
|
||||
case LangEnum.Jp:
|
||||
text = entity.Jp;
|
||||
break;
|
||||
case LangEnum.En:
|
||||
text = entity.En;
|
||||
break;
|
||||
}
|
||||
|
||||
if (text == string.Empty)
|
||||
text = entity.En;
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static UgqQuestInTestState ToProtoUgqQuestInTestState(this QuestContentEntity result, LangEnum langEnum, ImageUrlType ImgUrlType)
|
||||
{
|
||||
string ImagePath = "";
|
||||
if (ImgUrlType == ImageUrlType.TitleImg)
|
||||
ImagePath = _storageService.fileUrl(result.TitleImagePath);
|
||||
else if (ImgUrlType == ImageUrlType.BannerImg)
|
||||
ImagePath = _storageService.fileUrl(result.BannerImagePath);
|
||||
|
||||
return new UgqQuestInTestState
|
||||
{
|
||||
//ComposedQuestId = result.QuestId << 32 | result.Revision,
|
||||
ComposedQuestId = QuestHelper.convertQuestIdAndRevisionToUgqQuestId((UInt32)result.QuestId, (UInt32)result.Revision),
|
||||
Title = result.Title.GetLangText(langEnum),
|
||||
TitleImagePath = ImagePath,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static UgqBoardSearchResult ToProto(this QuestBoardQueryResult result, LangEnum langEnum, ImageUrlType ImgUrlType)
|
||||
{
|
||||
return new UgqBoardSearchResult
|
||||
{
|
||||
PageNumber = result.PageNumber,
|
||||
PageSize = result.PageSize,
|
||||
TotalPages = result.TotalPages,
|
||||
Items = { result.Items.Select(x => x.ToProto(langEnum, ImgUrlType)).ToList() }
|
||||
};
|
||||
}
|
||||
|
||||
public static UgqBoardSportlightResult ToProto(this QuestBoardSportlightQueryResult result, LangEnum langEnum, ImageUrlType ImgUrlType)
|
||||
{
|
||||
return new UgqBoardSportlightResult
|
||||
{
|
||||
MostLiked = new DateRangeUgqBoardItem
|
||||
{
|
||||
Today = result.MostLiked.Today?.ToProto(langEnum, ImgUrlType),
|
||||
ThisWeek = result.MostLiked.ThisWeek?.ToProto(langEnum, ImgUrlType),
|
||||
ThisMonth = result.MostLiked.ThisMonth?.ToProto(langEnum, ImgUrlType),
|
||||
},
|
||||
MostBookmarked = new DateRangeUgqBoardItem
|
||||
{
|
||||
Today = result.MostBookmarked.Today?.ToProto(langEnum, ImgUrlType),
|
||||
ThisWeek = result.MostBookmarked.ThisWeek?.ToProto(langEnum, ImgUrlType),
|
||||
ThisMonth = result.MostBookmarked.ThisMonth?.ToProto(langEnum, ImgUrlType),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static UgqBoardItem ToProto(this QuestBoardItemResult result, LangEnum langEnum, ImageUrlType ImgUrlType)
|
||||
{
|
||||
var compoesed_quest_id = QuestHelper.convertQuestIdAndRevisionToUgqQuestId((UInt32)result.QuestId, (UInt32)result.Revision);
|
||||
string ImagePath = "";
|
||||
if (ImgUrlType == ImageUrlType.TitleImg)
|
||||
ImagePath = _storageService.fileUrl(result.TitleImagePath);
|
||||
else if (ImgUrlType == ImageUrlType.BannerImg)
|
||||
ImagePath = _storageService.fileUrl(result.BannerImagePath);
|
||||
|
||||
return new UgqBoardItem
|
||||
{
|
||||
//ComposedQuestId = result.QuestId << 32 | result.Revision,
|
||||
ComposedQuestId = compoesed_quest_id,
|
||||
Title = result.Title.GetLangText(langEnum),
|
||||
TitleImagePath = ImagePath,
|
||||
LikeCount = result.LikeCount,
|
||||
BookmarkCount = result.BookmarkCount,
|
||||
Author = result.Author ?? "",
|
||||
GradeType = result.GradeType,
|
||||
Cost = result.Cost,
|
||||
};
|
||||
}
|
||||
|
||||
public static UgqBoardItemDetail ToProto(this QuestBoardDetailItemResult result, LangEnum langEnum, ImageUrlType ImgUrlType)
|
||||
{
|
||||
string beaconName = "";
|
||||
|
||||
if (result.BeaconId != 0)
|
||||
beaconName = _ugqMetadata.getBeaconName((int)result.BeaconId, langEnum);
|
||||
else if (result.UgcBeaconNickname != null)
|
||||
beaconName = result.UgcBeaconNickname;
|
||||
|
||||
string ImagePath = "";
|
||||
if (ImgUrlType == ImageUrlType.TitleImg)
|
||||
ImagePath = _storageService.fileUrl(result.TitleImagePath);
|
||||
else if (ImgUrlType == ImageUrlType.BannerImg)
|
||||
ImagePath = _storageService.fileUrl(result.BannerImagePath);
|
||||
|
||||
var compoesed_quest_id = QuestHelper.convertQuestIdAndRevisionToUgqQuestId((UInt32)result.QuestId, (UInt32)result.Revision);
|
||||
return new UgqBoardItemDetail
|
||||
{
|
||||
ComposedQuestId = compoesed_quest_id,
|
||||
Title = result.Title.GetLangText(langEnum),
|
||||
TitleImagePath = ImagePath,
|
||||
LikeCount = result.LikeCount,
|
||||
BookmarkCount = result.BookmarkCount,
|
||||
AcceptCount = result.QuestAcceptedCount,
|
||||
CompleteCount = result.QuestCompletedCount,
|
||||
Author = result.Author ?? "",
|
||||
Description = result.Description.GetLangText(langEnum),
|
||||
Langs = { ConverterCommon.buildLanguages(result.Title) },
|
||||
Beacon = beaconName,
|
||||
Liked = result.Liked.ToProto(),
|
||||
Bookmarked = result.Bookmarked.ToProto(),
|
||||
GradeType = result.GradeType,
|
||||
Cost = result.Cost,
|
||||
};
|
||||
}
|
||||
|
||||
public static GameQuestDataSimple ToSimpleDTO(this GameQuestDataEntity entity)
|
||||
{
|
||||
return new GameQuestDataSimple
|
||||
{
|
||||
QuestId = entity.QuestId,
|
||||
Revision = entity.Revision,
|
||||
UserGuid = entity.UserGuid,
|
||||
Author = entity.Author ?? "",
|
||||
Title = entity.Title,
|
||||
GradeType = entity.GradeType,
|
||||
State = entity.State,
|
||||
Cost = entity.Cost,
|
||||
Shutdown = entity.Shutdown,
|
||||
};
|
||||
}
|
||||
}
|
||||
282
UGQApiServer/Converter/UGQConveter.cs
Normal file
282
UGQApiServer/Converter/UGQConveter.cs
Normal file
@@ -0,0 +1,282 @@
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Amazon.S3.Model;
|
||||
|
||||
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using UGQDataAccess.Repository.Models;
|
||||
using UGQApiServer.Models;
|
||||
using UGQDatabase.Models;
|
||||
using UGQApiServer.Storage;
|
||||
using UGQApiServer.UGQData;
|
||||
using UGQDataAccess.Service;
|
||||
|
||||
|
||||
namespace UGQApiServer.Converter;
|
||||
|
||||
|
||||
public static class UGQConverter
|
||||
{
|
||||
static IStorageService _storageService = null!;
|
||||
static UGQMetaData _ugqMetadata = null!;
|
||||
|
||||
public static void init(IStorageService storageService, UGQMetaData ugqMetadata)
|
||||
{
|
||||
_storageService = storageService;
|
||||
_ugqMetadata = ugqMetadata;
|
||||
}
|
||||
|
||||
public static UGQText ToDTO(this TextEntity entity)
|
||||
{
|
||||
return new UGQText
|
||||
{
|
||||
Kr = entity.Kr,
|
||||
En = entity.En,
|
||||
Jp = entity.Jp,
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQTask ToDTO(this TaskEntity entity, LangEnum langEnum)
|
||||
{
|
||||
return new UGQTask
|
||||
{
|
||||
GoalText = entity.GoalText.ToDTO(),
|
||||
ActionId = entity.ActionId,
|
||||
ActionValue = entity.ActionValue,
|
||||
IsShowNpcLocation = entity.IsShowNpcLocation,
|
||||
UgcActionValueGuid = entity.UgcActionValueGuid,
|
||||
UgcActionValueName = entity.UgcActionValueName,
|
||||
DialogId = entity.DialogId,
|
||||
|
||||
ActionName = _ugqMetadata.getTaskActionName(entity.ActionId, langEnum),
|
||||
ActionValueName = _ugqMetadata.getTaskActionValueName(entity.ActionId, entity.ActionValue, langEnum),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static UGQAccount ToDTO(this AccountEntity entity)
|
||||
{
|
||||
return new UGQAccount
|
||||
{
|
||||
UserGuid = entity.UserGuid,
|
||||
Nickname = entity.Nickname,
|
||||
AccountId = entity.AccountId ?? "",
|
||||
SlotCount = (MetaHelper.GameConfigMeta.UGQDefaultSlot + entity.AdditionalSlotCount),
|
||||
GradeType = entity.GradeType,
|
||||
CreatorPoint = entity.CreatorPoint,
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQAccountItem ToDTO(this AccountItemResult entity)
|
||||
{
|
||||
return new UGQAccountItem
|
||||
{
|
||||
UserGuid = entity.UserGuid,
|
||||
Nickname = entity.Nickname,
|
||||
AccountId = entity.AccountId ?? "",
|
||||
SlotCount = (MetaHelper.GameConfigMeta.UGQDefaultSlot + entity.AdditionalSlotCount),
|
||||
GradeType = entity.GradeType,
|
||||
CreatorPoint = entity.CreatorPoint,
|
||||
QuestCount = entity.QuestCount,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQQuestProfitStats ToDTO(this QuestProfitStatsItemResult result, LangEnum langEnum)
|
||||
{
|
||||
return new UGQQuestProfitStats
|
||||
{
|
||||
QuestContentId = result.QuestContentId,
|
||||
QuestId = result.QuestId,
|
||||
Revision = result.Revision,
|
||||
Title = result.Title.GetLangText(langEnum),
|
||||
TitleImagePath = _storageService.fileUrl(result.TitleImagePath),
|
||||
BannerImagePath = _storageService.fileUrl(result.BannerImagePath),
|
||||
Completed = result.CompletedCount,
|
||||
TotalProfit = result.TotalProfit,
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQDialogSequenceAction ToDTO(this DialogSequenceActionEntity entity, LangEnum langEnum)
|
||||
{
|
||||
return new UGQDialogSequenceAction
|
||||
{
|
||||
Talker = entity.Talker,
|
||||
Type = entity.Type,
|
||||
Talk = entity.Talk.ToDTO(),
|
||||
Condition = entity.Condition,
|
||||
ConditionValue = entity.ConditionValue,
|
||||
NextSequence = entity.NextSequence,
|
||||
NpcAction = entity.NpcAction,
|
||||
|
||||
TypeName = _ugqMetadata.getDialogTypeName(entity.Type, langEnum),
|
||||
ConditioneName = _ugqMetadata.getDialogConditionName(entity.Type, entity.Condition, langEnum),
|
||||
ConditioneValueName = _ugqMetadata.getDialogConditionValueName(entity.Type, entity.Condition, entity.ConditionValue, langEnum),
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQDialogSequence ToDTO(this DialogSequenceEntity entity, LangEnum langEnum)
|
||||
{
|
||||
return new UGQDialogSequence
|
||||
{
|
||||
SequenceId = entity.SequenceId,
|
||||
Actions = entity.Actions.Select(x => x.ToDTO(langEnum)).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQPresetImage ToDTO(this UGQPresetImageMetaData data)
|
||||
{
|
||||
return new UGQPresetImage
|
||||
{
|
||||
Id = data.Id,
|
||||
ImagePath = _storageService.fileUrl(data.FileName),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static UGQSummary ToDTO(this SummaryItemResult result, LangEnum langEnum)
|
||||
{
|
||||
string beaconName = "";
|
||||
|
||||
if (result.BeaconId != 0)
|
||||
beaconName = _ugqMetadata.getBeaconName(result.BeaconId, langEnum);
|
||||
else if (result.UgcBeaconNickname != null)
|
||||
beaconName = result.UgcBeaconNickname;
|
||||
|
||||
return new UGQSummary
|
||||
{
|
||||
QuestContentId = result.QuestContentId,
|
||||
QuestId = result.QuestId,
|
||||
Revision = result.Revision,
|
||||
|
||||
UserGuid = result.UserGuid,
|
||||
Author = result.Author,
|
||||
|
||||
BeaconId = result.BeaconId,
|
||||
UgcBeaconGuid = result.UgcBeaconGuid,
|
||||
|
||||
GradeType = result.GradeType,
|
||||
|
||||
Title = result.Title.GetLangText(Culture.ToLangEnum(result.Savelanguage)),
|
||||
Languages = ConverterCommon.buildLanguages(result.Title),
|
||||
TitleImagePath = _storageService.fileUrl(result.TitleImagePath),
|
||||
BannerImagePath = _storageService.fileUrl(result.BannerImagePath),
|
||||
Description = result.Description.GetLangText(Culture.ToLangEnum(result.Savelanguage)),
|
||||
State = result.State,
|
||||
Cost = result.Cost,
|
||||
UpdatedAt = result.UpdatedAt,
|
||||
CreatedAt = result.CreatedAt,
|
||||
Savelanguage = result.Savelanguage,
|
||||
|
||||
Stats = new UGQStats
|
||||
{
|
||||
Accepted = result.AcceptedCount,
|
||||
Completed = result.CompletedCount,
|
||||
Like = result.LikeCount,
|
||||
Bookmark = result.BookmarkCount,
|
||||
Report = result.ReportCount,
|
||||
TotalProfit = result.TotalProfit,
|
||||
},
|
||||
|
||||
BeaconName = beaconName,
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQContent ToDTO(this QuestContentEntity entity, LangEnum langEnum)
|
||||
{
|
||||
string beaconName = "";
|
||||
|
||||
if (entity.BeaconId != 0)
|
||||
beaconName = _ugqMetadata.getBeaconName(entity.BeaconId, langEnum);
|
||||
else if (entity.UgcBeaconNickname != null)
|
||||
beaconName = entity.UgcBeaconNickname;
|
||||
|
||||
return new UGQContent
|
||||
{
|
||||
QuestContentId = entity.Id,
|
||||
QuestId = entity.QuestId,
|
||||
Revision = entity.Revision,
|
||||
BeaconId = entity.BeaconId,
|
||||
UgcBeaconGuid = entity.UgcBeaconGuid,
|
||||
|
||||
GradeType = entity.GradeType,
|
||||
Title = entity.Title.ToDTO(),
|
||||
Languages = ConverterCommon.buildLanguages(entity.Title),
|
||||
TitleImagePath = _storageService.fileUrl(entity.TitleImagePath),
|
||||
BannerImagePath = _storageService.fileUrl(entity.BannerImagePath),
|
||||
Description = entity.Description.ToDTO(),
|
||||
State = entity.State,
|
||||
Cost = entity.Cost,
|
||||
Tasks = entity.Tasks.Select(x => x.ToDTO(langEnum)).ToList(),
|
||||
LastUpdated = entity.UpdatedAt,
|
||||
|
||||
BeaconName = beaconName,
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQDialog ToDTO(this QuestDialogEntity entity, LangEnum langEnum)
|
||||
{
|
||||
return new UGQDialog
|
||||
{
|
||||
DialogId = entity.Id,
|
||||
Sequences = entity.Sequences.Select(x => x.ToDTO(langEnum)).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQCreatorPointHistory ToDTO(this CreatorPointHistoryEntity entity, LangEnum langEnum)
|
||||
{
|
||||
return new UGQCreatorPointHistory
|
||||
{
|
||||
Kind = entity.Kind,
|
||||
Amount = entity.Amount,
|
||||
TotalAmount = entity.TotalAmount,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQCreatorPointHistoryResult ToDTO(this CreatorPointHistoryQueryResult result, LangEnum langEnum)
|
||||
{
|
||||
return new UGQCreatorPointHistoryResult
|
||||
{
|
||||
PageNumber = result.PageNumber,
|
||||
PageSize = result.PageSize,
|
||||
TotalPages = result.TotalPages,
|
||||
Items = result.Items.Select(x => x.ToDTO(langEnum)).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQReserveAccountGradeResult ToDTO(this ReserveAccountGradeEntity entity)
|
||||
{
|
||||
return new UGQReserveAccountGradeResult
|
||||
{
|
||||
ReserveId = entity.Id.ToString(),
|
||||
UserGuid = entity.UserGuid,
|
||||
CurrentGradeType = entity.BeforeGradeType,
|
||||
ReserveGradeType = entity.ReserveGradeType,
|
||||
ReserveTime = entity.ReserveTime,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
IsCompleted = entity.IsCompleted,
|
||||
};
|
||||
}
|
||||
|
||||
public static UGQReserveAccountGradeResult ToDTO(this ReserveAccountGradeItemResult entity)
|
||||
{
|
||||
return new UGQReserveAccountGradeResult
|
||||
{
|
||||
ReserveId = entity.ReserveId,
|
||||
UserGuid = entity.UserGuid,
|
||||
AccountId = entity.AccountId,
|
||||
CurrentGradeType = entity.CurrentGradeType,
|
||||
ReserveGradeType = entity.ReserveGradeType,
|
||||
ReserveTime = entity.ReserveTime,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
IsCompleted = entity.IsCompleted,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
154
UGQApiServer/Converter/UGQMetaDataConverter.cs
Normal file
154
UGQApiServer/Converter/UGQMetaDataConverter.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using UGQApiServer.Models;
|
||||
using UGQApiServer.UGQData;
|
||||
|
||||
|
||||
namespace UGQApiServer.Converter;
|
||||
|
||||
public static class UGQMetaDataConverter
|
||||
{
|
||||
public static UGQNpcMetaData ToNpcLocale(this UGQNpcMetaData npc, LangEnum langEnum)
|
||||
{
|
||||
if (npc.NpcId != null)
|
||||
{
|
||||
var text = UGQDataHelper.getText(langEnum, npc.NpcName);
|
||||
if (text != null)
|
||||
npc.NpcName = text;
|
||||
|
||||
var titleText = UGQDataHelper.getText(langEnum, npc.NpcTitle);
|
||||
if (titleText != null)
|
||||
npc.NpcTitle = titleText;
|
||||
}
|
||||
|
||||
return npc;
|
||||
}
|
||||
|
||||
public static TaskAction ToTaskAction(this UGQTaskAction action, LangEnum langEnum)
|
||||
{
|
||||
string actionName = action.ActionName;
|
||||
if (action.TextId != string.Empty)
|
||||
{
|
||||
var text = UGQDataHelper.getText(langEnum, action.TextId);
|
||||
if (text != null)
|
||||
actionName = text;
|
||||
}
|
||||
|
||||
return new TaskAction
|
||||
{
|
||||
ActionId = action.ActionId,
|
||||
ActionName = actionName,
|
||||
};
|
||||
}
|
||||
|
||||
public static TaskActionValue ToTaskActionValue(this UGQActionValue actionValue, LangEnum langEnum)
|
||||
{
|
||||
string valueName = actionValue.ValueName;
|
||||
if (actionValue.TextId != string.Empty)
|
||||
{
|
||||
var text = UGQDataHelper.getText(langEnum, actionValue.TextId);
|
||||
if (text != null)
|
||||
valueName = text;
|
||||
}
|
||||
|
||||
return new TaskActionValue
|
||||
{
|
||||
ValueId = actionValue.ValueId,
|
||||
UgcValueGuid = actionValue.UgcValueGuid,
|
||||
ValueName = valueName,
|
||||
};
|
||||
}
|
||||
|
||||
public static DialogType ToDialogType(this UGQDialogType dialogType, LangEnum langEnum)
|
||||
{
|
||||
string typeName = dialogType.TypeName;
|
||||
if (dialogType.TextId != string.Empty)
|
||||
{
|
||||
var text = UGQDataHelper.getText(langEnum, dialogType.TextId);
|
||||
if (text != null)
|
||||
typeName = text;
|
||||
}
|
||||
|
||||
return new DialogType
|
||||
{
|
||||
TypeId = dialogType.TypeId,
|
||||
TypeName = typeName,
|
||||
};
|
||||
}
|
||||
|
||||
public static DialogAction ToDialogAction(this UGQDialogCondition action, LangEnum langEnum)
|
||||
{
|
||||
string actionName = action.ConditionName;
|
||||
if (action.TextId != string.Empty)
|
||||
{
|
||||
var text = UGQDataHelper.getText(langEnum, action.TextId);
|
||||
if (text != null)
|
||||
actionName = text;
|
||||
}
|
||||
|
||||
return new DialogAction
|
||||
{
|
||||
ActionId = action.ConditionId,
|
||||
ActionName = actionName,
|
||||
};
|
||||
}
|
||||
|
||||
public static DialogActionValue ToDialogActionValue(this UGQActionValue actionValue, LangEnum langEnum)
|
||||
{
|
||||
string valueName = actionValue.ValueName;
|
||||
if (actionValue.TextId != string.Empty)
|
||||
{
|
||||
var text = UGQDataHelper.getText(langEnum, actionValue.TextId);
|
||||
if (text != null)
|
||||
valueName = text;
|
||||
}
|
||||
|
||||
return new DialogActionValue
|
||||
{
|
||||
ValueId = actionValue.ValueId,
|
||||
ValueName = valueName,
|
||||
};
|
||||
}
|
||||
public static NpcActionValue ToNpcActionValue(this UGQBeaconActionData npcAction, LangEnum langEnum)
|
||||
{
|
||||
string valueName = npcAction.Name;
|
||||
if (npcAction.Name != string.Empty)
|
||||
{
|
||||
var text = UGQDataHelper.getText(langEnum, npcAction.Name);
|
||||
if (text != null)
|
||||
valueName = text;
|
||||
}
|
||||
|
||||
return new NpcActionValue
|
||||
{
|
||||
Id = npcAction.Id,
|
||||
Name = valueName,
|
||||
FileName = npcAction.FileName,
|
||||
};
|
||||
}
|
||||
|
||||
public static MapDataValue ToMapDataValue(this ZoneMetaData zoneMetaData, LangEnum langEnum)
|
||||
{
|
||||
//string valueName = npcAction.zone_name;
|
||||
//if (npcAction.zone_name != string.Empty)
|
||||
//{
|
||||
// var text = UGQDataHelper.getText(langEnum, npcAction.zone_name);
|
||||
// if (text != null)
|
||||
// valueName = text;
|
||||
//}
|
||||
MetaData.Instance.UGQMapImageMetaDataListbyId.TryGetValue(zoneMetaData.Id, out var mapImageData);
|
||||
|
||||
return new MapDataValue
|
||||
{
|
||||
Id = zoneMetaData.Id,
|
||||
Name = zoneMetaData.zone_name,
|
||||
MapSize_X = zoneMetaData.mapDistance_x,
|
||||
MapSize_Y = zoneMetaData.mapDistance_y,
|
||||
ImageFileName = mapImageData == null ? string.Empty : mapImageData.FileName,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user