
public class MemKey_Cfg {
    /// <summary>
    /// GM号列表
    /// </summary>
    /// <returns></returns>
    public static readonly string GM_uids_hash = "gamecfg-GM_uids";
    
}
public class MemKey_Game
{
    #region"   世界 Boss    "

    /// <summary>
    /// 世界boss,按照小时分场次
    /// </summary>
    /// <param name="zoneid"></param>
    /// <param name="uid"></param>
    /// <returns></returns>
    public static string BossFight_Damage_byDateHour_zset(int zoneid,int  bossid, string dateHour)
    {
        return $"gamerun-BossFight-byDateHour-zone{zoneid}-boss{bossid}-{dateHour}";
    }

    #endregion

    #region '   公会   '
    /// <summary>
    /// 公会
    /// </summary>
    /// <param name="zoneid"></param>
    /// <param name="guildId"></param>
    /// <returns></returns>
    public static string Guild(int zoneid,int guildId) => $"guild-{guildId}-zone{zoneid}";

    public static string Build()
    {
        return "gamecfg-build";
    }

    #endregion
}

public class MemKey_User
{

    #region"    辅助方法  "

    /// <summary>
    /// 是否使用短名称
    /// </summary>
    /// <returns></returns>
    private static bool bUseShort()
    {
        //        return true;  # 全部启用
        return Config.GameOnline;
    }

    /// <summary>
    /// key前缀
    /// </summary>
    /// <param name="zoneid"></param>
    /// <param name="uid"></param>
    /// <returns></returns>
    private static string Key_(int zoneid, string uid)
    {
        return bUseShort() ? $"u-{uid}-{zoneid}" : $"user-{uid}-zone{zoneid}";
    }

    #endregion

    #region"    Mail 邮件    "

    /// <summary>
    /// 玩家邮件 - 当前的maxid
    /// </summary>
    /// <param name="zoneid"></param>
    /// <param name="uid"></param>
    /// <returns></returns>
    public static string Mail_CurId_int(int zoneid, string uid)
    {
        return Key_(zoneid, uid) + (bUseShort() ? "-m-ci" : "-mail-curid");
    }

    /// <summary>
    /// 玩家邮件 - 已领取到的系统邮件id集合
    /// </summary>
    /// <param name="zoneid"></param>
    /// <param name="uid"></param>
    /// <returns></returns>
    public static string Mail_SysRecord_set(int zoneid, string uid)
    {
        return Key_(zoneid, uid) + (bUseShort() ? "-m-s" : "-mail-sysrecord");
    }

    /// <summary>
    /// 玩家邮件 - 邮件列表
    /// </summary>
    /// <param name="zoneid"></param>
    /// <param name="uid"></param>
    /// <returns></returns>
    public static string Mail_Queue_hash(int zoneid, string uid)
    {
        return Key_(zoneid, uid) + (bUseShort() ? "-m-q" : "-mail-queue");
    }

    #endregion

    #region '   公会  '
    /// <summary>
    /// 玩家公会信息
    /// </summary>
    /// <param name="uid"></param>
    /// <param name="zoneid"></param>
    /// <returns></returns>
    public static string Guild(string uid, int zoneid) => $"{Key_(zoneid, uid)}-guild";
   
    public static string gameInfo(string uid, int zoneid)
    {
        return bUseShort() ? Key_(zoneid, uid) + "-g" : Key_(zoneid, uid) + "-gameinfo";
    }
    #endregion
}

/// <summary>
/// 统计memkey
/// </summary>
public class MemKey_Statistics
{
    /// <summary>
    /// 游戏所有的区
    /// </summary>
    /// <returns></returns>
    public static string Zonelist()
    {
        return "gamecfg-zonelist";
    }


    /// <summary>
    /// 经验 金币钻石统计信息
    /// </summary>
    /// <param name="uid"></param>
    /// <param name="zoneid"></param>
    /// <returns></returns>
    public static string UserBaseParams(string uid,int zoneid)
    {
        return "userbaseParams-"+ uid + "-"+ zoneid;
    }

    public static string GamerunLoginUser(int zoneid,float day)
    {
        return "gamerun-loginUser-byUid-zone"+zoneid+"-day_"+day;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="uid"></param>
    /// <param name="zoneid"></param>
    /// <returns></returns>
    public static string SelfTaskDataCollect(string uid,int zoneid)
    {
        return "SelfTaskDataCollect-" + uid + "-" + zoneid;
    }

    /// <summary>
    /// TaskDataCollect
    /// </summary>
    /// <param name="zoneid"></param>
    /// <returns></returns>
    public static string TaskDataCollect(int zoneid)
    {
        return "TaskDataCollect-"+ zoneid;
    }

    /// <summary>
    /// 流失玩家的指标的统计
    /// </summary>
    /// <param name="zoneid"></param>
    /// <returns></returns>
    public static string LoseUserKeyCount(int type,int zoneid,float day)
    {
        string key = "LoseUserKeyCount-" + type + "lose-" +"zone"+zoneid + "-" + day;       
        return key;
    }

    public static string userNumRecord(int zoneid)
    {
        return "loginUserNum-zone" + zoneid;
    }

    public static string TargetStatistics(int zoneid)
    {
        return "TargetStatistics-" + zoneid;
    }
}