Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        public static WRTimeLineData DeserializeJSON(string json)
        {
            Debug.Log(json);
            WRTimeLineData tld = JsonConvert.DeserializeObject(json, typeof(WRTimeLineData)) as WRTimeLineData;


            return(tld);
        }
Esempio n. 3
0
        public static void Start(ProtoBattleVideoInfo video, int watchRoleId)
        {
            War.videoInfo = video;
            if (video.uid_local > 0)
            {
                War.record.SetWatchCount(video.uid_local, video.view_count++);
            }
            WRTimeLineData timeLineData = WRTimeLineData.Create(video.video_data);

            Start(timeLineData, watchRoleId);
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        internal static void Start(WRTimeLineData timeLineData, int watchRoleId)
        {
            War.watchRoleId  = watchRoleId;
            War.timeLineData = timeLineData;
            timeLineData.enterData.isRecord = true;
            if (timeLineData.overData != null)
            {
                timeLineData.overData.isRecord = true;
            }
            timeLineData.enterData.CheckWatchRole(watchRoleId);

//			Debug.Log ("timeLineDatastarCount Start 1=" + timeLineData.overData.legionDatas[0].starCount + "  "+ timeLineData.overData.legionDatas[0].buildCount);
//			Debug.Log ("timeLineDatastarCount Start 2=" + timeLineData.overData.legionDatas[1].starCount + "  "+ timeLineData.overData.legionDatas[1].buildCount);
            Start(timeLineData.enterData);
        }
Esempio n. 6
0
        public static WRTimeLineData Create(byte[] bytes)
        {
//			StringUtils.PrintBytes("bytes", bytes);
            MemoryStream memStream = new MemoryStream(bytes.Length);

            memStream.Position = 0;
            memStream.Write(bytes, 0, bytes.Length);



            memStream.Position = 0;
            WRTimeLineData timeLineData = Serializer.Deserialize <WRTimeLineData>(memStream);

            memStream.Dispose();
            return(timeLineData);
        }
Esempio n. 7
0
        void Init()
        {
            Debug.Log("WRTimeLine.Init");
            if (!War.isRecord)
            {
                this.enabled = false;
            }
            else
            {
                Debug.Log(" War.timeLineData=" + War.timeLineData);
                timeLineData = War.timeLineData;
                count        = timeLineData.queue.Count;

                if (index < count)
                {
                    action = timeLineData.queue[index];
                    index++;
                }
            }
        }
Esempio n. 8
0
        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());
        }