private void setupKey() { //---------------------------------------- // プレイヤー情報に持っているクエストキーリストを取得 // ※サーバーで有効期限の近い順でソートしてくれている //---------------------------------------- PacketStructQuestKey[] cKeyList = UserDataAdmin.Instance.m_StructPlayer.quest_key_list; //-------------------------------- // ぬるチェック //-------------------------------- if (cKeyList == null || cKeyList.Length <= 0) { return; } //-------------------------------- // 所持キーリストをアイテムリストに追加 // ※クエストキーはサーバーでソートしてくれてるのでそのまま追加 //-------------------------------- for (int iKey = 0; iKey < cKeyList.Length; iKey++) { if (cKeyList[iKey] == null || cKeyList[iKey].quest_key_cnt <= 0) { continue; } //クエストキーマスタ取得 MasterDataQuestKey cQuestKeyMaster = MasterFinder <MasterDataQuestKey> .Instance.Find((int)cKeyList[iKey].quest_key_id); if (cQuestKeyMaster == null) { Debug.LogError("QuestKey MasterData None! - " + cKeyList[iKey].quest_key_id); continue; } //クエストキーマスタに設定あり、クエストキー定義単位で表示 bool bRet = MainMenuUtil.ChkQuestKeyPlayableFromId(cQuestKeyMaster); if (bRet == false) { continue; } UIAtlas cIconAtlas = SceneObjReferMainMenu.Instance.m_MainMenuAtlas; string strSpriteName = "mm_quest_key"; //---------------------------------------- // ここまできたらチェックOK。表示対象としてリストに登録 //---------------------------------------- ItemKeyContext _newKey = new ItemKeyContext(); _newKey.Category = ItemKeyContext.CategoryType.QuestKey; _newKey.IconImage = cIconAtlas.GetSprite(strSpriteName); _newKey.keyMaster = cQuestKeyMaster; _newKey.Name = cQuestKeyMaster.key_name; _newKey.Count = cKeyList[iKey].quest_key_cnt.ToString(); _newKey.IsViewTime = false; _newKey.Time = ""; _newKey.timing_end = cQuestKeyMaster.timing_end; if (cQuestKeyMaster.timing_end != 0) { string timeFormat = GameTextUtil.GetText("common_expirationdate"); DateTime endTime = TimeUtil.GetDateTime(cQuestKeyMaster.timing_end).SubtractAMinute(); _newKey.Time = string.Format(timeFormat, endTime.ToString("yyyy/MM/dd (HH:mm)")); _newKey.IsViewTime = true; } _newKey.DidSelectItemKey = OnSelectKey; //リストに登録 m_Item.KeyList.Add(_newKey); } //期間でソート m_Item.KeyList.Sort((a, b) => (int)a.timing_end - (int)b.timing_end); }
private void OnSelectKey(ItemKeyContext _key) { SoundUtil.PlaySE(SEID.SE_MENU_OK); string item_name = ""; string move_pos = ""; switch (_key.Category) { case ItemKeyContext.CategoryType.FriendPoint: item_name = GameTextUtil.GetText("common_text1"); move_pos = GameTextUtil.GetText("common_text7"); break; case ItemKeyContext.CategoryType.UnitPoint: item_name = GameTextUtil.GetText("common_text2"); move_pos = GameTextUtil.GetText("common_text8"); break; case ItemKeyContext.CategoryType.ScratchTicket: item_name = _key.itemMaster.item_name; move_pos = GameTextUtil.GetText("common_text7"); break; case ItemKeyContext.CategoryType.QuestKey: item_name = _key.keyMaster.key_name; move_pos = GameTextUtil.GetText("common_text9"); break; } Dialog _newDialog = Dialog.Create(DialogType.DialogYesNo); _newDialog.SetDialogTextFromTextkey(DialogTextType.Title, "mm54q_title"); string mainFormat = GameTextUtil.GetText("mm54q_content1"); _newDialog.SetDialogText(DialogTextType.MainText, string.Format(mainFormat, item_name, move_pos)); _newDialog.SetDialogEvent(DialogButtonEventType.YES, () => { switch (_key.Category) { case ItemKeyContext.CategoryType.FriendPoint: MainMenuParam.m_GachaMaster = MasterDataUtil.GetActiveFriendGachaMaster(); MainMenuManager.Instance.SetResetSubTabFlag(); MainMenuManager.Instance.AddSwitchRequest(MAINMENU_SEQ.SEQ_GACHA_MAIN, false, false); MainMenuManager.Instance.CloseGlobalMenu(); break; case ItemKeyContext.CategoryType.UnitPoint: MainMenuManager.Instance.AddSwitchRequest(MAINMENU_SEQ.SEQ_SHOP_POINT, false, false); MainMenuManager.Instance.CloseGlobalMenu(); break; case ItemKeyContext.CategoryType.ScratchTicket: MainMenuParam.m_GachaMaster = MasterDataUtil.GetActiveItemPointGachaMaster(_key.itemMaster.fix_id); MainMenuManager.Instance.SetResetSubTabFlag(); MainMenuManager.Instance.AddSwitchRequest(MAINMENU_SEQ.SEQ_GACHA_MAIN, false, false); MainMenuManager.Instance.CloseGlobalMenu(); break; case ItemKeyContext.CategoryType.QuestKey: MainMenuParam.SetQuestSelectParam(_key.keyMaster.key_area_category_id); MainMenuManager.Instance.AddSwitchRequest(MAINMENU_SEQ.SEQ_QUEST_SELECT, false, false, false); MainMenuManager.Instance.CloseGlobalMenu(); break; } }); _newDialog.SetDialogTextFromTextkey(DialogTextType.YesText, "common_button4"); _newDialog.SetDialogTextFromTextkey(DialogTextType.NoText, "common_button5"); _newDialog.DisableCancelButton(); _newDialog.Show(); }
private void setupPoint() { if (UserDataAdmin.Instance.m_StructPlayer == null) { return; } List <ItemKeyContext> tmpList = new List <ItemKeyContext>(); PacketStructUseItem[] items = UserDataAdmin.Instance.m_StructPlayer.item_list; // レコード追加 for (int id = 0; id < items.Length; id++) { //所持していない if (items[id].item_cnt == 0) { continue; } //マスターに存在するか MasterDataUseItem itemMaster = MasterFinder <MasterDataUseItem> .Instance.Find((int)items[id].item_id); if (itemMaster == null) { continue; } //チケットかどうか if (itemMaster.gacha_event_id == 0) { continue; } //対象の有効なガチャが存在する MasterDataGacha gachaMaster = MasterDataUtil.GetActiveItemPointGachaMaster(itemMaster.fix_id); if (gachaMaster == null) { continue; } //イベントマスター取得 MasterDataEvent eventMaster = MasterDataUtil.GetMasterDataEventFromID(itemMaster.gacha_event_id); if (eventMaster == null) { continue; } //期間外 if (TimeEventManager.Instance.ChkEventActive(eventMaster.event_id) == false) { continue; } //ガチャチケット ItemKeyContext _newTicket = new ItemKeyContext(); _newTicket.Category = ItemKeyContext.CategoryType.ScratchTicket; _newTicket.Name = itemMaster.item_name; _newTicket.Count = items[id].item_cnt.ToString(); _newTicket.setupIcon(itemMaster); _newTicket.itemMaster = itemMaster; _newTicket.DidSelectItemKey = OnSelectKey; _newTicket.IsViewTime = false; _newTicket.Time = ""; _newTicket.timing_end = eventMaster.timing_end; if (eventMaster.timing_end != 0) { string timeFormat = GameTextUtil.GetText("common_expirationdate"); DateTime endTime = TimeUtil.GetDateTime(eventMaster.timing_end).SubtractAMinute(); _newTicket.Time = string.Format(timeFormat, endTime.ToString("yyyy/MM/dd (HH:mm)")); _newTicket.IsViewTime = true; m_Item.PointList.Add(_newTicket); } else { //期間が無限のチケットは最後に追加するので一時退避 tmpList.Add(_newTicket); } } //期間でソート m_Item.PointList.Sort((a, b) => (int)a.timing_end - (int)b.timing_end); //友情ポイント・ユニットポイント追加 { ItemKeyContext _newFP = new ItemKeyContext(); _newFP.Category = ItemKeyContext.CategoryType.FriendPoint; _newFP.IconImage = ResourceManager.Instance.Load("friend_point_icon", ResourceType.Common); _newFP.Name = GameTextUtil.GetText("common_text1"); _newFP.Count = UserDataAdmin.Instance.m_StructPlayer.have_friend_pt.ToString(); _newFP.IsViewTime = false; _newFP.Time = ""; _newFP.DidSelectItemKey = OnSelectKey; m_Item.PointList.Add(_newFP); ItemKeyContext _newUP = new ItemKeyContext(); _newUP.Category = ItemKeyContext.CategoryType.UnitPoint; _newUP.IconImage = ResourceManager.Instance.Load("mm_item_unitpoint", ResourceType.Common); _newUP.Name = GameTextUtil.GetText("common_text2"); _newUP.Count = UserDataAdmin.Instance.m_StructPlayer.have_unit_point.ToString(); _newUP.IsViewTime = false; _newUP.Time = ""; _newUP.DidSelectItemKey = OnSelectKey; m_Item.PointList.Add(_newUP); } //期間が無限のチケット追加 m_Item.PointList.AddRange(tmpList); }