Esempio n. 1
0
    //方法,购买角色按钮点击之后的操作
    public void BuyCharactorButtonClick()
    {
        //如果角色界面允许点击
        if (charactorInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("BuyCharactorButton");
            #endif

            //播放按钮音效
            MyClass.AudioPlay(soundPlayer, Resources.Load <AudioClip>("Audio/Button"), MyClass.soundEnable);

            //如果玩家的道具点数足够购买对应的角色
            if (MyClass.propertyPoints >= MyClass.charactorCost[centerPlayerIndex])
            {
                //扣除相应的道具点数
                MyClass.propertyPoints -= MyClass.charactorCost[centerPlayerIndex];

                //更新道具点数
                RefreshPropertyPoints();

                //对应的角色解锁
                charactorGroup.transform.GetChild(centerPlayerIndex).GetComponent <MenuCharactor>().CharactorUnlock();
            }

            //如果玩家的道具点数不足以购买对应的角色
            else
            {
                //道具界面不允许点击
                propertyInterfaceClickEnable = false;

                //如果玩家是第一次通过道具界面评论该游戏
                if (MyClass.firstRateFromPropertyInterface == 1)
                {
                    #if (IOS_SDK)
                    //如果评论按钮开关打开
                    if (SdkToU3d.GetIfHaveACommentButton())
                    {
                        //道具界面带评论按钮
                        propertyInterface = propertyInterfaceWithRate;
                    }

                    //如果评论按钮开关关闭
                    else
                    {
                        //道具界面不带评论按钮
                        propertyInterface = propertyInterfaceWithoutRate;
                    }
                    #else
                    //道具界面带评论按钮
                    propertyInterface = propertyInterfaceWithRate;
                    #endif
                }

                //如果玩家已经通过道具界面评论过该游戏
                else
                {
                    //道具界面不带评论按钮
                    propertyInterface = propertyInterfaceWithoutRate;
                }

                //道具界面激活
                propertyInterface.SetActive(true);
            }
        }
    }