示例#1
0
 public override void PostOpen()
 {
     base.PostOpen();
     this.squadManager = SquadManager.Instance;
     this.squadListWidget.Reset();
     this.availableColonistsWidget.Reset();
     this.squadMembersWidget.Reset();
     foreach (Squad current in this.squadManager.Squads)
     {
         this.squadListWidget.Add(current);
     }
     this.squadListWidget.Select(0);
 }
示例#2
0
        public void SyncSquadsToColonistBar()
        {
            if (!this.enabled)
            {
                return;
            }
            SquadManager      instance          = SquadManager.Instance;
            ColonistTracker   instance2         = ColonistTracker.Instance;
            AllColonistsSquad allColonistsSquad = SquadManager.Instance.AllColonistsSquad;

            this.groupDictionaryScratch.Clear();
            this.squadDictionaryScratch.Clear();
            this.colonistBarGroups.Clear();
            int count = instance.Squads.Count;

            for (int i = 0; i < count; i++)
            {
                Squad            squad            = instance.Squads[i];
                ColonistBarGroup colonistBarGroup = null;
                if (this.groupDictionary.TryGetValue(squad, out colonistBarGroup) && squad == allColonistsSquad)
                {
                    this.allColonistsGroup = colonistBarGroup;
                }
                if (squad.Pawns.Count > 0 && squad.ShowInColonistBar)
                {
                    bool flag = false;
                    if (colonistBarGroup == null)
                    {
                        colonistBarGroup = new ColonistBarGroup(squad.Pawns.Count);
                        flag             = true;
                    }
                    else if (colonistBarGroup.OrderHash != squad.OrderHash)
                    {
                        flag = true;
                    }
                    if (flag)
                    {
                        colonistBarGroup.Clear();
                        colonistBarGroup.Name = squad.Name;
                        colonistBarGroup.Id   = squad.Id;
                        foreach (Pawn current in squad.Pawns)
                        {
                            TrackedColonist trackedColonist = instance2.FindTrackedColonist(current);
                            if (trackedColonist != null)
                            {
                                colonistBarGroup.Add(trackedColonist);
                            }
                        }
                    }
                    this.colonistBarGroups.Add(colonistBarGroup);
                    this.groupDictionaryScratch[squad]            = colonistBarGroup;
                    this.squadDictionaryScratch[colonistBarGroup] = squad;
                }
            }
            Dictionary <ColonistBarGroup, Squad> dictionary  = this.squadDictionary;
            Dictionary <Squad, ColonistBarGroup> dictionary2 = this.groupDictionary;

            this.groupDictionary        = this.groupDictionaryScratch;
            this.squadDictionary        = this.squadDictionaryScratch;
            this.groupDictionaryScratch = dictionary2;
            this.squadDictionaryScratch = dictionary;
        }