public void ClickActiveButtonHander()
        {
            if (_currentClickSkillInfo == null)
            {
                return;
            }
            if (_currentClickSkillInfo.level == 0 && !_currentClickSkillInfo.isMaxExp)
            {
                CommonErrorTipsView.Open(Localization.Get("ui.player_cultivate_view.expNotMax"));
                return;
            }
            List <GameResData> costList = _currentClickSkillInfo.UpgradeCost;

            for (int i = 0, count = costList.Count; i < count; i++)
            {
                GameResData res = costList[i];
                int         own = 0;
                if (res.type == BaseResType.Item)
                {
                    own = ItemProxy.instance.GetItemCountByItemID(res.id);
                }
                else
                {
                    own = GameProxy.instance.BaseResourceDictionary.GetValue(res.type);
                }
                if (res.count > own)
                {
                    ItemData tempItemData = ItemData.GetBasicResItemByType(res.type);
                    Logic.UI.Tips.View.CommonErrorTipsView.Open(string.Format(Localization.Get("ui.player_cultivate_view.materialNotEnough"), Localization.Get(tempItemData.name)));
                    return;
                }
            }

            if (_currentClickSkillInfo.level == 0)
            {
                PlayerController.instance.CLIENT2LOBBY_TALENT_ACTIVATE_REQ(_currentClickSkillInfo.id);
                GameObject effect = ParticleUtil.CreateParticle("effects/prefabs/ui_shimo", _canvas);
                if (effect != null)
                {
                    effect.transform.SetParent(selectTransform.parent, false);
                    effect.transform.localPosition = selectTransform.localPosition;
                    GameObject.Destroy(effect, 1);
                }
            }
            else
            {
                PlayerController.instance.CLIENT2LOBBY_TALENT_UPGRADE_REQ(_currentClickSkillInfo.id);
            }
        }
Exemple #2
0
        public void LoadEffects()
        {
            _refreshParticleGameObject = ParticleUtil.CreateParticle(string.Format("effects/prefabs/{0}", EffectController.UI_EFFECT_28), canvas);
            _refreshParticleGameObject.transform.SetParent(transform, false);
            _refreshParticleGameObject.transform.localPosition = Vector3.zero;

            _floatParticleGameObject = ParticleUtil.CreateParticle(string.Format("effects/prefabs/{0}", EffectController.UI_ICON_FLOAT), canvas);
            _floatParticleGameObject.transform.SetParent(transform, false);
            _floatParticleGameObject.transform.localPosition = Vector3.zero;

            _tumbleParticleGameObject = ParticleUtil.CreateParticle(string.Format("effects/prefabs/{0}", EffectController.UI_ICON_TUMBLE), canvas);
            _tumbleParticleGameObject.transform.SetParent(transform, false);
            _tumbleParticleGameObject.transform.localPosition = Vector3.zero;

            ShowFloatParticle(false);
            ShowTumbleParticle(false);
            ShowRefreshParticle(false);
            ShowsSkillLock(false);
        }
Exemple #3
0
//    List<int> mRandomSkill = new List<int>();
    public override void  OnMsg(int msgID, object args)
    {
        if (msgID == (int)Const_Util.UNIT_MSG.GET_SKILL)
        {
            int skillCount = DataCfgMgr.instance.GetSkillCount();
            int randomID   = Random.Range(1, skillCount);
            mSkillItem.Add(randomID);
            BattleMsgDef.RandomSkillAward randomAward = new BattleMsgDef.RandomSkillAward(randomID, cobj.mPlayerIdx);
            BroadcastEventMgr.instance.TriggerEvent((int)Const_Util.BATTLE_EVENT.RANDOM_SKILL, 0, randomAward);
        }
        else if (msgID == (int)Const_Util.UNIT_MSG.SKILL_HIT_EFX)
        {
            int        skillID     = (int)args;
            SKILL      skill       = DataCfgMgr.instance.GetSkill(skillID);
            int        efxParObjID = 0;
            GameObject efxObj      = ResMgr.instance.CreateObject(skill.hit_efx, out efxParObjID);
            float      time        = ParticleUtil.GetParticleLength(efxObj.transform);
            efxObj.transform.position = renderCarTr.position;
            SkillHitEfx efx = new SkillHitEfx(skill.hit_efx, efxObj, time);
            efxParticles.Add(efx);
        }
    }
        private IEnumerator StrengthenSuccessRefreshCoroutine()
        {
            GameObject effect        = null;
            List <int> materialSlots = new List <int>();

            for (int i = 0, count = HeroStrengthenProxy.instance.SelectedMaterialHeroInfos.Length; i < count; i++)
            {
                if (HeroStrengthenProxy.instance.SelectedMaterialHeroInfos[i] != null)
                {
                    materialSlots.Add(i);
                }
            }
            int materialCount = materialSlots.Count;

            if (_rootCanvas == null)
            {
                _rootCanvas = gameObject.GetComponent <Canvas>();
            }

            RegenerateHeroButtons();
            RefreshHeroButtons();
            yield return(null);

            //强化材料特效
            float meterialEffectTime = 0.5f;
            int   index = 0;

            for (int i = 0; i < materialCount; i++)
            {
                index  = materialSlots[i];
                effect = ParticleUtil.CreateParticle("effects/prefabs/qianghua", _rootCanvas);
                effect.transform.SetParent(selectedMaterialHeroFrameButtons[index].transform.parent, false);
                effect.transform.localPosition = selectedMaterialHeroFrameButtons[index].transform.localPosition;
                GameObject.Destroy(effect, 1);
            }

            yield return(new WaitForSeconds(meterialEffectTime));

            RoleInfo roleInfo = HeroStrengthenProxy.instance.StrengthenHeroInfo;

            HeroStrengthenProxy.instance.ClearMaterials();
            _strengthenHeroButton.SetRoleInfo(roleInfo);
            RefreshSelectedMaterialHeroButtons();

            //聚集粒子特效
            float   particleMoveEffectTime = 0.6f;
            Vector3 moveLocation           = strengthenHeroButtonRoot.transform.localPosition;

            for (int i = 0; i < materialCount; i++)
            {
                index = materialSlots[i];
                int randomNum = Random.Range(1, 3);
                for (int k = 0; k < randomNum; k++)
                {
                    effect = ParticleUtil.CreateParticle("effects/prefabs/dandao", _rootCanvas);
                    effect.transform.SetParent(selectedMaterialHeroFrameButtons[index].transform.parent, false);
                    effect.transform.localPosition = selectedMaterialHeroFrameButtons[index].transform.localPosition;
                    float     randomX     = Random.Range(-150, 150) + effect.transform.localPosition.x;
                    float     randomY     = Random.Range(-150, 150) + effect.transform.localPosition.y;
                    Vector3   flyLocation = new Vector3(randomX, randomY, 0);
                    Vector3   v2          = flyLocation;
                    Vector3   v3          = new Vector3((moveLocation.x + v2.x) / 2, (moveLocation.y + v2.y) / 2);
                    Vector3[] v           = new Vector3[] { effect.transform.localPosition, v3, v2, moveLocation };
                    LeanTween.moveLocal(effect, v, particleMoveEffectTime).setEase(LeanTweenType.easeInSine).setDelay(0.03f * i);
                    GameObject.Destroy(effect, particleMoveEffectTime + 0.03f * i);
                }
            }
            yield return(new WaitForSeconds(particleMoveEffectTime));

            //升级特效
            if (strengthenAddLevel != 0)
            {
                effect = ParticleUtil.CreateParticle("effects/prefabs/shengji", _rootCanvas);
            }
            else
            {
                effect = ParticleUtil.CreateParticle("effects/prefabs/kapaixishou", _rootCanvas);
            }
            effect.transform.SetParent(strengthenHeroButtonRoot.transform.parent, false);
            effect.transform.localPosition = strengthenHeroButtonRoot.transform.localPosition;
            GameObject.Destroy(effect, 1);

            //经验条特效
            effect = ParticleUtil.CreateParticle("effects/prefabs/qianghua_jindutiao", _rootCanvas);
            effect.transform.SetParent(currentExpSlider.transform.parent, false);
            effect.transform.localPosition = currentExpSlider.transform.localPosition;
            GameObject.Destroy(effect, 1);

            RefreshAttribute();
            _isClickStrengthenBtn = false;
        }