diff --git a/chatter.xcodeproj/project.pbxproj b/chatter.xcodeproj/project.pbxproj index c630e35..23ffecb 100644 --- a/chatter.xcodeproj/project.pbxproj +++ b/chatter.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 9DCCE6CD1CD3457F0074771D /* Sheldon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DCCE6CC1CD3457F0074771D /* Sheldon.swift */; }; A016F8D41CCE76A80039184B /* Nathan.swift in Sources */ = {isa = PBXBuildFile; fileRef = A016F8D31CCE76A80039184B /* Nathan.swift */; }; A2AB56621CD35B40006999FD /* Homer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AB56611CD35B40006999FD /* Homer.swift */; }; + A3B00DEB1CD55CBE00B7117A /* Oettinger.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3B00DEA1CD55CBE00B7117A /* Oettinger.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -52,6 +53,7 @@ 9DCCE6CC1CD3457F0074771D /* Sheldon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sheldon.swift; sourceTree = ""; }; A016F8D31CCE76A80039184B /* Nathan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Nathan.swift; sourceTree = ""; }; A2AB56611CD35B40006999FD /* Homer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Homer.swift; sourceTree = ""; }; + A3B00DEA1CD55CBE00B7117A /* Oettinger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Oettinger.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -154,6 +156,7 @@ 9DCCE6CC1CD3457F0074771D /* Sheldon.swift */, 9D20C8091CD3BE9400C54F73 /* StarTrek.swift */, A2AB56611CD35B40006999FD /* Homer.swift */, + A3B00DEA1CD55CBE00B7117A /* Oettinger.swift */, 3284A1351CD3FD4500A5DD4F /* Minion.swift */, 3284A13B1CD4010200A5DD4F /* Barney.swift */, 79A8A7621CD0072100C7A040 /* Sherlock.swift */, @@ -192,6 +195,11 @@ LastSwiftUpdateCheck = 0730; LastUpgradeCheck = 0730; ORGANIZATIONNAME = "Universität Heidelberg"; + TargetAttributes = { + 8739C1B8191C1203009C7B3B = { + DevelopmentTeam = 57G2ZY49JR; + }; + }; }; buildConfigurationList = 8739C1B4191C1203009C7B3B /* Build configuration list for PBXProject "chatter" */; compatibilityVersion = "Xcode 3.2"; @@ -232,6 +240,7 @@ 879EC5111AF2952E00F36F1C /* AppDelegate.swift in Sources */, 9D20C80A1CD3BE9400C54F73 /* StarTrek.swift in Sources */, A2AB56621CD35B40006999FD /* Homer.swift in Sources */, + A3B00DEB1CD55CBE00B7117A /* Oettinger.swift in Sources */, 87468FD71CCD3B3500DB4A03 /* Chatter.swift in Sources */, A016F8D41CCE76A80039184B /* Nathan.swift in Sources */, 1716AF9F1CCE8A7600264EBE /* Obama.swift in Sources */, @@ -323,6 +332,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = "chatter/chatter-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = nikolai.krischkegmail.com; PRODUCT_BUNDLE_IDENTIFIER = "de.uni-hd.chatter.cotchere"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -339,6 +349,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = "chatter/chatter-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = nikolai.krischkegmail.com; PRODUCT_BUNDLE_IDENTIFIER = "de.uni-hd.chatter.cotchere"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; diff --git a/chatter/Chatter.swift b/chatter/Chatter.swift index ab9e85d..f992eb2 100644 --- a/chatter/Chatter.swift +++ b/chatter/Chatter.swift @@ -35,6 +35,8 @@ class Chatter { return NSStringFromClass(self.dynamicType).componentsSeparatedByString(".").last! } + var mood: Int = 0 + // MARK: Chatting @@ -77,6 +79,9 @@ class Chatter { - returns: A chat message that is a contextual correct response to the given message. */ func responseForMessage(message: Message) -> Message { + + + switch message.type { case .Statement: return [ @@ -116,6 +121,12 @@ class Chatter { ].randomElement() } } + func changeMood(message: Message) -> Int { + + // last message influences on mood (in case values are set) + mood = mood + (message.friendliness)! + return mood + } } @@ -162,10 +173,24 @@ struct Message: CustomStringConvertible { case Statement, Joke, QuestionBool, QuestionWhy } + /// let friendliness of message influence the mood of the chatter + var friendliness: Int? + var description: String { return content } + init(content: String, type: MessageType) { + self.content = content + self.type = type + } + + init(content: String, type: MessageType, friendliness: Int?) { + self.content = content + self.type = type + self.friendliness = friendliness + } + } diff --git a/chatter/Images.xcassets/oettinger.imageset/Contents.json b/chatter/Images.xcassets/oettinger.imageset/Contents.json new file mode 100644 index 0000000..174ea0e --- /dev/null +++ b/chatter/Images.xcassets/oettinger.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "media.imagefile.ba63014e-9421-4c89-962a-eaa643639d0c.normalized.media.jpeg", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/chatter/Images.xcassets/oettinger.imageset/media.imagefile.ba63014e-9421-4c89-962a-eaa643639d0c.normalized.media.jpeg b/chatter/Images.xcassets/oettinger.imageset/media.imagefile.ba63014e-9421-4c89-962a-eaa643639d0c.normalized.media.jpeg new file mode 100644 index 0000000..fca04db Binary files /dev/null and b/chatter/Images.xcassets/oettinger.imageset/media.imagefile.ba63014e-9421-4c89-962a-eaa643639d0c.normalized.media.jpeg differ diff --git a/chatter/Main.storyboard b/chatter/Main.storyboard index 1a89981..edadf81 100644 --- a/chatter/Main.storyboard +++ b/chatter/Main.storyboard @@ -144,7 +144,7 @@ - + @@ -167,7 +167,7 @@ - + diff --git a/chatter/Oettinger.swift b/chatter/Oettinger.swift new file mode 100644 index 0000000..a583e1c --- /dev/null +++ b/chatter/Oettinger.swift @@ -0,0 +1,50 @@ +// +// Oettinger.swift +// chatter +// +// Created by Nikolai Krischke on 30.04.16. +// Copyright © 2016 Universität Heidelberg. All rights reserved. +// + +import Foundation +import UIKit + +class Oettinger: Chatter { + + + required init(){ + super.init(image: UIImage(named: "oettinger")) + // set initial mood of oettinger to 2 because he looks funny + self.mood = 2 + } + + + override func nextMessage() -> Message { + return [ + Message(content: "That makes me so quickly nobody after!", type: .Statement), + Message(content: "Mood is \(mood)", type: .Statement), + Message(content: "Two rasins meet each oser, says one to se oser: Why have you got a headlight? Because I have to go into se stollen!", type: .Joke) + ].randomElement() + } + override func responseForMessage(message: Message) -> Message { + switch message.type{ + case .Statement: + return [ + Message(content: "If you want to enjoy life in full trains, you have to travel wis Deutsche Bahn.", type: .Statement, friendliness: 0) + ].randomElement() + case .QuestionBool: + return [ + Message(content: "Ladies and Gentlemen, sree hours of constructive questions and in a good atmosphere. I sink se comitee was very competent.", type: .QuestionBool, friendliness: -2) + ].randomElement() + case .QuestionWhy: + return [ + Message(content: "I'm not happy aber glücklich", type: .Statement, friendliness: 1), + Message(content: "Evrybody does as he pleases", type: .Statement, friendliness: 2) + ].randomElement() + case .Joke: + return [ + Message(content: "Ahaha. Sat was funny.", type: .Statement) + ].randomElement() + } + } +} \ No newline at end of file diff --git a/chatter/Trump.swift b/chatter/Trump.swift new file mode 100644 index 0000000..34ad34d --- /dev/null +++ b/chatter/Trump.swift @@ -0,0 +1,9 @@ +// +// Trump.swift +// chatter +// +// Created by Lucas-Raphael Müller on 29.04.16. +// Copyright © 2016 Universität Heidelberg. All rights reserved. +// + +import Foundation