Exemple #1
0
    //方法,执行振动打开按钮被点击之后的操作
    public void VibrateOnButtonClick()
    {
        //如果设置界面响应点击
        if (MenuController.Instance.settingInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("VibrateOnButton");
            #endif

            //播放按钮音效
            MyClass.AudioPlay(GameObject.Find("SoundPlayer").GetComponent <AudioSource>(),
                              Resources.Load <AudioClip>("Audio/button"),
                              MyClass.soundEnable);

            //振动开关关闭
            MyClass.vibrateEnable = 0;

            //将振动开关状态存入玩家偏好中
            PlayerPrefs.SetInt("vibrateEnable", MyClass.vibrateEnable);

            //VibrateOff按钮激活
            vibrateOffButton.SetActive(true);

            //本按钮禁用
            gameObject.SetActive(false);
        }
    }
Exemple #2
0
    //方法,执行新手引导按钮被点击之后的操作
    public void TutorialButtonClick()
    {
        //如果设置界面响应点击
        if (settingInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("TutorialButton");
            #endif

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

            //设置界面不再允许点击
            settingInterfaceClickEnable = false;

            //允许引导
            MyClass.tutorialEnable = 1;

            //将该状态标志位存入玩家偏好中
            PlayerPrefs.SetInt("tutorialEnable", MyClass.tutorialEnable);

            //游戏重新开局
            MyClass.gameStartWay = 0;

            //将该状态标志位存入玩家偏好中
            PlayerPrefs.SetInt("gameStartWay", MyClass.gameStartWay);

            //加载游戏场景
            GameObject.Find("FadeCanvas").GetComponent <FadeInOut>().SwitchScene("Game");
        }
    }
Exemple #3
0
    //方法,执行该按钮被按下之后的操作
    public void MusicOffButtonClick()
    {
        //如果设置界面响应点击
        if (MenuController.Instance.settingInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("MusicOffButton");
            #endif

            //背景音乐开关打开
            MyClass.musicEnable = 1;

            //将背景音乐开关状态存入玩家偏好中
            PlayerPrefs.SetInt("musicEnable", MyClass.musicEnable);

            //背景音乐开始播放
            MyClass.AudioPlay(GameObject.Find("MusicPlayer").GetComponent <AudioSource>(), MyClass.musicEnable);

            //MusicOn按钮激活
            musicOnButton.SetActive(true);

            //本按钮禁用
            gameObject.SetActive(false);
        }
    }
Exemple #4
0
    //方法,角色选择按钮被点击之后的操作
    public void CharactorButtonClick()
    {
        //如果首页界面允许点击
        if (menuInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("CharactorButton");
            #endif

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

            //首页界面不再允许点击
            menuInterfaceClickEnable = false;

            //设置界面不再允许点击
            settingInterfaceClickEnable = false;

            //角色界面不允许点击
            charactorInterfaceClickEnable = false;

            //角色区域不允许点击
            charactorGroup.enabled = false;

            //角色界面激活
            charactorInterface.SetActive(true);
        }
    }
Exemple #5
0
    //方法,执行MoreGame按钮被点击之后的操作
    public void MoreGameButtonClick()
    {
        //如果设置界面响应点击
        if (settingInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //评论
            SdkToU3d.MoreGames();

            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("MoreGameButton");
            #endif

            //播放按钮音效
            MyClass.AudioPlay(soundPlayer, Resources.Load <AudioClip>("Audio/Button"), MyClass.soundEnable);
        }
    }
Exemple #6
0
    //方法,观看视频按钮被点击之后的操作
    public void WatchVideoButtonClick()
    {
        //如果道具界面响应点击
        if (propertyInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //看视频送点数的奖励激活
            MyClass.videoRewardEnable = 1;

            //视频奖励类型为0
            MyClass.videoRewardType = 0;

            //展示视频广告
            SdkToU3d.ShowUnityAds();

            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("WatchVideoButton");
            #endif

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

            //观看视频按钮禁用
            propertyInterface.GetComponent <PropertyInterface>().watchVideoButton.SetActive(false);

            //观看视频禁用图片激活
            propertyInterface.GetComponent <PropertyInterface>().watchVideoDisableImage.SetActive(true);

            //初始冷却时间
            propertyInterface.GetComponent <PropertyInterface>().watchVideoColdTime.startColdTime = MyClass.watchVideoColdTime;

            //开始倒计时
            propertyInterface.GetComponent <PropertyInterface>().watchVideoColdTime.TimeCountDown();

            //将此时的时间存入玩家偏好中
            PlayerPrefs.SetInt("lastWatchVideoYear", System.DateTime.Now.Year);
            PlayerPrefs.SetInt("lastWatchVideoMonth", System.DateTime.Now.Month);
            PlayerPrefs.SetInt("lastWatchVideoDay", System.DateTime.Now.Day);
            PlayerPrefs.SetInt("lastWatchVideoHour", System.DateTime.Now.Hour);
            PlayerPrefs.SetInt("lastWatchVideoMinute", System.DateTime.Now.Minute);
            PlayerPrefs.SetInt("lastWatchVideoSecond", System.DateTime.Now.Second);
        }
    }
Exemple #7
0
    //方法,道具界面的评论按钮点击之后的操作
    public void RateGameButtonClick()
    {
        //如果道具界面响应点击
        if (propertyInterfaceClickEnable)
        {
            //如果玩家是第一次通过道具界面评论该游戏
            if (MyClass.firstRateFromPropertyInterface == 1)
            {
                #if (IOS_SDK)
                //评论
                SdkToU3d.Comment();

                //按钮追踪
                SdkToU3d.TrackButtonActionWithName("RateGameButton");
                #endif

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

                //玩家获得道具点数奖励
                MyClass.propertyPoints += 100;

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

                //更新差额道具点数
                propertyInterface.GetComponent <PropertyInterface>().RefreshDifferentialPropertyPoints();

                //状态标识位改变
                MyClass.firstRateFromPropertyInterface = 0;

                //将玩家是否是第一次通过道具界面评论该游戏的状态标志位存入玩家偏好中
                PlayerPrefs.SetInt("firstRate", MyClass.firstRateFromPropertyInterface);

                //道具界面不再响应点击
                propertyInterfaceClickEnable = false;

                //播放道具界面离场动画
                propertyInterface.GetComponent <Animator>().SetTrigger("PropertyInterfaceOut");
            }
        }
    }
Exemple #8
0
    //方法,执行支持我们按钮点击之后的操作
    public void SupportUsButtonClick()
    {
        //如果设置界面响应点击
        if (settingInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //看视频送点数的奖励关闭
            MyClass.videoRewardEnable = 0;

            //发送Email
            SdkToU3d.ShowGameEndADs();

            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("SupportUsButton");
            #endif

            //播放按钮音效
            MyClass.AudioPlay(soundPlayer, Resources.Load <AudioClip>("Audio/Button"), MyClass.soundEnable);
        }
    }
Exemple #9
0
    //方法,开始游戏按钮点击之后的操作
    public void PlayButtonClick()
    {
        //如果首页界面允许点击
        if (menuInterfaceClickEnable)
        {
             #if (IOS_SDK)
            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("PlayButton");
            #endif

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

            //首页界面不再允许点击
            menuInterfaceClickEnable = false;

            //加载游戏场景
            GameObject.Find("FadeCanvas").GetComponent <FadeInOut>().SwitchScene("Game");
        }
    }
Exemple #10
0
    //方法,分享链接按钮被点击之后的操作
    public void ShareLinkButtonClick()
    {
        //如果道具界面响应点击
        if (propertyInterfaceClickEnable)
        {
            //播放按钮音效
            MyClass.AudioPlay(soundPlayer, Resources.Load <AudioClip>("Audio/Button"), MyClass.soundEnable);

            //如果本地化语言为中文
            if (MyClass.localizationLanguageIndex == 0)
            {
                //微信分享送道具的奖励激活
                MyClass.weChatShareRewardEnable = 1;

                #if (IOS_SDK)
                //微信分享
                SdkToU3d.WeChatShare();

                //按钮追踪
                SdkToU3d.TrackButtonActionWithName("WeChatShareButton");
                #endif
            }

            //否则
            else
            {
                //facebook分享送道具的奖励激活
                MyClass.facebookShareRewardEnable = 1;

                #if (IOS_SDK)
                //Facebook分享
                SdkToU3d.FacebookShare();

                //按钮追踪
                SdkToU3d.TrackButtonActionWithName("FacebookShareButton");
                #endif
            }
        }
    }
Exemple #11
0
    //方法,执行该按钮被按下之后的操作
    public void VibrateOffButtonClick()
    {
        //如果设置界面响应点击
        if (MenuController.Instance.settingInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("VibrateOffButton");
            #endif

            //振动开关打开
            MyClass.vibrateEnable = 1;

            //将振动开关状态存入玩家偏好中
            PlayerPrefs.SetInt("vibrateEnable", MyClass.vibrateEnable);

            //VibrateOn按钮激活
            vibrateOnButton.SetActive(true);

            //本按钮禁用
            gameObject.SetActive(false);
        }
    }
Exemple #12
0
    //方法,执行成就按钮被点击之后的操作
    public void AchievementButtonClick()
    {
        //如果首页界面允许点击
        if (menuInterfaceClickEnable)
        {
            #if (IOS_SDK)
            //按钮追踪
            SdkToU3d.TrackButtonActionWithName("AchieveButton");
            #endif

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

            //首页界面不再允许点击
            menuInterfaceClickEnable = false;

            //成就界面不响应点击
            achieveInterfaceClickEnable = false;

            //成就界面激活
            achieveInterface.SetActive(true);
        }
    }
Exemple #13
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);
            }
        }
    }