示例#1
0
    private void useItem(uint fix_id)
    {
        ServerDataUtilSend.SendPacketAPI_ItemUse(fix_id)
        .setSuccessAction(_data =>
        {
            UserDataAdmin.Instance.m_StructPlayer = _data.UpdateStructPlayer <RecvItemUse>((PacketStructPlayer)UserDataAdmin.Instance.m_StructPlayer);
            //アイテム情報更新
            updateItemAll();

            MasterDataUseItem itemMaster = MasterFinder <MasterDataUseItem> .Instance.Find((int)fix_id);
            if (itemMaster != null)
            {
                // スタミナ回復ダイアログを表示
                if (MasterDataUtil.ChkUseItemTypeStaminaRecovery(itemMaster))
                {
                    DialogManager.Open1B("sh135q_title", "sh135q_content", "common_button1", true, true)
                    .SetOkEvent(() =>
                    {
                        StartCoroutine(MainMenuWebViewShowChk.PopupWebViewStart(MainMenuWebViewShowChk.PopupWebViewType.Mission));
                    });
                }
                else
                {
                    StartCoroutine(MainMenuWebViewShowChk.PopupWebViewStart(MainMenuWebViewShowChk.PopupWebViewType.Mission));
                }
            }
        })
        .setErrorAction(_data =>
        {
            int i = 0;
            i++;
        })
        .SendStart();
    }
示例#2
0
    private void setupItem()
    {
        if (UserDataAdmin.Instance.m_StructPlayer == null)
        {
            return;
        }

        // ユーザーの所持アイテムリスト
        //MasterDataUseItem[] item_masters = MasterFinder<MasterDataUseItem>.Instance.GetAll();
        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 (MasterDataUtil.ChkUseItemTypeStaminaRecovery(itemMaster))
            {
                //スタミナ系アイテム
                m_Item.AddRecord(Item.ItemType.Stamina, itemMaster, (int)items[id].item_cnt, items[id].use_timing, OnSelectItemData);
            }
            else if (MasterDataUtil.ChkUseItemTypeAmend(itemMaster))
            {
                //報酬増加アイテム
                m_Item.AddRecord(Item.ItemType.RewardUp, itemMaster, (int)items[id].item_cnt, items[id].use_timing, OnSelectItemData);
            }
            else if (itemMaster.gacha_event_id != 0)
            {
                //ガチャチケットはポイント関連に追加するのでここでは何もしない
            }
            else
            {
                //その他
                m_Item.AddRecord(Item.ItemType.Other, itemMaster, (int)items[id].item_cnt, items[id].use_timing, OnSelectItemData);
            }
        }
    }
示例#3
0
    private PacketStructUseItem useRecoverItem()
    {
        PacketStructUseItem[]      items = UserDataAdmin.Instance.m_StructPlayer.item_list;
        List <PacketStructUseItem> list  = new List <PacketStructUseItem>();

        // レコード追加
        for (int i = 0; i < items.Length; i++)
        {
            PacketStructUseItem item = items[i];
            if (item.item_cnt == 0)
            {
                continue;
            }

            MasterDataUseItem itemMaster = MasterFinder <MasterDataUseItem> .Instance.Find((int)item.item_id);

            if (itemMaster == null)
            {
                continue;
            }

            if (!MasterDataUtil.ChkUseItemTypeStaminaRecovery(itemMaster))
            {
                continue;
            }

            //スタミナ系アイテム
            list.Add(item);
        }

        if (list.Count <= 0)
        {
            return(null);
        }

        //[DG0-1196]fix_idの昇順ソートで使用順を決める ItemMaster.fix_id == PacketStructUseItem.item_id
        list.Sort((a, b) => (int)a.item_id - (int)b.item_id);

        return(list[0]);
    }
示例#4
0
    private void OnSelectItemData(ItemDataContext _item)
    {
        SoundUtil.PlaySE(SEID.SE_MENU_OK);

        if (_item.Count == 0)
        {
            //アイテムない
            Dialog _newDialog = Dialog.Create(DialogType.DialogYesNo);
            _newDialog.SetDialogTextFromTextkey(DialogTextType.Title, "mm53q_title");
            string mainFormat = GameTextUtil.GetText("mm53q_content");
            _newDialog.SetDialogText(DialogTextType.MainText, string.Format(mainFormat, _item.ItemMaster.item_name, ""));
            _newDialog.SetDialogEvent(DialogButtonEventType.YES, () =>
            {
                //ポイントショップへ
                MainMenuManager.Instance.AddSwitchRequest(MAINMENU_SEQ.SEQ_SHOP_POINT, false, false);
                MainMenuManager.Instance.CloseGlobalMenu();
            });
            _newDialog.SetDialogTextFromTextkey(DialogTextType.YesText, "common_button4");
            _newDialog.SetDialogTextFromTextkey(DialogTextType.NoText, "common_button5");
            _newDialog.DisableCancelButton();
            _newDialog.Show();
        }
        else if (MasterDataUtil.ChkUseItemTypeStaminaRecovery(_item.ItemMaster) && UserDataAdmin.Instance.IsStaminaMax())
        {
            //スタミナが満タン
            Dialog _newDialog = Dialog.Create(DialogType.DialogOK);
            _newDialog.SetTitleFromTextKey("mm56q_title");
            _newDialog.SetMainFromTextKey("mm56q_content");
            _newDialog.SetDialogText(DialogTextType.OKText, Dialog.CONFIRM_BUTTON_TITLE);
            _newDialog.DisableCancelButton();
            _newDialog.Show();
        }
        else if (MainMenuUtil.IsItemEffectValid(_item.ItemMaster))
        {
            //使用中
            Dialog _newDialog = Dialog.Create(DialogType.DialogOK);
            _newDialog.SetTitleFromTextKey("mm61q_title");
            _newDialog.SetMainFromTextKey("mm61q_content");
            _newDialog.SetDialogText(DialogTextType.OKText, Dialog.CONFIRM_BUTTON_TITLE);
            _newDialog.DisableCancelButton();
            _newDialog.Show();
        }
        else
        {
            string _item_name        = _item.ItemMaster.item_name;
            string _item_effect_time = "";
            if (_item.ItemMaster.effect_span_m != 0)
            {
                _item_effect_time = string.Format("({0}分)", _item.ItemMaster.effect_span_m);
            }
            Dialog _newDialog = Dialog.Create(DialogType.DialogYesNo);
            _newDialog.SetDialogTextFromTextkey(DialogTextType.Title, "mm52q_title");
            string mainFormat = GameTextUtil.GetText("mt52q_content");

            if (MasterDataUtil.ChkUseItemTypeStaminaRecovery(_item.ItemMaster))
            {
                //回復後のスタミナ値を表示.
                int result_stamina = UserDataAdmin.Instance.GetUseItemStamina(_item.ItemMaster);
                mainFormat += "\n\n" + string.Format(GameTextUtil.GetText("sh132q_content3"), result_stamina, UserDataAdmin.Instance.m_StructPlayer.stamina_max);
                // オーバー回復になるかどうか
                if (result_stamina > UserDataAdmin.Instance.m_StructPlayer.stamina_max)
                {
                    mainFormat += "\n\n" + GameTextUtil.GetText("sh132q_content5");
                }
            }
            _newDialog.SetDialogText(DialogTextType.MainText, string.Format(mainFormat, _item_name, _item_effect_time));
            _newDialog.SetDialogEvent(DialogButtonEventType.YES, () =>
            {
                useItem(_item.ItemMaster.fix_id);
            });
            _newDialog.SetDialogTextFromTextkey(DialogTextType.YesText, "common_button4");
            _newDialog.SetDialogTextFromTextkey(DialogTextType.NoText, "common_button5");
            _newDialog.DisableCancelButton();
            _newDialog.Show();
        }
    }