private void SetOneActivity(Transform cell, int activityId) { Debug.LogError("SetOneActivity activityId=" + activityId); HuoDongZhongXin huoDongZhongXin = DataReader <HuoDongZhongXin> .Get(activityId); ResourceManager.SetTexture(cell.Find("imgIcon").GetComponent <RawImage>(), huoDongZhongXin.picture); cell.Find("imgIcon").GetComponent <RawImage>().SetNativeSize(); Button component = cell.Find("imgIcon").GetComponent <Button>(); component.get_onClick().RemoveAllListeners(); component.get_onClick().AddListener(delegate { this.OnClickImgIcon(int.Parse(cell.get_name())); }); ActiveCenterInfo activeCenterInfo = ActivityCenterManager.infoDict.get_Item(activityId); cell.Find("txtOpenTime").GetComponent <Text>().set_text(this.GetFormatOpenTime(huoDongZhongXin)); string text = (activeCenterInfo.remainTimes != -1) ? activeCenterInfo.remainTimes.ToString() : "不限"; cell.Find("txtRemainNum").GetComponent <Text>().set_text(text); cell.Find("txtPeopleNum").GetComponent <Text>().set_text(huoDongZhongXin.people.ToString()); for (int i = 0; i < huoDongZhongXin.award.get_Count(); i++) { int icon = DataReader <Items> .Get(huoDongZhongXin.award.get_Item(i)).icon; Debug.LogError("itemIconId=" + icon); GameObject gameObject = ItemShow.ShowItem(cell, huoDongZhongXin.award.get_Item(i), -1L, false, null, 2001); gameObject.get_transform().set_localScale(new Vector3(0.8f, 0.8f, 0.8f)); float num = this.itemIconPositionX[huoDongZhongXin.award.get_Count() - 1].get_Item(i); gameObject.get_transform().set_localPosition(new Vector3(num, -201f)); } this.SetActivityWithState(cell, activityId, ActivityCenterManager.infoDict.get_Item(activityId).status); }
private void OnActiveChangeNty(short state, ActiveChangeNty msg = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } if (msg == null) { return; } for (int i = 0; i < msg.activeInfos.get_Count(); i++) { ActiveCenterInfo activeCenterInfo = msg.activeInfos.get_Item(i); ActivityCenterManager.infoDict.set_Item(activeCenterInfo.id, activeCenterInfo); if (this.CurrentACInfoDic.ContainsKey(activeCenterInfo.id) && activeCenterInfo.status != ActiveCenterInfo.ActiveStatus.AS.Start) { this.CurrentACInfoDic.Remove(activeCenterInfo.id); } if (!this.CurrentACInfoDic.ContainsKey(activeCenterInfo.id) && activeCenterInfo.status == ActiveCenterInfo.ActiveStatus.AS.Start && this.CheckCanShowTownTip(activeCenterInfo.id)) { this.CurrentACInfoDic.Add(activeCenterInfo.id, activeCenterInfo); } } EventDispatcher.Broadcast(EventNames.ActivityAnnounce); }
private void OnActiveCenterLoginPush(short state, ActiveCenterLoginPush msg = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } if (msg != null) { if (this.CurrentACInfoDic == null) { this.CurrentACInfoDic = new Dictionary <int, ActiveCenterInfo>(); } for (int i = 0; i < msg.activeInfos.get_Count(); i++) { ActiveCenterInfo activeCenterInfo = msg.activeInfos.get_Item(i); ActivityCenterManager.infoDict.set_Item(activeCenterInfo.id, activeCenterInfo); if (activeCenterInfo.status == ActiveCenterInfo.ActiveStatus.AS.Start && !this.CurrentACInfoDic.ContainsKey(activeCenterInfo.id) && this.CheckCanShowTownTip(activeCenterInfo.id)) { this.CurrentACInfoDic.Add(activeCenterInfo.id, activeCenterInfo); } } } if (this.CurrentACInfoDic != null && this.CurrentACInfoDic.get_Count() > 0) { EventDispatcher.Broadcast(EventNames.ActivityAnnounce); } }
public void ChangeGuildFieldActivityTip(bool isOpen) { if (this.CurrentACInfoDic == null) { this.CurrentACInfoDic = new Dictionary <int, ActiveCenterInfo>(); } if (isOpen) { if (this.CurrentACInfoDic != null && !this.CurrentACInfoDic.ContainsKey(10004) && GuildManager.Instance.IsJoinInGuild()) { ActiveCenterInfo activeCenterInfo = new ActiveCenterInfo(); activeCenterInfo.id = 10004; activeCenterInfo.status = ActiveCenterInfo.ActiveStatus.AS.Start; this.CurrentACInfoDic.Add(10004, activeCenterInfo); } else if (this.CurrentACInfoDic != null && this.CurrentACInfoDic.ContainsKey(10004) && !GuildManager.Instance.IsJoinInGuild()) { this.CurrentACInfoDic.Remove(10004); } } else if (this.CurrentACInfoDic != null && this.CurrentACInfoDic.ContainsKey(10004)) { this.CurrentACInfoDic.Remove(10004); } EventDispatcher.Broadcast(EventNames.ActivityAnnounce); }
public void ChangeGuildWarActivityTip(GuildWarTimeStep.GWTS guildWarStep) { if (this.CurrentACInfoDic == null) { this.CurrentACInfoDic = new Dictionary <int, ActiveCenterInfo>(); } if (guildWarStep == GuildWarTimeStep.GWTS.FINAL_MATCH_BEG || guildWarStep == GuildWarTimeStep.GWTS.HALF_MATCH1_BEG || guildWarStep == GuildWarTimeStep.GWTS.HALF_MATCH2_BEG) { if (this.CurrentACInfoDic != null && !this.CurrentACInfoDic.ContainsKey(10005) && GuildManager.Instance.IsJoinInGuild()) { ActiveCenterInfo activeCenterInfo = new ActiveCenterInfo(); activeCenterInfo.id = 10005; activeCenterInfo.status = ActiveCenterInfo.ActiveStatus.AS.Start; this.CurrentACInfoDic.Add(10005, activeCenterInfo); } else if (this.CurrentACInfoDic != null && this.CurrentACInfoDic.ContainsKey(10005) && !GuildManager.Instance.IsJoinInGuild()) { this.CurrentACInfoDic.Remove(10005); } } else if (this.CurrentACInfoDic != null && this.CurrentACInfoDic.ContainsKey(10005)) { this.CurrentACInfoDic.Remove(10005); } EventDispatcher.Broadcast(EventNames.ActivityAnnounce); }
public List <ActiveCenterInfo> GetActivityInfoList() { List <ActiveCenterInfo> list = new List <ActiveCenterInfo>(); if (ActivityCenterManager.infoDict.get_Count() <= 0) { List <HuoDongZhongXin> dataList = DataReader <HuoDongZhongXin> .DataList; for (int i = 0; i < dataList.get_Count(); i++) { ActiveCenterInfo activeCenterInfo = new ActiveCenterInfo(); activeCenterInfo.id = dataList.get_Item(i).activityid; activeCenterInfo.status = ActiveCenterInfo.ActiveStatus.AS.NotOpen; activeCenterInfo.remainTimes = ((dataList.get_Item(i).num <= 0) ? -1 : dataList.get_Item(i).num); ActivityCenterManager.infoDict.Add(activeCenterInfo.id, activeCenterInfo); } } using (Dictionary <int, ActiveCenterInfo> .Enumerator enumerator = ActivityCenterManager.infoDict.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <int, ActiveCenterInfo> current = enumerator.get_Current(); list.Add(current.get_Value()); } } return(list); }
protected override void StartExecute(bool isFastNav) { if (base.Data == null || base.Targets == null) { return; } ActiveCenterInfo activeCenterInfo = null; if (ActivityCenterManager.infoDict.TryGetValue(10003, ref activeCenterInfo) && activeCenterInfo.status == ActiveCenterInfo.ActiveStatus.AS.Start) { LinkNavigationManager.OpenMushroomHitUI(); } else { UIManagerControl.Instance.ShowToastText("活动未开启!"); } }
private void Init() { List <ActiveCenterInfo> activityInfoList = ActivityCenterManager.Instance.GetActivityInfoList(); activityInfoList.Sort(delegate(ActiveCenterInfo a, ActiveCenterInfo b) { int stateWeight = this.GetStateWeight(a.id); int stateWeight2 = this.GetStateWeight(b.id); if (stateWeight != stateWeight2) { return(stateWeight.CompareTo(stateWeight2)); } int timeWeight = this.GetTimeWeight(a.id); int timeWeight2 = this.GetTimeWeight(b.id); if (timeWeight != timeWeight2) { return(timeWeight.CompareTo(timeWeight2)); } return(0); }); using (List <ActiveCenterInfo> .Enumerator enumerator = activityInfoList.GetEnumerator()) { while (enumerator.MoveNext()) { ActiveCenterInfo current = enumerator.get_Current(); Debug.LogError("sort status=" + ActivityCenterManager.infoDict.get_Item(current.id).status); } } Transform transform = base.get_transform().Find("centre").Find("scrollRect").Find("gridLayoutGroup"); for (int i = 0; i < transform.get_childCount(); i++) { Object.Destroy(transform.GetChild(i).get_gameObject()); } int num = Mathf.CeilToInt((float)ActivityCenterManager.infoDict.get_Count() / 3f); for (int j = 0; j < num; j++) { GameObject gameObject = new GameObject(); gameObject.AddComponent <RectTransform>(); gameObject.get_transform().SetParent(transform, false); for (int k = 0; k < 3; k++) { int num2 = 3 * j + k; GameObject gameObject2; if (num2 >= ActivityCenterManager.infoDict.get_Count()) { gameObject2 = new GameObject(); ResourceManager.SetTexture(gameObject2.AddComponent <RawImage>(), "qidaikapai"); gameObject2.GetComponent <RawImage>().SetNativeSize(); } else { gameObject2 = ResourceManager.GetInstantiate2Prefab("ActivityCenterCell"); gameObject2.set_name(activityInfoList.get_Item(num2).id.ToString()); this.SetOneActivity(gameObject2.get_transform(), activityInfoList.get_Item(num2).id); } gameObject2.get_transform().SetParent(gameObject.get_transform(), false); gameObject2.SetActive(true); gameObject2.get_transform().set_localRotation(Quaternion.get_identity()); gameObject2.get_transform().set_localPosition(new Vector3((float)(-360 + k * 360), 0f)); } } }
private void SetTimeData(MeiRiMuBiao dailyData) { this.SetDailyData(dailyData); this.mTxLiveness.get_gameObject().SetActive(false); this.mGoGoto.SetActive(false); this.GuildWarOpen = false; int id = dailyData.id; if (id != 12030) { if (id != 12050) { this.CurrentLimit = this.GetActiveIdByDailyId(dailyData.id); HuoDongZhongXin huoDongZhongXin = DataReader <HuoDongZhongXin> .Get(this.CurrentLimit); if (huoDongZhongXin != null) { this.mTxDesc.set_text(GameDataUtils.GetChineseContent(513518, false) + " " + ActivityCenterManager.Instance.GetFormatOpenTime(huoDongZhongXin, true, true, "\n")); } if (!this.mTxLvTips.get_transform().get_parent().get_gameObject().get_activeSelf()) { ActiveCenterInfo activeCenterInfo = null; if (this.CurrentLimit > 0 && ActivityCenterManager.infoDict.TryGetValue(this.CurrentLimit, ref activeCenterInfo) && activeCenterInfo.status == ActiveCenterInfo.ActiveStatus.AS.Start) { this.ShowGotoButton(); } } } else if (!GuildManager.Instance.IsJoinInGuild()) { this.mTxLvTips.get_transform().get_parent().get_gameObject().SetActive(true); this.mTxLvTips.set_text(GameDataUtils.GetChineseContent(301049, false)); } else if (!this.mTxLvTips.get_transform().get_parent().get_gameObject().get_activeSelf()) { string[] guildWarOpenTime; if (GuildWarManager.Instance.GuildWarTimeStep >= GuildWarTimeStep.GWTS.HALF_MATCH2_END && GuildWarManager.Instance.GuildWarTimeStep < GuildWarTimeStep.GWTS.FINAL_MATCH_END) { guildWarOpenTime = GuildWarManager.Instance.GetGuildWarOpenTime(4); } else if (GuildWarManager.Instance.GuildWarTimeStep >= GuildWarTimeStep.GWTS.HALF_MATCH1_END && GuildWarManager.Instance.GuildWarTimeStep < GuildWarTimeStep.GWTS.HALF_MATCH2_END) { guildWarOpenTime = GuildWarManager.Instance.GetGuildWarOpenTime(3); } else { guildWarOpenTime = GuildWarManager.Instance.GetGuildWarOpenTime(2); } this.mTxDesc.set_text(string.Concat(new string[] { GameDataUtils.GetChineseContent(513518, false), " ", GameDataUtils.GetChineseContent(513518 + int.Parse(guildWarOpenTime[0]), false), "\n", guildWarOpenTime[1], "-", guildWarOpenTime[3] })); if (GuildWarManager.Instance.GuildWarTimeStep == GuildWarTimeStep.GWTS.HALF_MATCH2_BEG || GuildWarManager.Instance.GuildWarTimeStep == GuildWarTimeStep.GWTS.FINAL_MATCH_BEG || GuildWarManager.Instance.GuildWarTimeStep == GuildWarTimeStep.GWTS.HALF_MATCH1_BEG) { this.GuildWarOpen = true; this.ShowGotoButton(); } } } else if (!GuildManager.Instance.IsJoinInGuild()) { this.mTxLvTips.get_transform().get_parent().get_gameObject().SetActive(true); this.mTxLvTips.set_text(GameDataUtils.GetChineseContent(301049, false)); } else if (!this.mTxLvTips.get_transform().get_parent().get_gameObject().get_activeSelf()) { string[] array = DataReader <GongHuiXinXi> .Get("ExpTime").value.Split(new char[] { ',' }); if (array != null && array.Length == 2) { this.mTxDesc.set_text(string.Concat(new string[] { GameDataUtils.GetChineseContent(513518, false), " 每天\n", array[0], "-", array[1] })); if (GuildManager.Instance.IsGuildFieldOpen) { this.ShowGotoButton(); } } } }