Beispiel #1
0
    public override void Cancel(BaseScene.INPUT_TYPE type, JoystickManager.JOYSTICK_KEY_STATE keyState, JoystickManager.PLAYER_INDEX player)
    {
        if (SongCard.IsDownloading())
        {
            if (!buyConfirm.gameObject.activeSelf)
            {
                buyConfirm.Show(() =>
                {
                    list.CancelDownload();
                }, "正在下载,是否取消?");
            }
            else
            {
                buyConfirm.gameObject.SetActive(false);
            }
            return;
        }

        Sounder.instance.Play("返回按键");
        if (buyConfirm.gameObject.activeSelf)
        {
            buyConfirm.gameObject.SetActive(false);
        }
        else if (alert.gameObject.activeSelf)
        {
            alert.gameObject.SetActive(false);
            return;
        }
        else
        {
            LoadLevel("Title", false);
        }
    }
Beispiel #2
0
    public override void PressEnter(BaseScene.INPUT_TYPE type, JoystickManager.JOYSTICK_KEY_STATE keyState, JoystickManager.PLAYER_INDEX player)
    {
        if (keyState != JoystickManager.JOYSTICK_KEY_STATE.KEY_DOWN)
        {
            return;
        }


        if (alert.gameObject.activeSelf)
        {
            alert.gameObject.SetActive(false);
            return;
        }


        if (curItem == okBtn)
        {
            if (DataUtils.isAutoMode)
            {
                Global.GoAutoMode();
            }

            //加载下个场景
            EnterGame();
            return;
        }


        //=====================================CHARACTER===================
        if (inProp == false)
        {
            if (downloading)
            {
                if (confirm.gameObject.activeSelf)
                {
                    confirm.Press();
                    return;
                }
                return;
            }
            if (keyState != JoystickManager.JOYSTICK_KEY_STATE.KEY_DOWN)
            {
                return;
            }
            if (confirm.gameObject.activeSelf)
            {
                confirm.Press();
                return;
            }
            else if (alert.gameObject.activeSelf)
            {
                alert.gameObject.SetActive(false);
                return;
            }


            switch (characterIndex)
            {
            case 1:
            case 2:
            case 5:
            case 6:
                //直接进入游戏
                SetCharacter(characterIndex, true);
                return;
            }

            CharacterCard card  = cards[characterIndex];
            int           money = DataUtils.GetMoney();

            bool moneyEnough = money >= card.data.price;
            if (card.isLock)
            {
                confirm.Show(() =>
                {
                    if (moneyEnough)
                    {
                        Sounder.instance.Play("消费音效");
                        DataUtils.SetCharacterIsUnLock(card.data.id);
                        DataUtils.AddMoney(-card.data.price);
                        card.isLock = false;
                        card.RefreshLock();
                        lockSprite.SetActive(cards[characterIndex].isLock);
                        DownloadVideo();
                    }
                    else
                    {
                        Sounder.instance.Play("BAD音效");
                        alert.Show("您的音乐币不足");
                    }
                }, "花费" + card.data.price + "音乐币解锁");
            }
            else
            {
                DownloadVideo();
            }
        }
        else
        {
            PropData lastSelectData = null;

            PropCard c = curItem as PropCard;
            if (c == null)
            {
                return;
            }
            switch (c.data.id)
            {
            case 1:
            case 2:
            case 3:
                //纠正ID从1开始
                if (DataUtils.isAutoMode)
                {
                    return;
                }
                if (c.GetIsBuy())
                {
                    c.SetBuy(false);
                    DataUtils.AddMoney(c.data.price);
                    DataUtils.correntPropCount = 0;
                    Sounder.instance.Play("购买道具音效取消");
                    return;
                }

                if (DataUtils.correntPropCount > 0)
                {
                    lastSelectData = Global.PROP_TABLE[DataUtils.correntPropCount / 5];     //ID1,2,3就是纠正道具
                }

                if (TryBuyItem(c.data.price, lastSelectData == null ? 0 : lastSelectData.price))
                {
                    c.SetBuy(true);
                    DataUtils.correntPropCount = c.data.id * 5;
                    if (lastSelectData != null)
                    {
                        propCards[lastSelectData.id - 1].SetBuy(false);
                    }
                    Sounder.instance.Play("购买道具音效");
                }
                else
                {
                    alert.Show("您的音乐币不足");
                    Sounder.instance.Play("BAD音效");
                }
                break;

            case 4:
            case 5:
            case 6:
                //456
                if (DataUtils.isAutoMode)
                {
                    return;
                }
                if (c.GetIsBuy())
                {
                    c.SetBuy(false);
                    DataUtils.AddMoney(c.data.price);
                    DataUtils.lifeType = Global.LIFE_TYPE.LV1;
                    Sounder.instance.Play("购买道具音效取消");
                    return;
                }

                if (DataUtils.lifeType > Global.LIFE_TYPE.LV1)
                {
                    lastSelectData = Global.PROP_TABLE[(int)DataUtils.lifeType + 3];     //ID 4,5,6就是血量
                }

                if (TryBuyItem(c.data.price, lastSelectData == null?0:lastSelectData.price))
                {
                    DataUtils.lifeType = (Global.LIFE_TYPE)c.data.id - 3;
                    c.SetBuy(true);
                    if (lastSelectData != null)
                    {
                        propCards[lastSelectData.id - 1].SetBuy(false);
                    }
                    Sounder.instance.Play("购买道具音效");
                }
                else
                {
                    alert.Show("您的音乐币不足");
                    Sounder.instance.Play("BAD音效");
                }
                break;

            case 7:
                c.SetBuy(!c.GetIsBuy());
                DataUtils.isAutoMode = c.GetIsBuy();
                if (DataUtils.isAutoMode)
                {
                    Sounder.instance.Play("购买道具音效");
                    CancelBuy();
                }
                else
                {
                    Sounder.instance.Play("购买道具音效取消");
                }

                for (int i = 0; i < propCards.Length; i++)
                {
                    if (propCards[i] != c)
                    {
                        propCards[i].SetEnable(!DataUtils.isAutoMode);
                    }
                }
                break;
            }
        }
    }
Beispiel #3
0
    public override void PressEnter(BaseScene.INPUT_TYPE type, JoystickManager.JOYSTICK_KEY_STATE keyState, JoystickManager.PLAYER_INDEX player)
    {
        if (hasSelect)
        {
            return;
        }
        if (downloading)
        {
            if (confirm.gameObject.activeSelf)
            {
                confirm.Press();
                return;
            }
            return;
        }
        if (keyState != JoystickManager.JOYSTICK_KEY_STATE.KEY_DOWN)
        {
            return;
        }
        if (confirm.gameObject.activeSelf)
        {
            confirm.Press();
            return;
        }
        else if (alert.gameObject.activeSelf)
        {
            alert.gameObject.SetActive(false);
            return;
        }

        if (Global.isAllResLocal)
        {
            SelectCharacter(index, true);
            return;
        }

        switch (index)
        {
        case 2:
        case 3:
        case 6:
        case 7:
            //直接进入游戏
            SelectCharacter(index, true);
            return;
        }

        CharacterCard card  = cards[index - 1];
        int           money = DataUtils.GetMoney();

        bool moneyEnough = money >= card.data.price;

        if (card.isLock)
        {
            confirm.Show(() =>
            {
                if (moneyEnough)
                {
                    Sounder.instance.Play("消费音效");
                    DataUtils.SetCharacterIsUnLock(card.data.id);
                    DataUtils.AddMoney(-card.data.price);
                    card.isLock = false;
                    card.RefreshLock();
                    lockSprite.SetActive(cards[index - 1].isLock);
                    DownloadVideo();
                }
                else
                {
                    Sounder.instance.Play("BAD音效");
                    alert.Show("您的音乐币不足");
                }
            }, "花费" + card.data.price + "音乐币解锁");
        }
        else
        {
            DownloadVideo();
        }
    }