| | |
| | | [XLua.LuaCallCSharp]
|
| | | public class FairyJadeInvestmentModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity
|
| | | {
|
| | | // public Dictionary<int, FairyJadeInvestmentClass> FairyJadeInvestmentDic = new Dictionary<int, FairyJadeInvestmentClass>();//等级(0-300级)
|
| | | public Dictionary<int, Dictionary<int, FairyJadeInvestmentClass>> FairyJadeInvestmentTypeDic = new Dictionary<int, Dictionary<int, FairyJadeInvestmentClass>>();//根据投资类型来存储奖励类型和金额(类型3,4,5);
|
| | | // public Dictionary<int, int> InfoSeriors = new Dictionary<int, int>();//奖励领取信息//key为索引,Value(0,未领,其他值未领的钱数)等级(0-300级)
|
| | | public Dictionary<int, Dictionary<int, int>> InfoSeriorsTypeDic = new Dictionary<int, Dictionary<int, int>>();//根据类型存储奖励信息
|
| | | public Dictionary<int, Dictionary<int, int>> InvestmentAmountTypeDic = new Dictionary<int, Dictionary<int, int>>();//根据类型获得投资金额
|
| | | // public Dictionary<int, int> InvestmentAmountDic = new Dictionary<int, int>();//投资金额
|
| | | public Dictionary<int, BinningClass> BinningDic = new Dictionary<int, BinningClass>();//根据类型获取各个类型投资的档位金额和分档
|
| | | public static Action FairyJadeInfoSeriorsUpdate;
|
| | | // public int InvestGold = 0; // 投资额度
|
| | | // public int InvestmentGrade = 0;//0未投,1档,2,档,3,档,4档
|
| | | public int SelectNumber = 0;//记录想要投资的钱数
|
| | | public int RecordSelectNumberMax = 0;//用来标记最大可投资额度
|
| | | public List<int> MultipleList = new List<int>();
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | if (PlayerDatas.Instance.baseData.LV >= 300 && !isOpen)
|
| | | if (PlayerDatas.Instance.baseData.LV > 500 && !isOpen)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
| | | {
|
| | | IsOk = false;
|
| | | IsRedpoint = false;
|
| | | // InvestGold = 0;
|
| | | SelectNumber = 0;
|
| | | RecordSelectNumberMax = 0;
|
| | | InvestmentAmountTypeDic.Clear();
|
| | | InfoSeriorsTypeDic.Clear();
|
| | | FairyJadeInvestmentTypeDic.Clear();
|
| | | // FairyJadeInvestmentDic.Clear();
|
| | | // InvestmentAmountDic.Clear();
|
| | | // InfoSeriors.Clear();
|
| | | Assignment();
|
| | |
|
| | | }
|
| | |
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent += Updatefighting;
|
| | | FairyJadeInvestmentWin.FairyJadeInvestmentRedPointEvent -= FairyJadeInvestmentRedPoint;
|
| | | FairyJadeInvestmentWin.FairyJadeInvestmentRedPointEvent += FairyJadeInvestmentRedPoint;
|
| | | DebugEx.LogError(InfoSeriorsTypeDic);
|
| | | }
|
| | |
|
| | | private void FairyJadeInvestmentRedPoint()
|
| | |
| | | fairyJadeInvestment.Type = value.type;
|
| | | fairyJadeInvestment.NeedDay = value.needDay;
|
| | | fairyJadeInvestment.NeedLv = value.needLV;
|
| | | SetInfoSeriors(value.type, fairyJadeInvestment.ID);
|
| | | MonthlyInvestmentModel.MonthlyInvestmentItem FairyJadeItem = new MonthlyInvestmentModel.MonthlyInvestmentItem();
|
| | | var _jsonData = LitJson.JsonMapper.ToObject(value.award);
|
| | | foreach (string key in _jsonData.Keys)
|
| | |
| | | {
|
| | | var dict = FairyJadeInvestmentTypeDic[value.type];
|
| | | FairyJadeInvestmentClass fairyJadeInvestment = new FairyJadeInvestmentClass();
|
| | | if (value.id >= 310)
|
| | | {
|
| | | fairyJadeInvestment.ID = value.id % 100;
|
| | | }
|
| | | else
|
| | | {
|
| | | fairyJadeInvestment.ID = value.id % 10;
|
| | | }
|
| | | fairyJadeInvestment.ID = fairyJadeInvestment.ID = value.id % 100;
|
| | | SetInfoSeriors(value.type, fairyJadeInvestment.ID);
|
| | | fairyJadeInvestment.Type = value.type;
|
| | | fairyJadeInvestment.NeedDay = value.needDay;
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | // DebugEx.LogError(FairyJadeInvestmentTypeDic);
|
| | | }
|
| | |
|
| | | private void SetInfoSeriors(int type, int id)
|
| | |
| | | public void Assignment()
|
| | | {
|
| | | AssignmentType();
|
| | | //var InvestConfig = Config.Instance.GetAllValues<InvestConfig>();
|
| | | //if (FairyJadeInvestmentDic.Count > 0)
|
| | | //{
|
| | | // return;
|
| | | //}
|
| | | //foreach (var value in InvestConfig)
|
| | | //{
|
| | | // if (value.type == 3 && !FairyJadeInvestmentDic.ContainsKey(value.needLV))
|
| | | // {
|
| | | // FairyJadeInvestmentClass fairyJadeInvestment = new FairyJadeInvestmentClass();
|
| | | // if (value.id >= 310)
|
| | | // {
|
| | | // fairyJadeInvestment.ID = value.id % 100;
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // fairyJadeInvestment.ID = value.id % 10;
|
| | | // }
|
| | | // if (!InfoSeriors.ContainsKey(fairyJadeInvestment.ID))
|
| | | // {
|
| | | // InfoSeriors.Add(fairyJadeInvestment.ID, 0);
|
| | | // }
|
| | | // fairyJadeInvestment.Type = value.type;
|
| | | // fairyJadeInvestment.NeedDay = value.needDay;
|
| | | // fairyJadeInvestment.NeedLv = value.needLV;
|
| | | // MonthlyInvestmentModel.MonthlyInvestmentItem FairyJadeItem = new MonthlyInvestmentModel.MonthlyInvestmentItem();
|
| | | // var _jsonData = LitJson.JsonMapper.ToObject(value.award);
|
| | | // foreach (string key in _jsonData.Keys)
|
| | | // {
|
| | | // var _job = int.Parse(key);
|
| | | // var _itemArray = LitJson.JsonMapper.ToObject<int[][]>(_jsonData[key].ToJson());
|
| | | // for (int j = 0; j < _itemArray.Length; j++)
|
| | | // {
|
| | | // FairyJadeItem.Add(_job, new AwardItem()
|
| | | // {
|
| | | // item = new Item(_itemArray[j][0], _itemArray[j][1]),
|
| | | // isBind = _itemArray[j][2],
|
| | | // });
|
| | | // }
|
| | | // }
|
| | | // fairyJadeInvestment.FairyJadeInvestmentItem = FairyJadeItem;
|
| | | // FairyJadeInvestmentDic.Add(value.needLV, fairyJadeInvestment);
|
| | | // }
|
| | | //}
|
| | | // DebugEx.LogError(FairyJadeInvestmentDic);
|
| | | }
|
| | |
|
| | | public void GetInfoSeriors(HA337_tagMCGoldInvestInfo vNetData)//接受信息
|
| | | {
|
| | | //if (vNetData.InvestType == 3)
|
| | | //{
|
| | | // InvestmentAmount();
|
| | | // InvestGold = (int)vNetData.InvestGold;
|
| | | // if (InvestmentAmountDic.ContainsKey(InvestGold))
|
| | | // {
|
| | | // InvestmentGrade = InvestmentAmountDic[InvestGold];
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // InvestmentGrade = 0;
|
| | | // }
|
| | | // for (int i = 0; i < vNetData.RewardRecordCnt; i++)
|
| | | // {
|
| | | // if (InfoSeriors.ContainsKey((int)vNetData.InvestRewardList[i].RewardIndex))
|
| | | // {
|
| | | // InfoSeriors[(int)vNetData.InvestRewardList[i].RewardIndex] = (int)vNetData.InvestRewardList[i].RewardValue;
|
| | | // }
|
| | | // }
|
| | | // if (FairyJadeInfoSeriorsUpdate != null)
|
| | | // {
|
| | | // FairyJadeInfoSeriorsUpdate();
|
| | | // }
|
| | | // if (IsOk)
|
| | | // {
|
| | | // InvestmentRedPoint();
|
| | | // }
|
| | | //}
|
| | |
|
| | | if (vNetData.InvestType == 3 || vNetData.InvestType == 4 || vNetData.InvestType == 5)
|
| | | {
|
| | | InvestmentAmount();
|
| | |
| | | var dit = InvestmentAmountTypeDic[vNetData.InvestType];
|
| | | if (dit.ContainsKey((int)vNetData.InvestGold))
|
| | | {
|
| | | BinningDic[vNetData.InvestType].Money = (int)vNetData.InvestGold;
|
| | | BinningDic[vNetData.InvestType].Binning = dit[(int)vNetData.InvestGold];
|
| | | BinningClass binningClass = new BinningClass();
|
| | | binningClass.Money= (int)vNetData.InvestGold;
|
| | | binningClass.Binning= dit[(int)vNetData.InvestGold];
|
| | | BinningDic[vNetData.InvestType] = binningClass;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | | InfoSeriorsTypeDic[vNetData.InvestType] = Dit;
|
| | | }
|
| | | InvestmentRedPoint();
|
| | | if (FairyJadeInfoSeriorsUpdate != null)
|
| | | {
|
| | | FairyJadeInfoSeriorsUpdate();
|
| | |
| | | {
|
| | | InvestmentAmountType();
|
| | | SetBinning();
|
| | | //if (InvestmentAmountDic.Count <= 0)
|
| | | //{
|
| | | // InvestmentAmountDic.Add(VipInvestModel.GetInvestGold(3, 0), 1);
|
| | | // InvestmentAmountDic.Add(VipInvestModel.GetInvestGold(3, 1), 2);
|
| | | // InvestmentAmountDic.Add(VipInvestModel.GetInvestGold(3, 2), 3);
|
| | | // InvestmentAmountDic.Add(VipInvestModel.GetInvestGold(3, 3), 4);
|
| | | // RecordSelectNumberMax = VipInvestModel.GetInvestGold(3, 3);
|
| | | //}
|
| | | }
|
| | |
|
| | | private void SetBinning()
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | BinningClass binning = new BinningClass();
|
| | | binning.Money = 0;
|
| | | binning.Money = 0;
|
| | | BinningDic.Add(3, binning);
|
| | | BinningDic.Add(4, binning);
|
| | | BinningDic.Add(5, binning);
|
| | | BinningClass binning1 = new BinningClass();
|
| | | BinningClass binning2 = new BinningClass();
|
| | | BinningClass binning3 = new BinningClass();
|
| | | BinningDic.Add(3, binning1);
|
| | | BinningDic.Add(4, binning2);
|
| | | BinningDic.Add(5, binning3);
|
| | | }
|
| | | private void InvestmentAmountType()
|
| | | {
|
| | |
| | | type += 1;
|
| | | if (PlayerLV >= key)
|
| | | {
|
| | | int indexID = Dit[key].ID; |
| | | int indexID = Dit[key].ID;
|
| | | if (InvestmentGrade != 0)
|
| | | {
|
| | | var dit = GetInfoSeriors();
|
| | |
| | | return 3;
|
| | | }
|
| | | bool Isbool3 = false;
|
| | | |
| | | if (FairyJadeInvestmentTypeDic.ContainsKey(3) && InfoSeriorsTypeDic.ContainsKey(3))
|
| | | {
|
| | | int typeGrade = GetInvestmentGradeT(3);
|
| | | var dit = FairyJadeInvestmentTypeDic[3];
|
| | | var dit1 = InfoSeriorsTypeDic[3];
|
| | | foreach (var key in dit.Keys)
|
| | |
| | | if (IsReceive == 0)
|
| | | {
|
| | | Isbool3 = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | List<AwardItem> fairyJadeInvestmentItem = dit[key].FairyJadeInvestmentItem.GetAwardItem(typeGrade);
|
| | | int AtPresentNumber = 0;
|
| | | if (IsReceive != 0)
|
| | | {
|
| | | List<AwardItem> fairyJadeInvestmentItemAdd = dit[key].FairyJadeInvestmentItem.GetAwardItem(IsReceive);
|
| | | AwardItem itemAdd = fairyJadeInvestmentItemAdd[0];
|
| | | AtPresentNumber = itemAdd.item.count;
|
| | | }
|
| | | if (fairyJadeInvestmentItem[0].item.count > AtPresentNumber)
|
| | | {
|
| | | Isbool3 = true;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | bool Isbool4 = false;
|
| | | if (FairyJadeInvestmentTypeDic.ContainsKey(4) && InfoSeriorsTypeDic.ContainsKey(4))
|
| | | {
|
| | | int typeGrade = GetInvestmentGradeT(4);
|
| | | var dit = FairyJadeInvestmentTypeDic[4];
|
| | | var dit1 = InfoSeriorsTypeDic[4];
|
| | | foreach (var key in dit.Keys)
|
| | |
| | | if (IsReceive == 0)
|
| | | {
|
| | | Isbool4 = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | List<AwardItem> fairyJadeInvestmentItem = dit[key].FairyJadeInvestmentItem.GetAwardItem(typeGrade);
|
| | | int AtPresentNumber = 0;
|
| | | if (IsReceive != 0)
|
| | | {
|
| | | List<AwardItem> fairyJadeInvestmentItemAdd = dit[key].FairyJadeInvestmentItem.GetAwardItem(IsReceive);
|
| | | AwardItem itemAdd = fairyJadeInvestmentItemAdd[0];
|
| | | AtPresentNumber = itemAdd.item.count;
|
| | | }
|
| | | if (fairyJadeInvestmentItem[0].item.count > AtPresentNumber)
|
| | | {
|
| | | Isbool3 = true;
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | bool Isbool5 = false;
|
| | | if (FairyJadeInvestmentTypeDic.ContainsKey(5) && InfoSeriorsTypeDic.ContainsKey(5))
|
| | | {
|
| | | int typeGrade = GetInvestmentGradeT(5);
|
| | | var dit = FairyJadeInvestmentTypeDic[5];
|
| | | var dit1 = InfoSeriorsTypeDic[5];
|
| | | foreach (var key in dit.Keys)
|
| | |
| | | {
|
| | | Isbool5 = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | List<AwardItem> fairyJadeInvestmentItem = dit[key].FairyJadeInvestmentItem.GetAwardItem(typeGrade);
|
| | | int AtPresentNumber = 0;
|
| | | if (IsReceive != 0)
|
| | | {
|
| | | List<AwardItem> fairyJadeInvestmentItemAdd = dit[key].FairyJadeInvestmentItem.GetAwardItem(IsReceive);
|
| | | AwardItem itemAdd = fairyJadeInvestmentItemAdd[0];
|
| | | AtPresentNumber = itemAdd.item.count;
|
| | | }
|
| | | if (fairyJadeInvestmentItem[0].item.count > AtPresentNumber)
|
| | | {
|
| | | Isbool3 = true;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | return type;
|
| | | }
|
| | |
|
| | | private int GetInvestmentGradeT(int Type)
|
| | | {
|
| | | int InvestmentGrade = 0;
|
| | | if (BinningDic.ContainsKey(Type))
|
| | | {
|
| | | InvestmentGrade = BinningDic[Type].Binning;
|
| | | }
|
| | | return InvestmentGrade;
|
| | | }
|
| | | public int GetInvestmentGrade()//获取投资档位
|
| | | {
|
| | | int InvestmentGrade = 0;
|