You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

128 lines
3.1 KiB

using System;
using System.Collections.Generic;
using Sog;
public partial class PayDiamondDesc
{
public long startTimeInt;
public long endTimeInt;
public uint currencyRes;
public int currencyId;
public void SetStartTimeInt(long startTime)
{
startTimeInt = startTime;
}
public void SetEndTimeInt(long endTime)
{
endTimeInt = endTime;
}
}
public partial class PayDiamondDescMgr
{
// 钻石礼包
public SortedList<uint, PayDiamondDesc> diamondList;
//每日特惠子礼包
public SortedList<int, PayDiamondDesc> dailySaleSubList;
public PayDiamondDesc GetDiamondByMoney(uint payMoney)
{
PayDiamondDesc last = null;
foreach (PayDiamondDesc desc in diamondList.Values)
{
if (payMoney < desc.currencyRes)
{
break;
}
last = desc;
}
return last;
}
public override void ReadComplete()
{
diamondList = new SortedList<uint, PayDiamondDesc>();
dailySaleSubList = new SortedList<int, PayDiamondDesc>();
SortedList<int, PayDiamondDesc> descList = PayDiamondDescMgr.Instance.ItemTable;
if (descList == null)
{
return;
}
foreach (PayDiamondDesc desc in descList.Values)
{
// //24 每日特惠子礼包 只记录每日特惠子礼包
// if (desc.goodsType != 24)
// {
// continue;
// }
if (!dailySaleSubList.ContainsKey(desc.itemID))
{
dailySaleSubList.Add(desc.itemID, desc);
}
}
}
public void UpdateGameCurrency(int currencyId)
{
TraceLog.Trace("GameServer.UpdateGameCurrency currency {0}", currencyId);
if (currencyId == 0 && !OSUtils.IsWindows())
{
throw new Exception("currency is 0");
}
foreach (PayDiamondDesc desc in PayDiamondDescMgr.Instance.ItemTable.Values)
{
desc.currencyId = currencyId;
desc.currencyRes = desc.currency[currencyId].Value;
TraceLog.Trace("GameServer.UpdateGameCurrency item {0} money {1} paymentId {2}", desc.itemID,
desc.currencyRes, desc.productID);
}
ReadDone();
}
private void ReadDone()
{
SortedList<int, PayDiamondDesc> descList = PayDiamondDescMgr.Instance.ItemTable;
if (descList == null)
{
return;
}
foreach (PayDiamondDesc desc in descList.Values)
{
// 1是钻石, 只记录钻石礼包
if (desc.bdc_product_type != 1)
{
continue;
}
if (!diamondList.ContainsKey(desc.currencyRes))
{
diamondList.Add(desc.currencyRes, desc);
}
else
{
TraceLog.Error("PayDiamondDescMgr.ReadComplete money_dollar {0} already exist", desc.currencyRes);
m_ErrorCount++;
}
}
}
}