/// <summary> /// Joins channel /// </summary> private void JoinPredefinedChannels() { canvasGroup.interactable = false; if (statusInfoText) { statusInfoText.text = "Finding rooms... Please wait!"; statusInfoText.gameObject.SetActive(true); } MstTimer.WaitForSeconds(0.5f, () => { // Join default chat Mst.Client.Chat.JoinChannel(defaultChannelName, (isSuccess, error) => { canvasGroup.interactable = true; statusInfoText.gameObject.SetActive(false); if (!isSuccess) { Mst.Events.Invoke(MstEventKeys.showOkDialogBox, new OkDialogBoxEventMessage(error, () => { Hide(); ViewsManager.Show("UsernamePickView"); })); return; } // Get my channels Mst.Client.Chat.GetMyChannels((channels, error) => { statusInfoText.gameObject.SetActive(false); if (!string.IsNullOrEmpty(error)) { Mst.Events.Invoke(MstEventKeys.showOkDialogBox, new OkDialogBoxEventMessage(error, () => { Hide(); ViewsManager.Show("UsernamePickView"); })); return; } DrawChannelsList(channels); }); }); }); }
public void Submit() { Mst.Client.Chat.PickUsername(usernameInputField.text, (isSuccess, error) => { if (!isSuccess) { Logs.Error(error); Mst.Events.Invoke(MstEventKeys.showOkDialogBox, new OkDialogBoxEventMessage(error)); return; } // Save username in global params Mst.Options.Set(MstDictKeys.USER_NAME, usernameInputField.text); Hide(); ViewsManager.Show("ChatsView"); }); }