public static void Load() { string strData = C_Save.LoadString(Name, C_LocalPath.StreamingAssetsConfigPath); if (!string.IsNullOrEmpty(strData)) { WordBallConfigItemList.Clear(); JsonData WordBallConfigItemListJD = C_Json.GetJsonKeyJsonData(strData, "WordBallConfigItemList"); if (WordBallConfigItemListJD != null) { for (int i = 0; i < WordBallConfigItemListJD.Count; i++) { if (WordBallConfigItemListJD[i] != null) { FieldGuideConfigItem item = new FieldGuideConfigItem(); item.ID = C_Json.GetJsonKeyInt(WordBallConfigItemListJD[i], "ID"); item.Name = C_Json.GetJsonKeyString(WordBallConfigItemListJD[i], "Name"); item.Type = C_Json.GetJsonKeyInt(WordBallConfigItemListJD[i], "Type"); item.BallType = C_Json.GetJsonKeyInt(WordBallConfigItemListJD[i], "BallType"); WordBallConfigItemList.Add(item); } } } } }
void Awake() { string actionConfig = C_Singleton <GameResMgr> .GetInstance().LoadString("action_config", "entity", "character", "c_framework/entity/character/" + Name + "/config/"); if (!string.IsNullOrEmpty(actionConfig)) { JsonData actionJD = C_Json.GetJsonKeyJsonData(actionConfig, "Acton"); if (actionJD != null) { for (int i = 0; i < actionJD.Count; i++) { CharacterAction action = new CharacterAction(); action.Name = C_Json.GetJsonKeyString(actionJD[i], "Name"); action.Type = C_Json.GetJsonKeyInt(actionJD[i], "Type"); action.EndType = C_Json.GetJsonKeyInt(actionJD[i], "EndType"); action.DurationTime = C_Json.GetJsonKeyFloat(actionJD[i], "DurationTime"); JsonData animatorControllerJD = C_Json.GetJsonKeyJsonData(actionJD[i], "AnimatorController"); if (animatorControllerJD != null) { for (int j = 0; j < animatorControllerJD.Count; j++) { CharacterActionItem item = new CharacterActionItem(); item.Name = C_Json.GetJsonKeyString(animatorControllerJD[j], "Name"); item.Type = C_Json.GetJsonKeyInt(animatorControllerJD[j], "Type"); item.DurationTime = C_Json.GetJsonKeyFloat(animatorControllerJD[j], "DurationTime"); action.AnimatorController.Add(item); } } JsonData audioJD = C_Json.GetJsonKeyJsonData(actionJD[i], "Audio"); if (audioJD != null) { for (int j = 0; j < audioJD.Count; j++) { CharacterActionItem item = new CharacterActionItem(); item.Name = C_Json.GetJsonKeyString(audioJD[j], "Name"); item.Type = C_Json.GetJsonKeyInt(audioJD[j], "Type"); item.DurationTime = C_Json.GetJsonKeyFloat(audioJD[j], "DurationTime"); action.Audio.Add(item); } } m_CharacterAction.Add(action); } } } }
public static void UpdateData(string data) { JsonData jsonData = C_Json.GetJsonKeyJsonData(data, "_ResList"); if (jsonData != null) { _ResList.Clear(); for (int i = 0; i < jsonData.Count; i++) { ResItem resItem = new ResItem(); resItem.name = C_Json.GetJsonKeyString(jsonData[i], "name"); resItem.path = C_Json.GetJsonKeyString(jsonData[i], "path"); resItem.resType = C_Json.GetJsonKeyString(jsonData[i], "resType"); // resItem.overriden = C_Json.GetJsonKeyBool(jsonData[i], "overriden"); if (string.IsNullOrEmpty(resItem.resType)) { continue; } else if (resItem.resType.Equals("texture")) { resItem.textureType = C_Json.GetJsonKeyInt(jsonData[i], "textureType"); resItem.readEnable = C_Json.GetJsonKeyInt(jsonData[i], "readEnable"); resItem.gengrateMipMaps = C_Json.GetJsonKeyInt(jsonData[i], "gengrateMipMaps"); resItem.maxSize = C_Json.GetJsonKeyString(jsonData[i], "maxSize"); resItem.format = C_Json.GetJsonKeyInt(jsonData[i], "format"); } else if (resItem.resType.Equals("audioclip")) { resItem.loadtype = C_Json.GetJsonKeyInt(jsonData[i], "loadtype"); resItem.compressionFormat = C_Json.GetJsonKeyInt(jsonData[i], "compressionFormat"); resItem.quality = C_Json.GetJsonKeyString(jsonData[i], "quality"); resItem.sampleRateSet = C_Json.GetJsonKeyInt(jsonData[i], "sampleRateSet"); } _ResList.Add(resItem); } } }
public static List <HotUpdateItem> ParseHotUpdateConfig(string config) { List <HotUpdateItem> list = new List <HotUpdateItem>(); //解析 if (!string.IsNullOrEmpty(config)) { JsonData configJD = C_Json.GetJsonKeyJsonData(config, "config"); if (configJD != null) { foreach (JsonData itemJD in configJD) { HotUpdateItem item = new HotUpdateItem(); item.Name = C_Json.GetJsonKeyString(itemJD, "name"); item.MD5 = C_Json.GetJsonKeyString(itemJD, "md5"); list.Add(item); } } } return(list); }
public static void Load() { string strData = C_Save.LoadString(Name, C_LocalPath.StreamingAssetsConfigPath); if (!string.IsNullOrEmpty(strData)) { JsonData learningRhythmNameJD = C_Json.GetJsonKeyJsonData(strData, "LearningRhythmName"); if (learningRhythmNameJD != null) { LearningRhythmName = new string[learningRhythmNameJD.Count]; for (int i = 0; i < learningRhythmNameJD.Count; i++) { LearningRhythmName[i] = (string)learningRhythmNameJD[i]; } } JsonData learningRhythmCourseJD = C_Json.GetJsonKeyJsonData(strData, "LearningRhythmCourse"); if (learningRhythmCourseJD != null) { LearningRhythmCourse = new int[learningRhythmCourseJD.Count]; for (int i = 0; i < learningRhythmCourseJD.Count; i++) { LearningRhythmCourse[i] = (int)learningRhythmCourseJD[i]; } } JsonData learningTimeNameJD = C_Json.GetJsonKeyJsonData(strData, "LearningTimeName"); if (learningTimeNameJD != null) { LearningTimeName = new string[learningTimeNameJD.Count]; for (int i = 0; i < learningTimeNameJD.Count; i++) { LearningTimeName[i] = (string)learningTimeNameJD[i]; } } JsonData learningTimeJD = C_Json.GetJsonKeyJsonData(strData, "LearningTime"); if (learningTimeJD != null) { LearningTime = new int[learningTimeJD.Count]; for (int i = 0; i < learningTimeJD.Count; i++) { LearningTime[i] = (int)learningTimeJD[i]; } } JsonData restTimeNameJD = C_Json.GetJsonKeyJsonData(strData, "RestTimeName"); if (restTimeNameJD != null) { RestTimeName = new string[restTimeNameJD.Count]; for (int i = 0; i < restTimeNameJD.Count; i++) { RestTimeName[i] = (string)restTimeNameJD[i]; } } JsonData restTimeJD = C_Json.GetJsonKeyJsonData(strData, "RestTime"); if (restTimeJD != null) { RestTime = new int[restTimeJD.Count]; for (int i = 0; i < restTimeJD.Count; i++) { RestTime[i] = (int)restTimeJD[i]; } } } }
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()); } }
public static void Load() { string strData = C_Save.LoadString(Name, C_LocalPath.StreamingAssetsConfigPath); if (!string.IsNullOrEmpty(strData)) { JsonData levelMaxStarJD = C_Json.GetJsonKeyJsonData(strData, "LevelMaxStar"); if (levelMaxStarJD != null) { LevelMaxStar = new int[levelMaxStarJD.Count]; for (int i = 0; i < levelMaxStarJD.Count; i++) { LevelMaxStar[i] = (int)levelMaxStarJD[i]; } } JsonData levelNameJD = C_Json.GetJsonKeyJsonData(strData, "LevelName"); if (levelNameJD != null) { LevelName = new string[levelNameJD.Count]; for (int i = 0; i < levelNameJD.Count; i++) { LevelName[i] = (string)levelNameJD[i]; } } JsonData levelUnlockStageJD = C_Json.GetJsonKeyJsonData(strData, "LevelUnlockStage"); if (levelUnlockStageJD != null) { LevelUnlockStage = new string[levelUnlockStageJD.Count]; for (int i = 0; i < levelUnlockStageJD.Count; i++) { LevelUnlockStage[i] = (string)levelUnlockStageJD[i]; } } JsonData gradeMaxStarJD = C_Json.GetJsonKeyJsonData(strData, "GradeMaxStar"); if (gradeMaxStarJD != null) { GradeMaxStar = new int[gradeMaxStarJD.Count]; for (int i = 0; i < gradeMaxStarJD.Count; i++) { GradeMaxStar[i] = (int)gradeMaxStarJD[i]; } } JsonData gradeNameJD = C_Json.GetJsonKeyJsonData(strData, "GradeName"); if (gradeNameJD != null) { GradeName = new string[gradeNameJD.Count]; for (int i = 0; i < gradeNameJD.Count; i++) { GradeName[i] = (string)gradeNameJD[i]; } } JsonData gradeUnlockStageJD = C_Json.GetJsonKeyJsonData(strData, "GradeUnlockStage"); if (gradeUnlockStageJD != null) { GradeUnlockStage = new string[gradeUnlockStageJD.Count]; for (int i = 0; i < gradeUnlockStageJD.Count; i++) { GradeUnlockStage[i] = (string)gradeUnlockStageJD[i]; } } } }
void GetTecentReslut(string result) { float score = 0; try { string resultWord = "0"; if (!string.IsNullOrEmpty(result)) { // WordRespone itemDate = JsonUtility.FromJson<WordRespone>(result);//特殊处理的jason,一般jason类继续使用框架jason C_DebugHelper.Log("class:RecognizeAudio function:GetTecentReslut line 59.. result =" + result); string word = C_Json.GetJsonKeyString(result, "inputWords"); #if !UNITY_IOS int pronCompletion = C_Json.GetJsonKeyInt(result, "pronCompletion"); #else #endif int resultCode = C_Json.GetJsonKeyInt(result, "resultCode"); float pronAccuracy = C_Json.GetJsonKeyFloat(result, "pronAccuracy"); float pronFluency = C_Json.GetJsonKeyFloat(result, "pronFluency"); if (resultCode == 1) { if (_ResultType == ResultType.PickWord) { //解析所有的文字,找到分数最高的文字 float wordMaxScore = 0f; JsonData wordList = C_Json.GetJsonKeyJsonData(result, "words"); if (wordList != null) { for (int i = 0; i < wordList.Count; i++) { if (wordList[i] != null) { string wordName = C_Json.GetJsonKeyString(wordList[i], "word"); float pronAccuracy_word = C_Json.GetJsonKeyFloat(wordList[i], "pronAccuracy"); float pronFluency_word = C_Json.GetJsonKeyFloat(wordList[i], "pronFluency"); #if !UNITY_IOS float tmpScore = pronAccuracy_word * 0.6f + pronFluency_word * 100f * 0.4f; #else float tmpScore = pronAccuracy_word; //C_DebugHelper.Log("class:RecognizeAudio function:GetTecentReslut line 153.. pronFluency_word =" + pronFluency_word); #endif if (tmpScore >= wordMaxScore || (i == 0)) { wordMaxScore = tmpScore; resultWord = wordName; } } } } DoScoreCallBack(resultWord); return; } else if (_ResultType == ResultType.PickScore) { //直接计算分数 #if !UNITY_IOS score = (pronAccuracy * 0.6f + pronFluency * 100f * 0.4f) * pronCompletion; #else score = (pronAccuracy * 0.6f + pronFluency * 100f * 0.4f); #endif } } if (_ResultCallback != null) { C_DebugHelper.Log("_ResultCallback ..GetTecentReslut result =" + result); _ResultCallback(score.ToString()); _ResultCallback = null; } } else { C_DebugHelper.Log("class:RecognizeAudio function:GetTecentReslut line 169.. result =" + result); DoScoreCallBack(score.ToString()); } } catch (Exception e) { DoScoreCallBack(score.ToString()); } }