示例#1
0
        public void SortRelations()
        {
            Dictionary <PairInfo, List <LinkInfo> > ids = new Dictionary <PairInfo, List <LinkInfo> >(20);

            for (int i = 0; i < Links.Count; i += 1)
            {
                PairInfo pair = new PairInfo
                {
                    key   = Links[i].from.UID + "_" + Links[i].to.UID,
                    value = Links[i].to.UID + "_" + Links[i].from.UID
                };
                List <LinkInfo> array = GetLinks(Links[i].from.UID, Links[i].to.UID);
                if (!ids.ContainsKey(pair))
                {
                    ids.Add(pair, array);
                    int length = array.Count;
                    for (int j = 0; j < length; j += 1)
                    {
                        array[j].number = length % 2 != 0 ? j : j + 1;
                        array[j].repeat = j;
                        array[j].RandomLength((length - 1) * 50f);
                    }
                }
            }
        }
示例#2
0
 private bool HadPair(ref List <PairInfo> list, PairInfo pair)
 {
     for (int i = 0; i < list.Count; i += 1)
     {
         if (list[i].Equals(pair))
         {
             return(true);
         }
     }
     return(false);
 }