private void InitMissionList()
        {
            RectTransform[] componentsInChildren = this.missionListViewContents.GetComponentsInChildren <RectTransform>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionListViewContents.transform)
                {
                    componentsInChildren[i].gameObject.transform.SetParent(null);
                    Object.Destroy(componentsInChildren[i].gameObject);
                }
            }
            List <WrapperGarrisonMission> list = PersistentMissionData.missionDictionary.Values.ToList <WrapperGarrisonMission>();

            if (this.isInProgressMissionList)
            {
                list = (from mission in list
                        orderby mission.StartTime + mission.MissionDuration
                        select mission).ToList <WrapperGarrisonMission>();
            }
            else
            {
                list = (from mission in list
                        orderby StaticDB.garrMissionDB.GetRecord(mission.MissionRecID).TargetLevel
                        select mission).ToList <WrapperGarrisonMission>();
            }
            foreach (WrapperGarrisonMission wrapperGarrisonMission in list)
            {
                GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(wrapperGarrisonMission.MissionRecID);
                if (record != null)
                {
                    if (record.GarrFollowerTypeID == (uint)GarrisonStatus.GarrisonFollowerType)
                    {
                        if (this.isInProgressMissionList)
                        {
                            if (wrapperGarrisonMission.MissionState == 0)
                            {
                                continue;
                            }
                            if (wrapperGarrisonMission.MissionState == 1)
                            {
                                TimeSpan t = GarrisonStatus.CurrentTime() - wrapperGarrisonMission.StartTime;
                                if ((wrapperGarrisonMission.MissionDuration - t).TotalSeconds <= 0.0)
                                {
                                    continue;
                                }
                            }
                        }
                        if (this.isInProgressMissionList || wrapperGarrisonMission.MissionState == 0)
                        {
                            GameObject gameObject = Object.Instantiate <GameObject>(this.missionListItemPrefab);
                            gameObject.transform.SetParent(this.missionListViewContents.transform, false);
                            MissionListItem component = gameObject.GetComponent <MissionListItem>();
                            component.Init(record.ID);
                        }
                    }
                }
            }
        }
Beispiel #2
0
 private void PopulateCompletedMissionList()
 {
     foreach (WrapperGarrisonMission wrapperGarrisonMission in PersistentMissionData.missionDictionary.Values)
     {
         if ((wrapperGarrisonMission.MissionState == 2 || wrapperGarrisonMission.MissionState == 6) && !this.MissionIsOnCompletedMissionList(wrapperGarrisonMission.MissionRecID))
         {
             GameObject gameObject = Object.Instantiate <GameObject>(this.missionListItemPrefab);
             gameObject.transform.SetParent(this.completedMissionListContents.transform, false);
             MissionListItem component = gameObject.GetComponent <MissionListItem>();
             component.Init(wrapperGarrisonMission.MissionRecID);
             component.isResultsItem = true;
         }
     }
 }
Beispiel #3
0
 private void PopulateCompletedMissionList()
 {
     foreach (WrapperGarrisonMission value in PersistentMissionData.missionDictionary.Values)
     {
         if (value.MissionState != 2 && value.MissionState != 6 || this.MissionIsOnCompletedMissionList(value.MissionRecID))
         {
             continue;
         }
         GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.missionListItemPrefab);
         gameObject.transform.SetParent(this.completedMissionListContents.transform, false);
         MissionListItem component = gameObject.GetComponent <MissionListItem>();
         component.Init(value.MissionRecID);
         component.isResultsItem = true;
     }
 }