using UnityEngine; using UnityEngine.UI; using UnityEngine.Serialization; using Agora.Rtc; using Agora.Util; using Logger = Agora.Util.Logger; namespace Agora_RTC_Plugin.API_Example.Examples.Advanced.SetBeautyEffectOptions { public class SetBeautyEffectOptions : MonoBehaviour { [FormerlySerializedAs("appIdInput")] [SerializeField] private AppIdInput _appIdInput; [Header("_____________Basic Configuration_____________")] [FormerlySerializedAs("APP_ID")] [SerializeField] private string _appID = ""; [FormerlySerializedAs("TOKEN")] [SerializeField] private string _token = ""; [FormerlySerializedAs("CHANNEL_NAME")] [SerializeField] private string _channelName = ""; public Text LogText; internal Logger Log; internal IRtcEngine RtcEngine = null; public Text TextLighteningLevel; public Text TextSmoothnessLevel; public Text TextRednessLevel; public Text TextSharpnessLevel; public Slider SliderLighteningLevel; public Slider SliderSmoothnessLevel; public Slider SliderRednessLevel; public Slider SliderSharpnessLevel; private void Start() { LoadAssetData(); if (CheckAppId()) { SetUpUI(); InitEngine(); InitLogFilePath(); JoinChannel(); } } // Update is called once per frame private void Update() { PermissionHelper.RequestMicrophontPermission(); PermissionHelper.RequestCameraPermission(); } //Show data in AgoraBasicProfile [ContextMenu("ShowAgoraBasicProfileData")] private void LoadAssetData() { if (_appIdInput == null) return; _appID = _appIdInput.appID; _token = _appIdInput.token; _channelName = _appIdInput.channelName; } private bool CheckAppId() { Log = new Logger(LogText); return Log.DebugAssert(_appID.Length > 10, "Please fill in your appId in API-Example/profile/appIdInput.asset"); } private void InitEngine() { RtcEngine = Agora.Rtc.RtcEngine.CreateAgoraRtcEngine(); UserEventHandler handler = new UserEventHandler(this); RtcEngineContext context = new RtcEngineContext(_appID, 0, CHANNEL_PROFILE_TYPE.CHANNEL_PROFILE_LIVE_BROADCASTING, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_DEFAULT); RtcEngine.Initialize(context); RtcEngine.InitEventHandler(handler); } private void JoinChannel() { RtcEngine.EnableAudio(); RtcEngine.EnableVideo(); RtcEngine.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_BROADCASTER); RtcEngine.JoinChannel(_token, _channelName); } private void InitLogFilePath() { var path = Application.persistentDataPath + "/rtc.log"; #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN path = path.Replace('/', '\\'); #endif var nRet = RtcEngine.SetLogFile(path); this.Log.UpdateLog(string.Format("logPath:{0},nRet:{1}", path, nRet)); } private void SetUpUI() { this.SliderLighteningLevel.onValueChanged.AddListener((float value) => { this.TextLighteningLevel.text = "lighteningLevel:" + value; }); this.SliderSmoothnessLevel.onValueChanged.AddListener((float value) => { this.TextSmoothnessLevel.text = "smoothnessLevel:" + value; }); this.SliderRednessLevel.onValueChanged.AddListener((float value) => { this.TextRednessLevel.text = "rednessLevel:" + value; }); this.SliderSharpnessLevel.onValueChanged.AddListener((float value) => { this.TextSharpnessLevel.text = "sharpnessLevel:" + value; }); var btn = this.transform.Find("UI/StartButton").GetComponent