public void OnButtonClick(UnityEngine.GameObject go) { if (go == null) { return; } trialIntro = UIManager.Instance.GetWindowGoByName("TrialIntro"); TrialIntro script = null; if (trialIntro != null) { script = trialIntro.GetComponent <TrialIntro>(); } TrialUnit tu = go.GetComponent <TrialUnit>(); if (tu.HasOpen == false) {//未开放 SendScreeTipCenter(1200, tu.OpenLv.ToString()); return; } switch (go.name.TrimStart("1234567890".ToCharArray())) { case NAME_GOLD: UIManager.Instance.ShowWindowByName("TrialIntro"); if (script != null) { script.SetIntroType(TrialIntroType.JinBi); } break; case NAME_TREASURE: UIManager.Instance.ToggleWindowVisible("cangbaotu"); break; case NAME_TRIAL: UIManager.Instance.ShowWindowByName("TrialIntro"); if (script != null) { script.SetIntroType(TrialIntroType.ShiLian); } break; default: break; } }
private void PlayUnLock(UnityEngine.GameObject button) { //for (int i = 0; i < buttons.Count; i++) { // TrialUnit unit = buttons[i].GetComponent<TrialUnit>(); // if (unit != null) { // if (unit.HasOpen) {//播放第一个为开放的(等级从大到小排的序) // unit.PlayUnLock(); // break; // } // } //} TrialUnit unit = button.GetComponent <TrialUnit>(); if (unit != null) { unit.PlayUnLock(); } }
void OnEnable() { try { RoleInfo role_info = LobbyClient.Instance.CurrentRole; for (int i = 0; i < buttons.Count; i++) { bool open = false; int openLv = 0; string btnName = buttons[i].name; string unitName = ""; string openTime = ""; int type = -1; switch (btnName.TrimStart("1234567890".ToCharArray())) { case NAME_GOLD: openLv = LevelLockProvider.Instance.GetDataById(15).m_Level; //RoleInfo.c_GoldOpenLv; unitName = StrDictionaryProvider.Instance.GetDictString(882); openTime = GetOpenTime((int)MatchSceneEnum.Gold); type = (int)GuideActionEnum.Gold; break; case NAME_TREASURE: openLv = LevelLockProvider.Instance.GetDataById(13).m_Level; //ExpeditionPlayerInfo.c_UnlockLevel; unitName = StrDictionaryProvider.Instance.GetDictString(881); openTime = "00:00-24:00"; type = (int)GuideActionEnum.Expedition; break; case NAME_TRIAL: openLv = LevelLockProvider.Instance.GetDataById(14).m_Level; //RoleInfo.c_TrialOpenLv; unitName = StrDictionaryProvider.Instance.GetDictString(874); openTime = GetOpenTime((int)MatchSceneEnum.Attempt); type = (int)GuideActionEnum.Attempt; break; } if (role_info != null && role_info.Level >= openLv) { open = true; if (!role_info.IsDoneAction(type)) { PlayUnLock(buttons[i]); } } TrialUnit unit = buttons[i].GetComponent <TrialUnit>(); if (unit != null) { unit.UpdateData(unitName, open, openTime, openLv); } } CheckHasTip(); ////播放解锁特效 //buttons.Sort(SortByLv); //if (role_info != null) { // if (role_info.HasActivityTip) { // role_info.HasActivityTip = false; // CheckHasTip(); // PlayUnLock(); // } //} if (grid != null) { grid.repositionNow = true; } if (scrollView != null) { int num = buttons.Count; if (num <= 4 && num > 0) { scrollView.enabled = false; //强制居中 UIPanel panel = scrollView.gameObject.GetComponent <UIPanel>(); if (panel != null && buttons.Count > 0) { float interval = grid.cellWidth - buttons[0].GetComponent <UISprite>().width; float totalWidth = grid.cellWidth * num - interval; float scrollWidth = panel.GetViewSize().x; float tempX = scrollWidth / 2 - totalWidth / 2 - 25; UnityEngine.Vector2 tempVec2 = panel.clipOffset; panel.clipOffset = new UnityEngine.Vector2(-tempX, tempVec2.y); UnityEngine.Vector3 tempLocal = scrollView.gameObject.transform.localPosition; scrollView.gameObject.transform.localPosition = new UnityEngine.Vector3(tempX, tempLocal.y, tempLocal.z); } } else { scrollView.enabled = true; } } SetCoin(); } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
void Awake() { try { object eo; eo = ArkCrossEngine.LogicSystem.EventChannelForGfx.Subscribe("ge_ui_unsubscribe", "ui", UnSubscribe); if (eo != null) { eventlist.Add(eo); } eo = ArkCrossEngine.LogicSystem.EventChannelForGfx.Subscribe <int>("ge_user_levelup", "property", UserLevelUP); if (eo != null) { eventlist.Add(eo); } //buttons.Clear(); //buttons.Add(btnMars.gameObject); //buttons.Add(btnArena.gameObject); LevelLock levelLockCfg = LevelLockProvider.Instance.GetDataById(c_MarsUnlockLevelId); if (levelLockCfg != null) { m_MarsUnlockLevel = levelLockCfg.m_Level; } levelLockCfg = LevelLockProvider.Instance.GetDataById(c_ArenaUnlockLevelId); if (levelLockCfg != null) { m_ArenaUnlockLevel = 60; // m_ArenaUnlockLevel = levelLockCfg.m_Level; } List <GowTimeConfig> timeCfgs = GowConfigProvider.Instance.GowTimeConfigMgr.GetData(); string marsOpenTime = "00:00-24:00"; if (timeCfgs.Count >= (int)GowTimeConfig.TimeTypeEnum.MatchTime) { //设置战神赛开赛时间 GowTimeConfig openTimeCfg = timeCfgs[(int)GowTimeConfig.TimeTypeEnum.MatchTime - 1]; if (openTimeCfg != null /* && lblMarsOpenTime!=null*/) { int startHour = openTimeCfg.m_StartHour; marsOpenTime = string.Format("{0}:{1:d2}-{2}:{3:d2}", openTimeCfg.m_StartHour, openTimeCfg.m_StartMinute, openTimeCfg.m_EndHour, openTimeCfg.m_EndMinute ); //lblMarsOpenTime.text = openTime; } } if (btnMars != null) { TrialUnit unit = btnMars.GetComponent <TrialUnit>(); if (unit != null) { unit.SetLblLock(m_MarsUnlockLevel); unit.SetLblTime(marsOpenTime); } } if (btnArena != null) { TrialUnit unit = btnArena.GetComponent <TrialUnit>(); if (unit != null) { unit.SetLblLock(m_ArenaUnlockLevel); } } //buttons.Sort(SortByLv); CheckHasTip(); } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
void OnEnable() { try { RoleInfo role_info = LobbyClient.Instance.CurrentRole; if (role_info != null) { if (role_info.Level >= m_MarsUnlockLevel) { m_IsMarsUnlook = true; if (!role_info.IsDoneAction((int)GuideActionEnum.Gow)) { PlayUnLock(btnMars.gameObject); } } else { m_IsMarsUnlook = false; } if (role_info.Level >= m_ArenaUnlockLevel) { m_IsArenaUnlock = true; if (!role_info.IsDoneAction((int)GuideActionEnum.Arena)) { PlayUnLock(btnArena.gameObject); } } else { m_IsArenaUnlock = false; } if (btnMars != null) { TrialUnit unit = btnMars.GetComponent <TrialUnit>(); if (unit != null) { unit.UpdateOpen(m_IsMarsUnlook); } } if (btnArena != null) { TrialUnit unit = btnArena.GetComponent <TrialUnit>(); if (unit != null) { unit.UpdateOpen(m_IsArenaUnlock); } } //if (role_info.HasPvpTip) { // role_info.HasPvpTip = false; // CheckHasTip(); // PlayUnLock(); //} } SetCoin(); } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }