diff --git a/chatter.xcodeproj/project.pbxproj b/chatter.xcodeproj/project.pbxproj index ba69cdc..0c5b77b 100644 --- a/chatter.xcodeproj/project.pbxproj +++ b/chatter.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0D55A5DE1E9CD11E00CD1B41 /* IronMan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D55A5DD1E9CD11E00CD1B41 /* IronMan.swift */; }; 1716AF9F1CCE8A7600264EBE /* Obama.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1716AF9E1CCE8A7600264EBE /* Obama.swift */; }; 3284A1361CD3FD4500A5DD4F /* Minion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3284A1351CD3FD4500A5DD4F /* Minion.swift */; }; 3284A13C1CD4010200A5DD4F /* Barney.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3284A13B1CD4010200A5DD4F /* Barney.swift */; }; @@ -37,6 +38,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 0D55A5DD1E9CD11E00CD1B41 /* IronMan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IronMan.swift; sourceTree = ""; }; 1716AF9E1CCE8A7600264EBE /* Obama.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Obama.swift; sourceTree = ""; }; 3284A1351CD3FD4500A5DD4F /* Minion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Minion.swift; sourceTree = ""; }; 3284A13B1CD4010200A5DD4F /* Barney.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Barney.swift; sourceTree = ""; }; @@ -165,6 +167,7 @@ isa = PBXGroup; children = ( 87468FD61CCD3B3500DB4A03 /* Yoda.swift */, + 0D55A5DD1E9CD11E00CD1B41 /* IronMan.swift */, DC161D071CD60CE7001ADBC4 /* Seneca.swift */, A016F8D31CCE76A80039184B /* Nathan.swift */, 1716AF9E1CCE8A7600264EBE /* Obama.swift */, @@ -276,6 +279,7 @@ 3284A13C1CD4010200A5DD4F /* Barney.swift in Sources */, 9DCCE6CD1CD3457F0074771D /* Sheldon.swift in Sources */, 87DC34E61CEA18A000AC0EE6 /* Teenager.swift in Sources */, + 0D55A5DE1E9CD11E00CD1B41 /* IronMan.swift in Sources */, 3284A1361CD3FD4500A5DD4F /* Minion.swift in Sources */, 79A8A7631CD0072100C7A040 /* Sherlock.swift in Sources */, 879EC5451AF29DC200F36F1C /* ViewController.swift in Sources */, diff --git a/chatter/Images.xcassets/Iron Man.imageset/Contents.json b/chatter/Images.xcassets/Iron Man.imageset/Contents.json new file mode 100644 index 0000000..5971164 --- /dev/null +++ b/chatter/Images.xcassets/Iron Man.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Iron Man.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/chatter/Images.xcassets/Iron Man.imageset/Iron Man.png b/chatter/Images.xcassets/Iron Man.imageset/Iron Man.png new file mode 100644 index 0000000..d8239f6 Binary files /dev/null and b/chatter/Images.xcassets/Iron Man.imageset/Iron Man.png differ diff --git a/chatter/IronMan.swift b/chatter/IronMan.swift new file mode 100644 index 0000000..3641113 --- /dev/null +++ b/chatter/IronMan.swift @@ -0,0 +1,71 @@ +// +// IronMan.swift +// chatter +// +// Created by Elvira Beisel on 11.04.17. +// Copyright © 2017 Universität Heidelberg. All rights reserved. +// + +import Foundation +import UIKit + +class IronMan : Chatter{ + + required init() { + super.init(image: UIImage(named: "Iron Man")) + } + + override func nextMessage() -> Message { + return [ + Message(content: "How'd you solve the icing problem?", type: .questionWhy), + Message(content: "It's your birthday?", type: .questionBool), + Message(content: "What is the point of owning a race car if you can't drive it?", type: .questionBool), + Message(content: "What are you trying to get rid of me for? You got plans?", type: .questionBool), + Message(content: "Give me a scotch. I'm starving", type: .statement), + + + ].randomElement() + } + + override func responseForMessage(_ message: Message) -> Message { + switch message.type { + case .statement: + return [ + Message(content: "I don't like it when you have plans.", type: .statement), + Message(content: "Give me a scotch. I'm starving.", type: .statement), + Message(content: "Iron Man. That's kind of catchy. It's got a nice ring to it.", type: .statement), + Message(content: "Yeah...okay.", type: .statement), + Message(content: "I'm a huge fan of the way you lose control and turn into an enourmous green rage monster.", type: .statement), + Message(content: "Yeah? And?", type: .questionWhy), + Message(content: "👍", type: .statement) + ].randomElement() + case .questionBool: + return [ + Message(content: "Let's face it, this is not the worst thing you've caught me doing.", type: .statement), + Message(content: "I knew that.", type: .statement), + Message(content: "I already told you, I don't want to join your super secret boy band.", type: .statement), + Message(content: "You know, it's times like these when I realize what a superhero I am.", type: .statement), + Message(content: "Might wanna look into it!", type: .statement), + Message(content: "Yeah, I can fly!", type: .statement), + Message(content: "It's totally cool if you take a picture with me. Don't put this on MySpace. Please, no gang signs. Just kidding, you can put it up", type: .statement) + ].randomElement() + case .questionWhy: + return [ + Message(content: "I am Iron Man.", type: .statement), + Message(content: "Why not?", type: .statement), + Message(content: "Who knows?!", type: .statement), + Message(content: "Look, stop telling me. Just leave it on the screen.", type: .statement), + Message(content: "Look at me, I'm flying!", type: .statement), + ].randomElement() + + case .joke: + return [ + Message(content: "Yeah well vacation's over.", type: .statement), + Message(content: "Hihihi", type: .statement), + Message(content: "Good one 😉", type: .statement), + Message(content: "😀😀", type: .statement) + ].randomElement() + } + } + +}