-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from surenpoghosian/Hints-LS-71
Hints-LS-71 added hint on how to play before the first game
- Loading branch information
Showing
9 changed files
with
443 additions
and
29 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
-50.5 KB
(56%)
.../project.xcworkspace/xcuserdata/surenpoghosyan.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
269 changes: 247 additions & 22 deletions
269
...ings.xcodeproj/xcuserdata/surenpoghosyan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
Large diffs are not rendered by default.
Oops, something went wrong.
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
21 changes: 21 additions & 0 deletions
21
Greedy Kings/Assets.xcassets/UI Assets/GameScene/Gamescene_Hint.imageset/Contents.json
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,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Gamescene_Hint.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+1.45 MB
.../Assets.xcassets/UI Assets/GameScene/Gamescene_Hint.imageset/Gamescene_Hint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
118 changes: 118 additions & 0 deletions
118
Greedy Kings/Game/UI/Game Scene/Views/HintViewController.swift
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,118 @@ | ||
// | ||
// HintView.swift | ||
// Greedy Kings | ||
// | ||
// Created by Suren Poghosyan on 16.01.24. | ||
// | ||
|
||
import UIKit | ||
|
||
|
||
final class HintViewController: UIViewController { | ||
private var modal: UIView! | ||
private var modalStackView: UIStackView! | ||
|
||
private var hintImage: UIImage! | ||
private var hintImageView: UIImageView! | ||
private var okButton: UIButton! | ||
private var screenSize = UIScreen.main.bounds | ||
private var modalWidth: Double! | ||
private var modalHeight: Double! | ||
|
||
var onHintClose: (() -> Void)? | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
view.backgroundColor = UIColor.clear | ||
|
||
modalWidth = screenSize.width * 0.7 | ||
modalHeight = screenSize.height * 0.85 | ||
setupHintImageView() | ||
setupOkButton() | ||
setupModal() | ||
setupModalStackView() | ||
} | ||
|
||
|
||
|
||
private func setupOkButton(){ | ||
okButton = UIButton() | ||
okButton.setTitle("START", for: .normal) | ||
|
||
okButton.setBackgroundImage(UIImage(named: "button"), for: .normal) | ||
okButton.setBackgroundImage(UIImage(named: "buttonTouched"), for: .highlighted) | ||
|
||
okButton.setTitleColor(UIColor(named: "backgroundColor"), for: .normal) | ||
okButton.titleLabel?.font = UIFont.systemFont(ofSize: 28, weight: .bold) | ||
|
||
okButton.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
okButton.addAction(UIAction(handler: {[weak self]_ in | ||
if let onHintClose = self?.onHintClose { | ||
self?.dismiss(animated: true) | ||
onHintClose() | ||
} | ||
}), for: .touchUpInside) | ||
|
||
} | ||
|
||
|
||
private func setupHintImageView(){ | ||
hintImage = UIImage(named: "Gamescene_Hint") | ||
hintImageView = UIImageView() | ||
hintImageView.image = hintImage | ||
hintImageView.contentMode = .scaleAspectFit | ||
|
||
hintImageView.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
NSLayoutConstraint.activate([ | ||
hintImageView.widthAnchor.constraint(equalToConstant: CGFloat(modalWidth * 0.9)), | ||
hintImageView.heightAnchor.constraint(equalToConstant: CGFloat(modalHeight * 0.75)) | ||
]) | ||
} | ||
|
||
private func setupModal(){ | ||
modal = UIView() | ||
modal.layer.cornerRadius = 30 | ||
modal.backgroundColor = UIColor(named: "backgroundColor") | ||
|
||
view.addSubview(modal) | ||
|
||
modal.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
NSLayoutConstraint.activate([ | ||
modal.centerXAnchor.constraint(equalTo: view.centerXAnchor), | ||
modal.centerYAnchor.constraint(equalTo: view.centerYAnchor), | ||
modal.widthAnchor.constraint(equalToConstant: modalWidth), | ||
modal.heightAnchor.constraint(equalToConstant: modalHeight) | ||
]) | ||
} | ||
|
||
private func setupModalStackView(){ | ||
|
||
|
||
modalStackView = UIStackView(arrangedSubviews: [hintImageView, okButton]) | ||
|
||
modalStackView.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
modalStackView.axis = .vertical | ||
modalStackView.spacing = 10 | ||
|
||
modal.addSubview(modalStackView) | ||
|
||
modalStackView.distribution = .fillProportionally | ||
|
||
NSLayoutConstraint.activate([ | ||
modalStackView.centerXAnchor.constraint(equalTo: view.centerXAnchor), | ||
modalStackView.leftAnchor.constraint(equalTo: modal.leftAnchor, constant: 35), | ||
modalStackView.rightAnchor.constraint(equalTo: modal.rightAnchor, constant: -35), | ||
modalStackView.topAnchor.constraint(equalTo: modal.topAnchor, constant: 20), | ||
modalStackView.bottomAnchor.constraint(equalTo: modal.bottomAnchor, constant: -20), | ||
|
||
]) | ||
} | ||
|
||
|
||
|
||
} | ||
|