Beispiel #1
0
    void GetMarkAtlasAndSet(int m_pid, UISprite mItemIcon)
    {
        ConfigDataType datatype = DataCore.getDataType(m_pid);

        if (datatype == ConfigDataType.Monster)
        {
            AtlasMgr.mInstance.SetHeadSprite(mItemIcon, m_pid.ToString());
            return;
        }
        else if (datatype == ConfigDataType.Equip)
        {
            mItemIcon.atlas = AtlasMgr.mInstance.equipAtlas;
        }
        else if (datatype == ConfigDataType.Gems)
        {
            mItemIcon.atlas = AtlasMgr.mInstance.commonAtlas;
        }
        else if (datatype == ConfigDataType.Item)
        {
            mItemIcon.atlas = AtlasMgr.mInstance.itemAtlas;
        }
        else if (datatype == ConfigDataType.Frag)
        {
            SoulInfo info = new SoulInfo(0, m_pid, 1);
            Soul     soul = new Soul();
            soul.m_config = Core.Data.soulManager.GetSoulConfigByNum(info.num);
            soul.m_RTData = info;
            if (soul.m_config.type == (int)ItemType.Monster_Frage)
            {
                MonsterData mon = Core.Data.monManager.getMonsterByNum(soul.m_config.updateId);
                if (mon != null)
                {
                    AtlasMgr.mInstance.SetHeadSprite(mItemIcon, mon.ID.ToString());
                }
            }
            else if (soul.m_config.type == (int)ItemType.Equip_Frage)
            {
                EquipData equip = Core.Data.EquipManager.getEquipConfig(soul.m_config.updateId);
                if (equip != null)
                {
                    mItemIcon.atlas      = AtlasMgr.mInstance.equipAtlas;
                    mItemIcon.spriteName = soul.m_config.updateId.ToString();
                }
            }
            else
            {
                mItemIcon.atlas      = AtlasMgr.mInstance.itemAtlas;
                mItemIcon.spriteName = soul.m_RTData.num.ToString();
            }
            return;
        }
        ItemData _data = Core.Data.itemManager.getItemData(m_pid);

        if (_data != null)
        {
            mItemIcon.spriteName = _data.iconID.ToString();
        }
    }
Beispiel #2
0
    void OnReachedEvent()
    {
        switch (harpoonState)
        {
        case HARPOON_STATE.NONE:
            break;

        case HARPOON_STATE.MOVING:
            ReturnHarpoon(HARPOON_STATE.RETURNING);

            break;

        case HARPOON_STATE.RETURNING:
            ResetProjectile();
            owner.GetComponent <UnitInfo>().EquipWeapon(1);
            break;

        case HARPOON_STATE.FIXED:
            break;

        case HARPOON_STATE.RETURNING_WITH_SOUL:
            SoulInfo soulInfo = fixedTarget.GetComponent <SoulInfo>();
            if (soulInfo)
            {
                if (soulInfo.buffType != BuffBehaviour.BuffType.None)
                {
                    owner.GetComponent <UnitInfo>().AddBuff(soulInfo.buffType, soulInfo.buffTime);
                }
            }
            //rigidbody.isKinematic = true;
            ResetProjectile();
            owner.GetComponent <UnitInfo>().EquipWeapon(1);
            break;

        case HARPOON_STATE.RETURNING_WITH_OBJECT:
            //rigidbody.isKinematic = true;
            DettachObject(fixedTarget);
            ResetProjectile();
            owner.GetComponent <UnitInfo>().EquipWeapon(1);
            break;

        case HARPOON_STATE.FLYING:
            //rigidbody.isKinematic = true;
            //ResetProjectile();
            harpoonState = HARPOON_STATE.HANGING;
            owner.transform.eulerAngles = new Vector3(0, owner.transform.eulerAngles.y, 0);
            break;

        default:
            break;
        }
    }
    protected override IEnumerator BehaviourCoroutine()
    {
        if (harpoon.harpoonState == PHarpoon.HARPOON_STATE.FIXED)
        {
            if (harpoon.fixedTarget != null && harpoon.fixedTarget.tag == "Monster")
            {
                Vector3 f = (harpoon.transform.position - unitInfo.transform.position).normalized;
                f.y = 0;
                unitInfo.GetMovement().RotateTo(f, 10);
                SoulInfo soulInfo = harpoon.fixedTarget.GetComponent <SoulInfo>();
                CameraSpring.Instance.ChangeCamInfo("Player_HealingSoul");
                if (soulInfo.IsAnEvil())
                {
                    //harpoon.transform.rotation = Quaternion.LookRotation(harpoon.transform.position-unitInfo.transform.position);
                    CameraSpring.Instance.SetFixTarget(harpoon.transform);
                    animator.CrossFade("HealingSoul_Ready", 0.025f);
                    unitInfo.ChangeState(UnitInfo.UnitState.action);
                    float percentage       = 50;
                    float warning          = 0;
                    float warningTime      = 0;
                    float warningTimeDelay = 1;
                    //float timeCheck=castTime;
                    //while (timeCheck>0)
                    //{
                    //    timeCheck -= Time.deltaTime;
                    //    yield return null;
                    //}
                    harpoon.harpoonState = PHarpoon.HARPOON_STATE.RETURNING_WITH_SOUL;
                    LineRenderer lineRenderer = harpoon.chainDrawer.GetComponent <LineRenderer>();
                    lineRenderer.material.color = Color.green;
                    while (percentage < 100 && percentage >= 0)
                    {
                        f = (harpoon.transform.position - unitInfo.transform.position).normalized;
                        //f.y = 0;
                        unitInfo.GetMovement().RotateTo(f, 10);
                        if (warningTime > 0)
                        {
                            warningTime -= Time.deltaTime;
                            if (warningTime <= 0)
                            {
                                warningTimeDelay            = UnityEngine.Random.Range(3.0f, 4.0f);
                                lineRenderer.material.color = Color.green;
                            }
                        }
                        else if (warningTimeDelay <= 0 && warningTime <= 0)
                        {
                            warningTime = UnityEngine.Random.Range(0.5f, 1.0f);
                            lineRenderer.material.color = Color.red;
                        }
                        else if (warningTimeDelay > 0)
                        {
                            warningTimeDelay -= Time.deltaTime;
                        }
                        if (Input.GetKey(KeyCode.Mouse0))
                        {
                            if (warningTime > 0)
                            {
                                warning += Time.deltaTime;
                            }
                            else
                            {
                                percentage += Time.deltaTime;
                            }
                            animator.Play("HealingSoul_Pulling");
                        }
                        else
                        {
                            animator.Play("HealingSoul_Ready");
                            percentage -= Time.deltaTime;
                        }
                        yield return(null);
                    }
                    //soulInfo.SetEvilGuage(soulInfo.GetEvilGuage()-100);
                }
            }
        }
        yield return(null);

        CameraSpring.Instance.ChangeCamInfo("Player");
        StopAction();
    }
    public void OnShow(SecretShopDataStruct data)
    {
        if (data == null)
        {
            gameObject.SetActive(false);
            return;
        }
        else
        {
            gameObject.SetActive(true);
        }

        mdata = data;

        mItemIcon.gameObject.SetActive(true);
        mItemNum.gameObject.SetActive(true);
        mItemName.gameObject.SetActive(true);
        mChoose.gameObject.SetActive(true);

        GetObject(data.num);

        SetItemStatus();
        SetItemPrice();

        titleObj.SetActive(true);

        if (mdata.type == 1)
        {
            spDiscountTitle.spriteName = "sc_msz_dz";
        }
        else if (mdata.type == 2)
        {
            spDiscountTitle.spriteName = "sc_msz_dj1";
        }
        else if (mdata.type == 0)
        {
            titleObj.SetActive(false);
        }

        mChoose.gameObject.SetActive(false);

        mItemName.text = str;

        mSoulIcon.gameObject.SetActive(false);
        mItemNum.text = ItemNumLogic.setItemNum(mdata.count, mItemNum, mItemNum.gameObject.transform.parent.gameObject.GetComponent <UISprite>());
        ConfigDataType datatype = DataCore.getDataType(data.num);

        if (datatype == ConfigDataType.Monster)
        {
            AtlasMgr.mInstance.SetHeadSprite(mItemIcon, data.num.ToString());
            mItemIcon.MakePixelPerfect();
            return;
        }
        else if (datatype == ConfigDataType.Equip)
        {
            mItemIcon.atlas = AtlasMgr.mInstance.equipAtlas;
        }
        else if (datatype == ConfigDataType.Gems)
        {
            mItemIcon.atlas = AtlasMgr.mInstance.commonAtlas;
        }
        else if (datatype == ConfigDataType.Item)
        {
            mItemIcon.atlas = AtlasMgr.mInstance.itemAtlas;
        }
        else if (datatype == ConfigDataType.Frag)
        {
            SoulInfo info = new SoulInfo(0, data.num, data.count);
            Soul     soul = new Soul();
            soul.m_config = Core.Data.soulManager.GetSoulConfigByNum(info.num);
            soul.m_RTData = info;
            if (soul.m_config.type == (int)ItemType.Monster_Frage)
            {
                MonsterData mon = Core.Data.monManager.getMonsterByNum(soul.m_config.updateId);
                if (mon != null)
                {
                    mSoulIcon.gameObject.SetActive(true);
                    AtlasMgr.mInstance.SetHeadSprite(mItemIcon, mon.ID.ToString());
                    mItemIcon.MakePixelPerfect();
                    mSoulIcon.spriteName = "bag-0003";
                }
            }
            else if (soul.m_config.type == (int)ItemType.Equip_Frage)
            {
                EquipData equip = Core.Data.EquipManager.getEquipConfig(soul.m_config.updateId);
                if (equip != null)
                {
                    mSoulIcon.gameObject.SetActive(true);
                    mItemIcon.atlas      = AtlasMgr.mInstance.equipAtlas;
                    mItemIcon.spriteName = soul.m_config.updateId.ToString();
                    mItemIcon.MakePixelPerfect();
                    mSoulIcon.spriteName = "sui";
                }
            }
            else
            {
                mItemIcon.atlas      = AtlasMgr.mInstance.itemAtlas;
                mItemIcon.spriteName = soul.m_RTData.num.ToString();
            }
            return;
        }
        else
        {
            RED.LogWarning("unknow reward type");
        }

        if (datatype == ConfigDataType.Gems)
        {
            GemsManager gemsMgr = Core.Data.gemsManager;
            if (gemsMgr != null)
            {
                GemData Gdata = gemsMgr.getGemData(mdata.num);
                if (Gdata != null)
                {
                    mItemIcon.spriteName = Gdata.anime2D;
                }
            }
        }
        else if (datatype == ConfigDataType.Item)
        {
            ItemData item = Core.Data.itemManager.getItemData(mdata.num);
            if (item != null)
            {
                mItemIcon.spriteName = item.iconID.ToString();
            }
        }
        else
        {
            mItemIcon.spriteName = mdata.num.ToString();
        }

        mItemIcon.MakePixelPerfect();
    }
    void KeyInput()
    {
        if (myUnit.GetCondition() != ConditionData.UnitCondition.none)
        {
            movement.Stop();
            return;
        }

        // Zoom IN
        if (myUnit.GetAction().IsUsingAction("ThrowHarpoon"))
        {
            if (myUnit.GetAction().behaviourState < 3)
            {
                if ((!Input.GetKey(KeyCode.Mouse1) || myUnit.currentWeapon.weaponName != "Harpoon"))
                {
                    /*camSpring.ChangeCamInfo("Player");
                     * zoomIn = false;*/
                    if (zoomIn)
                    {
                        camSpring.ChangeCamInfo("Player");
                        zoomIn = false;
                    }
                    myUnit.GetAction().StopAction();
                }
            }

            /*if (zoomIn && !movement.isOnGround)
             * {
             *  Time.timeScale = 0.3f;
             *  Time.fixedDeltaTime = 0.02F * Time.timeScale;
             * }
             * else
             * {
             *  Time.timeScale = 1f;
             *  Time.fixedDeltaTime = 0.02F * Time.timeScale;
             * }*/
        }
        else
        {
            if (myUnit.currentWeapon.weaponName == "Harpoon")
            {
                if (Input.GetKeyDown(KeyCode.Mouse1))
                {
                    if (myUnit.GetAction().UseSkill("ThrowHarpoon"))
                    {
                        camSpring.ChangeCamInfo("Player_Aim");
                        zoomIn = true;
                    }
                }
            }
            else if (harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.FIXED)
            {
                if (Input.GetKeyDown(KeyCode.Mouse1))
                {
                    myUnit.GetAction().UseSkill("PullHarpoon");
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            if (harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.FIXED)
            {
                myUnit.GetAction().UseSkill("HookShot", false);
            }
            else if (!zoomIn && harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.NONE)
            {
                myUnit.GetAction().UseSkill("SwingWeapon");
            }
            else if (zoomIn && harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.NONE)
            {
                myUnit.GetAction().UseSkill("ThrowHarpoon");
            }
        }
        MovementInput();
        if (Input.GetKey(KeyCode.E) && harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.FIXED)
        {
            if (harpoonProjectile.fixedTarget.tag == "Monster")
            {
                SoulInfo soulInfo = harpoonProjectile.fixedTarget.GetComponent <SoulInfo>();
                if (soulInfo && soulInfo.IsAnEvil())
                {
                    myUnit.GetAction().UseSkill("HealingSoul", false);
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.Space) && !myUnit.GetAction().IsUsingAction())
        {
            if (!movement.isOnGround)
            {
                if (myUnit.IsHaveBuff(BuffBehaviour.BuffType.Fly))
                {
                    myUnit.GetAction().UseSkill("Flying");
                }
            }
            else
            {
                movement.Jump(jumpPower);
            }
        }
    }
Beispiel #6
0
    public void SetDetail(int num, int numvalue)
    {
        if (_Numbg != null && _Num != null)
        {
            _Numbg.gameObject.SetActive(false);
            _Num.SafeText("");
        }
        ConfigDataType type     = DataCore.getDataType(num);
        string         _str     = "";
        int            _starnum = 0;

        if (numvalue > 0)
        {
            if (_Numbg != null && _Num != null)
            {
                _Numbg.gameObject.SetActive(true);
                _Num.SafeText(numvalue.ToString());
            }
        }

        if (_Tag != null)
        {
            _Tag.gameObject.SetActive(false);
        }
        switch (type)
        {
        case ConfigDataType.Monster:
            AtlasMgr.mInstance.SetHeadSprite(_Head, num.ToString());
            _str     = Core.Data.monManager.getMonsterByNum(num).name;
            _starnum = Core.Data.monManager.getMonsterByNum(num).star;
            break;

        case ConfigDataType.Item:
            _Head.atlas = AtlasMgr.mInstance.itemAtlas;
//				_Head.spriteName = num.ToString();
            _Head.spriteName = Core.Data.itemManager.getItemData(num).iconID.ToString();
            _starnum         = Core.Data.itemManager.getItemData(num).star;
            _str             = Core.Data.itemManager.getItemData(num).name;
            break;

        case ConfigDataType.Equip:
            _Head.atlas      = AtlasMgr.mInstance.equipAtlas;
            _Head.spriteName = num.ToString();
            _starnum         = Core.Data.EquipManager.getEquipConfig(num).star;
            _str             = Core.Data.EquipManager.getEquipConfig(num).name;
            break;

        case ConfigDataType.Gems:
            _Head.atlas      = AtlasMgr.mInstance.commonAtlas;
            _Head.spriteName = num.ToString();
            _starnum         = Core.Data.gemsManager.getGemData(num).star;
            _str             = Core.Data.gemsManager.getGemData(num).name;
            break;

        case ConfigDataType.Frag:
            SoulInfo info = new SoulInfo(0, num, 1);
            Soul     soul = new Soul();
            soul.m_config = Core.Data.soulManager.GetSoulConfigByNum(info.num);
            soul.m_RTData = info;
            if (soul.m_config.type == (int)ItemType.Monster_Frage)
            {
                MonsterData mon = Core.Data.monManager.getMonsterByNum(soul.m_config.updateId);
                if (mon != null)
                {
                    AtlasMgr.mInstance.SetHeadSprite(_Head, mon.ID.ToString());
                    _Head.MakePixelPerfect();
                }
            }
            else if (soul.m_config.type == (int)ItemType.Equip_Frage)
            {
                EquipData equip = Core.Data.EquipManager.getEquipConfig(soul.m_config.updateId);
                if (equip != null)
                {
                    _Head.atlas      = AtlasMgr.mInstance.equipAtlas;
                    _Head.spriteName = soul.m_config.updateId.ToString();
                }
            }
            else
            {
                _Head.atlas      = AtlasMgr.mInstance.itemAtlas;
                _Head.spriteName = soul.m_RTData.num.ToString();
            }
            _starnum = Core.Data.soulManager.GetSoulConfigByNum(num).star;
            _str     = Core.Data.soulManager.GetSoulConfigByNum(num).name;
            if (_Tag != null)
            {
                _Tag.gameObject.SetActive(true);
            }
            break;

        default:
            RED.LogError(" not found  : " + num);
            break;
        }

        _StarGroup.SetStar(_starnum);
        _Name.text = _str;
    }