Open joshuaauerbachwatson opened 1 month ago
Something is limpingly working now with a playing view, no setup view, and no modal dialogs. There is a crash in the lead player when ending the setup phase because it is dummied out and the game handle code doesn't quite understand what to do. I think the setup view needs to be a lot like the playing view but with some extra controls.
Once we get rid of the crash (by creating a real setup view) and verify that some rudimentary play can occur, I will start restoring the modal dialogs. They will all be redone as SwiftUI popovers or alerts.
In developing the setup controls, a couple of sub-issues come up.
There is also other logic to be added as all the button actions are still TODO at this poin
The current layout of the setup view is a mess.
PlayingSurface
needs attention to get its aspect ratio correct, both when it is dominating the playing view, and when it is windowed (slightly smaller) into the setup view.It would also be good to get solitaire mode cleaned up so I can make sure all the interactions in the PlayingSurface
are actually working. There is some evidence that the view does not always update when it should.
This might be the way to do the orientation locking:
This might be how you force a particular aspect ratio:
https://developer.apple.com/documentation/swiftui/view/aspectratio(_:contentmode:)-771ow
- Controls for naming, selecting, saving, loading and deleting setups need to be grouped together.
The GameTokensView
in unigame
might provide a clue. It has a place where the current game token is displayed, a place where selectable game tokens of the past of displayed, and add and delete buttons. I don't want the saved setup control to occupy as much space, though, particularly vertical space. So, I would use a picker rather than a list for the saved tokens. The picker also takes the place of the "current" display, but we would need buttons to add, delete, and load.
The semantics of "add" would subsume "save" (the current setup is saved under the added name).
- Similarly, we still need a deal dialog.
I think we now have one, although the actual dealing is untested.
Setup view is now better. i'm trying to use solitaire mode to shake out bugs. Issues noted:
Another issues
3. The
PlayingSurface
needs attention to get its aspect ratio correct, both when it is dominating the playing view, and when it is windowed (slightly smaller) into the setup view.
I've done some layout tweaks to fix the aspect ratio, by using the .aspectRatio
modifier as per the link posted above. Still no orientation locking, but I expect to return to that since it is part of the TODO material in PlayingSurface
. Right now, the setup view layout looks good on iPad simulators but there are ugly overlaps when running directly on mac. I am not worrying too much about that.
I think the next step is to get solitaire mode fully smoothed out so I can then use it to debug all the interactions involving the PlayingSurface
.
Solitaire mode seems more or less working. Issues with the setup screen remain pending.
The setup screen issues are mostly resolved. Time to exercise setup and playing more fully in solitaire mode and then test multiplayer scenarios.
I have separately been developing the
unigame
framework, which carries the "any" aspect ofanyCards
further (basically supporting any game that has players taking turns). This is made possible by the fact that theunigame
client provides the UI for player management, chat, and help but just has dummy UIs for setup and playing. So, you can have a UI that has nothing to do with cards (e.g. chess, checkers, dominos, Mah Jongg ...).Splitting responsibility for the text of the help view is an aspect of
unigame
that is not yet fully worked out. It could be as simple as pasting together pieces of HTML but that assumes that the help describing the player management and the fixed aspects of setup and playing (basically, the logic of turn taking) can be written in a way that can be included in almost any game. Not sure about that.Currently,
unigame
assumes that Auth0 is used to acquire tokens (becauseunigame-server
assumes that), but does not have anAuth0
dependency nor anAuth0.plist
because each using app needs to declare its own Auth0 application identity with its own unique callbacks matching the Apple bundle ID. The management of that split is tentatively worked out.Most of this is currently untested. So, the plan is to change
anyCards
so that it declares a dependency onunigame
and becomes the first user of it. Sinceunigame
owns the top content view, which is SwiftUI, and the top level shells of theSetup
andPlaying
views are also SwiftUI, this means thatanyCards
needs to either useSwiftUI
or make use ofUIViewRepresentable
to embed the existingUIKit
material as needed. I will play that by ear as I go.Logistically, since this is a huge sweeping change to
anyCards
I will develop the new limping version of it on a branch.