public void Init() { dialog = gameObject.GetComponent <DialogManager>(); dialogTXT = gameObject.GetComponent <RoomDialog>(); playerAvatar = GameObject.FindGameObjectWithTag("Player"); }
private void Init() { dialog = gameObject.GetComponent <RoomDialog>(); txt1 = dialog.GetPlayertxt(); txt2 = dialog.GetNPCtxt(); rulesTxt = dialog.GetRulseDialog(); rulesNum = 0; SetSpeakerHeads(); }
private async Task AddRoomAsync(CancellationToken token) { try { var room = new RoomStatus(); using (var dialog = new RoomDialog(RoomDialogType.Add, room)) { if (await dialog.ShowAsync() != ContentDialogResult.Primary) { return; } } await room.GetRoomInfoDataAsync(true, token); if (_roomList.Items.Any(x => x.RoomId == room.RoomId)) { using var dialog = new DisposableContentDialog { Title = @"房间已存在", Content = @"不能添加重复房间", PrimaryButtonText = @"确定", DefaultButton = ContentDialogButton.Primary }; await dialog.ShowAsync(); return; } AddRoom(room); } catch (Exception ex) { _logger.LogError(ex, @"添加房间出错"); var message = ex is JsonException ? @"可能是房间号错误" : ex.Message; using var dialog = new DisposableContentDialog { Title = @"添加房间出错", Content = message, PrimaryButtonText = @"确定", DefaultButton = ContentDialogButton.Primary }; await dialog.ShowAsync(); } }