示例#1
0
 /// <summary>
 /// Hide this instance.
 /// </summary>
 public void Hide(bool hide)
 {
     //OwnBtn.Hide (hide);
     //Name.Hide (hide);
     //Count.Hide(hide);
     Icon.Hide(hide);
     Cover.Hide(hide);
 }
示例#2
0
    /**
     * tzz added
     * set the item icon sub-function
     *
     * @param	_itemIcon		item icon prefab
     * @param	_itemInfo		item data information
     */
    public static void SetItemIcon(Transform _itemIcon, ItemSlotData _itemInfo, bool _lockedOrEmpty = true)
    {
        //SpriteText numTex = _itemIcon.FindChild("Count").GetComponent<SpriteText>();
        // SpriteText newTex = _itemIcon.FindChild("NewText").GetComponent<SpriteText>();
        PackedSprite        sprite           = _itemIcon.Find("Icon").GetComponent <PackedSprite>();
        PackedSprite        Plus             = _itemIcon.Find("PlusIndicator").GetComponent <PackedSprite>();
        PackedSprite        sprite1          = _itemIcon.Find("IconQiangHua1").GetComponent <PackedSprite>();
        PackedSprite        sprite2          = _itemIcon.Find("IconQiangHua2").GetComponent <PackedSprite>();
        PackedSprite        sprite3          = _itemIcon.Find("IconQiangHua3").GetComponent <PackedSprite>();
        PackedSprite        sprite4          = _itemIcon.Find("IconQiangHua4").GetComponent <PackedSprite>();
        PackedSprite        sprite5          = _itemIcon.Find("IconQiangHua5").GetComponent <PackedSprite>();
        List <PackedSprite> iconQianghuaList = new List <PackedSprite>();

        iconQianghuaList.Add(sprite1);
        iconQianghuaList.Add(sprite2);
        iconQianghuaList.Add(sprite3);
        iconQianghuaList.Add(sprite4);
        iconQianghuaList.Add(sprite5);
        for (int i = 0; i < iconQianghuaList.Count; i++)
        {
            PackedSprite packeQianghua = iconQianghuaList[i];
            packeQianghua.transform.localScale = Vector3.zero;
        }

        if (!InitializedPos)
        {
            InitializedPos = true;
            VisiblePos     = new Vector3(0, 0, 0);                     //numTex.transform.localPosition;
        }

        // the PlayAnim has adjust whether gameobject is actived otherwise no effect
        //
        bool tFormerSpriteActive = sprite.gameObject.active;

        sprite.gameObject.active = true;

        if (_itemInfo != null && _itemInfo.IsUnLock())
        {
            if (null != _itemInfo.MItemData)
            {
                if (_itemInfo.MItemData.BasicData.Count > 1)
                {
                    //numTex.transform.localPosition = VisiblePos;
                    //numTex.Text = _itemInfo.MItemData.BasicData.Count.ToString();
                    //if(numTex.transform.localScale.x == 1 && Globals.Instance.MGUIManager.widthRatio != 1){
                    //numTex.transform.localScale = new Vector3(1/Globals.Instance.MGUIManager.widthRatio,
                    //1/Globals.Instance.MGUIManager.heightRatio,1);
                    //}
                }
                else
                {
                    //numTex.transform.localPosition = InvisiblePos;
                }

                // newText.Text = "New!";
                sprite.Hide(false);
                sprite.PlayAnim(_itemInfo.MItemData.BasicData.Icon);

                if (_itemInfo.MItemData.BasicData.StrengthenLevel > 1)
                {
                    int qianghuaXingLeve = (_itemInfo.MItemData.BasicData.StrengthenLevel - 1) / 20;
                    for (int i = 0; i <= qianghuaXingLeve; i++)
                    {
                        PackedSprite packeQianghua = iconQianghuaList[i];
                        packeQianghua.transform.localScale = Vector3.one;
                    }
                }
            }
            else
            {
                //numTex.transform.localPosition = InvisiblePos;
                Plus.transform.localPosition = InvisiblePos;

                sprite.PlayAnim(PackageItemIconSlot.IconNullNormal);
            }
        }
        else
        {
            //numTex.transform.localPosition = InvisiblePos;
            Plus.transform.localPosition = InvisiblePos;

            sprite.PlayAnim(_lockedOrEmpty ? PackageItemIconSlot.IconLock : PackageItemIconSlot.IconNullNormal);
        }

        // restore the active of gameobject
        sprite.gameObject.active = tFormerSpriteActive;
    }
 /// <summary>
 /// Hide the specified iHide.
 /// </summary>
 /// <param name='iHide'>
 /// I hide.
 /// </param>
 public void Hide(bool iHide)
 {
     mIconSprite.Hide(iHide);
     mAttributeText.Hide(iHide);
 }
    void Update()
    {
        decreaseCooldowns();

        if (lastCastTime != -1)
        {
            doAnimToDirection(lastAnimation);

            if (wasCasting)
            {
                if (wasCastingSummon)
                {
                    if (isCentralized)
                    {
                        skillSummonInvoked();
                    }
                    else
                    {
                        if (positionizeSkillInvoked(teleportPoint_central))
                        {
                            skillSummonInvoked();
                        }
                    }
                    return;
                }
                if (wasCastingIcicle)
                {
                    skillIcicleInvoked();
                    return;
                }
                if (wasCastingBlame)
                {
                    if (isCentralized)
                    {
                        skillBlameInvoked();
                    }
                    else
                    {
                        if (positionizeSkillInvoked(teleportPoint_central))
                        {
                            skillBlameInvoked();
                        }
                    }
                    return;
                }
                if (wasCastingCurse)
                {
                    if (isNearPlayer)
                    {
                        skillCurseInvoked();
                    }
                    else
                    {
                        List <GameObject> unsafePoints = unsafeTeleportPoints();
                        int pos = random.Next(0, unsafePoints.Count);
                        if (positionizeSkillInvoked(unsafePoints[pos]))
                        {
                            skillCurseInvoked();
                        }
                    }
                }
                if (wasCastingLifeDrain)
                {
                    if (isNearPlayer)
                    {
                        skillLifeDrainInvoked();
                    }
                    else
                    {
                        List <GameObject> unsafePoints = unsafeTeleportPoints();
                        int pos = random.Next(0, unsafePoints.Count);
                        if (positionizeSkillInvoked(unsafePoints[pos]))
                        {
                            skillLifeDrainInvoked();
                        }
                    }
                }
                if (wasCastingTeleport)
                {
                    skillTeleportInvoked(null);
                    return;
                }
            }
            if (Time.time - lastCastTime > sprites.GetAnim("Hitted (L)").GetDuration() && gotHit)
            {
                gotHit       = false;
                lastCastTime = -1;
            }
            if (Time.time - lastCastTime > sprites.GetAnim("Dead (L)").GetDuration() && isDying)
            {
                sprites.StopAnim();
                sprites.Hide(true);
            }
            if (Time.time - lastCastTime > sound_dying.length && isDying)
            {
                Instantiate(victory);
                for (int i = 0; i < instancedMob.Count; i++)
                {
                    Destroy(instancedMob[i]);
                }
                instancedMob.Clear();
                Destroy(gameObject);
            }
            magicInterrupted = false;
            return;
        }

        if (curHP == 0)
        {
            doAnimToDirection("Dead");
            audio.PlayOneShot(sound_dying);
            Physics.IgnoreCollision(player.GetComponent <CharacterController>().collider, GetComponent <CharacterController>().collider, true);
            lastCastTime = Time.time;
            isDying      = true;
            return;
        }

        if (curGlobalCooldown > 0)
        {
            doAnimToDirection("Standing");
            return;
        }

        if (curLifeDrainCooldown == 0 && curHP < maxHP * 25 / 100)
        {
            wasCasting          = true;
            wasCastingLifeDrain = true;
            lastCastTime        = Time.time;
            if (nearPlayer(gameObject))
            {
                isNearPlayer = true;
            }
            else
            {
                isNearPlayer = false;
            }
        }
        else if (curSummonCooldown == 0)
        {
            wasCasting       = true;
            wasCastingSummon = true;
            lastCastTime     = Time.time;
            if (transform.position == teleportPoint_central.transform.position)
            {
                isCentralized = true;
            }
            else
            {
                isCentralized = false;
            }
        }
        else if (curCurseCooldown == 0)
        {
            wasCasting      = true;
            wasCastingCurse = true;
            lastCastTime    = Time.time;
            if (nearPlayer(gameObject))
            {
                isNearPlayer = true;
            }
            else
            {
                isNearPlayer = false;
            }
        }
        else if (curIcicleCooldown == 0)
        {
            wasCasting       = true;
            wasCastingIcicle = true;
            lastCastTime     = Time.time;
        }
        else if (curBlameCooldown == 0)
        {
            wasCasting      = true;
            wasCastingBlame = true;
            lastCastTime    = Time.time;
            if (transform.position == teleportPoint_central.transform.position)
            {
                isCentralized = true;
            }
            else
            {
                isCentralized = false;
            }
        }
        else if (curTeleportCooldown == 0 && nearPlayer(gameObject))        // there is no cooldown to attack, try to run
        {
            doAnimToDirection("Casting 1");
            wasCasting         = true;
            wasCastingTeleport = true;
            lastCastTime       = Time.time;
            if (currentDirection == Direction.Left)
            {
                skillTeleport.DoAnim("Departure (L)");
            }
            else
            {
                skillTeleport.DoAnim("Departure (R)");
            }
            audio.PlayOneShot(sound_teleport);
        }
        else
        {
            doAnimToDirection("Standing");
        }
    }
示例#5
0
 // Update is called once per frame
 public override void Start()
 {
     base.Start();
     CameraControl.FinishReached += FinishReachedHandler;
     selection.Hide(true);
 }
示例#6
0
 public void Hide(bool hide)
 {
     Plus.Hide(hide);
     Count.Hide(hide);
     Icon.Hide(hide);
 }