/// <summary> /// 打开卡片选择窗口 /// </summary> private void openTeamEditWindow() { DateTime dt = TimeKit.getDateTimeMillis(ServerTimeKit.getMillisTime());//获取服务器时间 int dayOfWeek = TimeKit.getWeekCHA(dt.DayOfWeek); int nowOfDay = ServerTimeKit.getCurrentSecond(); int[] timeInfo = CommandConfigManager.Instance.getOneOnOneBossTimeInfo(); //开放时间 int[] data = CommandConfigManager.Instance.getOneOnOneBossData(); //开放日期 for (int i = 0; i < data.Length; i++) { if (dayOfWeek == data[i] && nowOfDay > timeInfo[0] && nowOfDay < timeInfo[1]) { if (AttackBossOneOnOneManager.Instance.canChallengeTimes + AttackBossOneOnOneManager.Instance.buyTimes <= 0) //次数用完 { UiManager.Instance.openDialogWindow <TextTipWindow>((win) => { win.init(LanguageConfigManager.Instance.getLanguage("OneOnOneBoss_033"), 0.8f); }); return; } UiManager.Instance.openWindow <CardSelectWindow>((win) => { win.Initialize(CardChooseWindow.CHATSHOW); }); return; } } UiManager.Instance.openDialogWindow <TextTipWindow>((win) => {//没开启活动 win.init(LanguageConfigManager.Instance.getLanguage("OneOnOneBoss_018"), 0.8f); }); }
//如果具体时间已经过期,取下一个星期几的时间 private int getNextTime(int time) { int now = ServerTimeKit.getSecondTime(); //当前时间有效 if (now < detailEndTime) { return(-1); } DateTime dt = TimeKit.getDateTime(time); int currTime = dt.Hour * 3600 + dt.Minute * 60 + dt.Second; int morning = time - currTime; //当天凌晨 int nowWeek = TimeKit.getWeekCHA(dt.DayOfWeek); //当前是周几 if (nowWeek >= weekDay [weekDay.Length - 1]) //如果已经大于最大周,大活动过期 { return(morning + (7 - nowWeek + weekDay[0]) * 86400); } else { foreach (int day in weekDay) { if (day > nowWeek) { return(morning + (day - nowWeek) * 86400); } } } return(-1); }
/// <summary> /// 获得星期 /// </summary> private void getDayOfTime() { System.DateTime serverDate = ServerTimeKit.getDateTime(); int day = TimeKit.getWeekCHA(serverDate.DayOfWeek); setTimeLabel(day); }
/// <summary> /// 更新比赛进度 /// </summary> private void setProgess(int indexxx) { timeProgress.SetActive(true); Utils.RemoveAllChild(timeProgress.transform); GameObject go = NGUITools.AddChild(timeProgress, timeItemPrefab); GodsWarTimeProgress itme = go.GetComponent <GodsWarTimeProgress> (); itme.fatherWindow = this; if (indexxx == 0) { itme.initTime(); } else { int day = TimeKit.getWeekCHA(ServerTimeKit.getDateTime().DayOfWeek); if (day != 4) { timeProgress.SetActive(false); } else { itme.initFinal(); } } }
public void refreshTips() { if (this == null || !gameObject.activeInHierarchy) { if (timer != null) { timer.stop(); timer = null; } return; } //punitiveButton.gameObject.transform.FindChild("Tips").gameObject.SetActive(false); //punitiveTips.SetActive(false); lastBattleTips.SetActive(false); oneOnOneBossTips.SetActive(false); DateTime dt = TimeKit.getDateTimeMillis(ServerTimeKit.getMillisTime());//获取服务器时间 //showPuntiveTips(dt); if (UserManager.Instance.self.getUserLevel() >= CommandConfigManager.Instance.lastBattleData.openLevel && TimeKit.getWeekCHA(dt.DayOfWeek) == CommandConfigManager.Instance.lastBattleData.dayOfWeek) { lastBattleTips.SetActive(true); } int[] data = CommandConfigManager.Instance.getOneOnOneBossData(); if (UserManager.Instance.self.getUserLevel() >= CommandConfigManager.Instance.getOneOnOneBossLimitLv()) { for (int i = 0; i < data.Length; i++) { if (TimeKit.getWeekCHA(dt.DayOfWeek) == data[i]) { oneOnOneBossTips.SetActive(true); } } } }
//计算出当前最近的一次活动时间(即将开启,或者已经在活动时间内) public override void computeTime(int time) { base.computeTime(time); DateTime dt = TimeKit.getDateTime(time); int currTime = dt.Hour * 3600 + dt.Minute * 60 + dt.Second; int morning = time - currTime; //当天凌晨 int nowWeek = TimeKit.getWeekCHA(dt.DayOfWeek); //当前是周几 if (nowWeek > weekDay [weekDay.Length - 1]) //如果已经大于最大周,大活动过期 { startTime = morning + (7 - nowWeek + weekDay[0]) * 86400; endTime = startTime + 86400; } else { foreach (int day in weekDay) { if (day >= nowWeek) { startTime = morning + (day - nowWeek) * 86400; endTime = startTime + 86400; return; } } } }
/// <summary> /// 获取当前服务器为星期几 /// </summary> /// <returns>The day of week.</returns> public int GetDayOfWeek() { System.DateTime serverDate = ServerTimeKit.getDateTime(); int day = TimeKit.getWeekCHA(serverDate.DayOfWeek); return(day); }
public int getWeekOfDayState() { System.DateTime serverDate = ServerTimeKit.getDateTime(); int day = TimeKit.getWeekCHA(serverDate.DayOfWeek); if (day == 6 || day == 7) { state = 1; } if (day == 1 || day == 2 || day == 3) { state = 2; } if (day == 4) { state = 3; } if (day == 5) { state = 4; } // if(GameManager.Instance.godsWarState!=-1) // return GameManager.Instance.godsWarState; return(state); }
/// <summary> /// 获取当天的日期 /// </summary> public void setDateTime() { System.DateTime serverDate = ServerTimeKit.getDateTime(); int day = TimeKit.getWeekCHA(serverDate.DayOfWeek); this.week = day; this.todaySecondTime = ServerTimeKit.getSecondTime(); }
/** 是否为公会战期间 */ public bool isOpenTime() { System.DateTime serverDate = ServerTimeKit.getDateTime(); foreach (int day in openTimeList) { if (day == TimeKit.getWeekCHA(serverDate.DayOfWeek)) { return(true); } } return(false); }
// 活动是否开启 // bool isActivityOpen() { int day = TimeKit.getWeekCHA(TimeKit.getDateTimeMillis(ServerTimeKit.getMillisTime()).DayOfWeek); for (int i = 0; i < CommandConfigManager.Instance.getLotteryData().openTime.Length; i++) { if (day == CommandConfigManager.Instance.getLotteryData().openTime[i]) { return(true); } } return(false); }
string getNextOpenTimeLabel() { int currentDay = TimeKit.getWeekCHA(TimeKit.getDateTimeMillis(ServerTimeKit.getMillisTime()).DayOfWeek); int[] openTimes = CommandConfigManager.Instance.getLotteryData().openTime; for (int i = 0; i < openTimes.Length; i++) { if (currentDay < openTimes[i]) { return(LanguageConfigManager.Instance.getLanguage("lottery_" + openTimes[i])); } } return(LanguageConfigManager.Instance.getLanguage("lottery_" + openTimes[0])); }
public bool bossFightIsOpen() { DateTime dt = TimeKit.getDateTimeMillis(ServerTimeKit.getMillisTime());//获取服务器时间 int dayOfWeek = TimeKit.getWeekCHA(dt.DayOfWeek); int nowOfDay = ServerTimeKit.getCurrentSecond(); int[] timeInfo = CommandConfigManager.Instance.getOneOnOneBossTimeInfo(); //开放时间 int[] data = CommandConfigManager.Instance.getOneOnOneBossData(); //开放日期 for (int i = 0; i < data.Length; i++) { if (dayOfWeek == data[i] && (nowOfDay >= timeInfo[0] && nowOfDay <= timeInfo[1])) { return(true); } } return(false); }
public string getStateInfo() { System.DateTime serverDate = ServerTimeKit.getDateTime(); int secondTime = ServerTimeKit.getSecondTime(); int day = TimeKit.getWeekCHA(serverDate.DayOfWeek); string time = ""; if (getGodsWarStateInfo() == STATE_NOTOPEN || day == 6 || day == 7) { time = LanguageConfigManager.Instance.getLanguage("godsWar_132") + getDateTime(ServerTimeKit.getSecondTime() + 86400 * (7 - day + 1)); return(time); } if (getGodsWarStateInfo() == STATE_SERVER_BUSY) { return(LanguageConfigManager.Instance.getLanguage("godsWar_13233")); } switch (day) { case 1: time = LanguageConfigManager.Instance.getLanguage("godsWar_17") + getDateTime(ServerTimeKit.getSecondTime()) + "-" + getDateTime(ServerTimeKit.getSecondTime() + 86400 * 2); break; case 2: time = LanguageConfigManager.Instance.getLanguage("godsWar_17") + getDateTime(ServerTimeKit.getSecondTime() - 86400) + "-" + getDateTime(ServerTimeKit.getSecondTime() + 86400); break; case 3: time = LanguageConfigManager.Instance.getLanguage("godsWar_17") + getDateTime(ServerTimeKit.getSecondTime() - 86400 * 2) + "-" + getDateTime(ServerTimeKit.getSecondTime()); break; case 4: time = LanguageConfigManager.Instance.getLanguage("godsWar_19") + getDateTime(ServerTimeKit.getSecondTime()); break; case 5: time = LanguageConfigManager.Instance.getLanguage("godsWar_20") + getDateTime(ServerTimeKit.getSecondTime()); break; default: break; } return(time); }
/// <summary> /// 设置神魔大战开始时间 /// </summary> private void setShenMoOpenTime() { System.DateTime serverDate = ServerTimeKit.getDateTime(); int day = TimeKit.getWeekCHA(serverDate.DayOfWeek); if (day < 5) { lblTime.text = LanguageConfigManager.Instance.getLanguage("godsWar_126", getDateTime(ServerTimeKit.getSecondTime() + 86400 * (5 - day)), GodsWarInfoConfigManager.Instance().getSampleBySid(8001).times[0].hour + ":" + (GodsWarInfoConfigManager.Instance().getSampleBySid(8001).times[0].minute == 0 ? "00" : GodsWarInfoConfigManager.Instance().getSampleBySid(8001).times[0].minute + "")); } else { int currentTime = serverDate.Hour * 3600 + serverDate.Minute * 60 + serverDate.Second; godsWarTime gwt = GodsWarInfoConfigManager.Instance().getSampleBySid(8001).times[0]; if (day == 5) { if (currentTime < gwt.hour * 3600 + gwt.minute * 60) { lblTime.text = LanguageConfigManager.Instance.getLanguage("godsWar_126", getDateTime(ServerTimeKit.getSecondTime() + 86400 * (5 - day)), GodsWarInfoConfigManager.Instance().getSampleBySid(8001).times[0].hour + ":" + (GodsWarInfoConfigManager.Instance().getSampleBySid(8001).times[0].minute == 0 ? "00" : GodsWarInfoConfigManager.Instance().getSampleBySid(8001).times[0].minute + "")); } else if (currentTime > gwt.hour * 3600 + gwt.minute * 60 && currentTime < gwt.hour * 3600 + gwt.minute * 60 + 1261) { lblTime.text = LanguageConfigManager.Instance.getLanguage("godsWar_1277"); } else { lblTime.text = LanguageConfigManager.Instance.getLanguage("godsWar_127"); } } } // if (zhanOrReplay.gameObject.activeInHierarchy && zhanOrReplay.textLabel.text == LanguageConfigManager.Instance.getLanguage("godsWar_125")) lblTime.text = LanguageConfigManager.Instance.getLanguage("godsWar_127"); }
/// <summary> /// 检测当前状态是否正确(主要是清理分组校验) /// </summary> private void checkState() { //校验星期 int currentDayState = GodsWarManagerment.Instance.getWeekOfDayState(); if (currentDayState == 2) { MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("godsWar_130"), (msg) => { finishWindow(); }); } //校验清理分组时间(这里和后台商量固定22点为清理时间,所以在21:59:59分时进入界面则弹回主界面) int dayOfWeek = TimeKit.getWeekCHA(ServerTimeKit.getDateTime().DayOfWeek); if (dayOfWeek == 7 && ServerTimeKit.getDateTime().Hour == 21 && ServerTimeKit.getDateTime().Minute == 59 && ServerTimeKit.getDateTime().Second == 59) { MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("godsWar_131"), (msg) => { finishWindow(); }); } }
//获得下个具体星期时间 private int getNextWeekDay(int morning) { DateTime dt = TimeKit.getDateTime(morning); int nowWeek = TimeKit.getWeekCHA(dt.DayOfWeek); //当前是周几 if (nowWeek > weekDay [weekDay.Length - 1]) //如果已经大于最大周,大活动过期 { isFinish = true; return(morning); } else { foreach (int day in weekDay) { if (day > nowWeek) { return(morning + (day - nowWeek) * 86400); } } isFinish = true; return(morning); } }
void Update() { if (RankManagerment.Instance.updateRankItemTotalDamage) { RankManagerment.Instance.updateRankItemTotalDamage = false; RankManagerment.Instance.loadData(RankManagerment.TYPE_BOSSDAMAGE, updateUI); } dt = TimeKit.getDateTimeMillis(ServerTimeKit.getMillisTime()); //获取服务器时间 dayOfWeek = TimeKit.getWeekCHA(dt.DayOfWeek); nowOfDay = ServerTimeKit.getCurrentSecond(); // 活动中// for (int i = 0; i < data.Length; i++) { if (dayOfWeek == data[i] && (nowOfDay >= timeInfo[0] && nowOfDay <= timeInfo[1])) { if (lblMyRank.transform.localPosition != lblMyRankOldPos && buttonHelp.localPosition != buttonHelpOldPos) { lalAward.gameObject.SetActive(true); awardIcon.SetActive(true); lblMyRank.transform.localPosition = lblMyRankOldPos; buttonHelp.localPosition = buttonHelpOldPos; } } // 活动未开// else { if (lblMyRank.transform.localPosition != lblMyRankMidPosObj.localPosition && buttonHelp.localPosition != buttonHelpMidPosObj.localPosition) { lalAward.gameObject.SetActive(false); awardIcon.SetActive(false); lblMyRank.transform.localPosition = lblMyRankMidPosObj.localPosition; buttonHelp.localPosition = buttonHelpMidPosObj.localPosition; } } } }
private void updateInfo() { DateTime dt = TimeKit.getDateTimeMillis(ServerTimeKit.getMillisTime());//获取服务器时间 int dayOfWeek = TimeKit.getWeekCHA(dt.DayOfWeek); int nowOfDay = ServerTimeKit.getCurrentSecond(); int[] timeInfo = CommandConfigManager.Instance.getOneOnOneBossTimeInfo(); //开放时间 int[] data = CommandConfigManager.Instance.getOneOnOneBossData(); //开放日期 for (int i = 0; i < data.Length; i++) { // if (dayOfWeek == data[i] && (nowOfDay == timeInfo[0] || nowOfDay == timeInfo[1])) { // GetBossAttackFPort fport = FPortManager.Instance.getFPort("GetBossAttackFPort") as GetBossAttackFPort; // fport.access(CommandConfigManager.Instance.getBossFightSid(), updateUI); // return; // } if (dayOfWeek == data[i] && (nowOfDay >= timeInfo[0] && nowOfDay <= timeInfo[1])) { updateNotOpen = true; if (updateOpen) { updateOpen = false; GetBossAttackFPort fport = FPortManager.Instance.getFPort("GetBossAttackFPort") as GetBossAttackFPort; fport.access(CommandConfigManager.Instance.getBossFightSid(), updateUI); } updateTime(timeInfo, nowOfDay); } else { updateOpen = true; if (updateNotOpen) { updateNotOpen = false; updateUIForNotOpen(); } } } }
protected override void begin() { UiManager.Instance.backGround.switchBackGround("ChouJiang_BeiJing"); base.begin(); new_punitiveButton.transform.localPosition = new Vector3(10000f, 10000f, 0f); new_practiceButton.transform.localPosition = new Vector3(10000f, 10000f, 0f); new_activityButton.transform.localPosition = new Vector3(10000f, 10000f, 0f); new_oneOnOneBossButton.transform.localPosition = new Vector3(10000f, 10000f, 0f); new_clmbTowerButton.transform.localPosition = new Vector3(10000f, 10000f, 0f); new_lastBattleButton.transform.localPosition = new Vector3(10000f, 10000f, 0f); if (!GameManager.Instance.skipGuide) { updateButtonPostion(); } else { updateButtonNoGuide(); } if (GuideManager.Instance.getOnTypp() == 41 && GuideManager.Instance.isMoriJuezhan) { updateFirendButton(); } else { DateTime dt = TimeKit.getDateTimeMillis(ServerTimeKit.getMillisTime()); int[] data = CommandConfigManager.Instance.getOneOnOneBossData(); // 末日决战选项置顶// if (UserManager.Instance.self.getUserLevel() >= CommandConfigManager.Instance.lastBattleData.openLevel && TimeKit.getWeekCHA(dt.DayOfWeek) == CommandConfigManager.Instance.lastBattleData.dayOfWeek) { new_lastBattleButton.transform.parent = huoDongContent.transform; new_lastBattleButton.transform.localPosition = new Vector3(0f, -0f, 0f); new_punitiveButton.transform.parent = huoDongContent.transform; new_punitiveButton.transform.localPosition = new Vector3(0f, -900f, 0f); } // 单挑boss置顶// else if (UserManager.Instance.self.getUserLevel() >= CommandConfigManager.Instance.getOneOnOneBossLimitLv()) { for (int i = 0; i < data.Length; i++) { if (TimeKit.getWeekCHA(dt.DayOfWeek) == data[i]) { new_punitiveButton.transform.parent = huoDongContent.transform; new_punitiveButton.transform.localPosition = new Vector3(0f, -540f, 0f); new_oneOnOneBossButton.transform.parent = huoDongContent.transform; new_oneOnOneBossButton.transform.localPosition = new Vector3(0f, 0f, 0f); } } } } timer = TimerManager.Instance.getTimer(UserManager.TIMER_DELAY); timer.addOnTimer(refreshTips); timer.start(); initFubenData(); if (GuideManager.Instance.isEqualStep(123001000) || GuideManager.Instance.isEqualStep(140003000) || GuideManager.Instance.isEqualStep(126003000) || GuideManager.Instance.isEqualStep(103003000) || GuideManager.Instance.isEqualStep(120003000)) { GuideManager.Instance.guideEvent(); } GuideManager.Instance.doFriendlyGuideEvent(); }