public void ProcessInputEvents()
        {
            if (this.CheckSelectedDesignatorValid())
            {
                if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
                {
                    if (this.selectedDesignator.DraggableDimensions == 0)
                    {
                        Designator       designator       = this.selectedDesignator;
                        AcceptanceReport acceptanceReport = this.selectedDesignator.CanDesignateCell(UI.MouseCell());
                        if (acceptanceReport.Accepted)
                        {
                            designator.DesignateSingleCell(UI.MouseCell());
                            designator.Finalize(true);
                        }
                        else
                        {
                            Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.SilentInput);
                            this.selectedDesignator.Finalize(false);
                        }
                    }
                    else
                    {
                        this.dragger.StartDrag();
                    }
                    Event.current.Use();
                }
                if (Event.current.type == EventType.MouseDown && Event.current.button == 1)
                {
                    goto IL_00ec;
                }
                if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
                {
                    goto IL_00ec;
                }
                goto IL_0121;
            }
            return;

IL_00ec:
            SoundDefOf.CancelMode.PlayOneShotOnCamera(null);
            this.Deselect();
            this.dragger.EndDrag();
            Event.current.Use();
            TutorSystem.Notify_Event("ClearDesignatorSelection");
            goto IL_0121;
IL_0121:
            if (Event.current.type == EventType.MouseUp && Event.current.button == 0 && this.dragger.Dragging)
            {
                this.selectedDesignator.DesignateMultiCell(this.dragger.DragCells);
                this.dragger.EndDrag();
                Event.current.Use();
            }
        }
Пример #2
0
        private void TryAddDragCell(IntVec3 c)
        {
            AcceptanceReport acceptanceReport = this.SelDes.CanDesignateCell(c);

            if (acceptanceReport.Accepted)
            {
                this.dragCells.Add(c);
            }
            else if (!acceptanceReport.Reason.NullOrEmpty())
            {
                this.failureReasonInt = acceptanceReport.Reason;
            }
        }
Пример #3
0
        protected override AcceptanceReport NameIsValid(string name)
        {
            AcceptanceReport result = base.NameIsValid(name);

            if (!result.Accepted)
            {
                return(result);
            }
            if (this.area.Map.areaManager.AllAreas.Any((Area a) => a != this.area && a.Label == name))
            {
                return("NameIsInUse".Translate());
            }
            return(true);
        }
Пример #4
0
        protected override AcceptanceReport NameIsValid(string name)
        {
            AcceptanceReport result = base.NameIsValid(name);

            if (!result.Accepted)
            {
                return(result);
            }
            if (this.zone.Map.zoneManager.AllZones.Any((Zone z) => z != this.zone && z.label == name))
            {
                return("NameIsInUse".Translate());
            }
            return(true);
        }
Пример #5
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;
            bool flag = false;

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
            {
                flag = true;
                Event.current.Use();
            }
            GUI.SetNextControlName("RenameField");
            string text = Widgets.TextField(new Rect(0f, 15f, inRect.width, 35f), curName);

            if (AcceptsInput && text.Length < MaxNameLength)
            {
                curName = text;
            }
            else if (!AcceptsInput)
            {
                ((TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl)).SelectAll();
            }
            if (!focusedRenameField)
            {
                UI.FocusControl("RenameField", this);
                focusedRenameField = true;
            }
            if (!(Widgets.ButtonText(new Rect(15f, inRect.height - 35f - 15f, inRect.width - 15f - 15f, 35f), "OK") | flag))
            {
                return;
            }
            AcceptanceReport acceptanceReport = NameIsValid(curName);

            if (!acceptanceReport.Accepted)
            {
                if (acceptanceReport.Reason.NullOrEmpty())
                {
                    Messages.Message("NameIsInvalid".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                }
                else
                {
                    Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.RejectInput, historical: false);
                }
            }
            else
            {
                SetName(curName);
                Find.WindowStack.TryRemove(this);
            }
        }
Пример #6
0
 public void ProcessInputEvents()
 {
     if (!CheckSelectedDesignatorValid())
     {
         return;
     }
     if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
     {
         if (selectedDesignator.DraggableDimensions == 0)
         {
             Designator       designator       = selectedDesignator;
             AcceptanceReport acceptanceReport = selectedDesignator.CanDesignateCell(UI.MouseCell());
             if (acceptanceReport.Accepted)
             {
                 designator.DesignateSingleCell(UI.MouseCell());
                 designator.Finalize(somethingSucceeded: true);
             }
             else
             {
                 Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.SilentInput, historical: false);
                 selectedDesignator.Finalize(somethingSucceeded: false);
             }
         }
         else
         {
             dragger.StartDrag();
         }
         Event.current.Use();
     }
     if ((Event.current.type == EventType.MouseDown && Event.current.button == 1) || KeyBindingDefOf.Cancel.KeyDownEvent)
     {
         SoundDefOf.CancelMode.PlayOneShotOnCamera();
         Deselect();
         dragger.EndDrag();
         Event.current.Use();
         TutorSystem.Notify_Event("ClearDesignatorSelection");
     }
     if (Event.current.type == EventType.MouseUp && Event.current.button == 0 && dragger.Dragging)
     {
         selectedDesignator.DesignateMultiCell(dragger.DragCells);
         dragger.EndDrag();
         Event.current.Use();
     }
 }
Пример #7
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;
            bool flag = false;

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
            {
                flag = true;
                Event.current.Use();
            }
            GUI.SetNextControlName("RenameField");
            string text = Widgets.TextField(new Rect(0f, 15f, inRect.width, 35f), this.curName);

            if (text.Length < this.MaxNameLength)
            {
                this.curName = text;
            }
            if (!this.focusedRenameField)
            {
                UI.FocusControl("RenameField", this);
                this.focusedRenameField = true;
            }
            if (Widgets.ButtonText(new Rect(15f, inRect.height - 35f - 15f, inRect.width - 15f - 15f, 35f), "OK", true, false, true) || flag)
            {
                AcceptanceReport acceptanceReport = this.NameIsValid(this.curName);
                if (!acceptanceReport.Accepted)
                {
                    if (acceptanceReport.Reason.NullOrEmpty())
                    {
                        Messages.Message("NameIsInvalid".Translate(), MessageTypeDefOf.RejectInput, false);
                    }
                    else
                    {
                        Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.RejectInput, false);
                    }
                }
                else
                {
                    this.SetName(this.curName);
                    Find.WindowStack.TryRemove(this, true);
                }
            }
        }
Пример #8
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;
            bool flag = false;

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
            {
                flag = true;
                Event.current.Use();
            }
            string text = Widgets.TextField(new Rect(0f, 15f, inRect.width, 35f), this.curName);

            if (text.Length < this.MaxNameLength)
            {
                this.curName = text;
            }
            if (!Widgets.ButtonText(new Rect(15f, (float)(inRect.height - 35.0 - 15.0), (float)(inRect.width - 15.0 - 15.0), 35f), "OK", true, false, true) && !flag)
            {
                return;
            }
            AcceptanceReport acceptanceReport = this.NameIsValid(this.curName);

            if (!acceptanceReport.Accepted)
            {
                if (acceptanceReport.Reason == null)
                {
                    Messages.Message("NameIsInvalid".Translate(), MessageTypeDefOf.RejectInput);
                }
                else
                {
                    Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.RejectInput);
                }
            }
            else
            {
                this.SetName(this.curName);
                Find.WindowStack.TryRemove(this, true);
            }
        }
Пример #9
0
 static void Postfix(ref Verse.AcceptanceReport __result, Thing t)
 {
     __result = t.IsAHaulableSetToUnhaulable();
 }