public string CreateButtonBaseName(GachaList.Gacha gacha, GachaGuaranteeCampaignInfo guarantee, bool resultScene = false) { string text = string.Empty; if (!resultScene || (gacha != null && gacha.requiredItemId > 0)) { text = gacha.buttonImg; } if (guarantee != null && guarantee.IsValid()) { string buttonImageName = guarantee.GetButtonImageName(); if (buttonImageName != string.Empty) { text = buttonImageName; } if (gacha.IsOncePurchase() && guarantee.IsStepUp()) { text = "BTN_GACHA_STEP10_Pay"; } if (guarantee.IsStepUp()) { text = ((!guarantee.hasFreeGachaReward) ? (text + "_" + guarantee.GetImageCount()) : (text + "_FREE")); } } if (resultScene && MonoBehaviourSingleton <GachaManager> .I.gachaResult != null && !string.IsNullOrEmpty(MonoBehaviourSingleton <GachaManager> .I.gachaResult.buttonImg) && string.IsNullOrEmpty(text)) { text = MonoBehaviourSingleton <GachaManager> .I.gachaResult.buttonImg; } if (string.IsNullOrEmpty(text)) { text = "BTN_GACHA_NORMAL1" + ((gacha.num != 1) ? "0" : string.Empty); } return(text); }
private GachaList.Gacha FindGacha(int gachaId, int gachaIndex, out GACHA_TYPE gacha_type, out GACHA_TYPE real_type, out GachaGuaranteeCampaignInfo guaranteeInfo) { GachaList.Gacha result = null; gacha_type = (GACHA_TYPE)0; real_type = (GACHA_TYPE)0; guaranteeInfo = new GachaGuaranteeCampaignInfo(); for (int i = 0; i < gachaData.types.Count; i++) { GachaList.GachaType gachaType = gachaData.types[i]; for (int j = 0; j < gachaType.groups.Count; j++) { GachaList.GachaGroup gachaGroup = gachaType.groups[j]; if (gachaGroup.gachas.Count > gachaIndex) { GachaList.Gacha gacha = gachaGroup.gachas[gachaIndex]; if (gacha.gachaId == gachaId) { result = gacha; gacha_type = gachaType.ViewType; real_type = gachaType.Type; guaranteeInfo = gachaGroup.gachaGuaranteeCampaignInfo.Find((GachaGuaranteeCampaignInfo info) => info.gachaId == gachaId); if (guaranteeInfo == null) { guaranteeInfo = new GachaGuaranteeCampaignInfo(); } return(result); } } } } return(result); }
public void SendGetGacha(Action <bool> call_back) { gachaData = null; Protocol.Send(GachaListModel.URL, delegate(GachaListModel ret) { bool obj = false; if (ret.Error == Error.None) { obj = true; gachaData = ret.result; gachaData.types.ForEach(delegate(GachaList.GachaType o) { o.groups.Sort((GachaList.GachaGroup x, GachaList.GachaGroup y) => y.priority - x.priority); }); gachaData.types.ForEach(delegate(GachaList.GachaType type) { type.groups.ForEach(delegate(GachaList.GachaGroup gr) { List <GachaList.Gacha> source = (from g in gr.gachas where g.IsOncePurchase() select g).ToList(); int num = source.Count(); for (int i = 0; i < num; i++) { GachaList.Gacha gacha = source.ElementAt(i); int gachaId = gacha.gachaId; gr.gachas.Remove(gacha); int targetSubGroup = (from g in gr.gachas where g.gachaId == gachaId select g.subGroup).First(); int index = (from ano in gr.gachas.Select((GachaList.Gacha g, int j) => new { Content = g, Index = j }) where ano.Content.subGroup == targetSubGroup select ano.Index).First(); gr.gachas.Insert(index, gacha); } }); }); Dirty(); } call_back(obj); }, string.Empty); }