Exemplo n.º 1
0
    private void EmitBeAttackedFontInvoke(EmitEffectFontData effectFontData)
    {
        GameData.BattleGameData.AttackedState currentAttackState = effectFontData._currBeAttackedState;
        GameObject gameObject = effectFontData._thisGameObject;
        int        damage     = effectFontData._currentEffectFontDamage;

        BattleBloodControl bloodControl = Globals.Instance.MGUIManager.GetGUIWindow <GUIBattleMain>().bloodControl;

        if (bloodControl == null)
        {
            Debug.Log("bloodControl is null");
            return;
        }

        // tzz modified for Refactoring
        Vector3 worldPos = gameObject.transform.position;

        worldPos.z += FightCellSlot.EffectDamageBloodOffset;
        Vector3 offset = new Vector3(0f, 20f, 0f);

        switch (currentAttackState)
        {
        case GameData.BattleGameData.AttackedState.DODGE:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.DODGE, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.NORMAL_ATTACKED:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_GRAY, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.NORMAL_CRIT:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_RED, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.SKILL_ATTACKED:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_GRAY, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.SKILL_CRIT:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_RED, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.TREAT_SKILL_ATTACKED:
        case GameData.BattleGameData.AttackedState.REDUCE_DAMAGE_SKILL_ATTACKED:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_GREEN, damage, "");
            break;

        default:
            Debug.LogError("Error AttackedState EmitBeAttackedFontInvoke " + currentAttackState);
            break;
        }
    }
Exemplo n.º 2
0
    private void EmitAttackFontInvoke(EmitEffectFontData effectFontData)
    {
        BattleBloodControl bloodControl = Globals.Instance.MGUIManager.GetGUIWindow <GUIBattleMain>().bloodControl;

        if (bloodControl == null)
        {
            Debug.Log("bloodControl is null");
            return;
        }

        GameData.BattleGameData.AttackState attackState = effectFontData._currAttackState;
        GameObject gameObject = effectFontData._thisGameObject;

        Vector3 worldPos = gameObject.transform.position;

        worldPos.z += FightCellSlot.EffectSkillNameOffset;
        Vector3 offset = new Vector3(0f, 20f, 0f);

        switch (attackState)
        {
        case GameData.BattleGameData.AttackState.NORMAL_ATTACK:
        case GameData.BattleGameData.AttackState.SKILL_ATTACK:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.SKILL, 0, effectFontData.skillName);
            break;

        case GameData.BattleGameData.AttackState.NORMAL_ATTACK_CRIT:
        case GameData.BattleGameData.AttackState.SKILL_ATTACK_CRIT:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.CRIT_SKILL, 0, effectFontData.skillName);
            break;

        case GameData.BattleGameData.AttackState.TREAT_SKILL_ATTACKED:
        case GameData.BattleGameData.AttackState.REDUCE_DAMAGE_SKILL_ATTACKED:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.SKILL, 0, effectFontData.skillName);
            break;

        default:
            Debug.LogError("Error AttackState EmitAttackFontInvoke " + attackState);
            break;
        }
    }
Exemplo n.º 3
0
    public virtual void Release()
    {
        ReleaseAttachmentSlots();

        if (_thisGameObject != null)
        {
            GameObject.Destroy(_thisGameObject);
            _thisGameObject = null;             // tzz add for clear attribute member

            BattleBloodControl.DestoryBloodStrip(_warshipID);
            Globals.Instance.M3DItemManager.DestroyEZ3DItem(_mEZ3DName.gameObject);
        }

        // deleete the general avatar if has
        if (mWarshipHeader != null)
        {
            Globals.Instance.M3DItemManager.DestroyEZ3DItem(mWarshipHeader.gameObject);
            mWarshipHeader = null;
        }

        // _warshipID = -1;
        _warshipResourceName = string.Empty;
    }
Exemplo n.º 4
0
    public override void InitializeGUI()
    {
        if (base._mIsLoaded)
        {
            return;
        }
        base._mIsLoaded = true;

        // tzz added for custom camera button
        //m_customCameraBtn = transform.FindChild("CustomCameraBtn").GetComponent<UIToggle>();
        //m_customCameraBtn.SetToggleState(BattleStatus.CustomCameraState?1:0);
        //UIEventListener.Get(m_customCameraBtn).onClick += OnCustomCameraBtnClick;

        _mRootTransform               = this.transform;
        _mRootTransform.parent        = Globals.Instance.MGUIManager.MGUICamera.transform;
        _mRootTransform.localPosition = new Vector3(0.0f, 0, 10f);

        _mQuickFightBtn = _mRootTransform.Find("QuickFightBtn").GetComponent <UIButton>() as UIButton;
        UIEventListener.Get(_mQuickFightBtn.gameObject).onClick += OnClickQuickFightBtn;

        _mBuffInfoRoot = _mRootTransform.Find("BuffInfo");

        _mDescriptionText = _mRootTransform.Find("Description").GetComponent <UIButton>() as UIButton;

        _mShipInfoRoot = _mRootTransform.Find("WarshipInfo");

        _mWarshipName   = _mShipInfoRoot.Find("NameText").GetComponent(typeof(UIButton)) as UIButton;
        _mWarshipLife   = _mShipInfoRoot.Find("LifeText").GetComponent(typeof(UIButton)) as UIButton;
        _mWarshipDander = _mShipInfoRoot.Find("DanderText").GetComponent(typeof(UIButton)) as UIButton;

        // _mSkillBtn = _mShipInfoRoot.FindChild("SkillIcon").GetComponent( typeof(UIButton) ) as UIButton;
        UIEventListener.Get(_mSkillBtn.gameObject).onClick += OnClickSkillBtn;
        // _mSkillIcon = _mSkillBtn.transform.FindChild("Icon").GetComponent( typeof(PackedSprite) ) as PackedSprite;

        _mShipInfoRoot.gameObject.SetActiveRecursively(false);
        _mDescriptionText.gameObject.SetActiveRecursively(false);

        UIButton btn = BuffIconTp.GetComponent <UIButton>() as UIButton;

        _mBuffIconWidth  = btn.GetComponent <Collider>().bounds.size.x;
        _mBuffIconHeight = btn.GetComponent <Collider>().bounds.size.y;

        InitBuffData();
        SetShipInfoVisible(false);

        RegisterSubscriber();
        base.GUILevel = 8;
        uiPortDefense = transform.Find("UIPortDefense");
        //uiPortDefense.gameObject.SetActiveRecursively(false);
        // if this battle is port defense
        if (GameStatusManager.Instance.MBattleStatus.MBattleResult.BattleType == GameData.BattleGameData.BattleType.PROT_DEFENSE_BATTLE)
        {
            moveHeadPanelL = uiPortDefense.Find("MoveHeadPanelL");
            moveHeadPanelR = uiPortDefense.Find("MoveHeadPanelR");
            VS             = uiPortDefense.Find("VS");
            VS.gameObject.SetActiveRecursively(false);
            bottomHead = uiPortDefense.Find("BottomHead");
            bottomHead.gameObject.SetActiveRecursively(false);
            portDefenseDialog = uiPortDefense.Find("PortDefenseDialog");
            InitPortDefenseSprite();
        }
        else
        {
            uiPortDefense.gameObject.SetActiveRecursively(false);
        }

        //init the ship blood control
        _bloodControl = new BattleBloodControl();
        _bloodControl.effectFontPreb   = bSkillEffectFont;
        _bloodControl.numberPreb       = bNumber;
        _bloodControl.textSkillPreb    = skillText;
        _bloodControl.progressBarBlood = progressBarBlood;

        //调用数据
        UpdateData();
    }
Exemplo n.º 5
0
    public void Attack(SkillDataSlot skillData)
    {
        // Assign the real normal attack skill id
        if (skillData._skillID == 0)
        {
            EWarshipTypeID type = (EWarshipTypeID)Property.TypeID;
            switch (type)
            {
            case EWarshipTypeID.AIRCRAFT_CARRIER:
            {
                skillData._skillID = NormaAttackDefine.NORMAL_AIRCRAFT_CARRIER;
                break;
            }

            case EWarshipTypeID.UNDER_WATER_CRAFT:
            {
                skillData._skillID = NormaAttackDefine.NORMAL_UNDER_WATER_CRAFT;
                break;
            }

            default:
            {
                skillData._skillID = NormaAttackDefine.NORMAL_CANNON_CRAFT;
                break;
            }
            }
        }

        // Fill in skill data from DataTable
        skillData.MSkillData.BasicData.SkillLogicID = skillData._skillID;
        skillData.MSkillData.FillDataFromConfig();

        // Create skill, and execute the skill logic
        Skill skill = Globals.Instance.MSkillManager.CreateSkill(skillData, this);

        skill.StartSkill();

        // add attack effect font
        GameData.BattleGameData.AttackState attackState = (GameData.BattleGameData.AttackState)skillData._attckerAttackState;
        BattleBloodControl bloodControl = Globals.Instance.MGUIManager.GetGUIWindow <GUIBattle>()._bloodControl;

        if (attackState == GameData.BattleGameData.AttackState.NORMAL_ATTACK_CRIT)
        {
            bloodControl.EmitEffectFont(_thisGameObject.transform, _thisGameObject.transform.position, new Vector3(0f, 40f, 0f), BattleEffectFont.EffectType.CRIT, 0, "");
        }
        else if (attackState == GameData.BattleGameData.AttackState.SKILL_ATTACK)
        {
            // Only skill attack allow display effect font
            if (!skillData.MSkillData.BasicData.SkillIsNormalAttack)
            {
                bloodControl.EmitEffectFont(_thisGameObject.transform,
                                            _thisGameObject.transform.position, new Vector3(0f, 30f, 0f), BattleEffectFont.EffectType.SKILL, 0, skillData.MSkillData.BasicData.SkillName);
            }
        }
        else if (attackState == GameData.BattleGameData.AttackState.SKILL_ATTACK_CRIT)
        {
            bloodControl.EmitEffectFont(_thisGameObject.transform, _thisGameObject.transform.position, new Vector3(0f, 40f, 0f), BattleEffectFont.EffectType.CRIT_SKILL, 0, skillData.MSkillData.BasicData.SkillName);
        }
        else if (attackState == GameData.BattleGameData.AttackState.TREAT_SKILL_ATTACKED ||
                 attackState == GameData.BattleGameData.AttackState.REDUCE_DAMAGE_SKILL_ATTACKED)
        {
            // tzz added for display name of TREAT_SKILL_ATTACKED and REDUCE_DAMAGE_SKILL_ATTACKED
            //
            bloodControl.EmitEffectFont(_thisGameObject.transform,
                                        _thisGameObject.transform.position, new Vector3(0f, 30f, 0f), BattleEffectFont.EffectType.SKILL, 0, skillData.MSkillData.BasicData.SkillName);
        }
    }