private void RefreshUI() { PlayerDataModule ply = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (ply == null) { return; } IDictionaryEnumerator itr = DataManager.ActivityTypeTable.GetEnumerator(); while (itr.MoveNext()) { ActivityTypeTableItem item = itr.Value as ActivityTypeTableItem; if (item == null) { continue; } int resId = GetActivityByType((int)item.type); if (resId < 0) { continue; } ActivityTableItem activityItem = DataManager.ActivityTable[resId] as ActivityTableItem; ActivityItem activity = null; foreach (ActivityItem temp in mActivityItemList) { if (temp.GetType() == (int)item.type) { activity = temp; } } if (activity == null) { GameObject gameObj = WindowManager.Instance.CloneGameObject(mActivityItemUnit); if (gameObj == null) { GameDebug.LogError("instance activityitem error"); return; } gameObj.SetActive(true); gameObj.transform.parent = mGrid.gameObject.transform; gameObj.transform.localScale = Vector3.one; mGrid.Reposition(); if (0 == item.isopen) { activity = new ActivityItem(gameObj); activity.updatezeroInfo((int)item.type, resId, item.name, item.scnenbg); activity.onOkClick = OnJoinActivity; activity.onXiangQingClick = OnActivityXiangQing; } else if (1 == item.isopen) { activity = new ActivityItem(gameObj); activity.UpdateInfo((int)item.type, resId, item.name, item.needlevel, ply.GetLevel(), (int)activityItem.starttime, (int)activityItem.overtime, item.max_time - ply.GetActivityTypeCompleteTime(activityItem.type), ply.IsActivityCompleted(resId), item.award_desc, item.scnenbg); activity.onOkClick = OnJoinActivity; activity.onXiangQingClick = OnActivityXiangQing; } mActivityItemList.Add(activity); } else { if (0 == item.isopen) { activity.updatezeroInfo((int)item.type, resId, item.name, item.scnenbg); } else if (1 == item.isopen) { activity.UpdateInfo((int)item.type, resId, item.name, item.needlevel, ply.GetLevel(), (int)activityItem.starttime, (int)activityItem.overtime, item.max_time - ply.GetActivityTypeCompleteTime(activityItem.type), ply.IsActivityCompleted(resId), item.award_desc, item.scnenbg); } } } // foreach (DictionaryEntry de in DataManager.ActivityTypeTable) // { // // } mGrid.repositionNow = true; }