Skip to content

Commit

Permalink
Update Chat.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
milchchan committed Oct 1, 2024
1 parent 6a19bce commit 0a18ceb
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions Apricot/Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1532,14 +1532,33 @@ struct Stage: UIViewRepresentable {
var types = agentView.types
var typeIndex = -1

if self.resource.old != self.resource.new {
agentView.change(path: self.resource.new)
self.resource.old = self.resource.new
}

if let first = agentView.characterViews.first, let name = first.name, let value = self.likes.new[name], self.likes.old != value.count {
withAnimation(.linear(duration: 0.5)) {
self.likes.old = value.count
if let first = agentView.characterViews.first {
if self.resource.old != self.resource.new {
self.resource.old = self.resource.new

await Script.shared.run(name: first.name!, sequences: Script.shared.characters.reduce(into: [], { x, y in
if y.name == first.name {
for sequence in y.sequences {
if sequence.name == "Stop" {
x.append(sequence)
}
}
}
}), words: []) { x in
var y = x

y.append(Sequence(name: nil))

Script.shared.queue.removeAll()

return y
}
}

if let name = first.name, let value = self.likes.new[name], self.likes.old != value.count {
withAnimation(.linear(duration: 0.5)) {
self.likes.old = value.count
}
}
}

Expand Down Expand Up @@ -1710,7 +1729,13 @@ struct Stage: UIViewRepresentable {
}
}
}
}), words: [])
}), words: []) { x in
var y = x

y.append(Sequence(name: String()))

return y
}
}
}

Expand Down Expand Up @@ -1828,6 +1853,10 @@ struct Stage: UIViewRepresentable {
self.update(agent: agent, force: flag)
}

func agentDidStop(_ agent: AgentView) {
agent.change(path: self.parent.resource.new)
}

func agentDidChange(_ agent: AgentView) {
self.parent.attributes.removeAll()
self.parent.attributes.append(contentsOf: agent.attributes)
Expand Down

0 comments on commit 0a18ceb

Please sign in to comment.