Esempio n. 1
0
    private void ShowBuySuccessDialog()
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        if (!gameData.HasEnoughMoney(customPriceL, customPriceM, customPriceS))
        {
            ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1005));
            return;
        }
        if (etBedName.text.Length <= 0)
        {
            ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1312));
            return;
        }
        //支付金钱
        gameData.PayMoney(customPriceL, customPriceM, customPriceS);
        //播放音效
        AudioHandler.Instance.PlaySound(AudioSoundEnum.Reward);

        DialogBean        dialogData    = new DialogBean();
        FindBedDialogView findBedDialog = DialogHandler.Instance.CreateDialog <FindBedDialogView>(DialogEnum.FindBed, this, dialogData);

        //点击继续
        findBedDialog.SetCallBackForContinue((view, data) =>
        {
            ShowBuySuccessDialog();
        });
        //如果幸运值生成数据
        gameData.userCharacter.GetAttributes(out CharacterAttributesBean characterAttributes);
        BuildBedBean buildBedData = customBedData.RandomDataByLucky(characterAttributes.lucky);

        findBedDialog.SetData(buildBedData);
    }
Esempio n. 2
0
    public override void Submit(DialogView dialogView, DialogBean dialogBean)
    {
        base.Submit(dialogView, dialogBean);
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        if (dialogView as FindBedDialogView)
        {
            FindBedDialogView findBedDialog = dialogView as FindBedDialogView;
            gameData.AddBed(findBedDialog.buildBedData);
            ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1311));
        }
        else
        {
            ShowBuySuccessDialog();
        }
    }