예제 #1
0
파일: Utility.cs 프로젝트: jonntd/Xbl
    public static Vector3 StringToVector3(string sVector)
    {
        // Remove the parentheses
        if (sVector.StartsWith("(") && sVector.EndsWith(")"))
        {
            sVector = sVector.Substring(1, sVector.Length - 2);
        }

        // split the items
        string[] sArray = sVector.Split(',');
        if (sArray == null)
        {
            C_DebugHelper.LogError("sVector = " + sVector + "数组没有用,隔开");
            return(Vector3.zero);
        }
        if (sArray != null && sArray.Length != 3)
        {
            C_DebugHelper.LogError("sVector = " + sVector + "数组数据长度不够3");
            return(Vector3.zero);
        }

        // store as a Vector3
        Vector3 result = new Vector3(float.Parse(sArray[0].ToString()), float.Parse(sArray[1].ToString()), float.Parse(sArray[2].ToString()));

        return(result);
    }
예제 #2
0
    public void AddGetRecordStatusEvent(System.Action <bool> actionCallback = null)
    {
        C_DebugHelper.LogErrorFormat("SpeechRecognizeSystemEvent AddGetRecordStatusEvent  start ");

        _ActionCallback = actionCallback;
        if (_GetRecordStatusEvent != null)
        {
            _GetRecordStatusEvent.UnregisterEvent();
        }
        _GetRecordStatusEvent = null;
        _GetRecordStatusEvent = new C_Event();
        _GetRecordStatusEvent.RegisterEvent(C_EnumEventChannel.Global, "ResponseRecordStatus", (status) => {
            _GetRecordStatusEvent.UnregisterEvent();
            if (status != null)
            {
                C_DebugHelper.LogErrorFormat("ResponseRecordStatus is :" + status);
                string answer = "1";
                if (answer.Equals(status[0]))
                {
                    if (_ActionCallback != null)
                    {
                        _ActionCallback(true);
                    }
                }
                else
                {
                    Tips.Create("开启语音权限后,才可以继续使用噢!");
                    if (_ActionCallback != null)
                    {
                        _ActionCallback(false);
                    }
                }
            }
        });
    }
예제 #3
0
    public bool IsTalked()
    {
        try
        {
            if (audio.clip == null)
            {
                return(false);
            }
            float[] tempSamples; //临时数据存储
            tempSamples = new float[audio.clip.samples * audio.clip.channels];
            audio.clip.GetData(tempSamples, 0);
            float sourceData = 0.0f;
            sourceData = Array.Find(tempSamples, e => Mathf.Abs(e) > 0.05f);
            if (Mathf.Abs(sourceData) > 0.05f)
            {
                return(true);
            }
            return(false);
        }
        catch (Exception e)
        {
            C_DebugHelper.Log("IsTalked line173:" + e);

            return(false);
        }
        finally
        {
        }
    }
예제 #4
0
    public bool CreataUICover()
    {
        if (_UICover != null)
        {
            _UICover.gameObject.SetActive(true);
            return(true);
        }
        GameObject go = GameObject.Instantiate(Resources.Load(_UICoverName) as GameObject);

        if (go == null)
        {
            C_DebugHelper.LogError("the Canvas u want to Load does'nt Exist in the path:" + _UICoverName);
            return(false);
        }
        go.SetActive(true);
        go.layer             = LayerMask.NameToLayer("UI");
        _UICover             = go.GetComponent <Canvas>();
        _UICover.renderMode  = RenderMode.ScreenSpaceCamera;
        _UICover.worldCamera = Assets.Scripts.C_Framework.C_UIMgr.c_UICameraHigh;
        //_Mic = _UICover.transform.Find(_MicName);
        //if (_Mic == null)
        //{
        //    C_DebugHelper.LogError("can't find the mic with the parent" + _UICover.name + ".check the child named by: " + _MicName);
        //    return false;
        //}
        //if(_Mic.gameObject.activeSelf == false)
        //{
        //    _Mic.gameObject.SetActive(true);
        //}
        return(true);
    }
예제 #5
0
        public string GetAffectResPath()
        {
            string res = "";

            if (actor != null)
            {
                MonoBehaviour[] monos = actor.GetComponents <MonoBehaviour>();
                for (int i = 0; i < monos.Length; i++)
                {
                    if (monos[i].GetType().ToString().EndsWith(ScriptEnd))
                    {
                        res += monos[i].GetType().GetMethod("GetAffectResPath", System.Reflection.BindingFlags.Public).
                               Invoke(actor, new System.Object[] { });
                    }
                }
                return(res);
            }

            if (CutsceneSequencePlayer._CurrentCutScene != null)
            {
                C_DebugHelper.LogError(CutsceneSequencePlayer._CurrentCutScene.name + "CollectRes Component is null or actor is null");
            }
            else
            {
                C_DebugHelper.LogError("CollectRes Component is null or actor is null");
            }
            return("");
        }
예제 #6
0
파일: BaseTouchItem.cs 프로젝트: jonntd/Xbl
        protected virtual void TouchEvent()
        {
            if (_CanTouch && TouchManager.Instance.IsTouchValid(0))
            {
                TouchPhaseEnum touchPhase = TouchManager.Instance.GetTouchPhase(0);
                if (touchPhase == TouchPhaseEnum.BEGAN)
                {
                    TouchManager.Instance.GetTouchPos(0, out _StartTouchpos);
                    RaycastHit hit;
                    C_DebugHelper.Log("TouchManager begin..");

                    Ray ray = GetCurrentCamera().ScreenPointToRay(_StartTouchpos);
                    if (Physics.Raycast(ray, out hit, _TouchDistance))
                    {
                        C_DebugHelper.Log("book is touch" + hit.collider.name);

                        if (hit.collider.gameObject == gameObject)
                        {
                            C_DebugHelper.Log("book is touch in:" + hit.collider.name);
                            //播放动画
                            _IsTouch = true;
                            TouchHandle();
                        }
                    }
                }
            }
        }
예제 #7
0
        public void InitCutScene(int start, int end)
        {
            InitCutScene();
            GameObject go    = GameObject.FindGameObjectWithTag("CutScene");
            int        count = go.transform.childCount;

            for (int i = 0; i < FileName.Count; i++)
            {
                C_DebugHelper.Log(FileName[i]);
                Transform temp = go.transform.Find(FileName[i]);
                if (temp == null)
                {
                    C_DebugHelper.LogError(FileName[i] + "not find");
                    return;
                }
                Cutscene cut = temp.GetComponent <Cutscene>();
                if (cut == null)
                {
                    C_DebugHelper.LogError(FileName[i] + "not find cutscene");
                    return;
                }
                if (i >= start && i <= end)
                {
                    cutscenes.Add(cut);
                }
            }
        }
예제 #8
0
    public byte[] GetClipData()
    {
        if (audio.clip == null)
        {
            C_DebugHelper.Log("GetClipData audio.clip is null");
            return(null);
        }

        float[] samples = new float[audio.clip.samples];

        audio.clip.GetData(samples, 0);


        byte[] outData = new byte[samples.Length * 2];

        int rescaleFactor = 32767;

        for (int i = 0; i < samples.Length; i++)
        {
            short temshort = (short)(samples[i] * rescaleFactor);

            byte[] temdata = System.BitConverter.GetBytes(temshort);

            outData[i * 2]     = temdata[0];
            outData[i * 2 + 1] = temdata[1];
        }
        if (outData == null || outData.Length <= 0)
        {
            C_DebugHelper.Log("GetClipData intData is null");
            return(null);
        }
        return(outData);
    }
예제 #9
0
파일: UnLoadBase.cs 프로젝트: jonntd/Xbl
        public void SetMainScene(string sceneName)
        {
            if (string.IsNullOrEmpty(sceneName))
            {
                C_DebugHelper.LogError("mainScenName is null");
                return;
            }
            Scene activescene = SceneManager.GetActiveScene();

            if (activescene != null && activescene.name.Equals(sceneName))
            {
                OnSceneChanged(activescene, activescene);
            }
            else
            {
                for (int i = 0; i < SceneManager.sceneCount; i++)
                {
                    if (sceneName.Equals(SceneManager.GetSceneAt(i).name))
                    {
                        SceneManager.SetActiveScene(SceneManager.GetSceneAt(i));
                        _SetActive = true;
                        break;
                    }
                }
            }
        }
예제 #10
0
    /// <summary>
    /// 播放背景音乐
    /// </summary>
    /// <param name="musicName"></param>
    /// <param name="isLocal"></param>
    /// <param name="loop"></param>
    public void PlayBgMusic(string musicName, bool isLocal = false, bool loop = true, SoundFadeState state = SoundFadeState.NONE)
    {
        if ((this.audioBg == null) && this.audioBg.mute)
        {
            return;
        }
        soundFadeState = SoundFadeState.NONE;
        string    name = musicName;
        AudioClip clip = C_Singleton <LocalAssetMgr> .Instance.Load_Music(name, isLocal);

        if (clip == null || (this.audioBg == null))
        {
            C_DebugHelper.LogError("musicName :" + musicName + "-Sound Clip Does Not Exists !");
        }
        else
        {
            audioBg.clip = clip;
            audioBg.loop = loop;
            audioBg.Play();

            if (state != SoundFadeState.NONE)
            {
                this.soundFadeState = state;
            }
            else
            {
                audioBg.volume = audioBgMusicVolumn;
            }
        }
    }
예제 #11
0
 public void PlayBgMusic(AudioClip clip, float voulume = 1, bool loop = true, SoundFadeState state = SoundFadeState.NONE)
 {
     if ((this.audioBg == null) && this.audioBg.mute)
     {
         return;
     }
     soundFadeState = SoundFadeState.NONE;
     if (clip == null || (this.audioBg == null))
     {
         C_DebugHelper.LogError("musicName :" + clip.name + "-Sound Clip Does Not Exists !");
     }
     else
     {
         audioBg.clip = clip;
         audioBg.loop = loop;
         audioBg.Play();
         if (state != SoundFadeState.NONE)
         {
             this.soundFadeState = state;
         }
         else
         {
             audioBg.volume = audioBgMusicVolumn;
         }
         audioBg.volume = voulume;
     }
 }
예제 #12
0
 protected override void Init()
 {
     string[] ms = Microphone.devices;
     deviceCount = ms.Length;
     if (deviceCount == 0)
     {
         C_DebugHelper.Log("no microphone found");
     }
 }
예제 #13
0
        void GenerateCutsceneAsync(int loadSum)
        {
            int sum = loadSum;

            //动态创建5个镜头
            for (int i = _CurrentNeedLoadIndex; i < _CurrentNeedLoadIndex + sum; i++)
            {
                //获取名字,创建cutscene,添加go对象为父节点
                if (i >= FileName.Count)
                {
                    continue;
                }
                bool       loadRes = false;
                GameObject temp    = null;
                if (_CutsceneNode != null)
                {
                    C_DebugHelper.Log("FileName[i]:" + FileName[i]);
                    Transform tran = _CutsceneNode.transform.Find(FileName[i]);
                    if (tran != null)
                    {
                        temp = tran.gameObject;
                    }
                    if (temp == null)
                    {
                        loadRes = true;
                    }
                }
                else
                {
                    loadRes = true;
                }

                if (loadRes)
                {
                    _StringBuilder.Length = 0;
                    _StringBuilder.Append("story/").Append(_ModuleName).Append("/").Append("cutscene/").Append(FileName[i]);
                    C_DebugHelper.Log("_StringBuilder.ToString():" + _StringBuilder.ToString());
                    temp = C_Singleton <GameResMgr> .GetInstance().LoadResource <GameObject>(_StringBuilder.ToString(), true, false);

                    if (temp == null)
                    {
                        continue;
                    }
                }
                temp.transform.SetParent(_CutsceneNode.transform);
                Cutscene cutscene = temp.GetComponent <Cutscene>();
                if (cutscene == null)
                {
                    continue;
                }
                cutscenes.Add(cutscene);
            }
            if (sum > 0)
            {
                _CurrentNeedLoadIndex += sum;
            }
        }
예제 #14
0
    /// <summary>
    /// 超时 判断 默认 正确
    /// </summary>
    void StopWithStartOverTimeCheck()
    {
        //没网 弹窗tips 不走腾讯云语音识别  等待超时
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            DelayCallback = DOVirtual.DelayedCall(2f, () =>
            {
                ClearEvent();
                DoScoreCallBack("100");
                C_DebugHelper.Log("本轮语音识别无网络,默认正确!");
            });
            Tips.Create("语音识别异常,请切换网络后重试");
            return;
        }

        //等待结果返回,5秒之后如果没有返回结果,则自动返回
        DelayCallback = DOVirtual.DelayedCall(_DelayTime, () =>
        {
            ClearEvent();
            DoScoreCallBack("100");
            C_DebugHelper.Log("当轮语音识别没有拿到结果,默认正确!请确定网络状况是否良好!");
        });
        float time = Time.time;

        //float timeScale = Time.timeScale;
        //DelayCallback.OnUpdate(() =>
        //{
        //    if (Time.timeScale != timeScale)
        //    {
        //        C_DebugHelper.Log("TimeScale:" + Time.timeScale);
        //        timeScale = Time.timeScale;
        //    }
        //    C_DebugHelper.Log("花费时间:" + (Time.time - time));
        //});


        if (_GetTecentWordEvent != null)
        {
            _GetTecentWordEvent.UnregisterEvent();
        }
        _GetTecentWordEvent = null;
        _GetTecentWordEvent = new C_Event();

        _GetTecentWordEvent.RegisterEvent(C_EnumEventChannel.Global, "ResponseRecord", (word) =>
        {
            //停掉超时计算
            //if (DelayCallback != null)
            //{
            //    DelayCallback.Kill();
            //    DelayCallback = null;
            //}
            ClearEvent();
            GetTecentReslut((word == null || word.Length <= 0) ? "" : word[0].ToString());
        });

        _IsRecording = false;
    }
예제 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="clip"></param>
        /// <param name="animEvtReceiverObject"></param>
        /// <param name="atPosition">当前动画片段的某一个时间位置</param>
        /// <param name="callback"></param>
        /// <param name="bind">绑定事件或者是解绑</param>
        private static bool BindOrUnbindCallback(this AnimationClip clip, GameObject animEvtReceiverObject, float atPosition, Action callback, bool bind)
        {
            var actionWord = bind ? "register" : "unregister";

            if (animEvtReceiverObject == null)
            {
                C_DebugHelper.LogWarningFormat("Trying to {0} callback for null animation event receiver game object", actionWord);
                return(false);
            }

            if (callback == null)
            {
                C_DebugHelper.LogWarningFormat("Trying to {0} null callback for animation clip", actionWord);
                return(false);
            }

            if (atPosition < 0.0f || atPosition > clip.length)
            {
                C_DebugHelper.LogWarningFormat("Trying to {0} callback for position outside of clip timeline", actionWord);
                return(false);
            }

            var eventReceiver = animEvtReceiverObject.GetComponent <AnimationEventReceiver>();

            if (bind)
            {
                if (eventReceiver == null)
                {
                    eventReceiver = animEvtReceiverObject.AddComponent <AnimationEventReceiver>();
                }

                if (!eventReceiver.RegisterTimelineCallback(atPosition, callback))
                {
                    return(false);
                }
                // Debug.Log("clip.AddEvent :"+ clip.name+ "<<<<<<<<<<<<<<<atPosition" + atPosition);
                clip.AddEvent(OnTimelineEventRaisedMethodName, atPosition, atPosition);
            }
            else
            {
                if (eventReceiver == null)
                {
                    Debug.LogWarning("Trying to unregister callback for game object without AnimationEventReceiver component");
                    return(false);
                }
                // Debug.Log("clip.RemoveEvent :" + clip.name + "++++++++++++++++++atPosition" + atPosition);

                var lastCallbackForPositionRemoved = eventReceiver.UnregisterTimelineCallback(atPosition, callback);
                if (lastCallbackForPositionRemoved)
                {
                    clip.RemoveEvent(OnTimelineEventRaisedMethodName, atPosition, atPosition);
                }
            }
            return(true);
        }
예제 #16
0
    /// <summary>
    /// 评分
    /// </summary>
    /// <param name="result">返回腾讯云的识别结果</param>
    public void GetTecentReslut_old(string result)
    {
        float  score      = 0;
        string resultWord = "0";

        if (!string.IsNullOrEmpty(result))
        {
            WordRespone itemDate = JsonUtility.FromJson <WordRespone>(result);//特殊处理的jason,一般jason类继续使用框架jason
            string      word     = itemDate.inputWords;
            C_DebugHelper.Log("class:RecognizeAudio function:GetTecentReslut  line 59..  word =" + word);
            int resultCode = itemDate.resultCode;
            if (resultCode == 1)
            {
                if (_ResultType == ResultType.PickWord)
                {
                    //解析所有的文字,找到分数最高的文字
                    float           wordMaxScore = 0f;
                    List <WordItem> wordList     = itemDate.words;
                    if (wordList != null)
                    {
                        for (int i = 0; i < wordList.Count; i++)
                        {
                            if (wordList[i] != null)
                            {
                                string wordName = wordList[i].word;
                                float  tmpScore = wordList[i].pronAccuracy * 0.6f + wordList[i].pronFluency * 100f * 0.4f;
                                if (tmpScore >= wordMaxScore || (i == 0))
                                {
                                    wordMaxScore = tmpScore;
                                    resultWord   = wordName;
                                }
                            }
                        }
                    }
                    DoScoreCallBack(resultWord);
                    return;
                }
                else if (_ResultType == ResultType.PickScore)
                {
                    //直接计算分数
                    score = (itemDate.pronAccuracy * 0.6f + itemDate.pronFluency * 100f * 0.4f) * itemDate.pronCompletion;
                }
            }
            if (_ResultCallback != null)
            {
                C_DebugHelper.Log("_ResultCallback ..GetTecentReslut  result =" + result);
                _ResultCallback(score.ToString());
                _ResultCallback = null;
            }
        }
        else
        {
            DoScoreCallBack(score.ToString());
        }
    }
예제 #17
0
 public static void ResumeCurrentCutscene()
 {
     if (_CurrentCutScene != null)
     {
         _CurrentCutScene.Resume();
     }
     else
     {
         C_DebugHelper.Log("_CurrentCutScene is null ,resume fail..");
     }
 }
예제 #18
0
파일: Utility.cs 프로젝트: jonntd/Xbl
 public static void getCutsceneState()
 {
     if (Utility.FindCurrentCutscene().isPaused)
     {
         C_DebugHelper.Log("current cus state: Utility.FindCurrentCutscene().isPaused");
     }
     else
     {
         C_DebugHelper.Log("current cus state: Utility.FindCurrentCutscene().play");
     }
 }
예제 #19
0
 public static void PauseCurrentCutscene()
 {
     if (_CurrentCutScene != null)
     {
         _CurrentCutScene.Pause();
     }
     else
     {
         C_DebugHelper.Log("_CurrentCutScene is null ,pause fail..");
     }
 }
예제 #20
0
    public void PokeRequestHttp(WWWForm form, string url, Action <string> callback, float timeout = 2.0f)
    {
        form.AddField("app", APP_CONST.PinYin);
        form.AddField("device", GameDataMgr.c_DeviceType);
        form.AddField("deviceid", GameDataMgr.c_DeviceUID);
        form.AddField("udid", GameDataMgr.c_UDID);
        form.AddField("ver", GameConfig.AppVersion);

        C_DebugHelper.Log("NetworkMgr SendHttpPost url = " + url + ", data = " + Encoding.UTF8.GetString(form.data));

        SendHttpPost(url, form.data, callback, timeout);
    }
예제 #21
0
 public static bool isPause()
 {
     if (_CurrentCutScene != null)
     {
         return(_CurrentCutScene.isPaused);
     }
     else
     {
         C_DebugHelper.Log("_CurrentCutScene is null ,pause fail..");
     }
     return(false);
 }
예제 #22
0
 public static void StopCurrentCutscene()
 {
     if (_CurrentCutScene != null)
     {
         _CurrentCutScene.Stop();
         _CurrentCutScene = null;
     }
     else
     {
         C_DebugHelper.Log("_CurrentCutScene is null ,resume Stop..");
     }
 }
예제 #23
0
파일: AnimatorTrack.cs 프로젝트: jonntd/Xbl
        //...
        protected override bool OnInitialize()
        {
            animator = actor.GetComponentInChildren <Animator>();
            if (animator == null)
            {
                C_DebugHelper.LogError("Animator Track requires that the actor has the Animator Component attached:" + actor);

                return(false);
            }

            return(true);
        }
예제 #24
0
    /// <summary>
    /// 开始录音,腾讯云
    /// </summary>
    /// <param name="answer"></param>
    /// <param name="scoreCallback"></param>
    public void StartRecognizeAudioTecent(string word, System.Action <string> scoreCallback, ResultType type = ResultType.PickScore, int langType = 1, int speechType = 1, float recordDur = 3f, bool reward = false)
    {
        _ResultCallback = scoreCallback;
        _ResultType     = type;
        if (recordDur <= 0)
        {
            DoScoreCallBack("0");
            C_DebugHelper.LogError("您设置的录音时间过短,请重新确认!");
            return;
        }

#if UNITY_EDITOR
        DelayStop = DOVirtual.DelayedCall(recordDur, () =>
        {
            StopWithStartOverTimeCheck();
        });
        return;
#endif



        if (_GetRecordStatusEvent != null)
        {
            _GetRecordStatusEvent.UnregisterEvent();
        }
        _GetRecordStatusEvent = null;
        _GetRecordStatusEvent = new C_Event();
        _GetRecordStatusEvent.RegisterEvent(C_EnumEventChannel.Global, "ResponseRecordStatus", (status) => {
            _GetRecordStatusEvent.UnregisterEvent();
            if (status != null)
            {
                string answer = "1";
                if (answer.Equals(status[0]))
                {
                    _IsRecording = true;
                }
                else
                {
                    Tips.Create("开启语音权限后,才可以继续使用噢!");
                }
            }
#if !UNITY_IOS
            StartRecordAction(recordDur);
#endif
        });

        _AnswerWord = word;
#if UNITY_IOS
        StartRecordAction(recordDur);
#endif
    }
예제 #25
0
        public void InitFile()
        {
            string[] moudleName = fileName.Split('_');
            if (moudleName.Length <= 0)
            {
                C_DebugHelper.LogError("读取的配置文件没有_符号进行命名模块,需要检查");
                return;
            }
            StoryName = _ModuleName = moudleName[0];
            StringBuilder filePath = new StringBuilder();

            filePath.Append("SlatePlayer/").Append(_ModuleName).Append("/").Append(fileName);
            ReadFile(filePath.ToString());
        }
예제 #26
0
    public string StopRecord()
    {
        /* if (!Microphone.IsRecording(null))
         * {
         *   return null;
         * }*/
        C_DebugHelper.LogErrorFormat("MicphoneSinglton StopRecord line56 ...");

        Microphone.End(null);
        audio.Stop();
        //保存语音文件
        // WavUtility.FromAudioClip(audio.clip, out _CurrentAudioFilePath);
        return(_CurrentAudioFilePath);
    }
예제 #27
0
        protected virtual void MoveNext()
        {
            if (_JumpFlag)//中途退出
            {
                isPlaying = false;
                onFinish.Invoke();
                return;
            }
            if (!string.IsNullOrEmpty(_CurrentMoudle) && cutscenes != null && cutscenes.Count == 1)
            {
            }
            if (!isPlaying || currentIndex >= cutscenes.Count)
            {
                isPlaying = false;
                onFinish.Invoke();
                return;
            }

            _CurrentCutScene = null;
            // DoClick();

            var cutscene = _CurrentCutScene = cutscenes[currentIndex];

            if (cutscene == null)
            {
                C_DebugHelper.LogError("Cutscene is null in Cutscene Sequencer" + gameObject);
                return;
            }
            if (!string.IsNullOrEmpty(_CurrentMoudle))
            {
            }
            cutscene.gameObject.SetActive(true);
            cutscene.isActive = false;
            cutscene.Play(() => {
                //埋点
                //  C_MonoSingleton<GameHelper>.GetInstance().StoryDataStatistics(Slate.CutsceneSequencePlayer.CurrentPlayerName);
                _CurrentCutScene = null;

                if (cutscenes != null && cutscenes.Count > 0)
                {
                    GameObject go = cutscenes[0].gameObject;
                    cutscenes.RemoveAt(0);
                    _DirtyCutsceneList.Add(go);
                    //StartCoroutine("ReleaseDirtyCutscene");
                }
                MoveNext();
                //GenerateCutsceneAsync(_LoadOnceCutsceneSUM);
            });
        }
예제 #28
0
    //根据文本,获取需要加载的对象
    public void StartLoadRes(string filepath, string resPath = "")
    {
        if (string.IsNullOrEmpty(filepath))
        {
            C_DebugHelper.LogError("filename is null");
            return;
        }
        if (!string.IsNullOrEmpty(resPath))
        {
            _ResFloder = resPath;
        }
        TextAsset binAsset = Resources.Load("PackagingResources/" + _ResFloder + "/" + filepath) as TextAsset;

        //解析文本
        if (binAsset == null)
        {
            C_DebugHelper.LogError(filepath + "出场文件路径不存在");
            return;
        }
        //读取每一行的内容
        string strAsset = binAsset.text.Replace("\r", string.Empty);

        string[] Info = strAsset.Split('\n');
        if (Info.Length <= 0)
        {
            C_DebugHelper.LogError(filepath + "剧情的文本文件有误");
            return;
        }
        try
        {
            _ResList.Clear();
            for (int i = 0; i < Info.Length; i++)
            {
                if (!string.IsNullOrEmpty(Info[i]))
                {
                    Info[i].Trim();
                    _ResList.Add(Info[i]);
                }
            }
        }
        catch (Exception e)
        {
            C_DebugHelper.LogError("文件名" + filepath + "错误信息" + e.Message);
        }
        //调用全部对象加载的接口
        // Debug.Log(filepath);
        _CurrentFilePath = filepath;
        GameResMgr.Instance.LoadAssetBundle_CacheList(filepath, _ResList);
    }
예제 #29
0
    public void StartRecord()
    {
        C_DebugHelper.LogErrorFormat("MicphoneSinglton StartRecord ...");


#if UNITY_EDITOR
#else
        audio.Stop();
        audio.loop = false;
        audio.mute = true;
        Microphone.End(null);
        audio.clip = Microphone.Start(null, false, 5, int.Parse(sFrequency));
        C_DebugHelper.LogErrorFormat("MicphoneSinglton StartRecord ... line46 ");
#endif
    }
예제 #30
0
파일: BaseTouchItem.cs 프로젝트: jonntd/Xbl
        public virtual void TouchHandle()
        {
            AudioManager.Instance.PlayEffectSound("public/sound/public_sd_009.ogg");

            mCollider.enabled = false;
            C_DebugHelper.Log(_AudioName);
            if (!string.IsNullOrEmpty(_AudioName))
            {
                AudioManager.Instance.PlayerSound(_AudioName, false, new System.Action(PlaySoundOver));
            }
            if (OnTouch != null)
            {
                OnTouch(mCurrentIndex);
            }
        }