Beispiel #1
0
        protected override void Resize(Rect rect)
        {
            base.Resize(rect);

            Vector2 panelMargin = Style.SizePanelMargin;

            PanelPawnList.Resize(new Rect(rect.xMin, rect.yMin, 110, 560));
            PanelRandomize.Resize(new Rect(PanelPawnList.PanelRect.xMax + panelMargin.x,
                                           PanelPawnList.PanelRect.yMin, 64, 64));
            PanelName.Resize(new Rect(PanelRandomize.PanelRect.xMax + panelMargin.x,
                                      PanelRandomize.PanelRect.yMin, 460, 64));
            PanelSaveLoad.Resize(new Rect(PanelName.PanelRect.xMax + panelMargin.x,
                                          PanelName.PanelRect.yMin, 284, 64));

            PanelAge.Resize(new Rect(PanelPawnList.PanelRect.xMax + panelMargin.x,
                                     PanelRandomize.PanelRect.yMax + panelMargin.y, 226, 64));
            PanelAppearance.Resize(new Rect(PanelAge.PanelRect.xMin, PanelAge.PanelRect.yMax + panelMargin.y,
                                            226, 405));

            PanelBackstory.Resize(new Rect(PanelAge.PanelRect.xMax + panelMargin.x, PanelAge.PanelRect.yMin,
                                           320, 120));
            PanelTraits.Resize(new Rect(PanelBackstory.PanelRect.xMin, PanelBackstory.PanelRect.yMax + panelMargin.y,
                                        320, 156));
            PanelHealth.Resize(new Rect(PanelBackstory.PanelRect.xMin, PanelTraits.PanelRect.yMax + panelMargin.y,
                                        320, 180));

            PanelSkills.Resize(new Rect(PanelBackstory.PanelRect.xMax + panelMargin.x, PanelBackstory.PanelRect.yMin,
                                        262, 362));
            PanelIncapable.Resize(new Rect(PanelSkills.PanelRect.xMin, PanelSkills.PanelRect.yMax + panelMargin.y,
                                           260, 103));
        }
Beispiel #2
0
 public TabViewPawns()
 {
     PanelPawnList   = new PanelPawnList();
     PanelRandomize  = new PanelRandomize();
     PanelName       = new PanelName();
     PanelAge        = new PanelAge();
     PanelAppearance = new PanelAppearance();
     PanelBackstory  = new PanelBackstory();
     PanelTraits     = new PanelTraits();
     PanelHealth     = new PanelHealth();
     PanelSkills     = new PanelSkills();
     PanelIncapable  = new PanelIncapableOf();
     PanelSaveLoad   = new PanelLoadSave();
 }
Beispiel #3
0
        public override void Draw(State state, Rect rect)
        {
            base.Draw(state, rect);

            // Draw the panels.
            PanelPawnList.Draw(state);
            if (state.CurrentPawn != null)
            {
                PanelRandomize.Draw(state);
                PanelName.Draw(state);
                PanelSaveLoad.Draw(state);
                PanelAge.Draw(state);
                PanelAppearance.Draw(state);
                PanelBackstory.Draw(state);
                PanelTraits.Draw(state);
                PanelHealth.Draw(state);
                PanelSkills.Draw(state);
                PanelIncapable.Draw(state);
            }
        }
Beispiel #4
0
        protected void InstrumentPanels()
        {
            State state = PrepareCarefully.Instance.State;

            GameStarted  += controller.StartGame;
            PresetLoaded += controller.LoadPreset;
            PresetSaved  += controller.SavePreset;

            // Instrument the characters tab view.
            ControllerPawns pawnController = controller.SubcontrollerCharacters;

            tabViewPawns.PanelAge.BiologicalAgeUpdated    += pawnController.UpdateBiologicalAge;
            tabViewPawns.PanelAge.ChronologicalAgeUpdated += pawnController.UpdateChronologicalAge;

            tabViewPawns.PanelAppearance.RandomizeAppearance += pawnController.RandomizeAppearance;
            tabViewPawns.PanelAppearance.GenderUpdated       += (Gender gender) => {
                pawnController.UpdateGender(gender);
                tabViewPawns.PanelAppearance.UpdatePawnLayers();
            };

            tabViewPawns.PanelBackstory.BackstoryUpdated      += pawnController.UpdateBackstory;
            tabViewPawns.PanelBackstory.BackstoryUpdated      += (BackstorySlot slot, Backstory backstory) => { pawnController.CheckPawnCapabilities(); };
            tabViewPawns.PanelBackstory.BackstoriesRandomized += pawnController.RandomizeBackstories;
            tabViewPawns.PanelBackstory.BackstoriesRandomized += () => { pawnController.CheckPawnCapabilities(); };

            tabViewPawns.PanelColonyPawns.PawnSelected           += this.SelectPawn;
            tabViewPawns.PanelColonyPawns.AddingPawn             += pawnController.AddingPawn;
            tabViewPawns.PanelColonyPawns.AddingPawnWithPawnKind += pawnController.AddFactionPawn;
            tabViewPawns.PanelColonyPawns.PawnDeleted            += pawnController.DeletePawn;
            tabViewPawns.PanelColonyPawns.PawnDeleted            += (CustomPawn pawn) => { pawnController.CheckPawnCapabilities(); };
            tabViewPawns.PanelColonyPawns.PawnSwapped            += this.SwapPawn;
            tabViewPawns.PanelWorldPawns.PawnSelected            += this.SelectPawn;
            tabViewPawns.PanelWorldPawns.AddingPawn             += pawnController.AddingPawn;
            tabViewPawns.PanelWorldPawns.AddingPawnWithPawnKind += pawnController.AddFactionPawn;
            tabViewPawns.PanelWorldPawns.PawnDeleted            += pawnController.DeletePawn;
            tabViewPawns.PanelWorldPawns.PawnDeleted            += (CustomPawn pawn) => { pawnController.CheckPawnCapabilities(); };
            tabViewPawns.PanelWorldPawns.PawnSwapped            += this.SwapPawn;

            tabViewPawns.PanelColonyPawns.Maximize += () => {
                state.PawnListMode = PawnListMode.ColonyPawnsMaximized;
                tabViewPawns.ResizeTabView();
            };
            tabViewPawns.PanelWorldPawns.Maximize += () => {
                state.PawnListMode = PawnListMode.WorldPawnsMaximized;
                tabViewPawns.ResizeTabView();
            };

            pawnController.PawnAdded += (CustomPawn pawn) => {
                PanelPawnList pawnList = null;
                if (pawn.Type == CustomPawnType.Colonist)
                {
                    pawnList = tabViewPawns.PanelColonyPawns;
                }
                else
                {
                    pawnList = tabViewPawns.PanelWorldPawns;
                }
                pawnList.ScrollToBottom();
                pawnList.SelectPawn(pawn);
            };
            pawnController.PawnAdded    += (CustomPawn pawn) => { pawnController.CheckPawnCapabilities(); };
            pawnController.PawnReplaced += (CustomPawn pawn) => { pawnController.CheckPawnCapabilities(); };

            tabViewPawns.PanelHealth.InjuryAdded  += pawnController.AddInjury;
            tabViewPawns.PanelHealth.InjuryAdded  += (Injury i) => { tabViewPawns.PanelHealth.ScrollToBottom(); };
            tabViewPawns.PanelHealth.ImplantAdded += pawnController.AddImplant;
            tabViewPawns.PanelHealth.ImplantAdded += (Implant i) => { tabViewPawns.PanelHealth.ScrollToBottom(); };

            tabViewPawns.PanelName.FirstNameUpdated += pawnController.UpdateFirstName;
            tabViewPawns.PanelName.NickNameUpdated  += pawnController.UpdateNickName;
            tabViewPawns.PanelName.LastNameUpdated  += pawnController.UpdateLastName;
            tabViewPawns.PanelName.NameRandomized   += pawnController.RandomizeName;

            tabViewPawns.PanelRandomize.RandomizeAllClicked += pawnController.RandomizeAll;
            tabViewPawns.PanelRandomize.RandomizeAllClicked += () => { pawnController.CheckPawnCapabilities(); };

            tabViewPawns.PanelSaveLoad.CharacterLoaded += pawnController.LoadCharacter;
            tabViewPawns.PanelSaveLoad.CharacterLoaded += (string filename) => { pawnController.CheckPawnCapabilities(); };
            tabViewPawns.PanelSaveLoad.CharacterSaved  += pawnController.SaveCharacter;

            tabViewPawns.PanelSkills.SkillLevelUpdated   += pawnController.UpdateSkillLevel;
            tabViewPawns.PanelSkills.SkillPassionUpdated += pawnController.UpdateSkillPassion;
            tabViewPawns.PanelSkills.SkillsReset         += pawnController.ResetSkills;
            tabViewPawns.PanelSkills.SkillsCleared       += pawnController.ClearSkills;

            tabViewPawns.PanelTraits.TraitAdded       += pawnController.AddTrait;
            tabViewPawns.PanelTraits.TraitAdded       += (Trait t) => { tabViewPawns.PanelTraits.ScrollToBottom(); };
            tabViewPawns.PanelTraits.TraitUpdated     += pawnController.UpdateTrait;
            tabViewPawns.PanelTraits.TraitRemoved     += pawnController.RemoveTrait;
            tabViewPawns.PanelTraits.TraitsRandomized += pawnController.RandomizeTraits;
            tabViewPawns.PanelTraits.TraitsRandomized += () => { tabViewPawns.PanelTraits.ScrollToTop(); };

            // Instrument the equipment tab view.
            ControllerEquipment equipment = controller.SubcontrollerEquipment;

            tabViewEquipment.PanelAvailable.EquipmentAdded += equipment.AddEquipment;
            tabViewEquipment.PanelAvailable.EquipmentAdded += tabViewEquipment.PanelSelected.EquipmentAdded;

            tabViewEquipment.PanelSelected.EquipmentRemoved      += equipment.RemoveEquipment;
            tabViewEquipment.PanelSelected.EquipmentCountUpdated += equipment.UpdateEquipmentCount;

            // Instrument the relationships tab view.
            ControllerRelationships relationships = controller.SubcontrollerRelationships;

            tabViewRelationships.PanelRelationshipsOther.RelationshipAdded            += relationships.AddRelationship;
            tabViewRelationships.PanelRelationshipsOther.RelationshipRemoved          += relationships.RemoveRelationship;
            tabViewRelationships.PanelRelationshipsParentChild.ParentAddedToGroup     += relationships.AddParentToParentChildGroup;
            tabViewRelationships.PanelRelationshipsParentChild.ChildAddedToGroup      += relationships.AddChildToParentChildGroup;
            tabViewRelationships.PanelRelationshipsParentChild.ParentRemovedFromGroup += relationships.RemoveParentFromParentChildGroup;
            tabViewRelationships.PanelRelationshipsParentChild.ChildRemovedFromGroup  += relationships.RemoveChildFromParentChildGroup;
            tabViewRelationships.PanelRelationshipsParentChild.GroupAdded             += relationships.AddParentChildGroup;
            tabViewPawns.PanelColonyPawns.PawnDeleted += relationships.DeleteAllPawnRelationships;
            pawnController.PawnAdded    += relationships.AddPawn;
            pawnController.PawnReplaced += relationships.ReplacePawn;
        }