private void InterrupCallback(string arg0) { JSONObject js = JSONObject.Create(arg0); if (js.GetBoolValue("is_interrupt")) { NoticeManager.Instance.SendNotice(Consts.NOTICE_SYSTEM_INTERRUPT); } }
public IOralServerResult ParseServerResult(string json) { try { if (string.IsNullOrEmpty(json)) { "error: ParseServerResult : json null".Log(); return(null); } else { } "log".Log(json); #if SHIP_DOCK_SDK //UnityEngine.Debug.Log("1"); JSONObject tmp = JSONObject.Create(json); Seq = tmp.GetIntValue("seq"); //UnityEngine.Debug.Log("2"); End = tmp.GetIntValue("end"); //UnityEngine.Debug.Log("3"); JSONObject errJs = tmp.GetField("error"); //UnityEngine.Debug.Log("4"); ErrorDsc error = new ErrorDsc(); error.Code = errJs.GetIntValue("code"); //UnityEngine.Debug.Log("5"); error.Desc = errJs.GetStringValue("desc"); //UnityEngine.Debug.Log("6"); error.RequestId = errJs.GetStringValue("requestId"); //UnityEngine.Debug.Log("7"); Error = error; JSONObject infos = tmp.GetField("ret"); //UnityEngine.Debug.Log("8"); AudioUrl = infos.GetStringValue("audioUrl"); //UnityEngine.Debug.Log("9"); PronAccuracy = infos.GetFloatValue("pronAccuracy"); //UnityEngine.Debug.Log("10"); PronFluency = infos.GetFloatValue("pronFluency"); //UnityEngine.Debug.Log("11"); PronCompletion = infos.GetFloatValue("pronCompletion"); //UnityEngine.Debug.Log("12"); SessionId = infos.GetStringValue("sessionId"); //UnityEngine.Debug.Log("13"); SuggestedScore = infos.GetFloatValue("suggestedScore"); //UnityEngine.Debug.Log("14"); JSONObject wordsjs = infos.GetField("words"); //UnityEngine.Debug.Log("15"); if (wordsjs.list.Count > 0) { //UnityEngine.Debug.Log(string.Format("count:{0}",wordsjs.list.Count)); Word[] words = new Word[wordsjs.list.Count]; for (int i = 0; i < words.Length; i++) { words[i] = new Word(); JSONObject tempList = wordsjs.list[i]; // words[i].BeginTime = wordsjs.list[i].GetIntValue("beginTime"); words[i].BeginTime = tempList.GetIntValue("beginTime"); //UnityEngine.Debug.Log("16"); //words[i].EndTime = wordsjs.list[i].GetIntValue("endTime"); words[i].BeginTime = tempList.GetIntValue("beginTime"); //UnityEngine.Debug.Log("17"); // words[i].MatchTag = wordsjs.list[i].GetIntValue("matchTag"); words[i].MatchTag = tempList.GetIntValue("matchTag"); //UnityEngine.Debug.Log("18"); //words[i].PronFluency = wordsjs.list[i].GetFloatValue("pronFluency"); words[i].PronFluency = tempList.GetFloatValue("pronFluency"); //UnityEngine.Debug.Log("19"); // words[i].PronAccuracy = wordsjs.list[i].GetFloatValue("pronAccuracy"); words[i].PronAccuracy = tempList.GetFloatValue("pronAccuracy"); //UnityEngine.Debug.Log("20"); // words[i].Content = wordsjs.list[i].GetStringValue("word"); words[i].Content = tempList.GetStringValue("word"); //UnityEngine.Debug.Log("21"); // JSONObject phonesObj = wordsjs.list[i].GetField("phoneInfos"); JSONObject phonesObj = tempList.GetField("phoneInfos"); // UnityEngine.Debug.Log("服务器返回结果,单词的音素长度:".Append()); if (phonesObj.list.Count > 0) { //UnityEngine.Debug.Log(string.Format("phonesObj.list.Count:{0}",phonesObj.list.Count)); PhoneInfo[] phoneInfos = new PhoneInfo[phonesObj.list.Count]; words[i].PhoneInfos = phoneInfos; for (int j = 0; j < phonesObj.list.Count; j++) { phoneInfos[j] = new PhoneInfo(); JSONObject tempPhone = phonesObj.list[j]; // phoneInfos[j].BeginTime = phonesObj.list[j].GetIntValue("beginTime"); phoneInfos[j].BeginTime = tempPhone.GetIntValue("beginTime"); //UnityEngine.Debug.Log("23"); //phoneInfos[j].EndTime = phonesObj.list[j].GetIntValue("endTime"); phoneInfos[j].EndTime = tempPhone.GetIntValue("endTime"); //UnityEngine.Debug.Log("24"); //phoneInfos[j].DetectedStress = phonesObj.list[j].GetBoolValue("detectedStress"); phoneInfos[j].DetectedStress = tempPhone.GetBoolValue("detectedStress"); //UnityEngine.Debug.Log("25"); // phoneInfos[j].Phone = phonesObj.list[j].GetStringValue("phone"); phoneInfos[j].Phone = tempPhone.GetStringValue("phone"); //UnityEngine.Debug.Log("26"); // phoneInfos[j].PronAccuracy = phonesObj.list[j].GetFloatValue("pronAccuracy"); phoneInfos[j].PronAccuracy = tempPhone.GetFloatValue("pronAccuracy"); //UnityEngine.Debug.Log("27"); // phoneInfos[j].Stress = phonesObj.list[j].GetBoolValue("stress"); phoneInfos[j].Stress = tempPhone.GetBoolValue("stress"); //UnityEngine.Debug.Log("28"); } } else { } } Words = words; } else { "log:Words null".Log(); Words = null; } #endif return(this); } catch (Exception ex) { "error: SDK ParseServerResult method expection,the return value IOralServerResult is null, details - {0}".Log(ex.ToString()); return(null); } }
private void CheckSkillInfos(ref RoleSkillListSObj info, ref SkillInfo[] skillInfos) { JSONObject item = default; if (mSInfos == default) { mMode = 0; } switch (mMode) { case 2: info.skills.infos = new SkillInfo[mSInfos.list.Count]; skillInfos = info.skills.infos; break; } int max = skillInfos.Length; for (int i = 0; i < max; i++) { if (skillInfos[i] != default && skillInfos.Length > i) { EditorGUILayout.HelpBox("技能 ".Append(skillInfos[i].name.ToString(), " -- ", skillInfos[i].skillName), MessageType.Info); } switch (mMode) { case 1: item = JSONObject.Create(JSONObject.Type.OBJECT); item.AddField("name", skillInfos[i].name); item.AddField("skillName", skillInfos[i].skillName); item.AddField("skillParams", JSONObject.Create(JSONObject.Type.ARRAY)); break; case 2: skillInfos[i] = new SkillInfo(); item = mSInfos[i]; skillInfos[i].name = item.GetIntValue("name"); skillInfos[i].skillName = item.GetStringValue("skillName"); break; } switch (mMode) { case 2: item = mSInfos[i]["skillParams"]; skillInfos[i].skillParams = new ValueSubgroup[item.list.Count]; break; } int n = skillInfos != default && skillInfos.Length > 0 && skillInfos[i].skillParams != default ? skillInfos[i].skillParams.Length : 0; ValueSubgroup vs; for (int j = 0; j < n; j++) { var v = skillInfos[i]; switch (mMode) { case 2: v.skillParams[j] = new ValueSubgroup(); break; } vs = v.skillParams[j]; vs.valueTypeInEditor = (ValueItemType)EditorGUILayout.EnumPopup(vs.valueTypeInEditor); vs.valueType = (int)vs.valueTypeInEditor; vs.valueInEditor = vs.valueInEditor == default ? string.Empty : vs.valueInEditor; vs.dampTime = EditorGUILayout.FloatField("时间", vs.dampTime); switch (mMode) { case 1: JSONObject s = JSONObject.Create(JSONObject.Type.OBJECT); s.AddField("valueTypeInEditor", vs.valueType); s.AddField("valueInEditor", vs.valueInEditor); s.AddField("keyField", vs.keyField); s.AddField("valueType", vs.valueType); s.AddField("str", vs.str); s.AddField("floatValue", vs.floatValue); s.AddField("triggerValue", vs.triggerValue); if (vs.dampTime > 0f) { s.AddField("dampTime", vs.dampTime); } item["skillParams"].Add(s); break; case 2: JSONObject ssi = item[j]; vs.valueTypeInEditor = (ValueItemType)ssi.GetIntValue("valueTypeInEditor"); vs.valueInEditor = ssi.GetStringValue("valueInEditor"); vs.keyField = ssi.GetStringValue("keyField"); vs.valueType = ssi.GetIntValue("valueType"); vs.str = ssi.GetStringValue("str"); vs.floatValue = ssi.GetFloatValue("floatValue"); vs.triggerValue = ssi.GetBoolValue("triggerValue"); vs.dampTime = ssi.HasField("dampTime") ? ssi.GetFloatValue("dampTime") : 0f; skillInfos[i].skillParams[j] = vs; break; } switch (vs.valueTypeInEditor) { case ValueItemType.STRING: vs.str = vs.valueInEditor; break; case ValueItemType.INT: case ValueItemType.FLOAT: vs.floatValue = float.Parse(string.IsNullOrEmpty(vs.valueInEditor) ? "0" : vs.valueInEditor); break; case ValueItemType.DOUBLE: vs.doubleValue = double.Parse(string.IsNullOrEmpty(vs.valueInEditor) ? "0" : vs.valueInEditor); break; } EditorGUILayout.TextField("参数名 ".Append(vs.keyField)); if (vs.valueType == ValueItem.BOOL) { vs.triggerValue = EditorGUILayout.Toggle("布尔值", vs.triggerValue); } else { EditorGUILayout.TextField("其他值", vs.valueInEditor); } v.skillParams[j] = vs; skillInfos[i] = v; } switch (mMode) { case 1: mSInfos.Add(item); break; } info.skills.infos = skillInfos; } }
private void CheckMotions(ref RoleSkillListSObj info, ref SkillInfo[] skillInfos) { switch (mMode) { case 2: info.skillMotions.infos = new MotionSceneInfo[mMInfos.list.Count]; break; } JSONObject item = default; MotionSceneInfo[] motionSceneInfos = info.skillMotions.infos; int max = motionSceneInfos.Length; for (int i = 0; i < max; i++) { var motionInfo = motionSceneInfos[i]; if (mMode == 0) { EditorGUILayout.HelpBox("技能动画 ".Append(motionInfo.ID.ToString(), "--", motionInfo.skillName), MessageType.Info); motionInfo.ID = EditorGUILayout.IntField("动画ID ", motionInfo.ID); motionInfo.isCombo = EditorGUILayout.Toggle("是否连续动画", motionInfo.isCombo); } switch (mMode) { case 1: item = JSONObject.Create(JSONObject.Type.OBJECT); item.AddField("ID", motionInfo.ID); item.AddField("skillName", skillInfos[i].skillName); item.AddField("isCombo", motionInfo.isCombo); item.AddField("indexsForID", JSONObject.Create(JSONObject.Type.ARRAY)); item.AddField("checkComboTime", motionInfo.checkComboTime); break; case 2: item = mMInfos[i]; motionSceneInfos[i] = new MotionSceneInfo(); motionInfo = motionSceneInfos[i]; motionInfo.ID = item.GetIntValue("ID"); motionInfo.skillName = item.GetStringValue("skillName"); motionInfo.isCombo = item.GetBoolValue("isCombo"); motionInfo.checkComboTime = item.GetFloatValue("checkComboTime"); motionInfo.indexsForID = new int[mMInfos[i].GetField("indexsForID").Count]; break; } if (motionInfo.isCombo) { int n = motionInfo.indexsForID.Length; for (int j = 0; j < n; j++) { if (mMode == 0) { if (motionInfo.indexsForID[j] < skillInfos.Length) { EditorGUILayout.TextField("技能信息关联 ".Append(j.ToString()), skillInfos[motionInfo.indexsForID[j]].skillName); } motionInfo.indexsForID[j] = EditorGUILayout.IntField("技能信息索引:", motionInfo.indexsForID[j]); } switch (mMode) { case 1: item["indexsForID"].Add(motionInfo.indexsForID[j]); break; case 2: item = mMInfos[i].GetField("indexsForID"); motionInfo.indexsForID[j] = (int)(item[j].n); break; } } motionInfo.checkComboTime = EditorGUILayout.FloatField("连续动画检测时间间隔:", motionInfo.checkComboTime); } else { if (mMode == 0) { if (motionInfo.indexsForID[0] < skillInfos.Length) { EditorGUILayout.TextField("技能信息关联", skillInfos[motionInfo.indexsForID[0]].skillName); } motionInfo.indexsForID[0] = EditorGUILayout.IntField("技能信息索引:", motionInfo.indexsForID[0]); } switch (mMode) { case 1: item["indexsForID"].Add(motionInfo.indexsForID[0]); break; case 2: item = mMInfos[i]["indexsForID"]; motionInfo.indexsForID[0] = (int)item[0].n; break; } } switch (mMode) { case 1: mMInfos.Add(item); break; } } }