Example #1
0
        public void SetXPSkillInfo(int nSpellID)
        {
            if (nSpellID <= 0)
            {
                Debug.LogWarning("XPSKill," + nSpellID);
                return;
            }

            IntPtr Ptr = GameLogicAPI.getSpellData(nSpellID);

            if (Ptr == IntPtr.Zero)
            {
                Debug.LogWarning("XPSKill,Ptr == IntPtr.Zero," + nSpellID);
                return;
            }

            SPELL.SPELL_DATA spellData = IntPtrHelper.toData <SPELL.SPELL_DATA>(Ptr);
            IntPtr           strPtr    = GameLogicAPI.getSpellStrData(nSpellID, (int)SPELL_DATA_ID.SPDATA_DESC);
            String           szDesc    = IntPtrHelper.Ptr2Str(strPtr);

            Debug.Log("XPSKill," + spellData.nID + "," + szDesc + "," + nSpellID);

            UBB.toHtml(ref szDesc, UBB_FORMAT_TYPE.UGUI);

            slotTooltipTrigger.SetText(UTooltipParamName.BodyText, szDesc);
            slotTooltipTrigger.enabled = true;

            skillImage.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_Skill, WndID.WND_ID_WAR_XPSKILL, 1, spellData.nIcon);
            skillImage.gameObject.SetActive(true);

            xpSkillName = spellData.szName;
        }
Example #2
0
    //#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.");
                }
            }
        }
    }
Example #3
0
        public void SetData()
        {
            if (EntityFactory.MainHeroView == null)
            {
                return;
            }
            int nMatchType = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MATCHTYPE);
            int nRankScore = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_RANKSCORE);
            int nRankGrade = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_RANKGRADE);

            if (nRankScore <= 0)
            {
                RankInvalidFrame.SetActive(true);
                RankFrame.SetActive(false);
                return;
            }

            int    nRankIcon    = GameLogicAPI.getRankIconIDByGrade(nMatchType, nRankGrade);
            int    nRankStar    = GameLogicAPI.getActorRankStar(nMatchType, nRankScore);
            int    nMaxRankStar = GameLogicAPI.getActorCurRankMaxStar(nMatchType, nRankScore);
            IntPtr ptr          = GameLogicAPI.getActorRankNameByGrade(nMatchType, nRankGrade);
            string strRankName  = "";

            if (ptr != IntPtr.Zero)
            {
                strRankName = IntPtrHelper.Ptr2Str(ptr);
            }

            RankInvalidFrame.SetActive(false);
            RankFrame.SetActive(true);
            RankImg.sprite    = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankImage, WndID.WND_ID_WAR_MAIN_FRAME, 1, nRankIcon);
            RankGradeDes.text = strRankName;
            for (int index = 0; index < RankStarFrame.childCount; ++index)
            {
                RankStarFrame.GetChild(index).gameObject.SetActive(true);
                if (nRankStar > 0)
                {
                    RankStarFrame.GetChild(index).GetComponent <Image>().sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankStarImage, WndID.WND_ID_WAR_MAIN_FRAME, 2);
                    nRankStar--;
                    nMaxRankStar--;
                }
                else if (nMaxRankStar > 0)
                {
                    RankStarFrame.GetChild(index).GetComponent <Image>().sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankStarImage, WndID.WND_ID_WAR_MAIN_FRAME, 1);
                    nMaxRankStar--;
                }
                else
                {
                    RankStarFrame.GetChild(index).gameObject.SetActive(false);
                }
            }

            if (param != null)
            {
                UEffectManager.Instance.DestroyEffect(UEffectType.UET_EffectPrefab, ref param);
                param = null;
            }
            param = new UEffectPrefabParam(_eType: UEffectPrefabType.UEPT_WarMain_RankEffect1 + nRankIcon - 1, _tfAttachParent: RankImg.gameObject.transform, _bAutoDestroy: false);
            UEffectManager.Instance.CreateEffect(UEffectType.UET_EffectPrefab, ref param);
        }
Example #4
0
        public virtual void SetData(UListItemRankRecord item)
        {
            if (item.node.wSeasonID <= 0)
            {
                BgIcon.gameObject.SetActive(true);
                ItemView.SetActive(false);
                BgIcon.raycastTarget = false;
                return;
            }
            BgIcon.gameObject.SetActive(true);
            BgIcon.raycastTarget = true;
            ItemView.SetActive(true);

            DateTime beginTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(item.node.nBeginTime);

            beginTime = beginTime.ToLocalTime();
            DateTime endTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(item.node.nEndTime);

            endTime     = endTime.ToLocalTime();
            Season.text = string.Format("({0}){1}年{2}月--{3}年{4}月", item.node.szSeasonTitle, beginTime.Year, beginTime.Month, endTime.Year, endTime.Month);

            int    nMatchType  = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MATCHTYPE);
            IntPtr ptr         = GameLogicAPI.getActorRankNameByGrade(nMatchType, item.node.wRankGrade);
            string strRankName = "";

            if (ptr != IntPtr.Zero)
            {
                strRankName = IntPtrHelper.Ptr2Str(ptr);
            }
            Rank.text = strRankName;

            WinCount.text = item.node.wWinCount.ToString();

            float fWinPro = item.node.wMatchCount > 0 ? (float)item.node.wWinCount / item.node.wMatchCount : 0;

            WinPro.text = string.Format("{0:F0}%", fWinPro * 100);

            int nIndex = 0;

            for (int i = 0; i < item.node.wHeroRecord.Length; i = i + 3)
            {
                int   nHeroID     = item.node.wHeroRecord[i];
                int   nMatchCount = item.node.wHeroRecord[i + 1];
                int   nWinCount   = item.node.wHeroRecord[i + 2];
                float fHeroWinPro = nMatchCount > 0 ? (float)nWinCount / nMatchCount : 0;

                MostUseHero[nIndex].sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_RANK_RECORD, 1, 4, nHeroID);

                string strTip = String.Format("胜率:{0}%<br>总场次:{1}", fHeroWinPro * 100, nMatchCount);
                UBB.toHtml(ref strTip);
                MostUseHeroTrigger[nIndex].SetText(UTooltipParamName.BodyText, strTip);

                nIndex++;
            }
        }
Example #5
0
        public void SetData(bool bSelfCaptain, cmd_entity_teammate_info data)
        {
            m_nPDBID = data.nPDBID;

            PlayerGo.SetActive(true);
            EmptyGo.SetActive(false);

            // HeadIcon SexIcon
            if (data.nSex < (int)PERSON_SEX.SEX_MAX && data.nSex >= (int)PERSON_SEX.SEX_MALE)
            {
                SexIcon.gameObject.SetActive(true);
                SexIcon.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_KinSex, WndID.WND_ID_RANK_INVITE, data.nSex + 1);
                HeadIcon.gameObject.SetActive(true);
                HeadIcon.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_PlayerHead, WndID.WND_ID_RANK_INVITE, 1, data.nSex + 1);
            }
            else
            {
                SexIcon.gameObject.SetActive(false);
                HeadIcon.gameObject.SetActive(false);
            }

            MasterIcon.gameObject.SetActive(data.isCaptain > 0);
            DeleteBtn.gameObject.SetActive(bSelfCaptain && data.isCaptain <= 0);

            NameDesc.text = data.szName;

            int nMatchType = data.byMatchType;
            int nRankScore = data.nRankScore;
            int nRankGrade = data.nRankGrade;

            if (nRankScore <= 0)
            {
                RankFrame.SetActive(false);
                return;
            }
            RankFrame.SetActive(true);

            int    nRankIcon   = GameLogicAPI.getRankIconIDByGrade(nMatchType, nRankGrade);
            IntPtr ptr         = GameLogicAPI.getActorRankNameByGrade(nMatchType, nRankGrade);
            string strRankName = "";

            if (ptr != IntPtr.Zero)
            {
                strRankName = IntPtrHelper.Ptr2Str(ptr);
            }
            RankIcon.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankImage, WndID.WND_ID_WAR_MAIN_FRAME, 1, nRankIcon);
            RankDesc.text   = strRankName;
        }
Example #6
0
        public void SetData(int nMatchType)
        {
            m_nMatchType = nMatchType;

            IntPtr ptr          = GameLogicAPI.getMatchNameByMatchType(nMatchType);
            string strMatchName = "";

            if (ptr != IntPtr.Zero)
            {
                strMatchName = IntPtrHelper.Ptr2Str(ptr);
            }
            TitleDesc.text = strMatchName;

            switch (nMatchType)
            {
            case (int)EMMatchType.MatchType_Match:
            {
                StartBtnDesc.text = "开始匹配";
            }
            break;

            case (int)EMMatchType.MatchType_MachineMatch:
            {
                StartBtnDesc.text = "开始人机";
            }
            break;

            case (int)EMMatchType.MatchType_Rank:
            {
                StartBtnDesc.text = "开始排位";
            }
            break;

            case (int)EMMatchType.MatchType_MultiCampMatch:
            {
                StartBtnDesc.text = "开始生存";
            }
            break;

            default:
                break;
            }
        }
        // 设置排位信息
        public void setRankInfo(cmd_entity_end_player_data selfData)
        {
            Debug.Log(String.Format("{0}({1}),{2},当前分:{3},上次分:{4}本局分:{5}", selfData.nMatchType, selfData.szMatchTypeName, selfData.nUpgradeRank, selfData.nPlayerMatchScore,
                                    selfData.nPreMatchTypeScore, selfData.nMatchScore));

            // 胜利且是排位赛才显示
            if ((EMMatchType)selfData.nMatchType == EMMatchType.MatchType_Rank)
            {
                // todo 战场的要单独处理下 王者段位以上的 只加分了 段位是单独换算的
                int    nBaseKingRankScore = GameLogicAPI.getMatchtTypeBaseKingRankScore(selfData.nMatchType);
                int    nMatchType         = selfData.nMatchType;
                int    nCurRankScore      = selfData.nPlayerMatchScore;
                int    nRankIconID        = GameLogicAPI.getActorRankIconID(nMatchType, nCurRankScore);
                int    nRankStar          = 0;
                string strRankName        = "";
                if (nCurRankScore >= nBaseKingRankScore)
                {
                    if (selfData.nPreMatchTypeScore >= nBaseKingRankScore)
                    {
                        // 本来就是王者段位的就取以前的等级
                        nRankIconID = GameLogicAPI.getRankIconIDByGrade(nMatchType, selfData.nPreMatchTypeGrade);
                        nRankStar   = GameLogicAPI.getActorRankStar(nMatchType, nBaseKingRankScore);
                        // 段位名称
                        IntPtr ptr = GameLogicAPI.getActorRankNameByGrade(nMatchType, selfData.nPreMatchTypeGrade);
                        if (ptr != IntPtr.Zero)
                        {
                            strRankName = IntPtrHelper.Ptr2Str(ptr);
                        }

                        // 升星级个数
                        int nDiff = 0;
                        if (selfData.nCurStarSection > 0)
                        {
                            nDiff = selfData.nMatchScore / selfData.nCurStarSection;
                        }

                        //当前星级 +
                        if (nDiff < 0)
                        {
                            StarUpDesc.gameObject.SetActive(true);
                            StarUpDesc.text = String.Format("星级:{0} 本局星级{1}", nRankStar, nDiff);
                        }
                        else if (nDiff > 0)
                        {
                            StarUpDesc.gameObject.SetActive(true);
                            StarUpDesc.text = String.Format("星级:{0} 本局星级+{0}", nRankStar, nDiff);
                        }
                        else
                        {
                            StarUpDesc.gameObject.SetActive(false);
                        }
                    }
                    else
                    {
                        // 新升级到王者段位的
                        nRankIconID = GameLogicAPI.getActorRankIconID(nMatchType, nCurRankScore);
                        nRankStar   = GameLogicAPI.getActorRankStar(nMatchType, nCurRankScore);
                        // 段位名称
                        IntPtr ptr = GameLogicAPI.getActorRankName(nMatchType, nCurRankScore);
                        if (ptr != IntPtr.Zero)
                        {
                            strRankName = IntPtrHelper.Ptr2Str(ptr);
                        }

                        if (selfData.nUpgradeRank > 0)
                        {
                            StarUpDesc.gameObject.SetActive(true);
                            StarUpDesc.text = String.Format("星级+{0}", 1);
                        }
                    }
                    GradeDesc.text = strRankName;
                }
                else
                {
                    nRankStar = GameLogicAPI.getActorRankStar(nMatchType, nCurRankScore);
                    int nMaxRankStar = GameLogicAPI.getActorCurRankMaxStar(nMatchType, nCurRankScore);

                    int nOldRankScore = selfData.nPreMatchTypeScore;
                    int nOldRankStar  = GameLogicAPI.getActorRankStar(nMatchType, nOldRankScore);

                    // 段位名称
                    IntPtr ptr = GameLogicAPI.getActorRankName(nMatchType, nCurRankScore);
                    if (ptr != IntPtr.Zero)
                    {
                        strRankName = IntPtrHelper.Ptr2Str(ptr);
                    }
                    GradeDesc.text = strRankName;

                    // 当前段位所有星级
                    m_RankIconList = new Image[nMaxRankStar];
                    for (int i = 0; i < nMaxRankStar; ++i)
                    {
                        GameObject RankIconItem = ResNode.InstantiateRes(RankIconDefaultItem);
                        RankIconItem.transform.SetParent(RankIconDefaultItem.transform.parent, false);
                        RankIconItem.SetActive(true);

                        m_RankIconList[i] = RankIconItem.GetComponent <Image>();
                    }

                    // 当前拥有星级
                    for (int j = 0; j < nRankStar; ++j)
                    {
                        m_RankIconList[j].sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankStarImage, WndID.WND_ID_WAR_RECORDTABLE_END, 2);
                    }

                    if (selfData.nUpgradeRank == 0) // 段位未发生改变
                    {
                        // 升星级个数
                        int nDiff = nRankStar - nOldRankStar;
                        if (nDiff < 0)
                        {
                            StarUpDesc.gameObject.SetActive(true);
                            StarUpDesc.text = String.Format("星级{0}", nDiff);
                        }
                        else if (nDiff > 0)
                        {
                            StarUpDesc.gameObject.SetActive(true);
                            StarUpDesc.text = String.Format("星级+{0}", nDiff);
                        }
                        else
                        {
                            StarUpDesc.gameObject.SetActive(false);
                        }
                    }
                    else if (selfData.nUpgradeRank < 0)
                    {
                        StarUpDesc.gameObject.SetActive(true);
                        StarUpDesc.text = String.Format("星级-{0}", 1);
                    }
                    else if (selfData.nUpgradeRank > 0)
                    {
                        StarUpDesc.gameObject.SetActive(true);
                        StarUpDesc.text = String.Format("星级+{0}", 1);
                    }
                }
            }
            else
            {
                RankScoreTip.gameObject.SetActive(false);
            }

            SSchemeWarStatisticMapConfig warStatConfig = ASpeedGame.Data.WarStatisticMap.WarStatisticMapConfig.Instance.getWarStatMapConfig(selfData.nMatchType);

            if (warStatConfig != null)
            {
                MatchTypeText.text = warStatConfig.strName;
            }
            else
            {
                MatchTypeText.text = "";
            }
        }
Example #8
0
        /// <summary>
        /// 汇总并排序伤害总量,返回按伤害总量排血的角色ID表
        /// </summary>
        /// <returns></returns>
        private List <int> SummaryAndSortData()
        {
            m_DeathReplayDataList.Clear();
            List <int> enemyOrderList = new List <int>();

            m_endTime = GameLogicAPI.GetUnityTickCount();

            bool tempFlag = true;

            //先汇总8次承受伤害数据
            foreach (HurtDataItem hurtData in m_ActorHurtDataList)
            {
                if (m_endTime - hurtData.hurtTime > DamageCalculationsTime)
                {
                    continue;
                }
                if (tempFlag)
                {
                    //保存符合条件的第一次受伤时间
                    m_startTime = hurtData.hurtTime;
                    tempFlag    = false;
                }

                DeathReplayData damageData = new DeathReplayData();
                EntityView      ev         = EntityFactory.getEntityViewByID(hurtData.uidOperator);
                if (ev == null || ev.Property == null)
                {
                    continue;
                }
                int skinID = ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SKIN);
                if (m_DeathReplayDataList.ContainsKey(skinID))
                {
                    damageData = m_DeathReplayDataList[skinID];
                    if (damageData.skillDamageList.ContainsKey(hurtData.skillID))
                    {
                        damageData.skillDamageList[hurtData.skillID] += hurtData.hurtNum;
                    }
                    else
                    {
                        damageData.skillDamageList.Add(hurtData.skillID, hurtData.hurtNum);
                    }
                    m_DeathReplayDataList[skinID] = damageData;
                }
                else
                {
                    damageData.uidOperator = hurtData.uidOperator;
                    damageData.pdbID       = LogicDataCenter.recordTableDataManager.getWarPersonPDBIDByUID(damageData.uidOperator);
                    damageData.skinID      = skinID;
                    EntityView view = EntityFactory.getEntityViewByID(Convert.ToInt32(hurtData.uidOperator));
                    if (view != null && view.Property != null)
                    {
                        damageData.entityType = view.Type;
                        if (view.Type == ENTITY_TYPE.TYPE_MONSTER)
                        {
                            /////////////////////////////////////////////
                            damageData.monsterID = view.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID);
                        }
                        damageData.roleName = view.Property.CreatureName;
                        damageData.skinName = view.Property.CreatureName;
                        if (view.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE)
                        {
                            int heroId = view.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
                            SSchemeHeroTypeConfig config = HeroTypeConfig.Instance.GetHeroTypeConfig(heroId);
                            if (config != null)
                            {
                                damageData.heroDesc = config.strAgainstWay;
                            }
                        }
                    }
                    WarRecordTableDataManager.WarPlayerVsInfo vsInfo = LogicDataCenter.recordTableDataManager.GetWarPlayerVsInfo(damageData.pdbID);
                    if (null != vsInfo)
                    {
                        damageData.skinName = vsInfo.szVocationName;
                    }
                    damageData.skillDamageList.Add(hurtData.skillID, hurtData.hurtNum);
                    damageData.goodsInfo  = LogicDataCenter.warMobaGoodsDataManager.GetPlayerGoodsInfo(damageData.pdbID);
                    damageData.personInfo = LogicDataCenter.recordTableDataManager.getWarPersonInfoByPDBID(damageData.pdbID);
                    m_DeathReplayDataList.Add(skinID, damageData);
                }
            }

            //再排汇总后的敌方角色的技能伤害表
            foreach (DeathReplayData data in m_DeathReplayDataList.Values)
            {
                foreach (KeyValuePair <int, int> kvp in data.skillDamageList)
                {
                    SkillDamageItem item = new SkillDamageItem();
                    item.skillID   = kvp.Key;
                    item.damageNum = kvp.Value;
                    IntPtr Ptr = GameLogicAPI.getSpellData(kvp.Key);
                    if (Ptr != IntPtr.Zero)
                    {
                        SPELL.SPELL_DATA spellData = IntPtrHelper.toData <SPELL.SPELL_DATA>(Ptr);
                        item.spellEffectType = spellData.nSpellEffectType;
                        item.skillIcon       = spellData.nIcon;
                        IntPtr strPtr = GameLogicAPI.getSpellStrData(kvp.Key, (int)SPELL_DATA_ID.SPDATA_NAME);
                        if (strPtr != null)
                        {
                            item.szSkillName = IntPtrHelper.Ptr2Str(strPtr);
                        }
                        strPtr = GameLogicAPI.getSpellStrData(kvp.Key, (int)SPELL_DATA_ID.SPDATA_DESC);
                        if (strPtr != null)
                        {
                            item.szSkillDesc = IntPtrHelper.Ptr2Str(strPtr);
                        }
                    }
                    //如果是普通攻击
                    if ((item.spellEffectType & (int)SPELL.SPELL_EFFECT_TYPE.SpellEffectType_NormalAttack) != 0)
                    {
                        //判断表里是否已经有普通攻击了,如果有就直接加值
                        SkillDamageItem temp = data.skillInfoList.Find(x => (x.spellEffectType & (int)SPELL.SPELL_EFFECT_TYPE.SpellEffectType_NormalAttack) != 0);
                        if (null != temp)
                        {
                            temp.damageNum += item.damageNum;
                        }
                        else
                        {
                            data.skillInfoList.Add(item);
                        }
                    }
                    else
                    {
                        data.skillInfoList.Add(item);
                    }
                }
                data.skillInfoList.Sort((x, y) => - x.damageNum.CompareTo(y.damageNum));
            }

            //再排序
            var dicSort = from objDic in m_DeathReplayDataList orderby objDic.Value.totalDamage descending select objDic;

            foreach (KeyValuePair <int, DeathReplayData> kvp in dicSort)
            {
                enemyOrderList.Add(kvp.Key);
            }
            //返回角色ID表
            return(enemyOrderList);
        }
Example #9
0
    public void addMonsterEffect(U3D_Render.EntityView dieEv, ulong uMurderID)
    {
        if (dieEv == null || dieEv.CampFlag != SPELL.CampFlag.CampFlag_Enemy || !CheckMonsterType(dieEv))
        {
            return;
        }

        U3D_Render.EntityView mainEv = EntityFactory.getMainPlayer();

        if (mainEv == null || mainEv.StateMachine.GetState() == GameLogic.EntityState.Dead)
        {
            return;
        }

        Vector3 monsterLoc = dieEv.gameObject.transform.position;
        Vector3 heroLoc    = mainEv.gameObject.transform.position;

        int  effectCount         = 0;
        bool needPlayMoneyEffect = false;
        //根据死亡对象类型控制光效数量
        int    vocationID   = dieEv.createinfo.nHeroID;
        string dieEffectMsg = "";
        IntPtr strPtr       = GameLogicAPI.toCoinLighting(vocationID, (int)ENTITY_TYPE.TYPE_MONSTER);

        if (strPtr != null)
        {
            dieEffectMsg = IntPtrHelper.Ptr2Str(strPtr);
        }
        if (dieEffectMsg.Contains(GameLogicConfigApi.MoneyEffect.ToString()))
        {
            needPlayMoneyEffect = true;
        }

        if ((ulong)mainEv.ID == uMurderID && GameLogicAPI.isInWarScene() != 0)
        {
            //如果是怪物类型
            if (dieEv.Type == ENTITY_TYPE.TYPE_MONSTER)
            {
                //中立野怪
                //if ((int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_WILD_MONSTER == dieEv.Flag)
                effectCount = 3;    //小兵和野怪都是3个
            }
            else if (dieEv.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE)
            {
                effectCount = 6;    //英雄6个
            }

            if (effectCount > 0 && needPlayMoneyEffect)
            {
                LightingEffectBehavior moneyEff = EffectHelper.PlayAndReturnEffect(ref mainEv, GameLogicConfigApi.MoneyEffect, mainEv.ID, mainEv.ID, monsterLoc, 0, 2);
                if (moneyEff != null)
                {
                    LightingEffectBehavior_Area effect = (LightingEffectBehavior_Area)moneyEff;
                    effect.SetEffectCount(effectCount);
                }
            }
            LightingEffectBehavior deadEff = EffectHelper.PlayAndReturnEffect(ref dieEv, GameLogicConfigApi.MonsterDeadEffect, dieEv.ID, dieEv.ID, monsterLoc, 0, 2);
            return;
        }

        int nMonsterDistance = GameLogicConfigApi.MonsterDistance;
        int nTowerDistance   = GameLogicConfigApi.TowerDistance;

        if ((monsterLoc - heroLoc).sqrMagnitude > (nMonsterDistance * nMonsterDistance))
        {
            return;
        }

        IList <U3D_Render.EntityView> monster_Entities = MapFinderManager.Nearest(monsterLoc, /*nTowerDistance*/ nMonsterDistance, SPELL.CampFlag.CampFlag_Self);

        if (monster_Entities == null)
        {
            return;
        }

        int   nMainID = 0;
        float fMinDis = 0.0f;

        foreach (U3D_Render.EntityView monsterEv in monster_Entities)
        {
            if (HeroDistanceMgr.CheckDistance(dieEv, monsterEv, nMonsterDistance) == false || monsterEv == null)
            {
                continue;
            }

            if ((int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER == monsterEv.Flag)
            {
                //return;
            }
            else if (ENTITY_TYPE.TYPE_PLAYER_ROLE == monsterEv.Type)
            {
                float fEntityDistance = (monsterLoc - monsterEv.gameObject.transform.position).sqrMagnitude;
                if (fMinDis == 0 || fEntityDistance < fMinDis)
                {
                    fMinDis = fEntityDistance;
                    nMainID = monsterEv.ID;
                }
            }
        }

        U3D_Render.EntityView view = EntityFactory.getEntityViewByID((int)uMurderID);

        if (nMainID == mainEv.ID && (ulong)nMainID != uMurderID && (int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER != view.Flag)
        {
            if ((view.InitMaskFlag & (int)ENTITY_MASKFLAG.MASKFLAG_DIE_NO_COMMONLIGHT) != (int)ENTITY_MASKFLAG.MASKFLAG_DIE_NO_COMMONLIGHT)
            {
                EffectHelper.Play(ref dieEv, GameLogicConfigApi.MonsterDeadEffect, dieEv.ID, mainEv.ID, monsterLoc);
            }
        }
    }
        public void SetData(UListWarMainModeItem item)
        {
            HeadIcon.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_WarMainMode, WndID.WND_ID_WAR_MAIN_FRAME, item.nModeID);
            if (HeadIcon.sprite == null)
            {
                HeadIcon.gameObject.SetActive(false);
            }
            else
            {
                HeadIcon.gameObject.SetActive(true);
            }
            RankInvalidFrame.gameObject.SetActive(false);
            RankFrame.gameObject.SetActive(false);
            RankTipBtn.gameObject.SetActive(false);
            RankStarFrame.gameObject.SetActive(false);
            if (item.nModeID == (int)EWarModeDef.MODE_RankVS)
            {
                RankTipBtn.gameObject.SetActive(true);
                // 自己是否有排位信息
                int    nMatchType   = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MATCHTYPE);
                int    nRankScore   = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_RANKSCORE);
                int    nRankGrade   = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_RANKGRADE);
                int    nRankIconID  = GameLogicAPI.getRankIconIDByGrade(nMatchType, nRankGrade);
                int    nRankStar    = GameLogicAPI.getActorRankStar(nMatchType, nRankScore);
                int    nMaxRankStar = GameLogicAPI.getActorCurRankMaxStar(nMatchType, nRankScore);
                IntPtr ptr          = GameLogicAPI.getActorRankNameByGrade(nMatchType, nRankGrade);
                string strRankName  = "";
                if (ptr != IntPtr.Zero)
                {
                    strRankName = IntPtrHelper.Ptr2Str(ptr);
                }

                RankImg.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankImage, WndID.WND_ID_WAR_MAIN_FRAME, 1, nRankIconID);
                if (RankImg.sprite == null || nRankScore <= 0)
                {
                    RankInvalidFrame.gameObject.SetActive(true);
                    RankFrame.gameObject.SetActive(false);
                }
                else
                {
                    RankStarFrame.gameObject.SetActive(true);
                    for (int index = 0; index < RankStarFrame.childCount; ++index)
                    {
                        if (nRankStar > 0)
                        {
                            RankStarFrame.GetChild(index).GetComponent <Image>().sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankStarImage, WndID.WND_ID_WAR_MAIN_FRAME, 2);
                            nRankStar--;
                            nMaxRankStar--;
                        }
                        else if (nMaxRankStar > 0)
                        {
                            RankStarFrame.GetChild(index).GetComponent <Image>().sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankStarImage, WndID.WND_ID_WAR_MAIN_FRAME, 1);
                            nMaxRankStar--;
                        }
                        else
                        {
                            RankStarFrame.GetChild(index).GetComponent <Image>().gameObject.SetActive(false);
                        }
                    }

                    RankInvalidFrame.gameObject.SetActive(false);
                    RankFrame.gameObject.SetActive(true);

                    // 设置胜场 胜率  段位描述 星级
                    ActorPlayerInfo info    = LogicDataCenter.playerSystemDataManager.GetActorPlayerInfo();
                    int             WinRate = info.playerInfo.nRankMatchNum > 0? (info.playerInfo.nRankWinNum * 100 / info.playerInfo.nRankMatchNum): 0;
                    RankDetailDes.text = String.Format("{0}:", ULocalizationService.Instance.Get("UIView", "WarStatistic", "MapWinCount")) + info.playerInfo.nRankWinNum + "  " + String.Format("{0}:", ULocalizationService.Instance.Get("UIView", "WarStatistic", "MapWinRate")) + WinRate + "%";
                    RankGradeDes.text  = strRankName;
                    RankScore.text     = "" + nRankScore;

                    if (m_RankEffectParam != null)
                    {
                        UEffectManager.Instance.DestroyEffect(UEffectType.UET_EffectPrefab, ref m_RankEffectParam);
                        m_RankEffectParam = null;
                    }

                    int nOffset = info.playerInfo.nRankIconID - 1;
                    if (nOffset >= 0)
                    {
                        UEffectParamBase param = new UEffectPrefabParam(_eType: UEffectPrefabType.UEPT_WarMain_RankEffect1 + nOffset, _tfAttachParent: this.RankImg.transform);
                        UEffectManager.Instance.CreateEffect(UEffectType.UET_EffectPrefab, ref param);

                        m_RankEffectParam = param;
                        UEffectPrefabParam paramPrefab = (UEffectPrefabParam)param;
                        paramPrefab.EffectGameObject.transform.SetAsFirstSibling();
                    }
                }
            }

            // 隐藏模式详细描述 以及 图片
            ModeDesText.text = item.strModeDesc;
            ModeDesText.gameObject.SetActive(false);

            // 设置tooltip
            //m_tooltip = this.gameObject.AddComponent<UTooltipTrigger>(ETooltipStyle.ETS_Default);
            //if (m_tooltip)
            //{
            //    string stTitleDesc = item.strModeTooltip;
            //    UBB.toHtml(ref stTitleDesc, UBB_FORMAT_TYPE.UGUI);
            //    m_tooltip.SetText(UTooltipParamName.BodyText, "<color=#FFFFFFFF><size=20>" + stTitleDesc + "</size></color>");
            //    m_tooltip.tipPosition = TipPosition.MouseTopRightCorner;
            //    m_tooltip.backgroundTint.a = 0;
            //}

            if (m_OpenEffectParam != null)
            {
                UEffectManager.Instance.DestroyEffect(UEffectType.UET_EffectPrefab, ref m_OpenEffectParam);
                m_OpenEffectParam = null;
            }

            if (item.bOpenEffect)
            {
                UEffectParamBase param = new UEffectPrefabParam(_eType: UEffectPrefabType.UEPT_WarMain_CanJoinEffect, _tfAttachParent: this.HeadIcon.transform);
                UEffectManager.Instance.CreateEffect(UEffectType.UET_EffectPrefab, ref param);

                m_OpenEffectParam = param;
                UEffectPrefabParam paramPrefab = (UEffectPrefabParam)param;
                paramPrefab.EffectGameObject.transform.SetAsFirstSibling();
            }

            ItemData = item;


            #region 新手引导部分
            if (!item.bUseGuideWidget)
            {
                gameObject.RemoveComponent <Guide.UGuideWidget>();
            }
            else
            {
                Guide.UGuideWidget guideWidget = gameObject.GetComponent <Guide.UGuideWidget>();
                if (guideWidget == null)
                {
                    guideWidget = this.gameObject.AddComponent <Guide.UGuideWidget>();
                }
                guideWidget.GuideID       = (GUIDE.EGuideNodeID)item.GuideWidgetData.nGuideID;
                guideWidget.GuideStepID   = item.GuideWidgetData.nGuideStepID;
                guideWidget.GuideEffectID = item.GuideWidgetData.nGuideEffectID;
                guideWidget.IsForceGuide  = item.GuideWidgetData.bForeceGuide;
            }
            #endregion
        }
Example #11
0
        public void OnCommand_UpdateNumProp(EntityNumPropEventArgs e)
        {
            if (e.objev == null || !e.objev.IsHero)
            {
                return;
            }

            switch (e.data.nPropID)
            {
            case (int)ENTITY_PROPERTY.PROPERTY_SEX:
            {
                int nSex = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SEX);
                actorInfo.HeadIcon.sprite = GetActorIcon(nSex + 1);
            }
            break;

            case (int)ENTITY_PROPERTY.PROPERTY_RANKGRADE:
            case (int)ENTITY_PROPERTY.PROPERTY_RANKSCORE:
            {
                int    nMatchType  = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MATCHTYPE);
                int    nRankScore  = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_RANKSCORE);
                int    nRankGrade  = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_RANKGRADE);
                int    nRankIcon   = GameLogicAPI.getRankIconIDByGrade(nMatchType, nRankGrade);
                IntPtr ptr         = GameLogicAPI.getActorRankNameByGrade(nMatchType, nRankGrade);
                string strRankName = "";
                if (ptr != IntPtr.Zero)
                {
                    strRankName = IntPtrHelper.Ptr2Str(ptr);
                }
                // 更新下本地的PlayerDataManager数据 这里是个坑 以前不是实时更新的
                ActorPlayerInfo info = LogicDataCenter.playerSystemDataManager.GetActorPlayerInfo();
                if (info.playerInfo.pDbid > 0)
                {
                    info.playerInfo.nRankScore  = nRankScore;
                    info.playerInfo.nRankIconID = nRankIcon;
                    info.playerInfo.chRankName  = strRankName;
                }

                if (nRankIcon > 0)
                {
                    actorInfo.RankIcon.gameObject.SetActive(true);
                    actorInfo.RankIcon.sprite = GetActorRankIcon(nRankIcon);
                }
                else
                {
                    actorInfo.RankIcon.gameObject.SetActive(false);
                }
            }
            break;

            case (int)ENTITY_PROPERTY.PROPERTY_LEVEL:
            {
                int nLevel = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_LEVEL);
                actorInfo.Lv.text = nLevel.ToString();
            }
            break;

            case (int)ENTITY_PROPERTY.PROPERTY_TICKET:
            {
                int nPoint = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_TICKET);
                actorInfo.PointNum.text = nPoint.ToString();
            }
            break;

            case (int)ENTITY_PROPERTY.PROPERTY_GOLD:
            {
                int nGold = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_GOLD);
                actorInfo.BindGoldNum.text = nGold.ToString();
            }
            break;

            default:
                break;
            }
        }