Example #1
0
    static int set_onCustomSort(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UITable obj = (UITable)o;
            System.Comparison <UnityEngine.Transform> arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Comparison <UnityEngine.Transform>)ToLua.CheckObject(L, 2, typeof(System.Comparison <UnityEngine.Transform>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Comparison <UnityEngine.Transform>), func) as System.Comparison <UnityEngine.Transform>;
            }

            obj.onCustomSort = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onCustomSort on a nil value" : e.Message));
        }
    }
 private void CheckSorted <T>(List <T> list, System.Comparison <T> comp)
 {
     for (int i = 1; i < list.Count; ++i)
     {
         Assert.IsTrue(comp(list[i - 1], list[i]) < 0, "List expected to be sorted isn't");
     }
 }
Example #3
0
        public static void GeometricShuffle <T>(List <T> list, System.Comparison <T> compareFunc, float coinWeight)
        {
            FYShuffle(list);
            list.Sort(compareFunc);

            List <T> shuffledList = new List <T>();

            while (list.Count > 0)
            {
                int currentIndex = 0;

                while (currentIndex < list.Count - 1)
                {
                    if (Random.value <= coinWeight)
                    {
                        break;
                    }
                    currentIndex++;
                }
                shuffledList.Add(list[currentIndex]);
                list.RemoveAt(currentIndex);
            }

            foreach (T item in shuffledList)
            {
                list.Add(item);
            }
        }
Example #4
0
    /// <summary>
    /// 删除中List中重复的元素,只保留一个,返回一个新的List
    /// </summary>
    /// <param name="comparison">比较两个元素是否一样的委托.返回0表示两个元素一样</param>
    public static List <T> RemoveRepetition <T>(this List <T> list, System.Comparison <T> comparison)
    {
        if (comparison == null)
        {
            throw new System.Exception("参数不能为空");
        }
        List <T> newList = new List <T>();

        foreach (var item in list)
        {
            bool isContain = false;
            foreach (var itemInNewList in newList)
            {
                if (comparison(item, itemInNewList) == 0)
                {
                    isContain = true;
                }
            }
            if (!isContain)
            {
                newList.Add(item);
            }
        }
        return(newList);
    }
Example #5
0
 public void Sort(System.Comparison <T> comparison)
 {
     if (array != null)
     {
         Array.Sort <T>(array, 0, arrayLength, new FunctorComparer <T>(comparison));
     }
 }
    /// <summary>
    /// List.Sort equivalent.
    /// </summary>

    public bool Sort(System.Comparison <T> comparer)
    {
        bool bSort = false;
        T    temp;
        int  i          = size - 1;
        int  j          = 0;
        int  nSwapIndex = 0;

        while (i > 0)
        {
            nSwapIndex = 0;
            for (j = 0; j < i; j++)
            {
                if (comparer(buffer[j + 1], buffer[j]) < 0)
                {//
                    temp          = buffer[j + 1];
                    buffer[j + 1] = buffer[j];
                    buffer[j]     = temp;
                    nSwapIndex    = j;//记录交换下标
                    bSort         = true;
                }
            }
            i = nSwapIndex;
        }
        return(bSort);
    }
Example #7
0
    /// <summary>
    /// 指定したリストを指定した比較関数でソートしたリストを返す。元のリストはソートしない
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="srcφ"></param>
    /// <param name="comp"></param>
    /// <returns></returns>
    public static List <T> GetSortList <T>(List <T> srcφ, System.Comparison <T> comp = null)
    {
        if (srcφ == null)
        {
            return(null);
        }
        if (srcφ.Count <= 0)
        {
            return(srcφ);
        }
        List <T> dst = new List <T>();

        srcφ.ForEach((l) =>
        {
            dst.Add(l);
        });

        if (comp == null)
        {
            dst.Sort();
        }
        else
        {
            dst.Sort(comp);
        }
        return(dst);
    }
Example #8
0
 protected virtual void InitMovements()
 {
     mBaseMotions     = GetComponents <ActorMovement>();
     mAdditiveMotions = m_AdditiveMotions == null ? new ActorMovement[0] : m_AdditiveMotions.GetComponents <ActorMovement>();
     mPassiveMotions  = m_PassiveMotions == null ? new ActorMovement[0] : m_PassiveMotions.GetComponents <ActorMovement>();
     System.Comparison <ActorMovement> compare = (x, y) => x.m_Priority >= y.m_Priority ? -1 : 1;
     GlobalUtil.Sort(mBaseMotions, compare);
     GlobalUtil.Sort(mAdditiveMotions, compare);
     GlobalUtil.Sort(mPassiveMotions, compare);
     //var node = lst.Last;
     for (int i = 0; i < mBaseMotions.Length; i++)
     {
         var mov = mBaseMotions[i];
         mov.SetActor(this);
         if (mov is IFallbackMovement)
         {
             mStFallback = (IFallbackMovement)mov;
         }
     }
     for (int i = 0; i < mAdditiveMotions.Length; i++)
     {
         mAdditiveMotions[i].SetActor(this);
     }
     for (int i = 0; i < mPassiveMotions.Length; i++)
     {
         mPassiveMotions[i].SetActor(this);
     }
 }
Example #9
0
        /// <summary>
        /// Allow construction of DataView with <see cref="System.Predicate&lt;DataRow&gt;"/> and <see cref="System.Comparison&lt;DataRow&gt;"/>
        /// </summary>
        /// <remarks>This is a copy of the other DataView ctor and needs to be kept in sync</remarks>
        internal DataView(DataTable table, System.Predicate <DataRow> predicate, System.Comparison <DataRow> comparison, DataViewRowState RowState)
        {
            GC.SuppressFinalize(this);
            Bid.Trace("<ds.DataView.DataView|API> %d#, table=%d, RowState=%d{ds.DataViewRowState}\n",
                      ObjectID, (table != null) ? table.ObjectID : 0, (int)RowState);
            if (table == null)
            {
                throw ExceptionBuilder.CanNotUse();
            }

            this._dvListener = new DataViewListener(this);
            this._locked     = false;
            this._table      = table;
            _dvListener.RegisterMetaDataEvents(this._table);

            if ((((int)RowState) &
                 ((int)~(DataViewRowState.CurrentRows | DataViewRowState.OriginalRows))) != 0)
            {
                throw ExceptionBuilder.RecordStateRange();
            }
            else if ((((int)RowState) & ((int)DataViewRowState.ModifiedOriginal)) != 0 &&
                     (((int)RowState) & ((int)DataViewRowState.ModifiedCurrent)) != 0
                     )
            {
                throw ExceptionBuilder.SetRowStateFilter();
            }
            _comparison = comparison;
            SetIndex2("", RowState, ((null != predicate) ? new RowPredicateFilter(predicate) : null), true);
        }
Example #10
0
        private Index(DataTable table, IndexField[] indexFields, System.Comparison <DataRow>?comparison, DataViewRowState recordStates, IFilter?rowFilter)
        {
            DataCommonEventSource.Log.Trace("<ds.Index.Index|API> {0}, table={1}, recordStates={2}",
                                            ObjectID, (table != null) ? table.ObjectID : 0, recordStates);
            Debug.Assert(indexFields != null);
            Debug.Assert(null != table, "null table");
            if ((recordStates &
                 (~(DataViewRowState.CurrentRows | DataViewRowState.OriginalRows))) != 0)
            {
                throw ExceptionBuilder.RecordStateRange();
            }
            _table     = table;
            _listeners = new Listeners <DataViewListener>(ObjectID, listener => null != listener);

            _indexFields  = indexFields;
            _recordStates = recordStates;
            _comparison   = comparison;

            _isSharable = (rowFilter == null) && (comparison == null); // a filter or comparison make an index unsharable
            if (null != rowFilter)
            {
                _rowFilter = new WeakReference(rowFilter);
                DataExpression?expr = (rowFilter as DataExpression);
                if (null != expr)
                {
                    _hasRemoteAggregate = expr.HasRemoteAggregate();
                }
            }
            InitRecords(rowFilter);

            // do not AddRef in ctor, every caller should be responsible to AddRef it
            // if caller does not AddRef, it is expected to be a one-time read operation because the index won't be maintained on writes
        }
Example #11
0
        /// <summary>
        /// 自定义排序
        /// </summary>
        /// <param name="customSortFunc"></param>
        public virtual void ReSortCustom(System.Comparison <Transform> customSortFunc)
        {
            //_comGrid.sorting = UIGrid.Sorting.Custom;
            //_comGrid.onCustomSort = customSortFunc;

            //_comGrid.repositionNow = true;
        }
Example #12
0
    /// <summary>
    /// List.Sort equivalent.
    /// </summary>

    public void Sort(System.Comparison <T> comparer)
    {
        if (size > 0)
        {
            System.Array.Sort(buffer, 0, size, new Comparer(comparer));
        }
    }
Example #13
0
        public static void    SortRows(List <object> rows)
        {
            if (0 == rows.Count)
            {
                return;
            }

            int sortingColumnIndex = func_getColumnsNames().IndexOf(SortingColumn);

            if (sortingColumnIndex < 0)
            {
                return;
            }

            // extracts comparison value from row
            System.Func <object, System.IComparable> valueSelector = (row) => func_getCompareValuesForSorting(row, sortingColumnIndex);

            if (null == valueSelector(rows [0]))                // function can not sort using this column
            {
                return;
            }


            System.Comparison <object> comparisonAscending = (p1, p2) => {
                return(valueSelector(p1).CompareTo(valueSelector(p2)));
            };
            System.Comparison <object> comparisonDescending = (p1, p2) => {
                return(-valueSelector(p1).CompareTo(valueSelector(p2)));
            };


            rows.Sort(DescendingSort ? comparisonDescending : comparisonAscending);
        }
Example #14
0
    public static T[] Sort <T>(T[] sourceArray, System.Comparison <T> comparison)
    {
        List <T> resultList = new List <T>(sourceArray);

        resultList.Sort(comparison);
        return(resultList.ToArray());
    }
Example #15
0
        /// <summary>
        /// 插入排序
        /// </summary>
        /// <typeparam name="T">数据类型</typeparam>
        /// <param name="list">数组</param>
        /// <param name="comparison">比较算法</param>
        public static void InsertionSort <T>(IList <T> list, System.Comparison <T> comparison)
        {
            if (list == null)
            {
                throw new System.ArgumentNullException("list");
            }

            if (comparison == null)
            {
                throw new System.ArgumentNullException("comparison");
            }

            int count = list.Count;

            for (int j = 1; j < count; j++)
            {
                T key = list[j];

                int i = j - 1;
                for (; i >= 0 && comparison(list[i], key) > 0; i--)
                {
                    list[i + 1] = list[i];
                }
                list[i + 1] = key;
            }
        }
Example #16
0
 /// <summary>
 /// Sort the range starting at 'index' of length 'count' using 'comparision' in assending order
 /// </summary>
 public void Sort(int index, int count, System.Comparison <T> comparison)
 {
     Debug.Assert(index + count <= arrayLength);
     if (count > 0)
     {
         Array.Sort <T>(array, index, count, new FunctorComparer <T>(comparison));
     }
 }
 public void Sort(System.Comparison <Transform> sorter)
 {
     list.Sort(sorter);
     for (int i = 0; i < list.Count; i++)
     {
         list[i].SetSiblingIndex(i);
     }
 }
Example #18
0
 /// <summary>
 /// 再起的にノードのソートを行う
 /// </summary>
 /// <param name="root">ノードのルート</param>
 /// <param name="comparer">比較用のメソッド</param>
 public static void Sort(GUITree <T> root, System.Comparison <GUITree <T> > comparer)
 {
     root.mChildren.Sort(comparer);
     for (int i = 0; i < root.mChildren.Count; ++i)
     {
         Sort(root.Children[i], comparer);
     }
 }
 public ListViewColumn(string name, System.Func <T, string> output, System.Comparison <T> compare, float w = 1)
 {
     Name     = name;
     Output   = output;
     IsAction = false;
     Width    = w;
     Compare  = compare;
 }
Example #20
0
 public void Sort(int index, int length, System.Comparison <T> comparison)
 {
     Debug.Assert(index + length <= arrayLength);
     if (length > 0)
     {
         Array.Sort <T>(array, index, length, new FunctorComparer <T>(comparison));
     }
 }
        static int _m_Sort(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.List <int> __cl_gen_to_be_invoked = (System.Collections.Generic.List <int>)translator.FastGetCSObj(L, 1);


                int __gen_param_count = LuaAPI.lua_gettop(L);

                if (__gen_param_count == 1)
                {
                    __cl_gen_to_be_invoked.Sort(  );



                    return(0);
                }
                if (__gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IComparer <int> >(L, 2))
                {
                    System.Collections.Generic.IComparer <int> comparer = (System.Collections.Generic.IComparer <int>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IComparer <int>));

                    __cl_gen_to_be_invoked.Sort(comparer);



                    return(0);
                }
                if (__gen_param_count == 2 && translator.Assignable <System.Comparison <int> >(L, 2))
                {
                    System.Comparison <int> comparison = translator.GetDelegate <System.Comparison <int> >(L, 2);

                    __cl_gen_to_be_invoked.Sort(comparison);



                    return(0);
                }
                if (__gen_param_count == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable <System.Collections.Generic.IComparer <int> >(L, 4))
                {
                    int index = LuaAPI.xlua_tointeger(L, 2);
                    int count = LuaAPI.xlua_tointeger(L, 3);
                    System.Collections.Generic.IComparer <int> comparer = (System.Collections.Generic.IComparer <int>)translator.GetObject(L, 4, typeof(System.Collections.Generic.IComparer <int>));

                    __cl_gen_to_be_invoked.Sort(index, count, comparer);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Generic.List<int>.Sort!"));
        }
Example #22
0
 public void Sort(System.Comparison <InventoryItem> compare)
 {
     if (_items == null)
     {
         Debug.Assert(space != null, "Cannot sort null InventorySpace!");
         _items = new List <InventoryItem>(space.items);
     }
     _items.Sort(compare);
 }
    public void Sort(System.Comparison <object> comparison)
    {
        if (this.ItemCount == 0 || this.SlotCount == 0)
        {
            return;
        }

        this.items.Sort(comparison);
    }
    static int Sort(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <UnityEngine.Material>)))
            {
                System.Collections.Generic.List <UnityEngine.Material> obj = (System.Collections.Generic.List <UnityEngine.Material>)ToLua.ToObject(L, 1);
                obj.Sort();
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <UnityEngine.Material>), typeof(System.Comparison <UnityEngine.Material>)))
            {
                System.Collections.Generic.List <UnityEngine.Material> obj = (System.Collections.Generic.List <UnityEngine.Material>)ToLua.ToObject(L, 1);
                System.Comparison <UnityEngine.Material> arg0 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (System.Comparison <UnityEngine.Material>)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(System.Comparison <UnityEngine.Material>), func) as System.Comparison <UnityEngine.Material>;
                }

                obj.Sort(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <UnityEngine.Material>), typeof(System.Collections.Generic.IComparer <UnityEngine.Material>)))
            {
                System.Collections.Generic.List <UnityEngine.Material>      obj  = (System.Collections.Generic.List <UnityEngine.Material>)ToLua.ToObject(L, 1);
                System.Collections.Generic.IComparer <UnityEngine.Material> arg0 = (System.Collections.Generic.IComparer <UnityEngine.Material>)ToLua.ToObject(L, 2);
                obj.Sort(arg0);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <UnityEngine.Material>), typeof(int), typeof(int), typeof(System.Collections.Generic.IComparer <UnityEngine.Material>)))
            {
                System.Collections.Generic.List <UnityEngine.Material> obj = (System.Collections.Generic.List <UnityEngine.Material>)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                int arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                System.Collections.Generic.IComparer <UnityEngine.Material> arg2 = (System.Collections.Generic.IComparer <UnityEngine.Material>)ToLua.ToObject(L, 4);
                obj.Sort(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Collections.Generic.List<UnityEngine.Material>.Sort"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #25
0
    /// <summary>
    /// List.Sort equivalent.
    /// </summary>

    public void Sort(System.Comparison <T> comparer)
    {
        if (buffer == null)
        {
            return;
        }

        System.Array.Sort(buffer, 0, size, new Comparer(comparer));
    }
Example #26
0
 public RectInt[] getCavesRectsSortedByXY()
 {
     System.Comparison <RectInt> comparsion = (rectA, rectB) =>
     {
         int firstCompare = rectA.x.CompareTo(rectB.x);
         return(firstCompare != 0 ? firstCompare : rectA.y.CompareTo(rectB.y));
     };
     System.Array.Sort(CavesRects, comparsion);
     return(CavesRects);
 }
Example #27
0
 public static void StableSort <T>(this List <T> p_list, System.Comparison <T> p_comparison)
 {
     if (p_list != null)
     {
         var v_array = p_list.ToArray();
         v_array.StableSort <T>(p_comparison);
         p_list.Clear();
         p_list.AddRange(v_array);
     }
 }
Example #28
0
 void LateUpdate()
 {
     InitializeMembers();
     System.Comparison <MetaballData> comparison = (a, b) => a.negative.CompareTo(b.negative);
     System.Array.Sort(m_entities, comparison);
     m_buffer.SetData(m_entities);
     m_material.SetBuffer("_Entities", m_buffer);
     m_material.SetInt("_NumEntities", m_num_entities);
     m_num_entities = 0;
 }
Example #29
0
    public Question AddQuestion()
    {
        Question item = new Question();
        item.id_dialog = GetFreeIdQuestion();
        questions.Add(item);
        System.Comparison<Question> cmp = new System.Comparison<Question>(Dialog.CompareId);
        questions.Sort(cmp);

        return item;
    }
Example #30
0
    public Intervention AddIntervention()
    {
        Intervention item = new Intervention();
        item.id_intervention = GetFreeIdIntervention();
        interventions.Add(item);
        System.Comparison<Intervention> cmp = new System.Comparison<Intervention>(Intervention.CompareId);
        interventions.Sort(cmp);

        return item;
    }
Example #31
0
    public Answer AddAnswer()
    {
        Answer item = new Answer();
        item.id_dialog = GetFreeIdAnswers();
        answers.Add(item);
        System.Comparison<Answer> cmp = new System.Comparison<Answer>(Dialog.CompareId);
        answers.Sort(cmp);

        return item;
    }
Example #32
0
    public static Delegate System_Comparison_Logic_Game_Model_GameResData(LuaFunction func)
    {
        if (func == null)
        {
            System.Comparison <Logic.Game.Model.GameResData> fn = delegate { return(0); };
            return(fn);
        }

        System.Comparison <Logic.Game.Model.GameResData> d = (new System_Comparison_Logic_Game_Model_GameResData_Event(func)).Call;
        return(d);
    }
Example #33
0
    public static Delegate System_Comparison_UnityEngine_Transform(LuaFunction func)
    {
        if (func == null)
        {
            System.Comparison <UnityEngine.Transform> fn = delegate { return(0); };
            return(fn);
        }

        System.Comparison <UnityEngine.Transform> d = (new System_Comparison_UnityEngine_Transform_Event(func)).Call;
        return(d);
    }
Example #34
0
    public void RepositionComparasion(
		System.Comparison<Transform> comparator = null
		)
    {
        MyComparator = comparator;
    }
Example #35
0
 void OnDisable()
 {
     MyComparator = null;
 }
    void OnRefreshMailGridList()
    {                                  
        LoggerHelper.Debug("RefreshMailGridList " + MailManager.Instance.IsMailInfoDirty );

        if (MailManager.Instance.GetMailInfoList().Count > 0)
        {
            SocietyUIViewManager.Instance.ShowDeleteReadBtn(true);
            SocietyUIViewManager.Instance.ShowMailVolume(true);
            SocietyUIViewManager.Instance.ShowNoMailBoxText(false);
            SocietyUIViewManager.Instance.SetMailVolume(MailManager.Instance.GetMailInfoList().Count.ToString() + "/60");
        }
        else
        {
            SocietyUIViewManager.Instance.ShowDeleteReadBtn(false);
            SocietyUIViewManager.Instance.ShowMailVolume(false);
            SocietyUIViewManager.Instance.ShowNoMailBoxText(true);
        }


        if (true)
        {
            MailManager.Instance.IsMailInfoDirty = false;

            SocietyUIViewManager.Instance.ClearMailGridList();
            List<Mogo.Game.MailInfo> m_listMailInfo = MailManager.Instance.GetMailInfoList();
            //sort

            System.Comparison<Mogo.Game.MailInfo> com = new System.Comparison<Mogo.Game.MailInfo>(
              (a, b) =>
              {
                  if (a.state == b.state) return b.time - a.time;

                  if (a.state == MAIL_STATE.ATTACH_NO_READ) return -1;

                  if (b.state == MAIL_STATE.ATTACH_NO_READ) return 1;


                  if (a.state == MAIL_STATE.NO_ATTACH_NO_READ) return -1;

                  if (b.state == MAIL_STATE.NO_ATTACH_NO_READ) return 1;


                  if (a.state == MAIL_STATE.ATTACH_READ) return -1;

                  if (b.state == MAIL_STATE.ATTACH_READ) return 1;
                      

                  //默认按时间降序
                  return b.time - a.time;
              }
              );
            m_listMailInfo.Sort(com);

            Mogo.Util.LoggerHelper.Debug(m_listMailInfo.Count);


            for (int i = 0; i < m_listMailInfo.Count; ++i)
            {
                MailGridData md = new MailGridData();
                if (m_listMailInfo[i].mailType == MAIL_TYPE.ID)
                {
                    try
                    {
                        int fromId = System.Int32.Parse(m_listMailInfo[i].from);
                        md.name = LanguageData.GetContent(fromId);
                        int titleId = System.Int32.Parse(m_listMailInfo[i].title);
                        md.topic = LanguageData.GetContent(titleId);
                    }
                    catch (System.Exception ex)
                    {
                    	md.name = m_listMailInfo[i].from;
                        md.topic = m_listMailInfo[i].title;
                        LoggerHelper.Except(ex);
                    }
                }
                else
                {
                    md.name = m_listMailInfo[i].from;
                    md.topic = m_listMailInfo[i].title;
                }
                
                md.mailId = m_listMailInfo[i].id;

                switch (m_listMailInfo[i].state)
                {
                    case MAIL_STATE.NO_ATTACH_NO_READ:
                        md.isNoRead = true;
                        md.isAttachNoRead = false;
                        md.isAttachRead = false;
                        md.isRead = false;
                        break;

                    case MAIL_STATE.ATTACH_NO_READ:
                        md.isNoRead = false;
                        md.isAttachNoRead = true;
                        md.isAttachRead = false;
                        md.isRead = false;
                        break;

                    case MAIL_STATE.NO_ATTACH_READ:
                        md.isNoRead = false;
                        md.isAttachNoRead = false;
                        md.isAttachRead = false;
                        md.isRead = true;
                        break;

                    case MAIL_STATE.ATTACH_READ:
                        md.isNoRead = false;
                        md.isAttachNoRead = false;
                        md.isAttachRead = true;
                        md.isRead = false;
                        break;

                    case MAIL_STATE.RECV_ATTACH_READ:
                        md.isNoRead = false;
                        md.isAttachNoRead = false;
                        md.isAttachRead = false;
                        md.isRead = true;
                        break;

                }
                md.time = Utils.GetTime(m_listMailInfo[i].time).ToString("MM/dd");
                SocietyUIViewManager.Instance.AddMailGrid(md);
            }

            MailManager.Instance.IsMailInfoDirty = false;
        }
    }