Пример #1
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("");
        }
Пример #2
0
        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;
                    }
                }
            }
        }
Пример #3
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;
            }
        }
    }
Пример #4
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);
                }
            }
        }
Пример #5
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);
    }
Пример #6
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;
     }
 }
Пример #7
0
    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);
    }
Пример #8
0
        //...
        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);
        }
Пример #9
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
    }
Пример #10
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());
        }
Пример #11
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);
            });
        }
Пример #12
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);
    }
Пример #13
0
 public static void SetMainScene(string sceneName)
 {
     if (string.IsNullOrEmpty(sceneName))
     {
         C_DebugHelper.LogError("mainScenName is null");
         return;
     }
     for (int i = 0; i < SceneManager.sceneCount; i++)
     {
         if (sceneName.Equals(SceneManager.GetSceneAt(i).name))
         {
             SceneManager.SetActiveScene(SceneManager.GetSceneAt(i));
             break;
         }
     }
 }
Пример #14
0
    //--------------------------------------------------缓存--------------------------------------------------
    /// <param name="resPath">格式“common/sound/aa.ogg”或者“pubic/sound/bb.ogg”或者“aoe/prefab/cam1/gg.prefab”</param>
    public T LoadAssetBundle_Cache <T>(string resPath, bool isInstantiate = false, bool isForever = false) where T : UnityEngine.Object
    {
        if (string.IsNullOrEmpty(resPath))
        {
            C_DebugHelper.LogError(" 加载接口的respath is null");
            return(null);
        }

        //拆分
        string resMoudle = "";

        System.Text.StringBuilder resName    = new System.Text.StringBuilder();
        System.Text.StringBuilder moudleName = new System.Text.StringBuilder();
        if (resPath.Contains("/"))
        {
            resName.Append(resPath.Substring(resPath.LastIndexOf('/') + 1)); //资源名字
            moudleName.Append(resPath.Substring(0, resPath.IndexOf('/')));   //模块名字
            resMoudle = moudleName.ToString();
        }
        else
        {
            resName.Append(resPath);
        }

        if (moudleName.ToString().ToLower().Equals("common"))
        {
            moudleName.Replace("common", "public");
        }

        string typePath = "";

        if (resPath.Contains("/"))
        {
            //去掉模块名
            typePath = resPath.Substring(resPath.IndexOf('/') + 1);
        }

        if (!string.IsNullOrEmpty(typePath) && typePath.Contains("/"))
        {
            //去掉包含的资源名字
            typePath = typePath.Substring(0, typePath.LastIndexOf('/'));
            moudleName.Append("/").Append(typePath).Append("/");
        }

        return(LoadAssetBundle_Cache <T>(resName.ToString(), resMoudle, "", moudleName.ToString(), isInstantiate, isForever));
    }
Пример #15
0
        public void ReadFile(string fileName)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                C_DebugHelper.LogError("文件是空,请检查");
                return;
            }
            TextAsset binAsset = Resources.Load(fileName) as TextAsset;

            if (binAsset == null)
            {
                C_DebugHelper.LogError(fileName + "读取可视化播放文件路径不存在");
                return;
            }
            if (binAsset.text == null)
            {
                C_DebugHelper.LogError(fileName + "读取可视化播放文件内容为空");
                return;
            }
            string content = binAsset.text.Replace("\r\n", string.Empty);

            FileName.Clear();
            //读取每一行的内容
            string[] Info = content.Split(',');
            if (Info.Length <= 0)
            {
                C_DebugHelper.LogError(fileName + "读取可视化播放文件内容不存在,");
                return;
            }
            try
            {
                for (int i = 0; i < Info.Length; i++)
                {
                    if (!string.IsNullOrEmpty(Info[i]))
                    {
                        Info[i].Trim();
                        FileName.Add(Info[i]);
                    }
                }
            }
            catch (System.Exception e)
            {
                C_DebugHelper.LogError(" 文件名" + fileName + "错误信息" + e.Message);
            }
        }
Пример #16
0
        public void Play()
        {
            if (isPlaying)
            {
                C_DebugHelper.LogWarning("Sequence is already playing" + gameObject);
                return;
            }

            if (cutscenes.Count == 0)
            {
                C_DebugHelper.LogError("No Cutscenes provided" + gameObject);
                return;
            }

            isPlaying    = true;
            currentIndex = 0;
            MoveNext();
        }
Пример #17
0
 public void InitCutScene()
 {
     InitFile();
     for (int i = 0; i < FileName.Count; i++)
     {
         Transform temp = _CutsceneNode.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;
         }
         cutscenes.Add(cut);
     }
 }
Пример #18
0
    public void LoadAssetBundle_CacheList(string type, List <string> assetBundleNameList)
    {
        if (string.IsNullOrEmpty(type) || assetBundleNameList.Count == 0)
        {
            return;
        }

        try
        {
            List <string> assetBundlePathList = new List <string>();

            for (int i = 0; i < assetBundleNameList.Count; i++)
            {
                assetBundlePathList.Add(GetAssetBundleFilePath(assetBundleNameList[i]));
            }

            C_ResMgr.LoadAssetBundleCacheList(type, assetBundlePathList);
        }
        catch (Exception e)
        {
            C_DebugHelper.LogError("LoadAssetBundleCacheList : " + e);
        }
    }
Пример #19
0
    public static IEnumerator SaveScreenShot(Camera shotCamera, Rect rect, string filename, int saveType, bool closeCamera = false)
    {
        yield return(new WaitForEndOfFrame());

        //   shotCamera.gameObject.SetActive(true);
        //  byte[] bytes =  CaptureScreenShot(shotCamera, rect, filename);
        Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGBA32, false);

        texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, false);
        texture.Apply();
        byte[] bytes = texture.EncodeToPNG();
        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            try
            {
                string base64String = System.Convert.ToBase64String(bytes);
                C_DebugHelper.Log("获取当前图片base64长度为---" + base64String.Length);
                C_DebugHelper.Log("获取base64String---" + base64String);
            }
            catch (System.Exception e)
            {
                C_DebugHelper.LogError("ImgToBase64String 转换失败:" + e.Message);
            }
        }
        else if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            string base64String = System.Convert.ToBase64String(bytes);
            C_DebugHelper.Log("获取base64String---" + base64String);

            string path = string.Concat(Application.dataPath, "/../capture/");
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            File.WriteAllBytes(string.Concat(path, "/", filename), bytes);
        }
    }
Пример #20
0
        public void InitCutScene(string start, string end)
        {
            bool Record = false;

            InitCutScene();

            GameObject go    = GameObject.FindGameObjectWithTag("CutScene");
            int        count = go.transform.childCount;

            for (int i = 0; i < FileName.Count; 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 (FileName[i].Equals(start))
                {
                    Record = true;
                }
                if (Record)
                {
                    cutscenes.Add(cut);
                }
                if (FileName[i].Equals(end))
                {
                    Record = false;
                }
            }
        }
Пример #21
0
    public T LoadResource <T>(string resName, string resPath, string resType, string exResPath = "", bool isInstantiate = false, bool isForever = false) where T : UnityEngine.Object
    {
        if (string.IsNullOrEmpty(resName))
        {
            return(null);
        }

        if (string.IsNullOrEmpty(resPath) && !string.IsNullOrEmpty(exResPath))
        {
            int index = exResPath.IndexOf('/');
            resPath = exResPath.Substring(0, (index == -1 ? exResPath.Length : index));
        }

        UnityEngine.Object tempObject = C_MonoSingleton <C_PoolMgr> .GetInstance().Spawn(resName, resType);

        if (tempObject != null)
        {
            return(tempObject as T);
        }

        //关卡a是内置资源包,需要使用内置资源
        if (GameConfig.LocalResources == 0)
        {
            string assetBundleName     = GetAssetBundleName(resName, resPath, resType, exResPath);
            string assetBundleFilePath = GetAssetBundleFilePath(assetBundleName);

            T temp1 = C_ResMgr.GetAssetBundleFormCache <T>(resName, assetBundleFilePath, isInstantiate, isForever);
            if (temp1 != null)
            {
                return(temp1);
            }

            if (m_AssetBundleManifest != null && Hash128.Parse("0") != m_AssetBundleManifest.GetAssetBundleHash(assetBundleName))
            {
                List <string> dpsList = new List <string>();

                if (!resName.Contains(".ogg"))
                {
                    dpsList = GetAllDependencies(assetBundleName);
                }
                //Debug.LogError("load bundle"+resName);
                T temp2 = C_ResMgr.LoadAssetBundle <T>(resName, assetBundleFilePath, dpsList, isInstantiate, isForever);
                if (temp2 != null)
                {
                    return(temp2);
                }
            }
        }

        string resourcePath = "";

        if (string.IsNullOrEmpty(exResPath))
        {
            resourcePath = "PackagingResources/" + resPath + "/" + resType + "/";
        }
        else
        {
            resourcePath = "PackagingResources/" + exResPath;
        }

        T resObject = C_ResMgr.LoadResource <T>(resName, resourcePath);

        if (isInstantiate && resObject != null)
        {
            resObject = GameObject.Instantiate(resObject);
        }

        if (resObject == null)
        {
            C_DebugHelper.LogError("-----------------------------------resName = " + resName + ", exResPath = " + exResPath + ", is null");
        }

        return(resObject);
    }
Пример #22
0
        private string Search(string matchContent = "")
        {
            List <string> ResList = new List <string>();

            if (!string.IsNullOrEmpty(matchContent))
            {
                string[] data = matchContent.Split('\n');
                for (int id = 0; id < data.Length; id++)
                {
                    ResList.Add(data[id]);
                }
            }
            string content = "";
            string mark    = "PackagingResources";

            for (int i = 0; i < cutscenes.Count; i++) //所有剧情
            {
                Cutscene cutscene = cutscenes[i];     //单个剧情
                if (cutscene != null)
                {
                    for (int ii = 0; ii < cutscene.groups.Count; ii++)//单个剧情的所有轨道
                    {
                        string[] fileName = cutscene.name.Split('_');
                        if (fileName.Length < 1)
                        {
                            C_DebugHelper.LogError(string.Format("'{0}'名字不规范 要求类似iuv_cam001 ", cutscene.name));
                            continue;
                        }
                        if (cutscene.name.Contains("(Clone)"))
                        {
                            int end = name.LastIndexOf("(Clone)");
                            cutscene.name = cutscene.name.Substring(0, (end == -1 ? cutscene.name.Length : end));
                        }
                        if (cutscene.name.Contains("(clone)"))
                        {
                            int end = name.LastIndexOf("(clone)");
                            cutscene.name = cutscene.name.Substring(0, (end == -1 ? cutscene.name.Length : end));
                        }
                        string dirpath = fileName[0] + "/prefabs/" + cutscene.name + "/" + cutscene.name;
                        ContainContent(dirpath, ResList);

                        //收集cutscene
                        string cutscenepath = fileName[0] + "/cutscene/" + cutscene.name;
                        ContainContent(cutscenepath, ResList);

                        //初始化镜头的所有对象
                        cutscene.LoadAffectedResEditor();
                        //对象prefab
                        var actor = cutscene.groups[ii].actor;
                        if (actor == null)
                        {
                            C_DebugHelper.LogWarning("对象:" + dirpath + " actor is null");
                        }
                        if (actor != null && PrefabUtility.GetPrefabType(actor) == PrefabType.Prefab)
                        {
                            string tempActorName = AssetDatabase.GetAssetPath(actor);
                            tempActorName = tempActorName.Substring(tempActorName.IndexOf(mark) + mark.Length + 1);
                            string temp = C_String.DeleteExpandedName(tempActorName).ToLower();
                            ContainContent(temp, ResList);
                        }
                        //所有的轨道上资源对象
                        List <CutsceneTrack> cutsceneTrack = cutscene.groups[ii].tracks;
                        if (cutsceneTrack != null)
                        {
                            for (int iii = 0; iii < cutsceneTrack.Count; iii++)
                            {
                                string path     = cutsceneTrack[iii].GetAffectResPath();
                                string pathTemp = C_String.DeleteExpandedName(path).ToLower();
                                ContainContent(pathTemp, ResList);

                                List <ActionClip> _actionClips = cutsceneTrack[iii].actionClips;
                                for (int j = 0; j < _actionClips.Count; j++)
                                {
                                    string clipPath     = _actionClips[j].GetAffectResPath();
                                    string clipPathTemp = C_String.DeleteExpandedName(clipPath).ToLower();
                                    ContainContent(clipPathTemp, ResList);
                                }
                            }
                        }
                    }
                }
            }
            //C_DebugHelper.Log("资源:+" + content);
            content = "";
            //清理重复的名字资源
            for (int i = 0; i < ResList.Count; i++)
            {
                content += ResList[i] + "\n";
            }
            return(content);
        }
Пример #23
0
    static void InitData(ModelData result, string json)
    {
        if (result == null)
        {
            C_DebugHelper.LogError("result is null");
            return;
        }
        if (string.IsNullOrEmpty(json))
        {
            C_DebugHelper.LogError("json is null");
            return;
        }
        string artScene = C_Json.GetJsonKeyString(json, "ArtScene");

        if (string.IsNullOrEmpty(artScene))
        {
            C_DebugHelper.LogError("ArtScene is null ");
            return;
        }
        result.ArtSceneName = artScene;
        string pathArtName = C_Json.GetJsonKeyString(json, "PathArtName");

        if (string.IsNullOrEmpty(pathArtName))
        {
            C_DebugHelper.LogError("ArtName is null ");
            return;
        }
        result.PathArtRootNodeName = pathArtName;
        string pathDesName = C_Json.GetJsonKeyString(json, "PathDesName");

        if (string.IsNullOrEmpty(pathDesName))
        {
            C_DebugHelper.LogError("DesName is null ");
            return;
        }
        result.PathDesRootNodeName = pathDesName;

        string desScene = C_Json.GetJsonKeyString(json, "DesScene");

        if (string.IsNullOrEmpty(desScene))
        {
            C_DebugHelper.LogError("DesScene is null ");
            return;
        }
        result.DesSceneName = desScene;

        string cutsceneArtName = C_Json.GetJsonKeyString(json, "CutsceneArtName");

        if (string.IsNullOrEmpty(cutsceneArtName))
        {
            C_DebugHelper.LogError("cutsceneArtName is null ");
            return;
        }
        result.CutsceneArtRootNodeName = cutsceneArtName;
        string cutsceneDesName = C_Json.GetJsonKeyString(json, "CutsceneDesName");

        if (string.IsNullOrEmpty(cutsceneDesName))
        {
            C_DebugHelper.LogError("cutsceneDesName is null ");
            return;
        }
        result.CutsceneDesRootNodeName = cutsceneDesName;

        JsonData pathReplacItemNameList = C_Json.GetJsonKeyJsonData(json, "PathReplaceItemName");

        if (pathReplacItemNameList == null)
        {
            C_DebugHelper.LogError("ReplaceItemName is null");
            return;
        }
        foreach (JsonData item in pathReplacItemNameList)
        {
            result.PathReplaceList.Add(item.ToString());
        }

        JsonData cutsceneReplacItemNameList = C_Json.GetJsonKeyJsonData(json, "CutsceneReplaceItemName");

        if (cutsceneReplacItemNameList == null)
        {
            C_DebugHelper.LogError("cutsceneReplacItemNameList is null");
            return;
        }
        foreach (JsonData item in cutsceneReplacItemNameList)
        {
            result.CutsceneReplaceList.Add(item.ToString());
        }
    }