public void updateObserver(ChatMenu newChatMenu, int i) { if (i < newChatMenu.GetChatMenuList().Count) { buttonText.text = newChatMenu.GetChild(i).GetButtonText(); } this.newChatMenu = newChatMenu; this.i = i; }
public void notifyObservers(ChatMenu chatMenu) { /** * This is pretty tricky conceptually. We'll have to loop back around to this. * This is coded a little weird. It'll work for now though. */ for (int i = 0; i < observerList.Count; i++) { if (i < chatMenu.GetChatMenuList().Count) { observerList[i].updateObserver(chatMenu, i); } } //This extra statement is separate, It updates the chatbotresponse. //It always has to do this... without any conditions. observerList[observerList.Count - 1].updateObserver(chatMenu, observerList.Count); }