private void errorHandler(SAFactoryEvent e) { SASocketDataDAO sdd = (SASocketDataDAO)e.Body; SError.Builder error = (SError.Builder)CommandCollection.getDataModel(ProtoTypeEnum.SError, sdd.bytes); SAUtils.LogError("错误码 : " + error.Code); }
private void fishChapterHandler(SAFactoryEvent action) { SASocketDataDAO sdd = (SASocketDataDAO)action.Body; fishChapter = (SFishChapter.Builder)CommandCollection.getDataModel(ProtoTypeEnum.SFishChapter, sdd.bytes); //关卡信息 Dictionary <int, STChapter> chapterMap = STChapter.getMap(); STChapter chapterData = chapterMap[fishChapter.ChapterID]; //关卡信息 string[] fishData = chapterData.SOF; //关卡鱼群 List <FishData> sof = new List <FishData>(); //关卡鱼群数据整理 sofVO = new Dictionary <int, FishData>(); FishData fd; int len = fishChapter.FishListCount; //只遍历存活的鱼群下标 int exist; //存活鱼的序号 for (int i = 0; i < len; ++i) //排列大小 { exist = fishChapter.GetFishList(i); fd = new FishData(exist, fishData[exist]);//找到存活的鱼数据 sof.Add(fd); sofVO.Add(exist, fd); } sof.Sort((FishData f1, FishData f2) => //从小到大 { return(f1.delay - f2.delay); }); ft = gameObject.GetComponent <FishTarget>(); if (null != ft) { ft.close(); Destroy(ft); } ft = gameObject.AddComponent <FishTarget>(); ft.init(this, fishChapter.StartTime, fishChapter.CurrentTime, sof); }