public void Start() { //送审下 关闭特效 if (AuditManager.Instance.AuditAndIOS()) { return; } mSysConfigBtn = GetComponent <UISysConfigBtn>(); if (mSysConfigBtn == null) { return; } AddListener(); Transform specialRoot = null; var window = UIManager.Instance.GetWindow("UIMainmapWindow"); if (window != null) { var go = window.FindChild("SpecialBtnPanel"); specialRoot = go.GetComponent <Transform>(); } //Transform specialRoot = transform.parent.parent.parent.parent.parent.parent.Find("SpecialBtnPanel"); if (specialRoot != null) { Transform specialTransform = specialRoot.Find(GetBtnName()); if (specialTransform != null) { GameObject specialGmaeObject = GameObject.Instantiate(specialTransform.gameObject); specialGmaeObject.name = GetBtnName(); specialTransform = specialGmaeObject.transform; specialTransform.SetParent(transform.Find("SysBtn"), false); specialTransform.SetAsFirstSibling(); } } UpdateState(); }
static int _m_GetMainUISysBtnBySysId_xlua_st_(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { { uint sysId = LuaAPI.xlua_touint(L, 1); UISysConfigBtn __cl_gen_ret = xc.ui.ugui.UIHelper.GetMainUISysBtnBySysId(sysId); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
static int _m_CreateMainUISysBtnBySysId_xlua_st_(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { { uint sysId = LuaAPI.xlua_touint(L, 1); UnityEngine.Transform parent_trans = (UnityEngine.Transform)translator.GetObject(L, 2, typeof(UnityEngine.Transform)); uint sort_index = LuaAPI.xlua_touint(L, 3); UISysConfigBtn __cl_gen_ret = xc.ui.ugui.UIHelper.CreateMainUISysBtnBySysId(sysId, parent_trans, sort_index); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
void UpdateUI() { if (mTimer != null) { mTimer.Destroy(); mTimer = null; } if (mActivityIds == null) { return; } Transform timerTextTrans = this.transform.Find("SysBtn").Find("TimerText"); if (timerTextTrans == null) { GameDebug.LogError("UIGuildLeagueSysBtn UpdateTimerText error!!! Can not find TimerText!!!"); return; } UISysConfigBtn btn = this.gameObject.GetComponent <UISysConfigBtn>(); //当预告开启的时候 预备和资格的 icon不允许显示 if (ActivityHelper.IsActivityOpen(GameConst.SYS_OPEN_LEAGUE_PRE_SHOW)) { btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); return; } // 系统是否开放 bool sysIsOpen = false; foreach (uint activityId in mActivityIds) { if (SysConfigManager.Instance.CheckSysHasOpenIgnoreActivity(activityId)) { sysIsOpen = true; break; } } if (sysIsOpen == false) { btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); return; } bool todayIsOpen = false; foreach (uint activityId in mActivityIds) { if (ActivityHelper.GetActivityInfo <bool>(activityId, "TodayIsOpen") == true) { todayIsOpen = true; break; } } if (todayIsOpen == false) { //this.gameObject.SetActive(false); btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); } else { DateTime curDateTime = Game.Instance.GetServerDateTime(); uint serverTime = Game.Instance.ServerTime; List <uint> startShowBtnTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_START_SHOW_BTN_TIME"); // 开始显示系统按钮时间(5点) List <uint> confirmTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_CONFIRM_TIME"); // 确认对战表时间(19点) List <uint> openTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_OPEN_TIME"); // 活动开启时间(21点) List <uint> closeTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_CLOSE_TIME"); // 活动关闭时间(22点) uint startShowBtnTimeHour = startShowBtnTimeStr[0]; uint startShowBtnTimeMinute = startShowBtnTimeStr[1]; uint confirmTimeHour = confirmTimeStr[0]; uint confirmTimeMinute = confirmTimeStr[1]; uint openTimeHour = openTimeStr[0]; uint openTimeMinute = openTimeStr[1]; uint closeTimeHour = closeTimeStr[0]; uint closeTimeMinute = closeTimeStr[1]; long startShowBtnTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)startShowBtnTimeHour, (int)startShowBtnTimeMinute, 0)); long confirmTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)confirmTimeHour, (int)confirmTimeMinute, 0)); long openTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)openTimeHour, (int)openTimeMinute, 0)); long roundTwoOpenTimestamp = openTimestamp + GameConstHelper.GetUint("GAME_GUILD_LEAGUE_ROUND_TWO_AFTER") * 60; long closeTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)closeTimeHour, (int)closeTimeMinute, 0)); long endTimestamp = 0; if (serverTime < startShowBtnTimestamp) // 5点前 { //this.gameObject.SetActive(false); btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); } else if (serverTime < confirmTimestamp) // 确认参赛资格前 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); endTimestamp = openTimestamp; } else if (serverTime < openTimestamp) // 第一轮比赛开启前 { if (GuildLeagueManager.Instance.CanJoinLeague() == true) // 有参赛资格 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); endTimestamp = openTimestamp; } else // 没有参赛资格 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); } } else if (serverTime < roundTwoOpenTimestamp) // 第二轮比赛开启前 { if (GuildLeagueManager.Instance.RoundOneIsOver() == false) // 第一轮还没结束 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); } else // 第一轮已经结束 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); endTimestamp = roundTwoOpenTimestamp; } } else if (serverTime < closeTimestamp) // 22点前 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); } else // 22点后 { //this.gameObject.SetActive(false); btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); } Text timerText = this.transform.Find("SysBtn").Find("TimerText").GetComponent <Text>(); if (endTimestamp > 0) { timerText.gameObject.SetActive(true); if (endTimestamp > serverTime) { long timeOffset = endTimestamp - serverTime; timerText.text = Utils.Timer.GetFMTTime2(1000f * timeOffset); mTimer = new Utils.Timer(timeOffset * 1000, false, 1000, (remainTime) => { if (remainTime > 0) { timerText.text = Utils.Timer.GetFMTTime2(remainTime); } else { timerText.text = ""; timerText.gameObject.SetActive(false); UpdateUI(); } }); } else { GameDebug.LogError("Init UIGuildLeagueSysBtn error, end timestamp is early then cur time!!!"); } } else { timerText.gameObject.SetActive(false); } } ShowEffect(RedPointDataMgr.Instance.GetRedPointVisible(70)); }