diff --git a/Pendu.xcodeproj/project.pbxproj b/Pendu.xcodeproj/project.pbxproj index 019554980791c0816d3a615c2a96c64fda9c5543..20b5c50d5c040a99a7e20ee3fd133098b8579663 100644 --- a/Pendu.xcodeproj/project.pbxproj +++ b/Pendu.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 159D0F242A13B19C0029D0F7 /* 1200x680_jp_zadi.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 159D0F232A13B19C0029D0F7 /* 1200x680_jp_zadi.jpeg */; }; + 157E41D92A1D04E400E6DE57 /* zadi.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 157E41D82A1D04E400E6DE57 /* zadi.jpeg */; }; BF3C480E2A0A1FCA00CE128F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF3C480D2A0A1FCA00CE128F /* AppDelegate.swift */; }; BF3C48102A0A1FCA00CE128F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF3C480F2A0A1FCA00CE128F /* SceneDelegate.swift */; }; BF3C48122A0A1FCA00CE128F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF3C48112A0A1FCA00CE128F /* ViewController.swift */; }; @@ -42,7 +42,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 159D0F232A13B19C0029D0F7 /* 1200x680_jp_zadi.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = 1200x680_jp_zadi.jpeg; path = ../../1200x680_jp_zadi.jpeg; sourceTree = "<group>"; }; + 157E41D82A1D04E400E6DE57 /* zadi.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = zadi.jpeg; path = ../../zadi.jpeg; sourceTree = "<group>"; }; BF3C480A2A0A1FCA00CE128F /* Pendu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Pendu.app; sourceTree = BUILT_PRODUCTS_DIR; }; BF3C480D2A0A1FCA00CE128F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; BF3C480F2A0A1FCA00CE128F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; @@ -116,8 +116,8 @@ BF3C48192A0A1FCD00CE128F /* Assets.xcassets */, BF3C481B2A0A1FCD00CE128F /* LaunchScreen.storyboard */, BF3C481E2A0A1FCD00CE128F /* Info.plist */, + 157E41D82A1D04E400E6DE57 /* zadi.jpeg */, BF3C48162A0A1FCA00CE128F /* Pendu.xcdatamodeld */, - 159D0F232A13B19C0029D0F7 /* 1200x680_jp_zadi.jpeg */, D082CCC82A0A33D600D97981 /* GameEngine.swift */, BF3C48422A0A3CFF00CE128F /* GameEngineTests.swift */, ); @@ -246,8 +246,8 @@ buildActionMask = 2147483647; files = ( BF3C481D2A0A1FCD00CE128F /* LaunchScreen.storyboard in Resources */, + 157E41D92A1D04E400E6DE57 /* zadi.jpeg in Resources */, BF3C481A2A0A1FCD00CE128F /* Assets.xcassets in Resources */, - 159D0F242A13B19C0029D0F7 /* 1200x680_jp_zadi.jpeg in Resources */, BF3C48152A0A1FCA00CE128F /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Pendu/Base.lproj/Main.storyboard b/Pendu/Base.lproj/Main.storyboard index 2ad08c17640319661497318001a5b7d22c06bbd8..e8596c733d019135494b73a517ce7df867a32c2c 100644 --- a/Pendu/Base.lproj/Main.storyboard +++ b/Pendu/Base.lproj/Main.storyboard @@ -16,7 +16,7 @@ <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="1200x680_jp_zadi.jpeg" translatesAutoresizingMaskIntoConstraints="NO" id="pv2-ee-Khp"> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="zadi.jpeg" translatesAutoresizingMaskIntoConstraints="NO" id="pv2-ee-Khp"> <rect key="frame" x="0.0" y="-43" width="414" height="319"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> </imageView> @@ -26,25 +26,12 @@ <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits"/> </textField> - <pickerView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3TE-rS-qnG"> - <rect key="frame" x="0.0" y="442" width="414" height="162"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> - </pickerView> - <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QSN-AU-ceX"> - <rect key="frame" x="308" y="402" width="33" height="31"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <state key="normal" title="Button"/> - <buttonConfiguration key="configuration" style="filled" title="+"/> - <connections> - <action selector="ajouterAct:" destination="BYZ-38-t0r" eventType="touchUpInside" id="eWg-jI-G3G"/> - </connections> - </button> <pickerView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LNU-nY-Uyk"> - <rect key="frame" x="0.0" y="641" width="414" height="162"/> + <rect key="frame" x="0.0" y="565" width="414" height="162"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> </pickerView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Choisissez un theme" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dAa-qb-1JB"> - <rect key="frame" x="119" y="612" width="158" height="21"/> + <rect key="frame" x="119" y="484" width="158" height="21"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -57,8 +44,25 @@ <nil key="textColor"/> <nil key="highlightedColor"/> </label> + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rxj-5T-1Nw"> + <rect key="frame" x="117" y="720" width="181" height="54"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <state key="normal" title="Button"/> + <buttonConfiguration key="configuration" style="filled" title="Lancer Partie"/> + <connections> + <action selector="LancerPartie:" destination="BYZ-38-t0r" eventType="touchUpInside" id="ccG-OM-Emx"/> + </connections> + </button> + <segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="NvB-ZN-BTJ"> + <rect key="frame" x="144" y="526" width="109" height="32"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <segments> + <segment title="Facile"/> + <segment title="Hard"/> + </segments> + </segmentedControl> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lae-hh-psQ"> - <rect key="frame" x="151" y="284" width="113" height="31"/> + <rect key="frame" x="119" y="284" width="160" height="31"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <state key="normal" title="Button"/> <buttonConfiguration key="configuration" style="gray"> @@ -70,22 +74,12 @@ <action selector="AfficherClassement:" destination="BYZ-38-t0r" eventType="touchUpInside" id="up5-UE-mBH"/> </connections> </button> - <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rxj-5T-1Nw"> - <rect key="frame" x="117" y="796" width="181" height="54"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <state key="normal" title="Button"/> - <buttonConfiguration key="configuration" style="filled" title="Lancer Partie"/> - <connections> - <action selector="LancerPartie:" destination="BYZ-38-t0r" eventType="touchUpInside" id="ccG-OM-Emx"/> - </connections> - </button> </subviews> <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/> </view> <connections> - <outlet property="ajouterbtn" destination="QSN-AU-ceX" id="QV2-7a-fT3"/> - <outlet property="choixPseudo" destination="3TE-rS-qnG" id="5a3-TN-FpU"/> + <outlet property="choixNiv" destination="NvB-ZN-BTJ" id="fAA-St-woR"/> <outlet property="choixTheme" destination="LNU-nY-Uyk" id="Fff-Y6-Z8A"/> <outlet property="classement" destination="lae-hh-psQ" id="YEG-ma-abh"/> <outlet property="pseudoinput" destination="iRK-mL-RC3" id="v77-OK-9QK"/> @@ -97,7 +91,7 @@ </scene> </scenes> <resources> - <image name="1200x680_jp_zadi.jpeg" width="1200" height="680"/> + <image name="zadi.jpeg" width="1928" height="1208"/> <systemColor name="systemBackgroundColor"> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> </systemColor> diff --git a/Pendu/ViewController.swift b/Pendu/ViewController.swift index 3cc7d09e5e243677650a803f662675703b7d7e8e..058e47c89d28be77dd47150a23f9ae73fbca2cae 100644 --- a/Pendu/ViewController.swift +++ b/Pendu/ViewController.swift @@ -1,45 +1,58 @@ -// -// ViewController.swift -// Pendu -// -// Created by Sofiane Lasri-Trienpont on 09/05/2023. -// - import UIKit -class ViewController: UIViewController { +class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate { @IBOutlet weak var classement: UIButton! @IBOutlet weak var pseudoinput: UITextField! - @IBOutlet weak var ajouterbtn: UIButton! - @IBOutlet weak var choixPseudo: UIPickerView! @IBOutlet weak var choixTheme: UIPickerView! + @IBOutlet weak var choixNiv: UISegmentedControl! - @IBAction func ajouterAct(_ sender: Any) { - - + let pickerData = ["Animals", "Sports", "Food", "Cities", "Colors"] + + override func viewDidLoad() { + super.viewDidLoad() + choixTheme.dataSource = self + choixTheme.delegate = self } @IBAction func LancerPartie(_ sender: Any) { + guard let pseudo = pseudoinput.text else { + return + } + let niveauIndex = choixNiv.selectedSegmentIndex + let niveau = choixNiv.titleForSegment(at: niveauIndex) - } - - @IBAction func AfficherClassement(_ sender: Any) { - + let themeIndex = choixTheme.selectedRow(inComponent: 0) + let theme = pickerData[themeIndex] + // Utilisez les valeurs récupérées comme vous le souhaitez + print("Pseudo: \(pseudo)") + print("Niveau: \(niveau ?? "")") + print("Thème: \(theme)") + // Ajoutez votre code supplémentaire ici + } + + // MARK: - UIPickerViewDataSource + + func numberOfComponents(in pickerView: UIPickerView) -> Int { + return 1 } + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + return pickerData.count + } + // MARK: - UIPickerViewDelegate - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view. + func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { + return pickerData[row] + } + + func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { + // Code à exécuter lorsque l'utilisateur sélectionne une valeur dans le pickerView. } - - } -