using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CloudGaming.DtoModel.Game
{
    /// <summary>
    /// 扩展类
    /// </summary>
    public static class GameInfoExtend
    {
        /// <summary>
        /// 转化游戏类
        /// </summary>
        /// <param name="gameList"></param>
        /// <param name="gameInfo"></param>
        /// <returns></returns>
        public static GameInfo ToGameInfo(this T_Game_List gameList, GameInfo? gameInfo = null)
        {
            if (gameInfo == null)
            {
                gameInfo = new GameInfo();
            }
            if (string.IsNullOrEmpty(gameInfo.GameName))
            {
                gameInfo.GameName = gameList.GameName;
            }
            if (string.IsNullOrEmpty(gameInfo.GameId))
            {
                gameInfo.GameId = gameList.GameId;
            }
            gameInfo.GamePeopleNum = gameList.GamePeopleNum;
            gameInfo.GameIsSaveFile = gameList.GameIsSaveFile;
            gameInfo.GameIsAdapter = gameList.GameIsAdapter;
            gameInfo.GameCloudId = gameList.GameCloudId;
            gameInfo.GameIntroduce = $"<div style=\"color:#ffffff  !important;\">{gameList.GameIntroduce}</div>";
            gameInfo.ScreenOrientation = gameList.ScreenOrientation;
            gameInfo.GameIsEditionMouse = gameList.GameIsEditionMouse;
            gameInfo.SteamId = gameList.SteamId;
            gameInfo.GameDifficulty = gameList.GameDifficulty;
            gameInfo.GameOperationModel = gameList.GameOperationModel;
            
            return gameInfo;
        }

    }
}
