Skip to content

Commit

Permalink
Merge pull request #25 from TORISOUP/change_new_nicolive
Browse files Browse the repository at this point in the history
ニコ生の新仕様(2024/8/5~)に対応
  • Loading branch information
TORISOUP authored Aug 11, 2024
2 parents 6d0a3c5 + 333b9ea commit fbc7762
Show file tree
Hide file tree
Showing 27 changed files with 3,950 additions and 8,063 deletions.
10,901 changes: 3,835 additions & 7,066 deletions Assets/TORISOUP/NicoliveClient/Example/Console/NicoliveSampleScene.unity

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Linq;
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
using Cysharp.Threading.Tasks;
using R3;
using UnityEngine;
using UnityEngine.UI;
Expand All @@ -16,35 +13,13 @@ public class ProgramIdPanel : MonoBehaviour
[SerializeField] private NicoliveSampleManager _manager;

[SerializeField] private InputField _programIdInputField;
[SerializeField] private Button _getCurrentProgramIdButton;
[SerializeField] private Button _setProgramIdButton;
[SerializeField] private Text _currentProgramIdText;

void Start()
{
var ct = this.GetCancellationTokenOnDestroy();
_getCurrentProgramIdButton.OnClickAsAsyncEnumerable(ct)
.ForEachAwaitWithCancellationAsync(async (_, c) =>
{
try
{
//取得したIDは一旦UIに反映
var programs = await _manager.GetCurrentProgramIdAsync(c);
if (programs.Length == 0)
{
Debug.LogError("番組IDが取得できませんでした");
_programIdInputField.text = "";
return;
}
_programIdInputField.text = programs.Last();
}
catch (Exception e) when (e is not OperationCanceledException)
{
Debug.LogError(e);
}
}, cancellationToken: ct)
.Forget();


//設定ボタンが押されたらUIの値を反映する
_setProgramIdButton.OnClickAsObservable()
.Subscribe(_ => _manager.SetTargetProgramId(_programIdInputField.text))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@ void Start()
builder.Append("room count:" + programInfo.Rooms.Length + "\n");
builder.Append("status:" + programInfo.Status.ToString() + "\n");
_programInfoLabel.text = builder.ToString();

//部屋一覧を登録する
foreach (var room in programInfo.Rooms)
{
if (!_manager.CurrentRooms.ContainsKey(room.Id))
{
_manager.CurrentRooms[room.Id] = room;
}
_manager.CurrentRooms.TryAdd(room.ViewUri, room);
}
}
catch (Exception e) when (e is not OperationCanceledException)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit fbc7762

Please sign in to comment.