Esempio n. 1
0
        /// <summary>
        /// 开始PK
        /// </summary>
        /// <param name="uidTarget">PK目标</param>
        /// <param name="pkLoc">PK点坐标</param>
        public void StartPK(int uidTarget, float[] pkLoc)
        {
            SkillCtrl sc = EntityFactory.MainHeroView.SkillCtrl;

            if (sc != null)
            {
                sc.doingPKSelection  = false;
                sc.enablePKSelection = false;
            }

            PKPosInfo posInfo = new PKPosInfo();

            posInfo.pos = pkLoc;
            UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_PKINFO_STARTPK, posInfo);
            UISystem.Instance.ShowWnd(WndID.WND_ID_WAR_FLOATFONTFRAME, true);

            UTopNameManager.Instance.SetPKMode(EntityFactory.MainHeroID, true);
            UTopNameManager.Instance.SetPKMode(uidTarget, true);
            UTopNameManager.PkTargetID = uidTarget;

            U3D_Render.EntityView targetEV = EntityFactory.getEntityViewByID(uidTarget);

            if (targetEV == null || targetEV.Property == null)
            {
                Trace.LogError("pk target ev or pk target ev property null!");
                return;
            }

            UBloodManager.Instance.PkTargetID = uidTarget;
            UBloodManager.Instance.CreatBlood(EntityFactory.MainHeroView, (int)GFxCampTpye.CT_Self);
            UBloodManager.Instance.CreatBlood(targetEV, (int)GFxCampTpye.CT_Enemy);

            pkTargetSkinID = 0;
            pkTargetSkinID = targetEV.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SKIN);

            pkSrcSkinID = 0;
            pkSrcSkinID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SKIN);
            EffectHelper.LoadPreLight(LightType.ActorSkin, pkTargetSkinID, CachePriority.PRIORITY_MEDIUM);

            LoadPKRelateSkin(pkTargetSkinID);
            LoadPKRelateSkin(pkSrcSkinID);
            m_bIsPK = true;
        }
Esempio n. 2
0
    /// <summary>
    /// 属性更新后处理
    /// </summary>
    /// <param name="nPropID"></param>
    /// <param name="nNewValue"></param>
    /// <param name="nOldValue"></param>
    private void OnAfterUpdateNumProp(int nPropID, int nNewValue, int nOldValue, int nOtherValue)
    {
        switch (nPropID)
        {
        case (int)ENTITY_PROPERTY.PROPERTY_SKIN:
        {
            if (nNewValue != nOldValue)
            {
                if (Master.SkinControl.ChangeSkin(nNewValue, nOtherValue, Master.IsHero? AssetLoadPriority.Priority_Exclusive : AssetLoadPriority.Priority_Normal) == U3D_Render.SkinCtrl.SkinChangedReslut.Succes)
                //if (Master.SkinControl.ChangeSkin(nNewValue, nOtherValue) == U3D_Render.SkinCtrl.SkinChangedReslut.Succes)
                {
#if ENABLE_YUNYING_MODE
                    if (nOldValue > 0)
                    {
                        EffectHelper.UnloadPreLight(ASpeedGame.Data.Scheme.LightType.ActorSkin, nOldValue);
                    }

                    EffectHelper.LoadPreLight(ASpeedGame.Data.Scheme.LightType.ActorSkin, nNewValue, CachePriority.PRIORITY_VERY_HIGH);
#else
                    //主城才需要这个
                    if (GameLogicAPI.isMainMap(SceneManager.Instance.m_curMapID))
                    {
                        // 主角切英雄或皮肤时加载下光效
                        if (Master.IsHero)
                        {
                            if (nOldValue > 0)
                            {
                                EffectHelper.UnloadPreLight(ASpeedGame.Data.Scheme.LightType.ActorSkin, nOldValue);
                            }

                            EffectHelper.LoadPreLight(ASpeedGame.Data.Scheme.LightType.ActorSkin, nNewValue, CachePriority.PRIORITY_VERY_HIGH);
                        }
                    }
#endif
                }
            }
        }
        break;

        case (int)ENTITY_PROPERTY.PROPERTY_SD:
        {
            BaseStateMachine fsm = Master.StateMachine;
            if (fsm)
            {
                fsm.maxRunForwardSpeed  = nNewValue / 100.0f;
                fsm.maxRunSidewaySpeed  = nNewValue / 100.0f * GameLogicAPI.getHeroSidewaySpeedFactor();
                fsm.maxRunBackwardSpeed = fsm.maxRunForwardSpeed * GameLogicAPI.getHeroBackwardSpeedFactor();
                fsm.updateMovingAnimSpeed();
            }
        }
        break;

        case (int)ENTITY_PROPERTY.PROPERTY_MASK:
        {
            BaseStateMachine fsm = Master.StateMachine;
            if (fsm)
            {
                fsm.ChangeMask(Master);
            }
        }
        break;

        case (int)ENTITY_PROPERTY.PROPERTY_VOCATION:
        {
            if (EntityFactory.MainHeroView != null && EntityFactory.MainHeroView.Property == this)
            {
                foreach (SSchemePersonModelData data in PersonModelConfig.Instance.PersonModelConfigs)
                {
                    if (data.nHeroID == nNewValue)
                    {
                        OperationType fpsMode = new OperationType();
                        fpsMode.operationType = data.nOperationType;
                        UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_COMMON_UPDATE_MAIN_HERO_VOCATION, fpsMode);
                        break;
                    }
                }
            }
        }
        break;

        case (int)ENTITY_PROPERTY.PROPERTY_OBSERVER:
        {
            if (EntityFactory.MainHeroView != null && EntityFactory.MainHeroView.Property == this)
            {
                if (nNewValue > 0)
                {
                    StageManager.Instance.CurPermissionState = EStage_PermissionState.ESPS_OB;
                }
                else
                {
                    StageManager.Instance.CurPermissionState = EStage_PermissionState.ESPS_NORMAL;
                }
            }
        }
        break;

        default:
            break;
        }
    }