/// <summary> /// 月間ログインボーナスの表示 /// </summary> void OnStartMonthlyLogin() { PacketStructLoginMonthly loginMonthlyData = UserDataAdmin.Instance.m_StructLoginMonthly; if (IsExistMonthlyLogin(loginMonthlyData) == false) { #if BUILD_TYPE_DEBUG DateTime todayTime; if (loginMonthlyData != null && loginMonthlyData.login_date > 0) { int nYear = (int)(loginMonthlyData.login_date / 100 / 100); int nMonth = (int)(loginMonthlyData.login_date / 100) % 100; int nDay = (int)(loginMonthlyData.login_date) % 100; todayTime = new DateTime(nYear, nMonth, nDay, 0, 0, 0); } else { todayTime = TimeManager.Instance.m_TimeNow; } string messageText = todayTime.ToString("yyyy年MM月dd日") + "の通常ログインボーナスのデータが取得できませんでした。\n" + "\n" + "このダイアログは、通常ログインボーナスの他にログインボーナスがある場合に表示されます。\n" + "\n" + "プランナーさんにマスターデータ設定が\n間違っていないか確認しください。\n" + "\n不明な場合はクライアントプログラマに報告してください。"; Dialog newDialog = Dialog.Create(DialogType.DialogScroll); newDialog.SetDialogText(DialogTextType.Title, "No LoginMonthlyData"); newDialog.SetDialogText(DialogTextType.MainText, messageText); newDialog.SetDialogTextFromTextkey(DialogTextType.OKText, "common_button7"); newDialog.SetDialogEvent(DialogButtonEventType.OK, () => { LoginBonusFSM.Instance.SendFsmNextEvent(); }); newDialog.Show(); #else LoginBonusFSM.Instance.SendFsmNextEvent(); #endif return; } m_IsExcecLoginBonus = true; LoginBonusDialog dialog = LoginBonusDialog.Create(); AndroidBackKeyManager.Instance.StackPush(gameObject, () => { dialog.OnClickBGPanel(); }); dialog.SetUpMonthlyLoginList(loginMonthlyData); dialog.Show(); dialog.CloseAction = () => { AndroidBackKeyManager.Instance.StackPop(gameObject); LoginBonusFSM.Instance.SendFsmNextEvent(); }; }
public static bool IsExistMonthlyLogin(PacketStructLoginMonthly login_monthly) { bool isExist = (login_monthly.monthly_list != null && login_monthly.login_list != null); return(isExist); }
/// <summary> /// 月間ログインボーナスリストの作成 /// </summary> /// <param name="loginMonthlyData"></param> public void SetUpMonthlyLoginList(PacketStructLoginMonthly loginMonthlyData) { MasterDataLoginMonthlyConverted[] loginMonthlyMasterArray = loginMonthlyData.monthly_list; uint today; // 今日の日付 if (loginMonthlyData != null && loginMonthlyData.login_date > 0) { today = loginMonthlyData.login_date; } else { today = (uint)(TimeManager.Instance.m_TimeNow.ToString("yyyyMMdd") + "00").ToLong(0); // 端末時間 } int loginIndex = 0; for (int i = 0; i < loginMonthlyMasterArray.Length; ++i) { if (loginMonthlyMasterArray[i] == null) { continue; } // 今日のデータ if ((int)loginMonthlyMasterArray[i].date == today) { loginIndex = i; } } if (loginMonthlyMasterArray.IsNullOrEmpty() == false) { //------------------------------------------------ //開始日 //------------------------------------------------ uint startMonthDate = loginMonthlyMasterArray[0].date; int nStartYear = (int)(startMonthDate / 100 / 100); int nStartMonth = (int)(startMonthDate / 100) % 100; int nStartDay = (int)(startMonthDate) % 100; if (startMonthDate.ToString().Length > 8) { // TODO:Ymd形式未対応サーバー用 後で削除 nStartYear = TimeUtil.GetDateTimeToYear(startMonthDate); nStartMonth = TimeUtil.GetDateTimeToMonth(startMonthDate); nStartDay = TimeUtil.GetDateTimeToDay(startMonthDate); } //------------------------------------------------ //終了日 //------------------------------------------------ uint endMonthDate = loginMonthlyMasterArray[loginMonthlyMasterArray.Length - 1].date; int nEndYear = (int)(endMonthDate / 100 / 100); int nEndMonth = (int)(endMonthDate / 100) % 100; int nEndDay = (int)(endMonthDate) % 100; if (endMonthDate.ToString().Length > 8) { // TODO:Ymd形式未対応サーバー用 後で削除 nEndYear = TimeUtil.GetDateTimeToYear(endMonthDate); nEndMonth = TimeUtil.GetDateTimeToMonth(endMonthDate); nEndDay = TimeUtil.GetDateTimeToDay(endMonthDate); } TitleText = GameTextUtil.GetText("loginbonus_normal_title"); StartDateText = string.Format(GameTextUtil.GetText("loginbonus_period_start"), nStartYear, nStartMonth, nStartDay); StartDateText += GameTextUtil.GetText("loginbonus_period_tilde"); EndDateText = string.Format(GameTextUtil.GetText("loginbonus_period_end"), nEndYear, nEndMonth, nEndDay); m_RecordPanel.DetailText = loginMonthlyMasterArray[loginIndex].message; } else { #if BUILD_TYPE_DEBUG // 検証ユーザーの時にユーザー変更で一般ユーザーになるとTimeManager.Instance.m_TimeNowが前のままで、データがおかしくなる string messageText = "通常ログインボーナスのデータが取得できませんでした。\n" + "\n" + "端末時間とサーバー時間がずれている可能性があります。\n" + "\n" + "管理ツールからユーザーのステータスを「開発ユーザー」に変更するか、\n" + "端末時間を現在の時間に修正してアクセスしてください。"; Dialog newDialog = Dialog.Create(DialogType.DialogScroll); newDialog.SetDialogText(DialogTextType.Title, "No LoginMonthlyData"); newDialog.SetDialogText(DialogTextType.MainText, messageText); newDialog.SetDialogTextFromTextkey(DialogTextType.OKText, "common_button7"); newDialog.SetDialogEvent(DialogButtonEventType.OK, () => { }); newDialog.Show(); #endif } m_RecordPanel.IsViewRecordList = true; m_RecordPanel.m_LoginBonusIndex = (uint)loginIndex; for (int i = 0; i < loginMonthlyMasterArray.Length; ++i) { MasterDataLoginMonthlyConverted loginMonthlyMasterData = loginMonthlyMasterArray[i]; LoginBonusRecordListContext record = new LoginBonusRecordListContext(); record.present_ids = loginMonthlyMasterData.present_ids; record.message = loginMonthlyMasterData.message; record.date_count = loginMonthlyMasterData.date % 100; if (loginMonthlyMasterData.date.ToString().Length > 8) { // TODO:Ymd形式未対応サーバー用 後で削除 record.date_count = (loginMonthlyMasterData.date / 100) % 100; } if (loginMonthlyMasterData.present_ids.IsNullOrEmpty() == false) { int presentID = loginMonthlyMasterData.present_ids[0]; MainMenuUtil.GetPresentIcon(MasterDataUtil.GetPresentParamFromID((uint)presentID), sprite => { record.IconImage = sprite; }); } else { MainMenuUtil.GetPresentIcon(null, sprite => { record.IconImage = sprite; }); } record.SetMonthlyLoginState(loginMonthlyMasterData.date, loginMonthlyData.login_list, loginMonthlyMasterArray[loginIndex].date); record.DidSelectItem = OnSelectRecord; m_RecordPanel.Records.Add(record); } #if BUILD_TYPE_DEBUG DebugDialogCheckNoPresent(m_RecordPanel.Records); #endif }