public override void Release(bool depthRelease = true) { base.Release(depthRelease); if (m_WelfareData != null) { m_WelfareData = null; } }
public override void SetGridData(object data) { base.SetGridData(data); if (data is WelfareBaseData) { m_WelfareData = (WelfareBaseData)data; if (m_lab_TitleName2 != null) { bool IsRushLv = m_WelfareData.welfareType == WelfareType.RushLevel; m_lab_TitleName2.gameObject.SetActive(IsRushLv); if (IsRushLv) { m_lab_TitleName2.text = m_WelfareData.process.ToString(); } } if (m_lableNamel != null) { m_lableNamel.text = m_WelfareData.title; } if (m_lableProcess != null) { string msg = ""; bool match = false; m_lableProcess.text = ""; if (m_WelfareData.state != QuickLevState.QuickLevState_HaveGet) { if (m_WelfareData.DataType == 2) { msg = string.Format("{0}/{1}", m_WelfareData.process, m_WelfareData.total);; SevenDayWelfare wdata = m_WelfareData as SevenDayWelfare; if (wdata.nType == 7) { if (m_WelfareData.process == 0) { msg = string.Format("{0}/{1}", "1000+", m_WelfareData.total); match = false; } else { match = m_WelfareData.process <= m_WelfareData.total; } } else { match = m_WelfareData.process >= m_WelfareData.total; } } else if (m_WelfareData.DataType == 1) { WelfareData wdata = m_WelfareData as WelfareData; if (wdata.type == WelfareType.OnLine || wdata.type == WelfareType.RoleLevel || wdata.type == WelfareType.OpenSever || wdata.type == WelfareType.SevenDay) { match = m_WelfareData.process >= m_WelfareData.total; msg = string.Format("{0}/{1}", m_WelfareData.process, m_WelfareData.total); } else if (wdata.type == WelfareType.FriendInvite) { if (wdata.inviteType == InviteType.Invited) { bool hadIvited = DataManager.Manager <WelfareManager>().HadBeenInvited; msg = string.Format("{0}/{1}", m_WelfareData.process, m_WelfareData.total); match = m_WelfareData.process >= m_WelfareData.total && hadIvited; } else { msg = string.Format("{0}/{1}", m_WelfareData.process, m_WelfareData.total); match = m_WelfareData.process >= m_WelfareData.total; } } else if (wdata.type == WelfareType.RushLevel) { msg = string.Format("{0}/{1}", MainPlayerHelper.GetPlayerLevel(), wdata.param2); match = MainPlayerHelper.GetPlayerLevel() >= wdata.param2; } } } m_lableProcess.text = match ? ColorManager.GetColorString(ColorType.JZRY_Green, msg) : ColorManager.GetColorString(ColorType.JZRY_Txt_Red, msg); } SetButtonState(); RefreshItems(); return; } }
// WelfareType curType = WelfareType.Month; void OnToggleWelfare(WelfareType type) { List <UIWelfareTypeGrid> lstgrid = m_ctor_ToggleScrollView.GetGrids <UIWelfareTypeGrid>(true); for (int i = 0; i < lstgrid.Count; i++) { lstgrid[i].OnWelfareSelect(type); } // UIWelfareTypeGrid grid = m_ctor_ToggleScrollView.GetGrid<UIWelfareTypeGrid>(m_lstWelfare.IndexOf(curType)); // if (grid != null) // { // grid.OnWelfareSelect(false); // } // grid = m_ctor_ToggleScrollView.GetGrid<UIWelfareTypeGrid>(m_lstWelfare.IndexOf(type)); // if (grid != null) // { // grid.OnWelfareSelect(true); // } // curType = type; m_widget_CheckInPanel.gameObject.SetActive(false); m_widget_OtherPanel.gameObject.SetActive(false); m_widget_RewardFindPanel.gameObject.SetActive(false); m_widget_BindContent.gameObject.SetActive(false); m_widget_FriendInviteContent.gameObject.SetActive(false); m_widget_CDkeyContent.gameObject.SetActive(false); m_widget_CollectWordContent.gameObject.SetActive(false); m__huodong_beijing.gameObject.SetActive(true); m_label_ScheduleLabel.gameObject.SetActive(type == WelfareType.CollectWord || type == WelfareType.SevenDay); if (type == WelfareType.FriendInvite) { m_lstWelFareData = m_dataManager.GetWelfareDatasBy2Type(type, curInviteType); } else { m_lstWelFareData = m_dataManager.GetWelfareDatasByType(type); } if (type == WelfareType.BindGift) { m_widget_BindContent.gameObject.SetActive(true); WelfareBaseData data = (WelfareBaseData)m_lstWelFareData[0]; RefreshItems(data.lstWelfareItems); RefreshBindBtns(); } else if (type == WelfareType.RewardFind) { m_widget_RewardFindPanel.gameObject.SetActive(true); bool hasReward = m_dataManager.HasRewardCanReBack(); if (hasReward) { m_trans_NullRewardTipsContent.gameObject.SetActive(false); m_ctor_RewardFindScroll.SetVisible(true); m_lstRewardFindData = m_dataManager.M_lstReward; if (m_lstRewardFindData != null) { m_lstRewardFindData.Sort(); if (m_ctor_RewardFindScroll != null) { m_ctor_RewardFindScroll.CreateGrids(m_lstRewardFindData.Count); } } } else { m_trans_NullRewardTipsContent.gameObject.SetActive(true); m_ctor_RewardFindScroll.SetVisible(false); } } else if (type == WelfareType.FriendInvite) { m_label_InviteCode.text = MainPlayerHelper.GetPlayerID().ToString(); m_widget_FriendInviteContent.gameObject.SetActive(true); m__huodong_beijing.gameObject.SetActive(false); m_lstWelFareData.Sort(); if (m_ctor_FriendInviteScroll != null) { m_ctor_FriendInviteScroll.CreateGrids(m_lstWelFareData.Count); } m_btn_InviterBtn.GetComponent <UIToggle>().value = curInviteType == InviteType.Inviter; m_btn_InvitedBtn.GetComponent <UIToggle>().value = curInviteType == InviteType.Invited; m_btn_InvitedRechargeBtn.GetComponent <UIToggle>().value = curInviteType == InviteType.InvitedRecharge; ChangeInviteState(); } else if (type == WelfareType.CDKey) { m_widget_CDkeyContent.gameObject.SetActive(true); } else if (type == WelfareType.CollectWord) { m_lstWelFareData.Sort(); m_widget_CollectWordContent.gameObject.SetActive(true); if (m_ctor_CollectWordScrollView != null) { m_ctor_CollectWordScrollView.CreateGrids(m_lstWelFareData.Count); } m_label_ScheduleLabel.text = m_dataManager.GetScheduleByType((uint)type); } else if (type == WelfareType.SevenDay) { m_label_ScheduleLabel.text = m_dataManager.GetScheduleByType((uint)type); m_lstWelFareData.Sort(); m_widget_OtherPanel.gameObject.SetActive(true); if (m_ctor_OtherScrollView != null) { m_ctor_OtherScrollView.CreateGrids(m_lstWelFareData.Count); } } else { m_widget_OtherPanel.gameObject.SetActive(type != WelfareType.Month); m_widget_CheckInPanel.gameObject.SetActive(type == WelfareType.Month); m_lstWelFareData.Sort(); if (type == WelfareType.Month) { if (m_ctor_CheckInScrollView != null) { m_ctor_CheckInScrollView.CreateGrids(m_lstWelFareData.Count); } CheckEnableSignBtn(); } else { if (type == WelfareType.RushLevel) { NetService.Instance.Send(new stReqLevGiftNumsDataUserCmd_C()); } if (m_ctor_OtherScrollView != null) { m_ctor_OtherScrollView.CreateGrids(m_lstWelFareData.Count); } } } ChangeTexture(type); }