Exemplo n.º 1
0
 public Controller(State state)
 {
     this.state = state;
     subcontrollerCharacters    = new ControllerPawns(state);
     subcontrollerEquipment     = new ControllerEquipment(state);
     subcontrollerRelationships = new ControllerRelationships(state);
     subcontrollerCharacters.CheckPawnCapabilities();
 }
Exemplo n.º 2
0
        protected void InstrumentPanels()
        {
            State state = PrepareCarefully.Instance.State;

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

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

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

            tabViewPawns.PanelAppearance.RandomizeAppearance += pawns.RandomizeAppearance;
            tabViewPawns.PanelAppearance.GenderUpdated       += pawns.UpdateGender;

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

            tabViewPawns.PanelPawnList.PawnSelected      += pawns.SelectPawn;
            tabViewPawns.PanelPawnList.PawnSelected      += (CustomPawn pawn) => { tabViewPawns.PanelName.ClearSelection(); };
            tabViewPawns.PanelPawnList.PawnSelected      += (CustomPawn pawn) => { tabViewPawns.PanelTraits.ScrollToTop(); };
            tabViewPawns.PanelPawnList.PawnSelected      += (CustomPawn pawn) => { tabViewPawns.PanelSkills.ScrollToTop(); };
            tabViewPawns.PanelPawnList.PawnSelected      += (CustomPawn pawn) => { tabViewPawns.PanelHealth.ScrollToTop(); };
            tabViewPawns.PanelPawnList.AddingPawn        += pawns.AddingPawn;
            tabViewPawns.PanelPawnList.AddingFactionPawn += pawns.AddFactionPawn;
            tabViewPawns.PanelPawnList.PawnDeleted       += pawns.DeletePawn;
            tabViewPawns.PanelPawnList.PawnDeleted       += (CustomPawn pawn) => { controller.CheckPawnCapabilities(); };
            pawns.PawnAdded    += (CustomPawn pawn) => { tabViewPawns.PanelPawnList.ScrollToBottom(); tabViewPawns.PanelPawnList.SelectPawn(pawn); };
            pawns.PawnAdded    += (CustomPawn pawn) => { controller.CheckPawnCapabilities(); };
            pawns.PawnReplaced += (CustomPawn pawn) => { controller.CheckPawnCapabilities(); };

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

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

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

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

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

            tabViewPawns.PanelTraits.TraitAdded       += pawns.AddTrait;
            tabViewPawns.PanelTraits.TraitAdded       += (Trait t) => { tabViewPawns.PanelTraits.ScrollToBottom(); };
            tabViewPawns.PanelTraits.TraitUpdated     += pawns.UpdateTrait;
            tabViewPawns.PanelTraits.TraitRemoved     += pawns.RemoveTrait;
            tabViewPawns.PanelTraits.TraitsRandomized += pawns.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.PanelPawnList.PawnDeleted += relationships.DeleteAllPawnRelationships;
            pawns.PawnAdded    += relationships.AddPawn;
            pawns.PawnReplaced += relationships.ReplacePawn;
        }