iOS 1.1.0 - Drag and Drop
This commit is contained in:
@@ -411,7 +411,7 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_TEAM = 4BC9Y2LL4B;
|
DEVELOPMENT_TEAM = 4BC9Y2LL4B;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@@ -426,7 +426,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.0;
|
MARKETING_VERSION = 1.1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.atridad.MagicCounter;
|
PRODUCT_BUNDLE_IDENTIFIER = com.atridad.MagicCounter;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
@@ -446,7 +446,7 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_TEAM = 4BC9Y2LL4B;
|
DEVELOPMENT_TEAM = 4BC9Y2LL4B;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@@ -461,7 +461,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.0;
|
MARKETING_VERSION = 1.1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.atridad.MagicCounter;
|
PRODUCT_BUNDLE_IDENTIFIER = com.atridad.MagicCounter;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
|
|||||||
Binary file not shown.
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main game screen displaying the grid of players.
|
* Main game screen displaying the grid of players.
|
||||||
@@ -17,6 +18,7 @@ struct GameView: View {
|
|||||||
@State private var gameState: GameState
|
@State private var gameState: GameState
|
||||||
@State private var showingStopConfirmation = false
|
@State private var showingStopConfirmation = false
|
||||||
@State private var selectedPlayerForCommander: PlayerState?
|
@State private var selectedPlayerForCommander: PlayerState?
|
||||||
|
@State private var draggedPlayer: PlayerState?
|
||||||
|
|
||||||
init(match: MatchRecord) {
|
init(match: MatchRecord) {
|
||||||
self._gameState = State(initialValue: match.state)
|
self._gameState = State(initialValue: match.state)
|
||||||
@@ -97,6 +99,11 @@ struct GameView: View {
|
|||||||
onScoop: { scoopPlayer(player) }
|
onScoop: { scoopPlayer(player) }
|
||||||
)
|
)
|
||||||
.frame(height: 260)
|
.frame(height: 260)
|
||||||
|
.onDrag {
|
||||||
|
self.draggedPlayer = player
|
||||||
|
return NSItemProvider(object: String(player.id) as NSString)
|
||||||
|
}
|
||||||
|
.onDrop(of: [.text], delegate: PlayerDropDelegate(item: player, items: $gameState.players, draggedItem: $draggedPlayer))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(24)
|
.padding(24)
|
||||||
@@ -357,3 +364,30 @@ struct CommanderDamageView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct PlayerDropDelegate: DropDelegate {
|
||||||
|
let item: PlayerState
|
||||||
|
@Binding var items: [PlayerState]
|
||||||
|
@Binding var draggedItem: PlayerState?
|
||||||
|
|
||||||
|
func performDrop(info: DropInfo) -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func dropEntered(info: DropInfo) {
|
||||||
|
guard let draggedItem = draggedItem else { return }
|
||||||
|
if draggedItem.id != item.id {
|
||||||
|
if let from = items.firstIndex(where: { $0.id == draggedItem.id }),
|
||||||
|
let to = items.firstIndex(where: { $0.id == item.id }) {
|
||||||
|
withAnimation {
|
||||||
|
let movedItem = items.remove(at: from)
|
||||||
|
items.insert(movedItem, at: to)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func dropUpdated(info: DropInfo) -> DropProposal? {
|
||||||
|
return DropProposal(operation: .move)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"layers" : [
|
"layers" : [
|
||||||
{
|
{
|
||||||
"image-name" : "logo 2.png",
|
"image-name" : "logo 2.png",
|
||||||
"name" : "logo 2",
|
"name" : "logo",
|
||||||
"position" : {
|
"position" : {
|
||||||
"scale" : 0.85,
|
"scale" : 0.85,
|
||||||
"translation-in-points" : [
|
"translation-in-points" : [
|
||||||
|
|||||||
Reference in New Issue
Block a user