diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..25ee8133558e0a5ec26185307c044335f80b8516 Binary files /dev/null and b/.DS_Store differ diff --git a/Pendu.xcodeproj/project.pbxproj b/Pendu.xcodeproj/project.pbxproj index f6eb00e40a608e271da417ae110ba5f69ac16b09..ec2988aec96882e4d4e512a5104e69cb49826d76 100644 --- a/Pendu.xcodeproj/project.pbxproj +++ b/Pendu.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ BF1D4A112A1CF23B002F97CB /* GameEngineMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5A7EC82A13BF8A00168B16 /* GameEngineMock.swift */; }; BF1D4A122A1CF36D002F97CB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF3C480D2A0A1FCA00CE128F /* AppDelegate.swift */; }; + 159D0F242A13B19C0029D0F7 /* 1200x680_jp_zadi.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 159D0F232A13B19C0029D0F7 /* 1200x680_jp_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 */; }; @@ -44,6 +45,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>"; }; 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>"; }; @@ -119,6 +121,7 @@ BF3C481B2A0A1FCD00CE128F /* LaunchScreen.storyboard */, BF3C481E2A0A1FCD00CE128F /* Info.plist */, BF3C48162A0A1FCA00CE128F /* Pendu.xcdatamodeld */, + 159D0F232A13B19C0029D0F7 /* 1200x680_jp_zadi.jpeg */, D082CCC82A0A33D600D97981 /* GameEngine.swift */, BF3C48422A0A3CFF00CE128F /* GameEngineTests.swift */, BF5A7EC82A13BF8A00168B16 /* GameEngineMock.swift */, @@ -249,6 +252,7 @@ files = ( BF3C481D2A0A1FCD00CE128F /* LaunchScreen.storyboard 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 25a763858ecdbea5c897a9fd8fa2225d7223d2ad..2ad08c17640319661497318001a5b7d22c06bbd8 100644 --- a/Pendu/Base.lproj/Main.storyboard +++ b/Pendu/Base.lproj/Main.storyboard @@ -1,24 +1,105 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> + <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--View Controller--> <scene sceneID="tne-QT-ifu"> <objects> - <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController"> + <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Pendu" customModuleProvider="target" sceneMemberID="viewController"> <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <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"> + <rect key="frame" x="0.0" y="-43" width="414" height="319"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + </imageView> + <textField opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iRK-mL-RC3"> + <rect key="frame" x="106" y="400" width="184" height="34"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <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"/> + <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"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="choissisez votre pseudo" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="doS-CU-ueI"> + <rect key="frame" x="106" y="351" width="184" height="21"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <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="lae-hh-psQ"> + <rect key="frame" x="151" y="284" width="113" height="31"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <state key="normal" title="Button"/> + <buttonConfiguration key="configuration" style="gray"> + <attributedString key="attributedTitle"> + <fragment content="Classement"/> + </attributedString> + </buttonConfiguration> + <connections> + <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="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"/> + </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> </objects> + <point key="canvasLocation" x="131.8840579710145" y="81.696428571428569"/> </scene> </scenes> + <resources> + <image name="1200x680_jp_zadi.jpeg" width="1200" height="680"/> + <systemColor name="systemBackgroundColor"> + <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </systemColor> + </resources> </document> diff --git a/Pendu/GameEngine.swift b/Pendu/GameEngine.swift index 2fa18691d7d2af2ca34f61e8562b51e78359cbee..219891e8252fd7598ea0b0cb6f88723943db991a 100644 --- a/Pendu/GameEngine.swift +++ b/Pendu/GameEngine.swift @@ -85,13 +85,18 @@ class GameEngine: NSObject { return word } - public func startNewGame(difficulty: String) -> Void { - print(WordToGuess(theme: "Animals", difficulty: "Easy")) - } + //public func startNewGame(difficulty: String) -> Void { + //wordToGuess = WordToGuess(theme: "Animals", difficulty: "Easy") + //} - public func guessLetter(letter: Character) -> Void { - // Vérification de la lettre proposée par le joueur - // Mise à jour de l'état de la lettre + public func guessLetter(letter: Character) -> Bool { + + if wordToGuess.contains(letter) { + return true + } else { + return false + } + } public func isGameOver() -> Bool { diff --git a/Pendu/ViewController.swift b/Pendu/ViewController.swift index 688be3ead8c69b86dbda310fb71c17d3a6452b2b..3cc7d09e5e243677650a803f662675703b7d7e8e 100644 --- a/Pendu/ViewController.swift +++ b/Pendu/ViewController.swift @@ -9,6 +9,32 @@ import UIKit class ViewController: UIViewController { + @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! + + @IBAction func ajouterAct(_ sender: Any) { + + + } + + + + @IBAction func LancerPartie(_ sender: Any) { + + + } + + @IBAction func AfficherClassement(_ sender: Any) { + + + + } + + + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. diff --git a/PenduTests/PenduTests.swift b/PenduTests/PenduTests.swift index d659345db8cafa5fdd6de0292abc93547ad1b6e9..b960a7496e65129377ed43b4c8533080a84deec9 100644 --- a/PenduTests/PenduTests.swift +++ b/PenduTests/PenduTests.swift @@ -32,5 +32,5 @@ class PenduTests: XCTestCase { // Put the code you want to measure the time of here. } } - + }