protected override void OnDragComplete(Vector3 cursorDown, Vector3 cursorUp) { base.OnDragComplete(cursorDown, cursorUp); if (hasFocus) { Grid.PosToXY(cursorDown, out int x0, out int y0); Grid.PosToXY(cursorUp, out int x1, out int y1); if (x0 > x1) { Util.Swap(ref x0, ref x1); } if (y0 < y1) { Util.Swap(ref y0, ref y1); } Blueprint blueprint = BlueprintsState.CreateBlueprint(new Vector2I(x0, y0), new Vector2I(x1, y1), this); if (blueprint.IsEmpty()) { PopFXManager.Instance.SpawnFX(BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE, Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_EMPTY), null, PlayerController.GetCursorPos(KInputManager.GetMousePos()), BlueprintsAssets.BLUEPRINTS_CONFIG_FXTIME); } else { void onConfirmDelegate(string blueprintName, FileNameDialog parent) { blueprint.Rename(blueprintName, false); blueprint.SetFolder(""); SpeedControlScreen.Instance.Unpause(false); PopFXManager.Instance.SpawnFX(BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE, Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_CREATED), null, PlayerController.GetCursorPos(KInputManager.GetMousePos()), BlueprintsAssets.BLUEPRINTS_CONFIG_FXTIME); parent.Deactivate(); } FileNameDialog blueprintNameDialog = UIUtilities.CreateTextDialog(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_NAMEBLUEPRINT_TITLE), false, onConfirmDelegate); SpeedControlScreen.Instance.Pause(false); blueprintNameDialog.onCancel = delegate { SpeedControlScreen.Instance.Unpause(false); PopFXManager.Instance.SpawnFX(BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE, Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_CANCELLED), null, PlayerController.GetCursorPos(KInputManager.GetMousePos()), BlueprintsAssets.BLUEPRINTS_CONFIG_FXTIME); blueprintNameDialog.Deactivate(); }; blueprintNameDialog.Activate(); } } }