Ejemplo n.º 1
0
 void OnClickpvp(ButtonScript obj, object args, int param1, int param2)
 {
     if (Prebattle.Instance.FindPlayer((int)PlayerInst.instId_) == null)
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("duifangbuzaichangjing"));
         return;
     }
     if (Prebattle.Instance.FindPlayer((int)PlayerInst.instId_) != null && Prebattle.Instance.FindPlayer((int)PlayerInst.instId_).playerData_.isInBattle_)
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("zhengzaizhandou"));
         return;
     }
     if (GuildSystem.IsMyGuildMember((int)PlayerInst.instId_) && ssd.sceneType_ == SceneType.SCT_GuildBattleScene)
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("bunenggongjibenjiazu"));
         return;
     }
     if (/*ssd.sceneType_ == SceneType.SCT_TeamPK||ssd.sceneType_ == SceneType.SCT_AlonePK &&*/ TeamSystem.isTeamMember((int)PlayerInst.instId_))
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("bunenggongji"));
         return;
     }
     if (GuildSystem.battleState == 1 && ssd.sceneType_ == SceneType.SCT_GuildBattleScene)
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("jiazuzhanopen"));
         return;
     }
     if (GuildSystem.battleState == 3)
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("jiazuzhanojieshu"));
         return;
     }
     NetConnection.Instance.requestPk((uint)PlayerInst.instId_);
 }
Ejemplo n.º 2
0
    public void Cast(int skillId, int skillLv, BattleActor caster, BattleActor[] aims, COM_ReportTarget[] propertyVals, FinishCallBack finCallback, AttackFinishCallBack attackfinishCallback = null, bool realAimPos = false)
    {
        GlobalInstanceFunction.Instance.openTimer_    = true;
        GlobalInstanceFunction.Instance.deadTimer_    = 0f;
        GlobalInstanceFunction.Instance.OnDeadFinish += OnDealDeadFinish;
        if (crt_data_ != null)
        {
            ClientLog.Instance.LogError("a skill is casting");
            return;
        }

        effectInsts_ = new Dictionary <int, EffectInst> ();

        crt_data_ = SkillData.GetData(skillId, skillLv);

        if (crt_data_ == null)
        {
            ClientLog.Instance.LogError("skill id :" + skillId + "has not data");
            return;
        }

        realAimPos_ = realAimPos;
        if (caster.InstId == GamePlayer.Instance.InstId || TeamSystem.isTeamMember(caster.InstId))
        {
            AttaclPanel.Instance.SetSkillIcon(skillId, skillLv, caster.AssetId);
            //caster.ControlEntity.PlayerInfoUI.GetComponent<Roleui>().ShowSkill(crt_data_.singEffectId_, caster.SkillNamePos());
        }

        isPhysic_ = crt_data_._IsPhysic;
        if (isPhysic_)
        {
            if (caster.battlePlayer.weaponItemId_ != 0)
            {
                isMelee_ = !caster.rangeWeapon();
            }
            else
            {
                isMelee_ = crt_data_._IsMelee;
            }
        }
        else
        {
            isMelee_ = crt_data_._IsMelee;
        }

        Transform t = Battle.Instance.GetStagePointByIndex(caster.BattlePos);

        if (t == null)
        {
            return;
        }
        caster_                  = caster;
        aims_                    = TrimNull(aims);
        props_                   = propertyVals;
        originObj_               = t.gameObject;
        finish_call_back_        = finCallback;
        attack_finish_call_back_ = attackfinishCallback;
        //caster_.ResetPos();
        Battle.Instance.ResetActorDirection();

        aimsQue_ = new Queue <BattleActor>();
        propQue_ = new Queue <COM_ReportTarget>();
        for (int i = 0; i < aims_.Length; ++i)
        {
            if (aims_[i] == null)
            {
                continue;
            }
            aimsQue_.Enqueue(aims_[i]);
            propQue_.Enqueue(props_[i]);
        }

        if (isMelee_)
        {
            caster_.attackAnim_ = caster_.GetWeaponAction() + GlobalValue.TAttack;
        }
        else
        {
            if (isPhysic_)
            {
                caster_.castAnim_ = caster_.GetWeaponAction() + GlobalValue.TCast;
            }
            else
            {
                caster_.castAnim_ = GlobalValue.TCast;
            }
        }

        caster.battlePlayer.mpCrt_ -= crt_data_._Cost_mana;

        if (caster.InstId == GamePlayer.Instance.InstId)
        {
            AttaclPanel.Instance.ChangeValue(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_);
            ScrollViewPanel.curMp = caster.battlePlayer.mpCrt_;
        }

        if (Battle.Instance.SelfActorBattleBaby != null)
        {
            if (caster.InstId == Battle.Instance.SelfActorBattleBaby.InstId)
            {
                AttaclPanel.Instance.ChangeValueBaby(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_);
            }
        }

        if (caster.ControlEntity.PlayerInfoUI != null &&
            caster.ControlEntity.PlayerInfoUI.GetComponent <Roleui>() != null)
        {
            Roleui roleinfoUI = caster.ControlEntity.PlayerInfoUI.GetComponent <Roleui>();
            roleinfoUI.ValueChange(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_, false);
        }

        //EffectAPI.Load (() => {
        //    if (crt_data_._Cast_effectID != -1)
        //        EffectAPI.Play((EFFECT_ID)crt_data_._Cast_effectID, caster_.ControlEntity.ActorObj, null, null, AfterCastEffect);
        //    else
        //        AfterCastEffect();
        //}, crt_data_._EffectID, crt_data_._Cast_effectID, crt_data_._Cast_effectID);
        if (crt_data_._Cast_effectID != -1)
        {
            EffectAPI.Play((EFFECT_ID)crt_data_._Cast_effectID, caster_.ControlEntity.ActorObj, null, null, AfterCastEffect);
        }
        else
        {
            AfterCastEffect();
        }
    }