/// <summary> /// 获取钓鱼加成 /// </summary> /// <returns></returns> uint GetAddIndex() { uint fishingUpFishId = DataManager.Manager <FishingManager>().FishingUpFishId; FishingDataBase fishingDb = GameTableManager.Instance.GetTableItem <FishingDataBase>(fishingUpFishId); if (fishingDb != null) { uint deg = fishingDb.pointerRange;///加成区域圆弧度数 if (tr != null) { Vector3 eulerAngles = tr.value.eulerAngles; float z = eulerAngles.z > 300 ? eulerAngles.z - 360 : eulerAngles.z; //Engine.Utility.Log.Error("--->>> 指针= " + z + " 0.5deg =" + deg * 0.5f + " offset=" + this.m_degOffset); if (z > -deg * 0.5f + this.m_degOffset && z < deg * 0.5f + this.m_degOffset) { //高加成的 Engine.Utility.Log.Error("--->>> 加成为2 !!!"); return(2); } } } Engine.Utility.Log.Error("--->>> 加成为1 !!!"); return(1); }
/// <summary> /// 初始化指针 /// </summary> void InitPointer() { uint fishingUpFishId = DataManager.Manager <FishingManager>().FishingUpFishId; FishingDataBase fishingDb = GameTableManager.Instance.GetTableItem <FishingDataBase>(fishingUpFishId); //初始化指针 if (tr != null) { tr.ResetToBeginning(); tr.PlayForward(); if (fishingDb != null) { tr.duration = fishingDb.ArcTime; } } //初始化转盘区域 m_sprite_PointerBg2.transform.eulerAngles = new Vector3(0, -90, 0); if (fishingDb != null) { uint deg = fishingDb.pointerRange; //加成区域圆弧度数 float fillAmount = deg * 1f / 180f; m_sprite_PointerBg2.fillAmount = fillAmount; this.m_degOffset = GetDegOffset(); m_sprite_PointerBg2.transform.eulerAngles = new Vector3(0, 0, -90 + deg * 0.5f + this.m_degOffset); } else { m_sprite_PointerBg2.fillAmount = 0; } }
/// <summary> /// 通过[鱼ID]二分快速查表 /// </summary> /// <param name="dwID">鱼ID</param> /// <returns></returns> public static FishingDataBase Query(this List <FishingDataBase> sorted, uint dwID) { var key = new FishingDataBase() { dwID = dwID }; var comparer = new Comparer1(); var index = sorted.BinarySearch(key, comparer); return(index >= 0 ? sorted[index] : default(FishingDataBase)); }
/// <summary> /// 深色弧度的一半 /// </summary> /// <returns></returns> float GetHalfDeg() { uint fishingUpFishId = DataManager.Manager <FishingManager>().FishingUpFishId; FishingDataBase fishingDb = GameTableManager.Instance.GetTableItem <FishingDataBase>(fishingUpFishId); if (fishingDb != null) { uint deg = fishingDb.pointerRange; //加成区域圆弧度数 return(deg * 0.5f); } else { Engine.Utility.Log.Error(" fishingUpFishId 出错了 取不到数据!!! "); return(0); } }
/// <summary> /// 钓上鱼了 /// </summary> void InitSuccessFishing() { m_trans_Center.gameObject.SetActive(true); //鱼 uint FishId = DataManager.Manager <FishingManager>().FishId; FishingDataBase fishingDb = GameTableManager.Instance.GetTableItem <FishingDataBase>(FishId); if (fishingDb != null) { // name m_label_fishname_label.text = fishingDb.strName; // icon UIManager.GetTextureAsyn(fishingDb.icon, ref m_iconAsynSeed, () => { if (null != m__icon) { m__icon.mainTexture = null; } }, m__icon, false); //border string borderName = ItemDefine.GetItemBorderIcon(fishingDb.borderId); UIManager.GetAtlasAsyn(UIManager.GetIconName(borderName, false), ref iuiBorderAtlas, () => { if (m_sprite_qualitybox != null) { m_sprite_qualitybox.atlas = null; } }, m_sprite_qualitybox, false); //积分 m_label_score_label.text = fishingDb.score.ToString(); //特效 PlayFishIconEffect(); } StartCoroutine(DelayToFalse()); }
/// <summary> /// 甩杆时告诉客户端几秒出现条什么鱼 /// </summary> /// <param name="msg"></param> public void OnGetOneFish(stGetOneFihsPropertyUserCmd_S msg) { this.m_fishingUpTime = Time.realtimeSinceStartup + msg.time; this.m_fishingUpFishId = msg.kind; FishingDataBase fishingDb = GameTableManager.Instance.GetTableItem <FishingDataBase>(this.m_fishingUpFishId); if (fishingDb != null) { this.m_fishingUpCd = fishingDb.upTime; } else { //没钓到鱼(10s + 2s后自动开始第二次钓鱼) this.m_fishingUpCd = 0; Engine.Utility.Log.Error(" fishId == 0 出错了!!! "); } if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.FishingPanel)) { DataManager.Manager <UIPanelManager>().SendMsg(PanelID.FishingPanel, UIMsgID.eFishingGetOne, null); } }