From da028f578c1d9a6c00fdd31e383dce1b8b46b642 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:31:43 +0900 Subject: [PATCH 01/18] =?UTF-8?q?=E3=83=9E=E3=83=AB=E3=83=81=E8=BB=A2?= =?UTF-8?q?=E9=80=81=E3=83=95=E3=82=A3=E3=83=AB=E3=82=BF=E3=83=BC=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 113 +++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 0169781..a36135a 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -127,12 +127,51 @@ public class RuleList [Header("ForwardingFilter の設定")] public bool enableForwardingFilterAction = false; public string forwardingFilterAction; + public bool enableForwardingFilterName = false; + public string forwardingFilterName; + public bool enableForwardingFilterPriority = false; + public int forwardingFilterPriority; public RuleList[] forwardingFilter; public bool enableForwardingFilterVersion = false; public string forwardingFilterVersion = ""; public bool enableForwardingFilterMetadata = false; public string forwardingFilterMetadataMessage = ""; + + [System.Serializable] + public class ForwardingFiltersRule + { + public string field; + public string op; + public string[] values; + } + [System.Serializable] + public class ForwardingFiltersRuleList + { + public ForwardingFiltersRule[] data; + } + + [System.Serializable] + public class ForwardingFiltersItem + { + public string action; + public string name; + public int priority; + public ForwardingFiltersRuleList[] rules; + public string version; + public string metadata; + } + + [System.Serializable] + public class ForwardingFiltersList + { + public ForwardingFiltersItem[] filters; + } + + [Header("ForwardingFilters の設定")] + + public ForwardingFiltersList forwardingFilters; + [Header("DataChannel シグナリングの設定")] public bool dataChannelSignaling = false; public int dataChannelSignalingTimeout = 30; @@ -781,6 +820,8 @@ public void OnClickStart() { config.ForwardingFilter = new Sora.ForwardingFilter(); if (enableForwardingFilterAction) config.ForwardingFilter.Action = forwardingFilterAction; + if (enableForwardingFilterName) config.ForwardingFilter.Name = forwardingFilterName; + if (enableForwardingFilterPriority) config.ForwardingFilter.Priority = forwardingFilterPriority; foreach (var rs in forwardingFilter) { var ccrs = new List(); @@ -800,7 +841,79 @@ public void OnClickStart() if (enableForwardingFilterVersion) config.ForwardingFilter.Version = forwardingFilterVersion; if (enableForwardingFilterMetadata) config.ForwardingFilter.Metadata = forwardingFilterMetadataJson; } + if (forwardingFilters != null && + forwardingFilters.filters != null && + forwardingFilters.filters.Length > 0) + { + config.ForwardingFilters = new Sora.ForwardingFilters(); + + foreach (var filter in forwardingFilters.filters) + { + var newFilter = new Sora.ForwardingFilter(); + if (!string.IsNullOrEmpty(filter.action)) + { + newFilter.Action = filter.action; + } + if (!string.IsNullOrEmpty(filter.name)) + { + newFilter.Name = filter.name; + } + if (filter.priority >= 0) + { + newFilter.Priority = filter.priority; + } + + if (filter.rules != null) + { + foreach (var ruleSet in filter.rules) + { + if (ruleSet.data != null) + { + var ruleList = new List(); + foreach (var rule in ruleSet.data) + { + if (!string.IsNullOrEmpty(rule.field) && + !string.IsNullOrEmpty(rule.op) && + rule.values != null) + { + var newRule = new Sora.ForwardingFilter.Rule + { + Field = rule.field, + Operator = rule.op + }; + newRule.Values.AddRange(rule.values); + ruleList.Add(newRule); + } + } + if (ruleList.Count > 0) + { + newFilter.Rules.Add(ruleList); + } + } + } + } + + if (!string.IsNullOrEmpty(filter.version)) + { + newFilter.Version = filter.version; + } + if (!string.IsNullOrEmpty(filter.metadata)) + { + newFilter.Metadata = filter.metadata; + } + + if (newFilter.Action != null || + newFilter.Name != null || + newFilter.Priority.HasValue || + newFilter.Rules.Count > 0 || + newFilter.Version != null || + newFilter.Metadata != null) + { + config.ForwardingFilters.Filters.Add(newFilter); + } + } + } sora.Connect(config); SetState(State.Started); Debug.LogFormat("Sora is Created: signalingUrl={0}, channelId={1}", signalingUrl, channelId); From e2c73d8b46facc607472b940fc6f223d2530a756 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:36:24 +0900 Subject: [PATCH 02/18] =?UTF-8?q?=E5=A4=89=E6=9B=B4=E5=B1=A5=E6=AD=B4?= =?UTF-8?q?=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0a2d7fd..25c1b67 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,13 @@ ## develop +- [CHANGE] forwardingfilters を設定可能にする + - マルチ転送フィルターを設定できるように項目を追加 + - @torikizi +- [UPDATE] forwardingfilter に name と priority を追加 + - 既存の forwardingfilter に name と priority を追加 + - @torikizi + ## sora-unity-sdk-2024.4.0 - [UPDATE] Sora Unity SDK 2024.4.0 にあげる From 3bd9be8d34882178ec927992e5e985cd4b5f16b8 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:55:41 +0900 Subject: [PATCH 03/18] =?UTF-8?q?CHANGE=20=E3=81=A7=E3=81=AF=E3=81=AA?= =?UTF-8?q?=E3=81=8F=20ADD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 25c1b67..f317312 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,10 +11,10 @@ ## develop -- [CHANGE] forwardingfilters を設定可能にする +- [ADD] forwardingfilters を設定可能にする - マルチ転送フィルターを設定できるように項目を追加 - @torikizi -- [UPDATE] forwardingfilter に name と priority を追加 +- [ADD] forwardingfilter に name と priority を追加 - 既存の forwardingfilter に name と priority を追加 - @torikizi From c593ce522945c3c4067cc4afcb9b106989c389ef Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:51:49 +0900 Subject: [PATCH 04/18] =?UTF-8?q?=E8=BB=A2=E9=80=81=E3=83=95=E3=82=A3?= =?UTF-8?q?=E3=83=AB=E3=82=BF=E3=83=BC=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=82=92?= =?UTF-8?q?=E8=A6=8B=E7=9B=B4=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index a36135a..817da74 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -816,7 +816,7 @@ public void OnClickStart() } fixedDataChannelLabels = config.DataChannels.Select(x => x.Label).ToArray(); } - if (forwardingFilter.Length != 0) + if (forwardingFilter != null && forwardingFilter.Length != 0) { config.ForwardingFilter = new Sora.ForwardingFilter(); if (enableForwardingFilterAction) config.ForwardingFilter.Action = forwardingFilterAction; @@ -830,6 +830,7 @@ public void OnClickStart() var ccr = new Sora.ForwardingFilter.Rule(); ccr.Field = r.field; ccr.Operator = r.op; + ccr.Values = new List(); foreach (var v in r.values) { ccr.Values.Add(v); @@ -845,7 +846,7 @@ public void OnClickStart() forwardingFilters.filters != null && forwardingFilters.filters.Length > 0) { - config.ForwardingFilters = new Sora.ForwardingFilters(); + config.ForwardingFilters = new List(); foreach (var filter in forwardingFilters.filters) { @@ -910,7 +911,7 @@ public void OnClickStart() newFilter.Version != null || newFilter.Metadata != null) { - config.ForwardingFilters.Filters.Add(newFilter); + config.ForwardingFilters.Add(newFilter); } } } From 8521ea0e4119349493158c35eccba09825d41883 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Sat, 21 Dec 2024 00:38:40 +0900 Subject: [PATCH 05/18] =?UTF-8?q?=E8=BB=A2=E9=80=81=E3=83=95=E3=82=A3?= =?UTF-8?q?=E3=83=AB=E3=82=BF=E3=83=BC=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E5=85=B1=E9=80=9A=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 41 ++++++------------------ 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 817da74..16b63f8 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -137,40 +137,20 @@ public class RuleList public bool enableForwardingFilterMetadata = false; public string forwardingFilterMetadataMessage = ""; - - [System.Serializable] - public class ForwardingFiltersRule - { - public string field; - public string op; - public string[] values; - } - [System.Serializable] - public class ForwardingFiltersRuleList - { - public ForwardingFiltersRule[] data; - } - [System.Serializable] public class ForwardingFiltersItem { public string action; public string name; public int priority; - public ForwardingFiltersRuleList[] rules; + public RuleList[] rules; public string version; public string metadata; } - [System.Serializable] - public class ForwardingFiltersList - { - public ForwardingFiltersItem[] filters; - } - [Header("ForwardingFilters の設定")] - public ForwardingFiltersList forwardingFilters; + public ForwardingFiltersItem[] forwardingFilters; [Header("DataChannel シグナリングの設定")] public bool dataChannelSignaling = false; @@ -842,13 +822,11 @@ public void OnClickStart() if (enableForwardingFilterVersion) config.ForwardingFilter.Version = forwardingFilterVersion; if (enableForwardingFilterMetadata) config.ForwardingFilter.Metadata = forwardingFilterMetadataJson; } - if (forwardingFilters != null && - forwardingFilters.filters != null && - forwardingFilters.filters.Length > 0) + if (forwardingFilters != null) { config.ForwardingFilters = new List(); - foreach (var filter in forwardingFilters.filters) + foreach (var filter in forwardingFilters) { var newFilter = new Sora.ForwardingFilter(); @@ -895,13 +873,14 @@ public void OnClickStart() } } - if (!string.IsNullOrEmpty(filter.version)) - { - newFilter.Version = filter.version; - } + newFilter.Version = filter.version; if (!string.IsNullOrEmpty(filter.metadata)) { - newFilter.Metadata = filter.metadata; + var ffm = new ForwardingFilterMetadata() + { + forwarding_filter_metadata = filter.metadata + }; + newFilter.Metadata = JsonUtility.ToJson(ffm); } if (newFilter.Action != null || From 1c5cdd887496320891418a266b98c14ac6245c57 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Mon, 23 Dec 2024 01:12:15 +0900 Subject: [PATCH 06/18] =?UTF-8?q?=E3=81=95=E3=82=89=E3=81=AB=E5=85=B1?= =?UTF-8?q?=E9=80=9A=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 154 ++++++++++------------- 1 file changed, 65 insertions(+), 89 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 16b63f8..c576f36 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -123,34 +123,27 @@ public class RuleList { public Rule[] data; } - - [Header("ForwardingFilter の設定")] - public bool enableForwardingFilterAction = false; - public string forwardingFilterAction; - public bool enableForwardingFilterName = false; - public string forwardingFilterName; - public bool enableForwardingFilterPriority = false; - public int forwardingFilterPriority; - public RuleList[] forwardingFilter; - public bool enableForwardingFilterVersion = false; - public string forwardingFilterVersion = ""; - public bool enableForwardingFilterMetadata = false; - public string forwardingFilterMetadataMessage = ""; - [System.Serializable] - public class ForwardingFiltersItem + public class ForwardingFilterSettings { + public bool enableAction = false; public string action; + public bool enableName = false; public string name; + public bool enablePriority = false; public int priority; public RuleList[] rules; - public string version; - public string metadata; + public bool enableVersion = false; + public string version = ""; + public bool enableMetadata = false; + public string metadata = ""; } - [Header("ForwardingFilters の設定")] + [Header("ForwardingFilter の設定")] + public ForwardingFilterSettings forwardingFilterSettings; - public ForwardingFiltersItem[] forwardingFilters; + [Header("ForwardingFilters の設定")] + public ForwardingFilterSettings[] forwardingFilters; [Header("DataChannel シグナリングの設定")] public bool dataChannelSignaling = false; @@ -619,7 +612,7 @@ class VideoH264Params [Serializable] class ForwardingFilterMetadata { - public string forwarding_filter_metadata; + public string metadata; } public void OnClickStart() @@ -698,13 +691,13 @@ public void OnClickStart() } // enableForwardingFilterMetadata が true の場合はメタデータを設定する string forwardingFilterMetadataJson = ""; - if (enableForwardingFilterMetadata) + if (forwardingFilterSettings.enableMetadata) { - var ffm = new ForwardingFilterMetadata() + var ffMetadata = new ForwardingFilterMetadata() { - forwarding_filter_metadata = forwardingFilterMetadataMessage + metadata = forwardingFilterSettings.metadata }; - forwardingFilterMetadataJson = JsonUtility.ToJson(ffm); + forwardingFilterMetadataJson = JsonUtility.ToJson(ffMetadata); } InitSora(); @@ -796,33 +789,40 @@ public void OnClickStart() } fixedDataChannelLabels = config.DataChannels.Select(x => x.Label).ToArray(); } - if (forwardingFilter != null && forwardingFilter.Length != 0) + if (forwardingFilterSettings != null) { config.ForwardingFilter = new Sora.ForwardingFilter(); - if (enableForwardingFilterAction) config.ForwardingFilter.Action = forwardingFilterAction; - if (enableForwardingFilterName) config.ForwardingFilter.Name = forwardingFilterName; - if (enableForwardingFilterPriority) config.ForwardingFilter.Priority = forwardingFilterPriority; - foreach (var rs in forwardingFilter) + if (forwardingFilterSettings.enableAction) config.ForwardingFilter.Action = forwardingFilterSettings.action; + if (forwardingFilterSettings.enableName) config.ForwardingFilter.Name = forwardingFilterSettings.name; + if (forwardingFilterSettings.enablePriority) config.ForwardingFilter.Priority = forwardingFilterSettings.priority; + + if (forwardingFilterSettings.rules != null) { - var ccrs = new List(); - foreach (var r in rs.data) + foreach (var ruleSet in forwardingFilterSettings.rules) { - var ccr = new Sora.ForwardingFilter.Rule(); - ccr.Field = r.field; - ccr.Operator = r.op; - ccr.Values = new List(); - foreach (var v in r.values) + if (ruleSet.data != null) { - ccr.Values.Add(v); + var ruleList = new List(); + foreach (var rule in ruleSet.data) + { + var newRule = new Sora.ForwardingFilter.Rule + { + Field = rule.field, + Operator = rule.op + }; + newRule.Values.AddRange(rule.values); + ruleList.Add(newRule); + } + config.ForwardingFilter.Rules.Add(ruleList); } - ccrs.Add(ccr); } - config.ForwardingFilter.Rules.Add(ccrs); } - if (enableForwardingFilterVersion) config.ForwardingFilter.Version = forwardingFilterVersion; - if (enableForwardingFilterMetadata) config.ForwardingFilter.Metadata = forwardingFilterMetadataJson; + + if (forwardingFilterSettings.enableVersion) config.ForwardingFilter.Version = forwardingFilterSettings.version; + if (forwardingFilterSettings.enableMetadata) config.ForwardingFilter.Metadata = forwardingFilterMetadataJson; } - if (forwardingFilters != null) + + if (forwardingFilters != null && forwardingFilters.Length > 0) { config.ForwardingFilters = new List(); @@ -830,68 +830,44 @@ public void OnClickStart() { var newFilter = new Sora.ForwardingFilter(); - if (!string.IsNullOrEmpty(filter.action)) - { + if (filter.enableAction) newFilter.Action = filter.action; - } - if (!string.IsNullOrEmpty(filter.name)) - { + if (filter.enableName) newFilter.Name = filter.name; - } - if (filter.priority >= 0) - { + if (filter.enablePriority) newFilter.Priority = filter.priority; - } - if (filter.rules != null) + if (filter.rules == null) return; + + foreach (var rule in filter.rules) { - foreach (var ruleSet in filter.rules) + if (rule.data == null) continue; + + var newRules = new List(); + foreach (var ruleData in rule.data) { - if (ruleSet.data != null) + var newRule = new Sora.ForwardingFilter.Rule { - var ruleList = new List(); - foreach (var rule in ruleSet.data) - { - if (!string.IsNullOrEmpty(rule.field) && - !string.IsNullOrEmpty(rule.op) && - rule.values != null) - { - var newRule = new Sora.ForwardingFilter.Rule - { - Field = rule.field, - Operator = rule.op - }; - newRule.Values.AddRange(rule.values); - ruleList.Add(newRule); - } - } - if (ruleList.Count > 0) - { - newFilter.Rules.Add(ruleList); - } - } + Field = ruleData.field, + Operator = ruleData.op + }; + newRule.Values.AddRange(ruleData.values); + newRules.Add(newRule); } + newFilter.Rules.Add(newRules); } - newFilter.Version = filter.version; - if (!string.IsNullOrEmpty(filter.metadata)) + if (filter.enableVersion) newFilter.Version = filter.version; + if (filter.enableMetadata) { - var ffm = new ForwardingFilterMetadata() + var ffMetadata = new ForwardingFilterMetadata() { - forwarding_filter_metadata = filter.metadata + metadata = filter.metadata }; - newFilter.Metadata = JsonUtility.ToJson(ffm); + newFilter.Metadata = JsonUtility.ToJson(ffMetadata); } - if (newFilter.Action != null || - newFilter.Name != null || - newFilter.Priority.HasValue || - newFilter.Rules.Count > 0 || - newFilter.Version != null || - newFilter.Metadata != null) - { - config.ForwardingFilters.Add(newFilter); - } + config.ForwardingFilters.Add(newFilter); } } sora.Connect(config); From 91b1e92932c6d7a9b08f6f2d295a7d271ec72633 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Mon, 23 Dec 2024 23:41:22 +0900 Subject: [PATCH 07/18] =?UTF-8?q?metadata=20=E3=82=92=20JSON=20=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B=E5=A0=B4=E6=89=80=E3=82=92=E5=85=B1=E9=80=9A?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index c576f36..0a4beac 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -615,6 +615,18 @@ class ForwardingFilterMetadata public string metadata; } + static class ForwardingFilterMetadataHelper + { + public static string ConvertMetadataToJson(string metadata) + { + var ffMetadata = new ForwardingFilterMetadata() + { + metadata = metadata + }; + return JsonUtility.ToJson(ffMetadata); + } + } + public void OnClickStart() { @@ -689,16 +701,6 @@ public void OnClickStart() }; videoH264ParamsJson = JsonUtility.ToJson(h264Params); } - // enableForwardingFilterMetadata が true の場合はメタデータを設定する - string forwardingFilterMetadataJson = ""; - if (forwardingFilterSettings.enableMetadata) - { - var ffMetadata = new ForwardingFilterMetadata() - { - metadata = forwardingFilterSettings.metadata - }; - forwardingFilterMetadataJson = JsonUtility.ToJson(ffMetadata); - } InitSora(); @@ -819,7 +821,10 @@ public void OnClickStart() } if (forwardingFilterSettings.enableVersion) config.ForwardingFilter.Version = forwardingFilterSettings.version; - if (forwardingFilterSettings.enableMetadata) config.ForwardingFilter.Metadata = forwardingFilterMetadataJson; + if (forwardingFilterSettings.enableMetadata) + { + config.ForwardingFilter.Metadata = ForwardingFilterMetadataHelper.ConvertMetadataToJson(forwardingFilterSettings.metadata); + } } if (forwardingFilters != null && forwardingFilters.Length > 0) @@ -860,13 +865,8 @@ public void OnClickStart() if (filter.enableVersion) newFilter.Version = filter.version; if (filter.enableMetadata) { - var ffMetadata = new ForwardingFilterMetadata() - { - metadata = filter.metadata - }; - newFilter.Metadata = JsonUtility.ToJson(ffMetadata); + newFilter.Metadata = ForwardingFilterMetadataHelper.ConvertMetadataToJson(filter.metadata); } - config.ForwardingFilters.Add(newFilter); } } From 45b09efbfe4832d85f0c3dd73f1e7365baec7bd1 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 00:07:06 +0900 Subject: [PATCH 08/18] =?UTF-8?q?=E6=95=B4=E3=81=88=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 0a4beac..e7e3901 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -835,12 +835,9 @@ public void OnClickStart() { var newFilter = new Sora.ForwardingFilter(); - if (filter.enableAction) - newFilter.Action = filter.action; - if (filter.enableName) - newFilter.Name = filter.name; - if (filter.enablePriority) - newFilter.Priority = filter.priority; + if (filter.enableAction) newFilter.Action = filter.action; + if (filter.enableName) newFilter.Name = filter.name; + if (filter.enablePriority) newFilter.Priority = filter.priority; if (filter.rules == null) return; From 53e1d6efcab49f3fb002a7a1036c9c15b071ad98 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 00:51:29 +0900 Subject: [PATCH 09/18] =?UTF-8?q?=E5=85=B1=E9=80=9A=E3=81=AE=E3=83=98?= =?UTF-8?q?=E3=83=AB=E3=83=91=E3=83=BC=E3=82=AF=E3=83=A9=E3=82=B9=E3=82=92?= =?UTF-8?q?=E4=BD=9C=E3=81=A3=E3=81=A6=E8=A8=AD=E5=AE=9A=E6=99=82=E3=81=AE?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92=E3=82=B9=E3=83=AA=E3=83=A0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 116 +++++++++++------------ 1 file changed, 53 insertions(+), 63 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index e7e3901..5308c47 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -138,6 +138,55 @@ public class ForwardingFilterSettings public bool enableMetadata = false; public string metadata = ""; } + public static class ForwardingFilterHelper + { + private static void ConfigureFilter(Sora.ForwardingFilter filter, ForwardingFilterSettings settings) + { + if (settings.enableAction) filter.Action = settings.action; + if (settings.enableName) filter.Name = settings.name; + if (settings.enablePriority) filter.Priority = settings.priority; + + if (settings.rules != null) + { + foreach (var ruleSet in settings.rules) + { + if (ruleSet?.data == null) continue; + + var ruleList = new List(); + foreach (var rule in ruleSet.data) + { + var newRule = new Sora.ForwardingFilter.Rule + { + Field = rule.field, + Operator = rule.op + }; + newRule.Values.AddRange(rule.values); + ruleList.Add(newRule); + } + + if (ruleList.Any()) + { + filter.Rules.Add(ruleList); + } + } + } + + if (settings.enableVersion) filter.Version = settings.version; + if (settings.enableMetadata) + { + filter.Metadata = ForwardingFilterMetadataHelper.ConvertMetadataToJson(settings.metadata); + } + } + + public static Sora.ForwardingFilter CreateFilter(ForwardingFilterSettings settings) + { + if (settings == null) return null; + + var filter = new Sora.ForwardingFilter(); + ConfigureFilter(filter, settings); + return filter; + } + } [Header("ForwardingFilter の設定")] public ForwardingFilterSettings forwardingFilterSettings; @@ -793,78 +842,19 @@ public void OnClickStart() } if (forwardingFilterSettings != null) { - config.ForwardingFilter = new Sora.ForwardingFilter(); - if (forwardingFilterSettings.enableAction) config.ForwardingFilter.Action = forwardingFilterSettings.action; - if (forwardingFilterSettings.enableName) config.ForwardingFilter.Name = forwardingFilterSettings.name; - if (forwardingFilterSettings.enablePriority) config.ForwardingFilter.Priority = forwardingFilterSettings.priority; - - if (forwardingFilterSettings.rules != null) - { - foreach (var ruleSet in forwardingFilterSettings.rules) - { - if (ruleSet.data != null) - { - var ruleList = new List(); - foreach (var rule in ruleSet.data) - { - var newRule = new Sora.ForwardingFilter.Rule - { - Field = rule.field, - Operator = rule.op - }; - newRule.Values.AddRange(rule.values); - ruleList.Add(newRule); - } - config.ForwardingFilter.Rules.Add(ruleList); - } - } - } - - if (forwardingFilterSettings.enableVersion) config.ForwardingFilter.Version = forwardingFilterSettings.version; - if (forwardingFilterSettings.enableMetadata) - { - config.ForwardingFilter.Metadata = ForwardingFilterMetadataHelper.ConvertMetadataToJson(forwardingFilterSettings.metadata); - } + config.ForwardingFilter = ForwardingFilterHelper.CreateFilter(forwardingFilterSettings); } - if (forwardingFilters != null && forwardingFilters.Length > 0) { config.ForwardingFilters = new List(); foreach (var filter in forwardingFilters) { - var newFilter = new Sora.ForwardingFilter(); - - if (filter.enableAction) newFilter.Action = filter.action; - if (filter.enableName) newFilter.Name = filter.name; - if (filter.enablePriority) newFilter.Priority = filter.priority; - - if (filter.rules == null) return; - - foreach (var rule in filter.rules) - { - if (rule.data == null) continue; - - var newRules = new List(); - foreach (var ruleData in rule.data) - { - var newRule = new Sora.ForwardingFilter.Rule - { - Field = ruleData.field, - Operator = ruleData.op - }; - newRule.Values.AddRange(ruleData.values); - newRules.Add(newRule); - } - newFilter.Rules.Add(newRules); - } - - if (filter.enableVersion) newFilter.Version = filter.version; - if (filter.enableMetadata) + var newFilter = ForwardingFilterHelper.CreateFilter(filter); + if (newFilter != null) { - newFilter.Metadata = ForwardingFilterMetadataHelper.ConvertMetadataToJson(filter.metadata); + config.ForwardingFilters.Add(newFilter); } - config.ForwardingFilters.Add(newFilter); } } sora.Connect(config); From f12b9e00b5859f4294d1184b0060e8dd29e9a248 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 11:09:04 +0900 Subject: [PATCH 10/18] =?UTF-8?q?=E3=83=98=E3=83=AB=E3=83=91=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E5=85=A8=E3=81=A6=E3=81=BE=E3=81=A8=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 35 +++++++++++------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 5308c47..1526fe2 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -140,6 +140,11 @@ public class ForwardingFilterSettings } public static class ForwardingFilterHelper { + [Serializable] + private class ForwardingFilterMetadata + { + public string metadata; + } private static void ConfigureFilter(Sora.ForwardingFilter filter, ForwardingFilterSettings settings) { if (settings.enableAction) filter.Action = settings.action; @@ -177,7 +182,17 @@ private static void ConfigureFilter(Sora.ForwardingFilter filter, ForwardingFilt filter.Metadata = ForwardingFilterMetadataHelper.ConvertMetadataToJson(settings.metadata); } } - + private static class ForwardingFilterMetadataHelper + { + public static string ConvertMetadataToJson(string metadata) + { + var ffMetadata = new ForwardingFilterMetadata() + { + metadata = metadata + }; + return JsonUtility.ToJson(ffMetadata); + } + } public static Sora.ForwardingFilter CreateFilter(ForwardingFilterSettings settings) { if (settings == null) return null; @@ -658,24 +673,6 @@ class VideoH264Params public string profile_level_id; } - [Serializable] - class ForwardingFilterMetadata - { - public string metadata; - } - - static class ForwardingFilterMetadataHelper - { - public static string ConvertMetadataToJson(string metadata) - { - var ffMetadata = new ForwardingFilterMetadata() - { - metadata = metadata - }; - return JsonUtility.ToJson(ffMetadata); - } - } - public void OnClickStart() { From b98f63fc7787428e5662e3d20fe2b7f1c4076cce Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 12:44:55 +0900 Subject: [PATCH 11/18] =?UTF-8?q?=E9=9D=9E=E6=8E=A8=E5=A5=A8=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 1526fe2..8568232 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -204,7 +204,8 @@ public static Sora.ForwardingFilter CreateFilter(ForwardingFilterSettings settin } [Header("ForwardingFilter の設定")] - public ForwardingFilterSettings forwardingFilterSettings; + [System.Obsolete("forwardingFilter は非推奨です。代わりに forwardingFilters を使用してください。")] + public ForwardingFilterSettings forwardingFilter; [Header("ForwardingFilters の設定")] public ForwardingFilterSettings[] forwardingFilters; @@ -837,9 +838,9 @@ public void OnClickStart() } fixedDataChannelLabels = config.DataChannels.Select(x => x.Label).ToArray(); } - if (forwardingFilterSettings != null) + if (forwardingFilter != null) { - config.ForwardingFilter = ForwardingFilterHelper.CreateFilter(forwardingFilterSettings); + config.ForwardingFilter = ForwardingFilterHelper.CreateFilter(forwardingFilter); } if (forwardingFilters != null && forwardingFilters.Length > 0) { From 8d099160eecaf0d84b0b5c47c6726ba2aef96acf Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 14:16:05 +0900 Subject: [PATCH 12/18] =?UTF-8?q?Settings=20=E3=81=8C=E3=81=A4=E3=81=84?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=82=8B=E5=BF=85=E8=A6=81=E3=81=AF=E3=81=AA?= =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 8568232..46e06af 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -124,7 +124,7 @@ public class RuleList public Rule[] data; } [System.Serializable] - public class ForwardingFilterSettings + public class ForwardingFilter { public bool enableAction = false; public string action; @@ -145,7 +145,7 @@ private class ForwardingFilterMetadata { public string metadata; } - private static void ConfigureFilter(Sora.ForwardingFilter filter, ForwardingFilterSettings settings) + private static void ConfigureFilter(Sora.ForwardingFilter filter, ForwardingFilter settings) { if (settings.enableAction) filter.Action = settings.action; if (settings.enableName) filter.Name = settings.name; @@ -193,7 +193,7 @@ public static string ConvertMetadataToJson(string metadata) return JsonUtility.ToJson(ffMetadata); } } - public static Sora.ForwardingFilter CreateFilter(ForwardingFilterSettings settings) + public static Sora.ForwardingFilter CreateFilter(ForwardingFilter settings) { if (settings == null) return null; @@ -205,10 +205,10 @@ public static Sora.ForwardingFilter CreateFilter(ForwardingFilterSettings settin [Header("ForwardingFilter の設定")] [System.Obsolete("forwardingFilter は非推奨です。代わりに forwardingFilters を使用してください。")] - public ForwardingFilterSettings forwardingFilter; + public ForwardingFilter forwardingFilter; [Header("ForwardingFilters の設定")] - public ForwardingFilterSettings[] forwardingFilters; + public ForwardingFilter[] forwardingFilters; [Header("DataChannel シグナリングの設定")] public bool dataChannelSignaling = false; From a181a492bc9953ed842967e5303d1c688fd487a7 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 15:33:44 +0900 Subject: [PATCH 13/18] =?UTF-8?q?=E3=83=98=E3=83=AB=E3=83=91=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=81=BE=E3=81=A8=E3=82=81=E3=82=8B=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E3=81=AF=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 94 ++++++++++-------------- 1 file changed, 40 insertions(+), 54 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 46e06af..f0fa175 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -138,76 +138,62 @@ public class ForwardingFilter public bool enableMetadata = false; public string metadata = ""; } - public static class ForwardingFilterHelper + + [Serializable] + private class ForwardingFilterMetadata { - [Serializable] - private class ForwardingFilterMetadata - { - public string metadata; - } - private static void ConfigureFilter(Sora.ForwardingFilter filter, ForwardingFilter settings) - { - if (settings.enableAction) filter.Action = settings.action; - if (settings.enableName) filter.Name = settings.name; - if (settings.enablePriority) filter.Priority = settings.priority; + public string metadata; + } + public static Sora.ForwardingFilter ConvertForwardingFilter(ForwardingFilter forwardingFilter) + { + var filter = new Sora.ForwardingFilter(); - if (settings.rules != null) + if (forwardingFilter.enableAction) filter.Action = forwardingFilter.action; + if (forwardingFilter.enableName) filter.Name = forwardingFilter.name; + if (forwardingFilter.enablePriority) filter.Priority = forwardingFilter.priority; + + if (forwardingFilter.rules != null) + { + foreach (var ruleListData in forwardingFilter.rules) { - foreach (var ruleSet in settings.rules) + var ruleList = new List(); + foreach (var rule in ruleListData.data) { - if (ruleSet?.data == null) continue; - - var ruleList = new List(); - foreach (var rule in ruleSet.data) + var newRule = new Sora.ForwardingFilter.Rule { - var newRule = new Sora.ForwardingFilter.Rule - { - Field = rule.field, - Operator = rule.op - }; - newRule.Values.AddRange(rule.values); - ruleList.Add(newRule); - } - - if (ruleList.Any()) - { - filter.Rules.Add(ruleList); - } + Field = rule.field, + Operator = rule.op + }; + newRule.Values.AddRange(rule.values); + ruleList.Add(newRule); } - } - if (settings.enableVersion) filter.Version = settings.version; - if (settings.enableMetadata) - { - filter.Metadata = ForwardingFilterMetadataHelper.ConvertMetadataToJson(settings.metadata); + if (ruleList.Any()) + { + filter.Rules.Add(ruleList); + } } } - private static class ForwardingFilterMetadataHelper + + if (forwardingFilter.enableVersion) filter.Version = forwardingFilter.version; + if (forwardingFilter.enableMetadata) { - public static string ConvertMetadataToJson(string metadata) + filter.Metadata = JsonUtility.ToJson(new ForwardingFilterMetadata() { - var ffMetadata = new ForwardingFilterMetadata() - { - metadata = metadata - }; - return JsonUtility.ToJson(ffMetadata); - } + metadata = forwardingFilter.metadata + }); } - public static Sora.ForwardingFilter CreateFilter(ForwardingFilter settings) - { - if (settings == null) return null; - var filter = new Sora.ForwardingFilter(); - ConfigureFilter(filter, settings); - return filter; - } + return filter; } [Header("ForwardingFilter の設定")] [System.Obsolete("forwardingFilter は非推奨です。代わりに forwardingFilters を使用してください。")] + public bool enableForwardingFilter = false; public ForwardingFilter forwardingFilter; [Header("ForwardingFilters の設定")] + public bool enableForwardingFilters = false; public ForwardingFilter[] forwardingFilters; [Header("DataChannel シグナリングの設定")] @@ -838,17 +824,17 @@ public void OnClickStart() } fixedDataChannelLabels = config.DataChannels.Select(x => x.Label).ToArray(); } - if (forwardingFilter != null) + if (enableForwardingFilter) { - config.ForwardingFilter = ForwardingFilterHelper.CreateFilter(forwardingFilter); + config.ForwardingFilter = ConvertForwardingFilter(forwardingFilter); } - if (forwardingFilters != null && forwardingFilters.Length > 0) + if (enableForwardingFilters) { config.ForwardingFilters = new List(); foreach (var filter in forwardingFilters) { - var newFilter = ForwardingFilterHelper.CreateFilter(filter); + var newFilter = ConvertForwardingFilter(filter); if (newFilter != null) { config.ForwardingFilters.Add(newFilter); From ffd5c588754c784cb659a26422ddaca43630f219 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:08:23 +0900 Subject: [PATCH 14/18] =?UTF-8?q?ForwardingFilter=20=E3=82=AF=E3=83=A9?= =?UTF-8?q?=E3=82=B9=E3=81=AE=20metadata=20=E3=81=AF=20string=20=E3=81=A7?= =?UTF-8?q?=E3=81=AF=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index f0fa175..010073c 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -136,11 +136,11 @@ public class ForwardingFilter public bool enableVersion = false; public string version = ""; public bool enableMetadata = false; - public string metadata = ""; + public ForwardingFilterMetadata metadata = new ForwardingFilterMetadata(); } [Serializable] - private class ForwardingFilterMetadata + public class ForwardingFilterMetadata { public string metadata; } @@ -178,10 +178,7 @@ public static Sora.ForwardingFilter ConvertForwardingFilter(ForwardingFilter for if (forwardingFilter.enableVersion) filter.Version = forwardingFilter.version; if (forwardingFilter.enableMetadata) { - filter.Metadata = JsonUtility.ToJson(new ForwardingFilterMetadata() - { - metadata = forwardingFilter.metadata - }); + filter.Metadata = JsonUtility.ToJson(forwardingFilter.metadata); } return filter; From c0ac41c7f45b08274eb9f33436d7d9f8ff497b02 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:10:11 +0900 Subject: [PATCH 15/18] =?UTF-8?q?=E5=88=9D=E6=9C=9F=E5=80=A4=E3=81=84?= =?UTF-8?q?=E3=82=89=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 010073c..a0727e2 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -136,7 +136,7 @@ public class ForwardingFilter public bool enableVersion = false; public string version = ""; public bool enableMetadata = false; - public ForwardingFilterMetadata metadata = new ForwardingFilterMetadata(); + public ForwardingFilterMetadata metadata; } [Serializable] From a67013682fa866cf036c3a48c1a2288d4ce9acd8 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:12:30 +0900 Subject: [PATCH 16/18] =?UTF-8?q?CHANGES=20=E3=81=AE=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E8=A6=8B=E7=9B=B4=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index f317312..62ea1db 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,7 +15,6 @@ - マルチ転送フィルターを設定できるように項目を追加 - @torikizi - [ADD] forwardingfilter に name と priority を追加 - - 既存の forwardingfilter に name と priority を追加 - @torikizi ## sora-unity-sdk-2024.4.0 From d0394af99f766304ccf3c7aeb526e3d313a7ec78 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:29:36 +0900 Subject: [PATCH 17/18] =?UTF-8?q?Inspector=20=E3=81=A7=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=B1=E3=83=BC=E3=82=B9=E3=81=AE=20null?= =?UTF-8?q?=20=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=82=92=E3=82=84?= =?UTF-8?q?=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 41 +++++++++++------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index a0727e2..358fb12 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -144,7 +144,7 @@ public class ForwardingFilterMetadata { public string metadata; } - public static Sora.ForwardingFilter ConvertForwardingFilter(ForwardingFilter forwardingFilter) + public static Sora.ForwardingFilter ConvertToSoraForwardingFilter(ForwardingFilter forwardingFilter) { var filter = new Sora.ForwardingFilter(); @@ -152,26 +152,23 @@ public static Sora.ForwardingFilter ConvertForwardingFilter(ForwardingFilter for if (forwardingFilter.enableName) filter.Name = forwardingFilter.name; if (forwardingFilter.enablePriority) filter.Priority = forwardingFilter.priority; - if (forwardingFilter.rules != null) + foreach (var ruleListData in forwardingFilter.rules) { - foreach (var ruleListData in forwardingFilter.rules) + var ruleList = new List(); + foreach (var rule in ruleListData.data) { - var ruleList = new List(); - foreach (var rule in ruleListData.data) + var newRule = new Sora.ForwardingFilter.Rule { - var newRule = new Sora.ForwardingFilter.Rule - { - Field = rule.field, - Operator = rule.op - }; - newRule.Values.AddRange(rule.values); - ruleList.Add(newRule); - } + Field = rule.field, + Operator = rule.op + }; + newRule.Values.AddRange(rule.values); + ruleList.Add(newRule); + } - if (ruleList.Any()) - { - filter.Rules.Add(ruleList); - } + if (ruleList.Any()) + { + filter.Rules.Add(ruleList); } } @@ -187,6 +184,7 @@ public static Sora.ForwardingFilter ConvertForwardingFilter(ForwardingFilter for [Header("ForwardingFilter の設定")] [System.Obsolete("forwardingFilter は非推奨です。代わりに forwardingFilters を使用してください。")] public bool enableForwardingFilter = false; + [System.Obsolete("forwardingFilter は非推奨です。代わりに forwardingFilters を使用してください。")] public ForwardingFilter forwardingFilter; [Header("ForwardingFilters の設定")] @@ -823,7 +821,7 @@ public void OnClickStart() } if (enableForwardingFilter) { - config.ForwardingFilter = ConvertForwardingFilter(forwardingFilter); + config.ForwardingFilter = ConvertToSoraForwardingFilter(forwardingFilter); } if (enableForwardingFilters) { @@ -831,11 +829,8 @@ public void OnClickStart() foreach (var filter in forwardingFilters) { - var newFilter = ConvertForwardingFilter(filter); - if (newFilter != null) - { - config.ForwardingFilters.Add(newFilter); - } + var newFilter = ConvertToSoraForwardingFilter(filter); + config.ForwardingFilters.Add(newFilter); } } sora.Connect(config); From 7ebc714f4408cecace95f88b0e4cd36e07cb2984 Mon Sep 17 00:00:00 2001 From: torikizi <51085972+torikizi@users.noreply.github.com> Date: Tue, 24 Dec 2024 17:04:08 +0900 Subject: [PATCH 18/18] =?UTF-8?q?rules=20=E3=81=A7=E3=81=AF=E3=81=AA?= =?UTF-8?q?=E3=81=8F=20ruleLists=20=E3=81=AB=E5=90=8D=E5=89=8D=E3=82=92?= =?UTF-8?q?=E5=A4=89=E3=81=88=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoraUnitySdkSamples/Assets/SoraSample.cs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/SoraUnitySdkSamples/Assets/SoraSample.cs b/SoraUnitySdkSamples/Assets/SoraSample.cs index 358fb12..acbf772 100644 --- a/SoraUnitySdkSamples/Assets/SoraSample.cs +++ b/SoraUnitySdkSamples/Assets/SoraSample.cs @@ -132,7 +132,7 @@ public class ForwardingFilter public string name; public bool enablePriority = false; public int priority; - public RuleList[] rules; + public RuleList[] ruleLists; public bool enableVersion = false; public string version = ""; public bool enableMetadata = false; @@ -152,7 +152,7 @@ public static Sora.ForwardingFilter ConvertToSoraForwardingFilter(ForwardingFilt if (forwardingFilter.enableName) filter.Name = forwardingFilter.name; if (forwardingFilter.enablePriority) filter.Priority = forwardingFilter.priority; - foreach (var ruleListData in forwardingFilter.rules) + foreach (var ruleListData in forwardingFilter.ruleLists) { var ruleList = new List(); foreach (var rule in ruleListData.data) @@ -165,18 +165,11 @@ public static Sora.ForwardingFilter ConvertToSoraForwardingFilter(ForwardingFilt newRule.Values.AddRange(rule.values); ruleList.Add(newRule); } - - if (ruleList.Any()) - { - filter.Rules.Add(ruleList); - } + filter.Rules.Add(ruleList); } if (forwardingFilter.enableVersion) filter.Version = forwardingFilter.version; - if (forwardingFilter.enableMetadata) - { - filter.Metadata = JsonUtility.ToJson(forwardingFilter.metadata); - } + if (forwardingFilter.enableMetadata) filter.Metadata = JsonUtility.ToJson(forwardingFilter.metadata); return filter; }