Exemple #1
0
        private void Reorder(int from, int to, int entryGroup)
        {
            int  num   = 0;
            Pawn pawn  = null;
            Pawn pawn2 = null;
            Pawn pawn3 = null;

            for (int i = 0; i < this.cachedEntries.Count; i++)
            {
                if (this.cachedEntries[i].group == entryGroup && this.cachedEntries[i].pawn != null)
                {
                    if (num == from)
                    {
                        pawn = this.cachedEntries[i].pawn;
                    }
                    if (num == to)
                    {
                        pawn2 = this.cachedEntries[i].pawn;
                    }
                    pawn3 = this.cachedEntries[i].pawn;
                    num++;
                }
            }
            if (pawn != null)
            {
                int num2 = (pawn2 == null) ? (pawn3.playerSettings.displayOrder + 1) : pawn2.playerSettings.displayOrder;
                for (int j = 0; j < this.cachedEntries.Count; j++)
                {
                    Pawn pawn4 = this.cachedEntries[j].pawn;
                    if (pawn4 != null)
                    {
                        if (pawn4.playerSettings.displayOrder == num2)
                        {
                            if (pawn2 != null && this.cachedEntries[j].group == entryGroup)
                            {
                                if (pawn4.thingIDNumber < pawn2.thingIDNumber)
                                {
                                    pawn4.playerSettings.displayOrder--;
                                }
                                else
                                {
                                    pawn4.playerSettings.displayOrder++;
                                }
                            }
                        }
                        else if (pawn4.playerSettings.displayOrder > num2)
                        {
                            pawn4.playerSettings.displayOrder++;
                        }
                        else
                        {
                            pawn4.playerSettings.displayOrder--;
                        }
                    }
                }
                pawn.playerSettings.displayOrder = num2;
                this.MarkColonistsDirty();
                MainTabWindowUtility.NotifyAllPawnTables_PawnsChanged();
            }
        }
        public void Reorder(int from, int to, int entryGroup)
        {
            int  num   = 0;
            Pawn pawn  = null;
            Pawn pawn2 = null;
            Pawn pawn3 = null;

            for (int i = 0; i < cachedEntries.Count; i++)
            {
                if (cachedEntries[i].group == entryGroup && cachedEntries[i].pawn != null)
                {
                    if (num == from)
                    {
                        pawn = cachedEntries[i].pawn;
                    }
                    if (num == to)
                    {
                        pawn2 = cachedEntries[i].pawn;
                    }
                    pawn3 = cachedEntries[i].pawn;
                    num++;
                }
            }
            if (pawn == null)
            {
                return;
            }
            int num2 = pawn2?.playerSettings.displayOrder ?? (pawn3.playerSettings.displayOrder + 1);

            for (int j = 0; j < cachedEntries.Count; j++)
            {
                Pawn pawn4 = cachedEntries[j].pawn;
                if (pawn4 == null)
                {
                    continue;
                }
                if (pawn4.playerSettings.displayOrder == num2)
                {
                    if (pawn2 != null && cachedEntries[j].group == entryGroup)
                    {
                        if (pawn4.thingIDNumber < pawn2.thingIDNumber)
                        {
                            pawn4.playerSettings.displayOrder--;
                        }
                        else
                        {
                            pawn4.playerSettings.displayOrder++;
                        }
                    }
                }
                else if (pawn4.playerSettings.displayOrder > num2)
                {
                    pawn4.playerSettings.displayOrder++;
                }
                else
                {
                    pawn4.playerSettings.displayOrder--;
                }
            }
            pawn.playerSettings.displayOrder = num2;
            MarkColonistsDirty();
            MainTabWindowUtility.NotifyAllPawnTables_PawnsChanged();
        }
Exemple #3
0
        private void Reorder(int from, int to, int entryGroup)
        {
            int  num   = 0;
            Pawn pawn  = null;
            Pawn pawn2 = null;
            Pawn pawn3 = null;

            for (int i = 0; i < cachedEntries.Count; i++)
            {
                Entry entry = cachedEntries[i];
                if (entry.group == entryGroup)
                {
                    Entry entry2 = cachedEntries[i];
                    if (entry2.pawn != null)
                    {
                        if (num == from)
                        {
                            Entry entry3 = cachedEntries[i];
                            pawn = entry3.pawn;
                        }
                        if (num == to)
                        {
                            Entry entry4 = cachedEntries[i];
                            pawn2 = entry4.pawn;
                        }
                        Entry entry5 = cachedEntries[i];
                        pawn3 = entry5.pawn;
                        num++;
                    }
                }
            }
            if (pawn != null)
            {
                int num2 = pawn2?.playerSettings.displayOrder ?? (pawn3.playerSettings.displayOrder + 1);
                for (int j = 0; j < cachedEntries.Count; j++)
                {
                    Entry entry6 = cachedEntries[j];
                    Pawn  pawn4  = entry6.pawn;
                    if (pawn4 != null)
                    {
                        if (pawn4.playerSettings.displayOrder == num2)
                        {
                            if (pawn2 != null)
                            {
                                Entry entry7 = cachedEntries[j];
                                if (entry7.group == entryGroup)
                                {
                                    if (pawn4.thingIDNumber < pawn2.thingIDNumber)
                                    {
                                        pawn4.playerSettings.displayOrder--;
                                    }
                                    else
                                    {
                                        pawn4.playerSettings.displayOrder++;
                                    }
                                }
                            }
                        }
                        else if (pawn4.playerSettings.displayOrder > num2)
                        {
                            pawn4.playerSettings.displayOrder++;
                        }
                        else
                        {
                            pawn4.playerSettings.displayOrder--;
                        }
                    }
                }
                pawn.playerSettings.displayOrder = num2;
                MarkColonistsDirty();
                MainTabWindowUtility.NotifyAllPawnTables_PawnsChanged();
            }
        }