public void SendMessage(string messageText) { var messageAuthor = GetRandomUser(); Message message = new Message(UChatUtils.GenerateId(), messageText, messageAuthor); OnMessageSended(message); }
private void OnAddUserClick() { string name = inputField.text; if (string.IsNullOrEmpty(name)) { return; } string avatarId = String.Empty; var sprite = avatar.GetComponent <Image>().sprite; if (sprite == null) { avatarId = UChatApp.Instance.Avatars.GetRandomSprite().name; } else { avatarId = sprite.name; } var newItem = Instantiate(configUserItemPrefab, scrollContent, false); var user = new User(UChatUtils.GenerateId(), name, avatarId); users.Add(user); newItem.Init(user); newItem.OnToggleClick += OnItemToggleChangedValue; newItem.OnDeleteUserClick += OnUserItemDeleteClick; newItem.gameObject.SetActive(true); newItem.SetToggleGroup(toggleGroup); configUserItems.Add(newItem); if (choosenUser == null) { newItem.SetToggle(true); } ClearInput(); }