Ejemplo n.º 1
0
    /// <summary>
    /// 単品受取したときのメーッセージ
    /// </summary>
    private void PresentOneOpenResultMessage(RecvPresentOpenValue result, bool isNoticeEnable)
    {
        if (result == null)
        {
            return;
        }

        string result_msg = "";
        bool   check      = false;

        //--------------------------------------------------------------
        // エラーテキストの取得
        // 1: 受け取りアイテム(ユニット)が上限に到達 2: クエストキー期限切れ 3:開封有効期限切れ
        //--------------------------------------------------------------
        if (result.error != null)
        {
            for (int i = 0; i < result.error.Length; ++i)
            {
                switch ((PRESENT_OPEN_ERROR_TYPE)result.error[i])
                {
                case PRESENT_OPEN_ERROR_TYPE.COUNT_LIMIT:
                    result_msg += Environment.NewLine + GameTextUtil.GetText("mt41q_content1");
                    break;

                case PRESENT_OPEN_ERROR_TYPE.QUEST_KEY_EXPIRED:
                    result_msg += Environment.NewLine + GameTextUtil.GetText("mt41q_content2");
                    break;

                case PRESENT_OPEN_ERROR_TYPE.RECEIVE_EXPIRED:
                    result_msg += Environment.NewLine + GameTextUtil.GetText("mt41q_content3");
                    break;
                }
            }
        }

        int presentOpenCount = (result.open_serial_id != null) ? result.open_serial_id.Length : 0; // 開封個数

        if (presentOpenCount > 0 && isNoticeEnable == false)
        {
            // 先頭に受け取りメッセージを追加
            result_msg = GameTextUtil.GetText("mt41q_content0") + Environment.NewLine + result_msg;
            check      = true;
        }
        else
        {
            // 先頭の改行を消す
            if (!result_msg.IsNullOrEmpty())
            {
                result_msg = result_msg.Remove(0, Environment.NewLine.Length);
            }
        }


        if (!result_msg.IsNullOrEmpty())
        {
            openDialog(GameTextUtil.GetText("mt40q_title"),
                       string.Format(GameTextUtil.GetText("mt41q_content"), result_msg),
                       GameTextUtil.GetText("common_button1"), check);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 全部受け取りした時のメッセージ
    /// </summary>
    private void PresentAllOpenResultMessage(RecvPresentOpenValue result)
    {
        if (result == null)
        {
            return;
        }

        //--------------------------------------------------------------
        // 受取エラーの数を取得
        // 1: 受け取りアイテム(ユニット)が上限に到達 2: クエストキー期限切れ 3:開封有効期限切れ
        //--------------------------------------------------------------
        int error_num_1 = 0;
        int error_num_2 = 0;
        int error_num_3 = 0;

        if (result.error != null)
        {
            for (int i = 0; i < result.error.Length; ++i)
            {
                switch ((PRESENT_OPEN_ERROR_TYPE)result.error[i])
                {
                case PRESENT_OPEN_ERROR_TYPE.COUNT_LIMIT:
                    ++error_num_1;
                    break;

                case PRESENT_OPEN_ERROR_TYPE.QUEST_KEY_EXPIRED:
                    ++error_num_2;
                    break;

                case PRESENT_OPEN_ERROR_TYPE.RECEIVE_EXPIRED:
                    ++error_num_3;
                    break;
                }
            }
        }

        //--------------------------------------
        // エラーテキストの取得
        //--------------------------------------
        string error_msg_1 = ""; // 所持上限テキスト
        string error_msg_2 = ""; // 有効期限切れテキスト
        string error_msg_3 = ""; // 受取期限超過テキスト

        if (error_num_1 > 0)
        {
            error_msg_1 = Environment.NewLine + string.Format(GameTextUtil.GetText("mt40q_content1"), error_num_1) + Environment.NewLine;
        }
        if (error_num_2 > 0)
        {
            error_msg_2 = Environment.NewLine + string.Format(GameTextUtil.GetText("mt40q_content2"), error_num_2) + Environment.NewLine;
        }
        if (error_num_3 > 0)
        {
            error_msg_3 = Environment.NewLine + string.Format(GameTextUtil.GetText("mt40q_content3"), error_num_3) + Environment.NewLine;
        }

        int presentOpenCount = (result.open_serial_id != null) ? result.open_serial_id.Length : 0; // 開封個数

        //--------------------------------------
        // ダイアログの表示
        //--------------------------------------
        if (presentOpenCount > 0)
        {
            // n個のプレゼントを受け取りました。
            openDialog(GameTextUtil.GetText("mt40q_title"),
                       string.Format(GameTextUtil.GetText("mt40q_content"), presentOpenCount, error_msg_1, error_msg_2, error_msg_3),
                       GameTextUtil.GetText("common_button1"), true);
        }
        else
        {
            // 全て受け取れませんでした。
            openDialog(GameTextUtil.GetText("mt40q_title"),
                       string.Format(GameTextUtil.GetText("mt40q_content0"), error_msg_1, error_msg_3),
                       GameTextUtil.GetText("common_button1"));
        }
    }