Пример #1
0
        internal string stringConcat(List <Guid> source)
        {
            if (source.Count == 0)
            {
                return("");
            }
            List <string> s = new List <string>();

            for (int j = 0; j < source.Count; j++)
            {
                contractUIObject c = getContract(source[j]);
                if (c == null)
                {
                    continue;
                }
                string i;
                if (c.Order == null)
                {
                    i = "N";
                }
                else
                {
                    i = c.Order.ToString();
                }
                string id = string.Format("{0}|{1}|{2}", source[j], i, c.ShowParams);
                s.Add(id);
            }

            return(string.Join(",", s.ToArray()));
        }
Пример #2
0
        internal List <Guid> loadPinnedContracts(List <Guid> gID)
        {
            List <contractUIObject> temp   = new List <contractUIObject>();
            List <Guid>             idTemp = new List <Guid>();

            foreach (Guid id in gID)
            {
                contractUIObject c = getContract(id);
                if (c != null)
                {
                    if (c.Order != null)
                    {
                        temp.Add(c);
                    }
                }
            }
            if (temp.Count > 0)
            {
                temp.Sort((a, b) =>
                {
                    return(Comparer <int?> .Default.Compare(a.Order, b.Order));
                });
                foreach (contractUIObject c in temp)
                {
                    idTemp.Add(c.Container.Root.ContractGuid);
                }
            }
            return(idTemp);
        }
Пример #3
0
        private void buildMissionList(string s, bool Active)
        {
            if (string.IsNullOrEmpty(s))
            {
                return;
            }
            else
            {
                string[] sA = s.Split(',');
                for (int i = 0; i < sA.Length; i++)
                {
                    contractContainer c   = null;
                    contractUIObject  cUI = null;
                    string[]          sB  = sA[i].Split('|');
                    try
                    {
                        Guid g = new Guid(sB[0]);
                        if (g == null)
                        {
                            continue;
                        }

                        c = contractParser.getActiveContract(g);
                        if (c == null)
                        {
                            continue;
                        }

                        addContract(c, Active, true);
                        cUI = getContract(g);
                        if (cUI == null)
                        {
                            continue;
                        }

                        cUI.SetHidden(!Active);
                        cUI.Order      = stringIntParse(sB[1]);
                        cUI.ShowParams = stringBoolParse(sB[2]);
                    }
                    catch (Exception e)
                    {
                        DMC_MBE.LogFormatted("Guid invalid: {0}", e);
                        continue;
                    }
                }
            }
        }
Пример #4
0
 internal contractUIObject getContract(Guid id)
 {
     if (contractList.ContainsKey(id))
     {
         contractUIObject c = contractList[id];
         if (c.Container == null)
         {
             return(null);
         }
         else
         {
             return(c);
         }
     }
     else
     {
         return(null);
     }
 }
Пример #5
0
        private bool addToMasterList(contractContainer c, bool add = false)
        {
            if (!contractList.ContainsKey(c.Root.ContractGuid))
            {
                contractUIObject cUI = new contractUIObject(c, this);

                contractList.Add(c.Root.ContractGuid, cUI);

                if (add && UIParent != null)
                {
                    UIParent.AddContract(cUI);
                }

                return(true);
            }
            else
            {
                DMC_MBE.LogFormatted("Master Mission List For: [{0}] Already Contains Contract: [{1}]", _missionTitle, c.Title);
            }

            return(false);
        }
Пример #6
0
        private List <Guid> sortContracts(List <Guid> list, contractSortClass sortClass, bool dsc)
        {
            sortList.Clear();

            int l = list.Count;

            for (int i = 0; i < l; i++)
            {
                Guid id = list[i];

                contractUIObject cC = currentMission.getContract(id);

                if (cC == null)
                {
                    continue;
                }

                if (cC.Order != null)
                {
                    continue;
                }

                sortList.Add(cC);
            }

            switch (sortClass)
            {
            case contractSortClass.Expiration:
                sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.Duration.CompareTo(b.Container.Duration), a.Container.Title.CompareTo(b.Container.Title)));
                break;

            case contractSortClass.Acceptance:
                sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.Root.DateAccepted.CompareTo(b.Container.Root.DateAccepted), a.Container.Title.CompareTo(b.Container.Title)));
                break;

            case contractSortClass.Reward:
                sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.TotalReward.CompareTo(b.Container.TotalReward), a.Container.Title.CompareTo(b.Container.Title)));

                break;

            case contractSortClass.Difficulty:
                sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.Root.Prestige.CompareTo(b.Container.Root.Prestige), a.Container.Title.CompareTo(b.Container.Title)));

                break;

            case contractSortClass.Planet:
                sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.TargetPlanet.CompareTo(b.Container.TargetPlanet), a.Container.Title.CompareTo(b.Container.Title)));

                break;

            case contractSortClass.Type:
                sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.Root.GetType().Name.CompareTo(b.Container.Root.GetType().Name), a.Container.Title.CompareTo(b.Container.Title)));
                sortList = typeSort(sortList, !dsc);
                break;
            }

            list.Clear();

            if (pinnedList.Count > 0)
            {
                list.AddRange(pinnedList);
            }

            int k = sortList.Count;

            for (int i = 0; i < k; i++)
            {
                contractUIObject c = sortList[i];

                if (c == null)
                {
                    continue;
                }

                list.Add(c.ID);
            }

            return(list);
        }