-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/cs3217-2324/group-project-t…
- Loading branch information
Showing
10 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+2.34 KB
(100%)
...proj/project.xcworkspace/xcuserdata/macbookpro.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// StatePopupNode.swift | ||
// TowerForge | ||
// | ||
// Created by Vanessa Mae on 05/04/24. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
protocol StatePopupDelegate { | ||
func onMenu() | ||
func onResume() | ||
} | ||
|
||
class StatePopupNode: TFSpriteNode { | ||
|
||
var delegate: StatePopupDelegate? | ||
|
||
init() { | ||
super.init(color: .clear, size: CGSize(width: 300, height: 300)) | ||
setupNode() | ||
} | ||
|
||
func setupNode() { | ||
let background = TFSpriteNode(imageName: "square-button", size: self.size) | ||
|
||
// TODO: Refactor into a constant | ||
background.position = CGPoint(x: 0, y: 0) | ||
background.name = "statePopupNode" | ||
|
||
let resumeButton = TFButtonNode(action: TFButtonDelegate(onTouchBegan: { [weak self] in | ||
self?.delegate?.onResume() | ||
}, | ||
onTouchEnded: {}), | ||
size: CGSize(width: 50, | ||
height: 50), | ||
imageNamed: "circle-button") | ||
resumeButton.name = "resumeButton" | ||
|
||
let menuButton = TFButtonNode(action: TFButtonDelegate(onTouchBegan: { [weak self] in | ||
self?.delegate?.onMenu() | ||
}, onTouchEnded: {}), size: CGSize(width: 50, height: 50), imageNamed: "circle-button") | ||
menuButton.name = "menuButton" | ||
|
||
// TODO: Refactor the position into a constants | ||
resumeButton.position = CGPoint(x: background.position.x + 150, y: background.position.y) | ||
menuButton.position = CGPoint(x: background.position.x - 150, y: background.position.y) | ||
|
||
background.zPosition = self.zPosition + 10 | ||
resumeButton.zPosition = self.zPosition + 20 | ||
menuButton.zPosition = self.zPosition + 20 | ||
|
||
self.add(child: background) | ||
self.add(child: menuButton) | ||
self.add(child: resumeButton) | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters