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 { FileNameDialog blueprintNameDialog = Utilities.CreateBlueprintRenameDialog(); SpeedControlScreen.Instance.Pause(false); blueprintNameDialog.onConfirm = delegate(string blueprintName) { blueprint.Rename(blueprintName.Substring(0, blueprintName.Length - 4)); SpeedControlScreen.Instance.Unpause(false); blueprintNameDialog.Deactivate(); blueprint.Write(); PopFXManager.Instance.SpawnFX(BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE, Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_CREATED), null, PlayerController.GetCursorPos(KInputManager.GetMousePos()), BlueprintsAssets.BLUEPRINTS_CONFIG_FXTIME); BlueprintsState.LoadedBlueprints.Add(blueprint); BlueprintsState.SelectedBlueprintIndex = BlueprintsState.LoadedBlueprints.Count - 1; }; 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(); } } }