//#region 指示器 ///// <summary> ///// 指示器对象显示半径 ///// </summary> //public float BillboardRadius = 600; ///// <summary> ///// 指示器对象在这个角度内以直线方式绘制 ///// </summary> //public int BillboardAngle = 30; ///// <summary> ///// 指示器坐标缓存 ///// </summary> //protected UIBillboardCache BillboardCache = new UIBillboardCache(); ///// <summary> ///// 临时实体数据 ///// </summary> //private List<UIBillboardQueryResult> tmpAroundEntitys = new List<UIBillboardQueryResult>(); ///// <summary> ///// 范围内活动的实体 ///// </summary> //protected Dictionary<Int32, EntityView> RangeActivityEntity = new Dictionary<int, EntityView>(); ///// <summary> ///// 需要隐藏的实体 ///// </summary> //List<int> HideHeroList = new List<int>(); ////保存附近玩家 //public void saveAroundPlayer() //{ // EntityView ev = EntityFactory.getMainPlayer(); // if (ev == null) // { // return; // } // List<Int32> TmpEntityIDList = new List<int>(RangeActivityEntity.Keys); // IList<EntityView> AroundEntitiesList = MapFinderManager.Nearest(ev.StateMachine.transform.position, ev.Sight, SPELL.CampFlag.CampFlag_Enemy); // if (AroundEntitiesList == null) // { // return; // } // Int32 nTmpEntityID = 0; // foreach (EntityView Entity_Ev in AroundEntitiesList) // { // nTmpEntityID = Entity_Ev.ID; // if (Entity_Ev == null || Entity_Ev.StateMachine == null || Entity_Ev.StateMachine.GetState() == EntityState.Dead || Entity_Ev.Type != ENTITY_TYPE.TYPE_PLAYER_ROLE) // continue; // if (!RangeActivityEntity.ContainsKey(nTmpEntityID)) // { // RangeActivityEntity.Add(nTmpEntityID, Entity_Ev); // } // else // { // TmpEntityIDList.Remove(nTmpEntityID); // } // } // while (TmpEntityIDList.Count > 0) // { // nTmpEntityID = TmpEntityIDList[0]; // RangeActivityEntity.Remove(nTmpEntityID); // TmpEntityIDList.RemoveAt(0); // } //} ////更新指示器公告板信息 //private void UpdateBillboard(System.Collections.Generic.List<UIBillboardQueryResult> entitys) //{ // BillboardCache.BeginProcessing(); // SFDisplayInfo info; // UIBillboardMC tmpBillboard; // for (int i = 0; i < entitys.Count; i++) // { // //从缓冲列表里获取可用的对象 // if (BillboardCache.GetUnusedBillboardMovieclip(entitys[i].entityID, out tmpBillboard)) // { // info = tmpBillboard.Billboard.GetDisplayInfo(); // info.Visible = true; // info.X = entitys[i].x; // info.Y = entitys[i].y; // tmpBillboard.Billboard.SetDisplayInfo(info); // EntityView targetEntityView = EntityFactory.getEntityViewByID(entitys[i].entityID); // int nEntityHeroID = targetEntityView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION); // int nTargetCamp = (int)targetEntityView.CampFlag; // //public function SetHeroBearing(_nTargetHeroPortraitID:int,_nTargetCamp:int,_strTargetDistance:String) // if (tmpBillboard.Billboard.Invoke("SetHeroBearing", nEntityHeroID, nTargetCamp, entitys[i].angle,entitys[i].distance+"米") == null) // { // Trace.LogError("call SetHeroBearing failed."); // } // } // } // BillboardCache.EndProcessing(); //} //private void GetPlayerAndUpdate() //{ // //移除上次调用存储的数据 // tmpAroundEntitys.Clear(); // if (RangeActivityEntity.Count > 0 && EntityFactory.MainHeroView.StateMachine.GetState() != EntityState.Dead) // { // foreach (KeyValuePair<int, EntityView> keypair in RangeActivityEntity) // { // GetQueryTarget(keypair.Key, keypair.Value.gameObject.transform); // } // } // UpdateBillboard(tmpAroundEntitys); //} ////计算英雄与附近的玩家目标的角度并映射到UI上 //private void GetQueryTarget(Int32 entityID, Transform TargetEntityTrans) //{ // Transform CameraTransform = SoldierCamera.MainInstance.getCameraTransform(); // //计算位置应该是计算英雄的位置,而不是相机的位置 // float checkDis = Vector3.Distance(TargetEntityTrans.position, EntityFactory.MainHero.transform.position); // if (checkDis > EntityFactory.MainHeroView.Sight || ScreenRaycast.isInScreen(TargetEntityTrans.position)) // return; // Vector3 vecHeroPos = EntityFactory.MainHeroView.gameObject.transform.position; // Vector3 DirHeroToTarget = TargetEntityTrans.position - vecHeroPos; // Vector3 DirHeroToCamera = CameraTransform.position - vecHeroPos; // DirHeroToTarget.y = DirHeroToCamera.y = 0; // //判断目标在相机的左右方,-1左方,+1右方 // Vector3 vecCross = Vector3.Cross(DirHeroToTarget.normalized, DirHeroToCamera.normalized); // float fLorR = Mathf.Sign(-vecCross.y); // //计算之间的夹角 // float angle = Vector3.Angle(DirHeroToTarget.normalized, DirHeroToCamera.normalized); // float relAngle = (angle * fLorR + 90) % 360; // float MovieWidth = MovieDef.GetWidth(); // float MovieHeight = MovieDef.GetHeight(); // UIBillboardQueryResult qr = new UIBillboardQueryResult(); // qr.entityID = entityID; // qr.x = (MovieWidth / 2) + BillboardRadius * (Mathf.Cos(Mathf.Deg2Rad * (relAngle))); // qr.y = (MovieHeight / 2) + BillboardRadius * (Mathf.Sin(Mathf.Deg2Rad * (relAngle))); // //在这个角度范围内图标水平移动 // if (relAngle > BillboardAngle && relAngle < BillboardAngle + 120) // { // qr.y = (MovieHeight / 2) + BillboardRadius * (Mathf.Sin(Mathf.Deg2Rad * BillboardAngle)); // } // qr.distance = Convert.ToUInt32(checkDis); // qr.angle = Convert.ToInt32(relAngle+90); // tmpAroundEntitys.Add(qr); //} //public void ClearBillboardCache() //{ // if (BillboardCache != null) // { // BillboardCache.ClearCache(); // BillboardCache = null; // } // if (RangeActivityEntity == null) // { // RangeActivityEntity.Clear(); // RangeActivityEntity = null; // } // if (tmpAroundEntitys != null) // { // tmpAroundEntitys.Clear(); // tmpAroundEntitys = null; // } // if (HideHeroList != null) // { // HideHeroList.Clear(); // HideHeroList = null; // } //} //public void OnTimer(int nTimerID) //{ // switch( nTimerID ) // { // case (int)EN_GameHud_Timer.ENGT_Pointer: // { // saveAroundPlayer(); // int nCount = HideHeroList.Count; // for (int i = 0; i < nCount; ++i ) // { // if (RangeActivityEntity.ContainsKey(HideHeroList[i])) // { // RangeActivityEntity.Remove(HideHeroList[i]); // } // } // } // break; // default: // break; // } //} //public void OnEvent(U3D_Render.Utility.EVENT eventID, int sourceID, System.Object objEvent) //{ // switch( eventID ) // { // case EVENT.ENTITY_SHOW_HERO: // { // if ( objEvent == null ) // return; // SEntityShowHero event_data = (SEntityShowHero)objEvent; // int nId = event_data.ev.ID; // if (event_data.bIsHide && !HideHeroList.Contains(nId)) // HideHeroList.Add(nId); // else if (!event_data.bIsHide && HideHeroList.Contains(nId)) // HideHeroList.Remove(nId); // } // break; // default: // break; // } //} //#endregion #region 技能提示 public void CreatureShowPormptUI(cmd_creature_ShowPromptUI data) { if (vSpellPrompt == null) { vSpellPrompt = new Value(); MyRoot.AttachMovie(ref vSpellPrompt, "Com.Scaleform.WarGameHud.WGH_SpellPrompt", "vSpellPrompt", 0); SFDisplayInfo di = vSpellPrompt.GetDisplayInfo(); di.X = 1920 / 2 + 100; di.Y = 1080 - 300; vSpellPrompt.SetDisplayInfo(di); } IntPtr DesPtr, IconPtr; //R ASpeedGame.Data.GameMobaSchemes.SSchemeShowSpellPrompt SchemesSpellPrompt = ASpeedGame.Data.GameMobaSchemes.GameMobaSchemesManager.Instance.GetSpellPromptInfo(data.nPromptID); if (SchemesSpellPrompt != null) { DesPtr = GameLogicAPI.getShortcutDes(SchemesSpellPrompt.nSlotID, (int)SLOT_TYPE.SLOT_TYPE_SKILL); IconPtr = GameLogicAPI.getSpellData(SchemesSpellPrompt.nSpellID); if (DesPtr != IntPtr.Zero && IconPtr != IntPtr.Zero) { string des = IntPtrHelper.Ptr2Str(DesPtr); SPELL.SPELL_DATA spellData = IntPtrHelper.toData <SPELL.SPELL_DATA>(IconPtr); if (vSpellPrompt == null || vSpellPrompt.Invoke("SetSpellPromptInfo", spellData.nIcon, des.ToUpper(), Convert.ToBoolean(data.nType)) == null) { Trace.LogWarning("SetSpellPromptInfo failed."); } } } }
public void SetXPSkill(UIXPSkillCD msg) { if (msg == null) { return; } SWar2ViewMsgXPBeginCD data = msg.data; PlayerCombatData playerWarData; if (m_dicPlayerWarInfo.TryGetValue((int)data.uID, out playerWarData)) { IntPtr Ptr = GameLogicAPI.getSpellData(data.nSkillID); if (Ptr == IntPtr.Zero) { Debug.LogWarning("SetXPSkill:Ptr is null"); return; } SPELL.SPELL_DATA spellData = IntPtrHelper.toData <SPELL.SPELL_DATA>(Ptr); Sprite sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_Skill, WndID.WND_ID_WAR_XPSKILL, 1, spellData.nIcon); if (sprite == null) { Debug.LogFormat("sprite is null.{0},{1}", data.nSkillID, spellData.nIcon); } playerWarData.summonerSkill3Image.enabled = true; playerWarData.summonerSkill3Image.sprite = sprite; int elapseTime = (int)((double)GameLogicAPI.getSyncTickCount() - (double)data.nBeginCDTick / 1000); int remainTime = data.nCDTime / 1000 - elapseTime; playerWarData.summonerSkill3Image.AddNewMaterial(EUIShaderType.EST_Gray); } }