public RectTransform GetItem(int index, RectTransform recyclableItem) { // indexの位置にあるセルを読み込む処理 if (null == recyclableItem) { // 初回ロード時はinstantateItemCountで指定した回数分だけitemがnullで来るので、ここで生成してあげる // 以降はitemが再利用されるため、Reflesh()しない限りnullは来ない recyclableItem = Instantiate(itemPrefab).GetComponent <RectTransform>(); } // セルの内容書き換え { ScratchLineUpLine _line = recyclableItem.GetComponent <ScratchLineUpLine>(); _line.ItemList.Clear(); int start_id = index * LINE_COUNT; for (int i = 0; i < LINE_COUNT; i++) { if (start_id + i >= m_RecvGachaLineup.Count) { continue; } int id = start_id + i; LineUpListItemContex _newItem = new LineUpListItemContex(m_RecvGachaLineup[id]); _newItem.setupResource(); _newItem.DidSelectItem += OnSelectItem; _line.ItemList.Add(_newItem); } } return(recyclableItem); }
public void Copy(LineUpListItemContex _data) { Id = _data.Id; UnitId = _data.UnitId; Ratio = _data.Ratio; RareFlag = _data.RareFlag; RareStar = _data.RareStar; NameText = _data.NameText; RatioText = _data.RatioText; }
public void OnSelectItem(LineUpListItemContex _item) { SoundUtil.PlaySE(SEID.SE_MENU_OK2); UnitDetailInfo unitDetail = MainMenuManager.Instance.OpenUnitDetailInfo(TutorialManager.IsExists ? false : true); if (unitDetail != null) { unitDetail.SetCharaID((uint)_item.UnitId); unitDetail.SetCloseAction(OnUnitDetailClose); m_Canvas.enabled = false; } }
public LineUpListItemContex(LineUpListItemContex _data) { Copy(_data); }
public void setup(MasterDataGacha gachaMaster, MasterDataStepUpGachaManage stepUpManageMaster, uint assgin_id, bool usedTip, string title) { if (gachaMaster == null) { return; } MasterDataGacha _master = gachaMaster; if (_master.type != MasterDataDefineLabel.GachaType.STEP_UP && _master.rainbow_decide == assgin_id) { // 確定ラインナップの場合 _master = MasterFinder <MasterDataGacha> .Instance.Find(_master.rainbow_decide); if (_master == null) { return; } } TitleText = title; uint startTimeU = _master.timing_start; uint endTimeU = _master.timing_end; // 販売日程(終了日が無期限のときは表示しない) DateText = ""; if (endTimeU != 0) { string dateFormat = GameTextUtil.GetText("scratch_display2"); DateTime startTime = TimeUtil.GetDateTime(startTimeU); DateTime endTime = TimeUtil.GetDateTime(endTimeU).SubtractAMinute(); DateText = String.Format(dateFormat, startTime.ToString("yyyy/MM/dd(HH:mm)"), endTime.ToString("yyyy/MM/dd(HH:mm)")); } var guide_master_type = EMASTERDATA_SERVER.GACHA_GROUP; var gachatextreftype = MasterDataDefineLabel.GachaTextRefType.NONE; uint gacha_fix_id = 0; uint _step_id = 0; uint _assgin_id = 0; if (_master.type == MasterDataDefineLabel.GachaType.STEP_UP) { guide_master_type = EMASTERDATA_SERVER.STEP_UP_GACHA; var _stepUpGachaMaster = MasterDataUtil.GetMasterDataStepUpGachaFromGachaID(_master.fix_id); if (_stepUpGachaMaster != null) { gacha_fix_id = _stepUpGachaMaster.fix_id; } else { #if BUILD_TYPE_DEBUG string text = String.Format("StepUpGachaMaster.gacha_idに\n「{0}」が未定義です", _master.fix_id); DialogManager.Open1B_Direct("ScratchLineUpDialog", text, "common_button7", true, true). SetOkEvent(() => { }); #endif } _step_id = stepUpManageMaster.fix_id; _assgin_id = assgin_id; if (stepUpManageMaster.normal1_assign_id == assgin_id) { gachatextreftype = MasterDataDefineLabel.GachaTextRefType.NOMAL1_RATE_URL; } else if (stepUpManageMaster.normal2_assign_id == assgin_id) { gachatextreftype = MasterDataDefineLabel.GachaTextRefType.NOMAL2_RATE_URL; } else if (stepUpManageMaster.special_assign_id == assgin_id) { gachatextreftype = MasterDataDefineLabel.GachaTextRefType.SPECIAL_RATE_URL; } if (gachatextreftype != MasterDataDefineLabel.GachaTextRefType.NONE) { m_ProbabilityUrl = MasterDataUtil.GetGachaText(EMASTERDATA_SERVER.STEP_UP_GACHA_MANAGE, _step_id, gachatextreftype); } } else { guide_master_type = EMASTERDATA_SERVER.GACHA_GROUP; gacha_fix_id = _master.gacha_group_id; gachatextreftype = MainMenuParam.m_GachaRainbowDecide == assgin_id ? MasterDataDefineLabel.GachaTextRefType.SPECIAL_RATE_URL : MasterDataDefineLabel.GachaTextRefType.NOMAL1_RATE_URL; m_ProbabilityUrl = MasterDataUtil.GetGachaText(guide_master_type, gacha_fix_id, gachatextreftype); } //ガイドライン m_GuidLineText = MasterDataUtil.GetGachaText(guide_master_type, gacha_fix_id, MasterDataDefineLabel.GachaTextRefType.GUIDLINE); //確率URL if (m_ProbabilityUrl.Length > 0) { ProbabilityText = GameTextUtil.GetText("Gacha_step_05"); IsProbability = true; } else { IsProbability = false; } // ガイドラインボタン表示フラグ IsUsedTip = usedTip; // 排出ユニット一覧 ServerDataUtilSend.SendPacketAPI_GetGachaLineup((int)_master.fix_id, _step_id, _assgin_id) .setSuccessAction(_data => { SortList <LineUpListItemContex> tmpLineup = new SortList <LineUpListItemContex>(); PacketStructGachaLineup[] lineup = _data.GetResult <RecvGetGachaLineup>().result.gacha_assign_unit_list; for (int i = 0; i < lineup.Length; i++) { LineUpListItemContex newItem = new LineUpListItemContex(i, lineup[i]); //newItem.DidSelectItem += OnSelectItem; tmpLineup.Body.Add(newItem); } tmpLineup.AddSortInfo(SORT_PARAM.RATIO_UP, SORT_ORDER.DESCENDING); tmpLineup.AddSortInfo(SORT_PARAM.LIMITED, SORT_ORDER.DESCENDING); tmpLineup.AddSortInfo(SORT_PARAM.GROUP_ID, SORT_ORDER.ASCENDING); tmpLineup.AddSortInfo(SORT_PARAM.RARITY, SORT_ORDER.DESCENDING); tmpLineup.AddSortInfo(SORT_PARAM.ID, SORT_ORDER.ASCENDING); m_RecvGachaLineup = tmpLineup.Exec(SORT_OBJECT_TYPE.LINUP_LIST); scrollContent.Initialize(this); }) .setErrorAction(_date => { Close(); }) .SendStart(); //BackKey設定 AndroidBackKeyManager.Instance.StackPush(gameObject, OnCloseButton); }