Beispiel #1
0
 private void UpdateSettings()
 {
     if (SelDoor == null)
     {
         return;
     }
     if (lastSelectedThing == SelThing)
     {
         Data.WantedState.locked       = locked;
         Data.WantedState.mode         = vistitorsAllowed ? LockMode.Allies : LockMode.Colony;
         Data.WantedState.petDoor      = petDoor;
         Data.WantedState.pensDoor     = pensDoor;
         Data.WantedState.allowSlave   = slaveDoor;
         Data.WantedState.allowAnimals = animalsAllowed;
         if (Data.NeedChange)
         {
             LockUtility.UpdateLockDesignation(SelDoor);
         }
     }
     else
     {
         OnOpen();
         lastSelectedThing = SelThing;
     }
 }
Beispiel #2
0
 private void SetOwnersFloatMenu(Building_Door door)
 {
     if (door != parent)
     {
         LockUtility.GetData(door).WantedState.owners.Clear();
         LockUtility.GetData(door).WantedState.owners.AddRange(LockUtility.GetData(parent).WantedState.owners);
     }
     LockUtility.UpdateLockDesignation(door);
 }
Beispiel #3
0
 public void UpdateOwners()
 {
     foreach (Building_Door door in Find.Selector.SelectedObjects.Where(o => o is Building_Door && o != parent))
     {
         LockUtility.GetData(door).WantedState.owners.Clear();
         LockUtility.GetData(door).WantedState.owners.AddRange(LockUtility.GetData(parent).WantedState.owners);
         LockUtility.UpdateLockDesignation(door);
     }
     LockUtility.UpdateLockDesignation(parent);
 }
Beispiel #4
0
 private void UpdateSettings()
 {
     Data.WantLocked          = locked;
     Data.WantedState.mode    = vistitorsAllowed ? LockMode.Allies : LockMode.Colony;
     Data.WantedState.petDoor = petDoor;
     // Owners
     if (Data.NeedChange)
     {
         LockUtility.UpdateLockDesignation(SelDoor);
     }
 }
Beispiel #5
0
 public override void ProcessInput(Event ev)
 {
     if (ev.button == 0)
     {
         SoundDefOf.Click.PlayOneShotOnCamera(null);
         LockUtility.GetData(parent).WantedState.locked = !LockUtility.GetData(parent).WantedState.locked;
         LockUtility.UpdateLockDesignation(parent);
     }
     else if (ev.button == 1)
     {
         SoundDefOf.Click.PlayOneShotOnCamera(null);
         var floatMenu = new FloatMenu(GetMenuOptions());
         Find.WindowStack.Add(floatMenu);
     }
 }
Beispiel #6
0
        public List <FloatMenuOption> GetMenuOptions()
        {
            var list = new List <FloatMenuOption>();

            list.Add(new FloatMenuOption(
                         LockUtility.GetData(parent).WantedState.locked ?
                         "Locks_UnlockToggle".Translate() :
                         "Locks_LockToggle".Translate(),
                         new Action(() =>
            {
                bool value = !LockUtility.GetData(parent).WantedState.locked;
                foreach (Building_Door door in Find.Selector.SelectedObjects.Where(o => o is Building_Door))
                {
                    LockUtility.GetData(door).WantedState.locked = value;
                    LockUtility.UpdateLockDesignation(door);
                }
            })
                         ));
            if (!LockUtility.GetData(parent).WantedState.Private)
            {
                list.Add(new FloatMenuOption(
                             LockUtility.GetData(parent).WantedState.mode == LockMode.Allies ?
                             "Locks_ForbidVisitors".Translate() :
                             "Locks_AllowVisitors".Translate(),
                             new Action(() =>
                {
                    LockMode value;
                    if (LockUtility.GetData(parent).WantedState.mode == LockMode.Allies)
                    {
                        value = LockMode.Colony;
                    }
                    else
                    {
                        value = LockMode.Allies;
                    }
                    foreach (Building_Door door in Find.Selector.SelectedObjects.Where(o => o is Building_Door))
                    {
                        LockUtility.GetData(door).WantedState.mode = value;
                        LockUtility.UpdateLockDesignation(door);
                    }
                })
                             ));
            }
            if (LockUtility.GetData(parent).WantedState.Private)
            {
                list.Add(new FloatMenuOption(
                             LockUtility.GetData(parent).WantedState.petDoor ?
                             "Locks_RemovePetDoor".Translate() :
                             "Locks_AddPetDoor".Translate(),
                             new Action(() =>
                {
                    bool value = !LockUtility.GetData(parent).WantedState.petDoor;
                    foreach (Building_Door door in Find.Selector.SelectedObjects.Where(o => o is Building_Door))
                    {
                        LockUtility.GetData(door).WantedState.petDoor = value;
                        LockUtility.UpdateLockDesignation(door);
                    }
                })
                             ));
            }
            list.Add(new FloatMenuOption(
                         "CommandBedSetOwnerLabel".Translate(),
                         new Action(() =>
            {
                Find.WindowStack.Add(new Dialog_AssignBuildingOwner(LockUtility.GetData(parent)));
                foreach (Building_Door door in Find.Selector.SelectedObjects.Where(o => o is Building_Door))
                {
                    if (door != parent)
                    {
                        LockUtility.GetData(door).WantedState.owners.Clear();
                        LockUtility.GetData(door).WantedState.owners.AddRange(LockUtility.GetData(parent).WantedState.owners);
                    }
                    LockUtility.UpdateLockDesignation(door);
                }
            })
                         ));
            if (LockUtility.GetData(parent).WantedState.Private)
            {
                list.Add(new FloatMenuOption(
                             "Locks_ClearOwners".Translate(),
                             new Action(() =>
                {
                    foreach (Building_Door door in Find.Selector.SelectedObjects.Where(o => o is Building_Door))
                    {
                        LockUtility.GetData(door).WantedState.owners.Clear();
                        LockUtility.UpdateLockDesignation(door);
                    }
                })
                             ));
            }
            return(list);
        }
Beispiel #7
0
 private void ClearOwnersFloatMenu(Building_Door door)
 {
     LockUtility.GetData(door).WantedState.owners.Clear();
     LockUtility.UpdateLockDesignation(door);
 }
Beispiel #8
0
 private void InvertPetDoorFloatMenu(Building_Door door, bool value)
 {
     LockUtility.GetData(door).WantedState.petDoor = value;
     LockUtility.UpdateLockDesignation(door);
 }
Beispiel #9
0
 private void InvertVisitorFloatMenu(Building_Door door, LockMode value)
 {
     LockUtility.GetData(door).WantedState.mode = value;
     LockUtility.UpdateLockDesignation(door);
 }
Beispiel #10
0
 private void InvertLockDesignation()
 {
     SoundDefOf.Click.PlayOneShotOnCamera(null);
     LockUtility.GetData(parent).WantedState.locked = !LockUtility.GetData(parent).WantedState.locked;
     LockUtility.UpdateLockDesignation(parent);
 }
Beispiel #11
0
 private void ClearOwnersFloatMenu(ThingWithComps door)
 {
     LockUtility.GetData(door).WantedState.owners.Clear();
     LockUtility.UpdateLockDesignation(door);
 }
Beispiel #12
0
 private void InvertPensDoorFloatMenu(ThingWithComps door, bool value)
 {
     LockUtility.GetData(door).WantedState.pensDoor = value;
     LockUtility.UpdateLockDesignation(door);
 }