Files
JJBB/Assets/Project/Script/Player/UserData/VipData.cs
2024-08-23 15:49:34 +08:00

124 lines
3.4 KiB
C#

using UnityEngine;
using System.Collections;
using GCGame.Table;
using System.Collections.Generic;
using System.Text;
using Games.GlobeDefine;
public class VipData
{
public static int m_MaxShowLevel = 12;
public static int GetVipLv()
{
return GameManager.gameManager.PlayerDataPool.VipCost;
}
public static void GetVipLevel(int nCost, ref int rLevel, ref int rLeft)
{
if (nCost < 0)
{
rLeft = 0;
rLevel = 0;
return;
}
var allData = TableManager.GetVipBook().Values;
foreach (var tBook in allData)
{
if (nCost < tBook.NeedPay)
{
rLeft = tBook.VipLevel;
rLevel = tBook.VipLevel;
}
}
}
public static string GetStarIconByLevel(int nLevel)
{
if (nLevel >= 1 && nLevel <= m_MaxShowLevel)
{
StringBuilder stringbuilt = new StringBuilder("");
stringbuilt.AppendFormat("Vip{0:D2}", nLevel);
return stringbuilt.ToString();
}
else
{
return "";
}
}
public static string GetVipImage(int nCost)
{
if (nCost < 0)
return "";
int nLevel = 0;
int nLeft = 0;
GetVipLevel(nCost, ref nLevel, ref nLeft);
return GetStarIconByLevel(nLevel);
}
public static int GetVipCopySceneNum(int sceneid)
{
int nId = -1;
if (sceneid == (int)GameDefine_Globe.TLI_COPYSCENEID.TLI_NUHAICHUJIAN)
{
nId = (int)Games.UserCommonData.USER_COMMONDATA.CD_VIPCP_NHCJ;
}
else if (sceneid == (int)GameDefine_Globe.TLI_COPYSCENEID.TLI_JUXIANZHUAN)
{
nId = (int)Games.UserCommonData.USER_COMMONDATA.CD_VIPCP_JXZ;
}
else if (sceneid == (int)GameDefine_Globe.TLI_COPYSCENEID.TLI_YANZIWU)
{
nId = (int)Games.UserCommonData.USER_COMMONDATA.CD_VIPCP_YZW;
}
else if (sceneid == (int)GameDefine_Globe.TLI_COPYSCENEID.TLI_YANWANGGUMO)
{
nId = (int)Games.UserCommonData.USER_COMMONDATA.CD_VIPCP_YWGM;
}
else if (sceneid == (int)GameDefine_Globe.TLI_COPYSCENEID.TLI_SHAOSHISHAN)
{
nId = (int)Games.UserCommonData.USER_COMMONDATA.CD_VIPCP_SSS;
}
else if (sceneid == (int)GameDefine_Globe.TLI_COPYSCENEID.TLI_ZHENLONGQIJU)
{
nId = (int)Games.UserCommonData.USER_COMMONDATA.CD_VIPCP_ZLQJ;
}
else
{
return 0;
}
return GameManager.gameManager.PlayerDataPool.CommonData.GetCommonData(nId);
}
public static int GetVipMaxCopySceneNum(int sceneid, int nCost)
{
if (nCost < 0)
return 0;
int nLevel = 0;
int nLeft = 0;
GetVipLevel(nCost, ref nLevel, ref nLeft);
return 0;
}
public static string MakeVipString(int nSceneID)
{
StringBuilder builder = new StringBuilder();
int nCost = GameManager.gameManager.PlayerDataPool.VipCost;
if (nCost >= 0)
{
int nMax = 0;
int nVip = 0;
if (nSceneID > 0)
{
nMax = GetVipMaxCopySceneNum(nSceneID, nCost);
nVip = GetVipCopySceneNum(nSceneID);
}
builder.AppendFormat(" VIP:{0}/{1}", nVip, nMax);
}
return builder.ToString();
}
}