IEnumerator OnUseJson() { string url = PathUtil.DataUrl + "test_WarEnterData.json"; WWW www = new WWW(url); yield return(www); if (string.IsNullOrEmpty(www.error)) { Debug.Log(url); WarEnterData enterData = JsonConvert.DeserializeObject(www.text, typeof(WarEnterData)) as WarEnterData; War.Start(enterData); } else { Debug.Log(string.Format("<color=red>[WarEnterData] test_WarEnterData.json失败 url={0} error={1} text={2}</color>", url, www.error, www.text)); } www.Dispose(); www = null; // StartCoroutine(CloseSound()); }
public static IEnumerator OnUseJson(int watchRoleId) { yield return(new WaitForEndOfFrame()); string url = PathUtil.DataUrl + "test_record.json"; WWW www = new WWW(url); yield return(www); if (string.IsNullOrEmpty(www.error)) { Debug.Log(url); WRTimeLineData timeLineData = WRTimeLineData.DeserializeJSON(www.text); War.Start(timeLineData, watchRoleId); } else { Debug.Log(string.Format("<color=red>[WRTimeLineData] test_record.json失败 url={0} error={1} text={2}</color>", url, www.error, www.text)); } www.Dispose(); www = null; }
public static IEnumerator OnUseBinary(int watchRoleId) { yield return(new WaitForEndOfFrame()); string filesPath = PathUtil.DataPath + "test_record.bin"; using (var file = File.OpenRead(filesPath)) { WRTimeLineData timeLineData = Serializer.Deserialize <WRTimeLineData>(file); War.Start(timeLineData, watchRoleId); } }
void Test_StartGame() { int stageId = 1091; VSMode vsModel = VSMode.Dungeon; TestWarParameter parameter = GameObject.Find("GlobalGenerator").GetComponent <TestWarParameter>(); if (parameter != null) { stageId = parameter.stageId; vsModel = parameter.vsMode; if (parameter.useJsonData) { StartCoroutine(OnUseJson()); return; } else if (parameter.useRecrodJson) { StartCoroutine(WRTimeLineData.OnUseJson(parameter.watchRoleId)); return; } else if (parameter.useRecrodBinary) { StartCoroutine(WRTimeLineData.OnUseBinary(parameter.watchRoleId)); return; } } // heroSkill=[heroId, skillId, skillLevel, skillId2, skillLevel2] // WarEnterData enterData = WarEnterData.CreateTest(3004, 1, new int[][]{ // new int[]{2, 20002, 1, 1, 101, 1}, // new int[]{5, 20003, 2, 1, 102, 1} // }); WarEnterData enterData; enterData = WarEnterData.CreateTest(stageId, 1, // 自己技能 new int[][] { // new int[]{20003, 8, 1, 0, 1}, // new int[]{20004, 8, 1, 0, 1}, // new int[]{20010, 8, 1, 0, 0}, // new int[]{20102, 8, 1, 0, 0}, // new int[]{20107, 8, 1, 0, 0}, // new int[]{20109, 8, 1, 0, 0}, // new int[]{20202, 17, 1, 0, 0}, // new int[]{20204, 19, 1, 0, 0}, // new int[]{20104, 8, 1, 0, 0}, // new int[]{20205, 8, 1, 0, 0}, // new int[]{20104, 3, 1, 0, 0}, // new int[]{20206, 3, 1, 0, 0}, // new int[]{20205, 12, 1, 0, 0}, new int[] { 20301, 19, 1, 0, 0 }, new int[] { 20302, 24, 1, 0, 0 }, new int[] { 20303, 25, 1, 0, 0 }, new int[] { 20304, 32, 1, 0, 0 }, new int[] { 20305, 33, 1, 0, 0 }, // new int[]{20301, 8, 1, 0, 0}, // new int[]{20302, 32, 1, 0, 0}, // new int[]{20303, 32, 1, 0, 0}, // new int[]{20304, 3, 1, 0, 0}, // new int[]{20305, 32, 1, 0, 0}, //new int[]{20202, 100004, 1, 0, 0}, //new int[]{20204, 100005, 1, 0, 0}, //new int[]{20205, 100006, 1, 0, 0}, //new int[]{20301, 100007, 1, 0, 0}, //new int[]{20302, 100008, 1, 0, 0}, }, //电脑技能 new int[][] { // new int[]{20301, 251001, 1, 0, 0}, // new int[]{20302, 251001, 1, 0, 0}, // new int[]{20303, 251001, 1, 0, 0}, new int[] { 20301, 101001, 1, 0, 0 }, new int[] { 20302, 191001, 1, 0, 0 }, new int[] { 20303, 251001, 1, 0, 0 }, new int[] { 20304, 311001, 1, 0, 0 }, } ); enterData.skillConfigDict = skillConfigs; enterData.vsmode = vsModel; War.Start(enterData); // StartCoroutine(CloseSound()); }