SetNumberRapid() public method

public SetNumberRapid ( int number ) : void
number int
return void
Ejemplo n.º 1
0
    public override void OnUpdate()
    {
        base.OnUpdate();

        if (GlobalVars.CurStageData.TimeLimit > 0)          //限制时间的关卡
        {
            int min    = (int)GameLogic.Singleton.GetTimeRemain() / 60;
            int second = (int)GameLogic.Singleton.GetTimeRemain() % 60;
            m_minNumber.SetNumberRapid(min);
            m_secNumber.SetNumberRapid(second);

            if (GameLogic.Singleton.GetTimeRemain() > 0.01 && GameLogic.Singleton.GetTimeRemain() <= 15 && GameLogic.Singleton.GetGameFlow() == TGameFlow.EGameState_Playing)       //小于15秒播粒子
            {
                if (!m_hurryTimeParticle.activeSelf)
                {
                    m_hurryTimeParticle.SetActive(true);
                }
            }
            else                    //大于15秒关闭粒子
            {
                if (m_hurryTimeParticle.activeSelf)
                {
                    m_hurryTimeParticle.SetActive(false);
                }
            }
            m_timeBar.fillAmount = GameLogic.Singleton.GetTimeRemain() / GlobalVars.CurStageData.TimeLimit;
        }
    }
Ejemplo n.º 2
0
    public override void OnShow()
    {
        base.OnShow();
        UIGameHead gamehead = UIWindowManager.Singleton.GetUIWindow <UIGameHead>();

        gamehead.ShowCoin(true);

        m_msgLabel.text  = Localization.instance.Get("Use_" + GlobalVars.UsingItem.ToString());
        m_costLabel.text = CapsConfig.GetItemPrice(GlobalVars.UsingItem).ToString();
        m_coinDrawer.SetNumberRapid(CapsConfig.GetItemPrice(GlobalVars.UsingItem));

        int startX = (GameLogic.Singleton.BlockXStart + GameLogic.Singleton.BlockXEnd) / 2;
        int startY = (GameLogic.Singleton.BlockYStart + GameLogic.Singleton.BlockYStart) / 2;

        //若冰块关,找个冰块
        if (GlobalVars.CurStageData.Target == GameTarget.ClearJelly)
        {
            for (int i = 0; i <= GameLogic.BlockCountX; ++i)
            {
                int x = (startX + i) % GameLogic.BlockCountX;
                for (int j = 0; j < GameLogic.BlockCountY; ++j)
                {
                    int y = (startY + j) % GameLogic.BlockCountY;
                    if (GameLogic.Singleton.PlayingStageData.CheckFlag(x, y, GridFlag.Jelly) || GameLogic.Singleton.PlayingStageData.CheckFlag(x, y, GridFlag.JellyDouble))
                    {
                        CapBlock pBlock = GameLogic.Singleton.GetBlock(new Position(x, y));
                        if (pBlock != null && pBlock.color < TBlockColor.EColor_Nut1 && pBlock.CurState == BlockState.Normal)
                        {
                            GlobalVars.UsingItemTarget = new Position(x, y);
                            SetTarget(GlobalVars.UsingItemTarget);
                            break;
                        }
                    }
                }
            }
        }
        else
        {
            //不是冰块关,找个可点块
            for (int i = 0; i <= GameLogic.BlockCountX; ++i)
            {
                int x = (startX + i) % GameLogic.BlockCountX;
                for (int j = 0; j < GameLogic.BlockCountY; ++j)
                {
                    int      y      = (startY + j) % GameLogic.BlockCountY;
                    CapBlock pBlock = GameLogic.Singleton.GetBlock(new Position(x, y));
                    if (pBlock != null && pBlock.color < TBlockColor.EColor_Nut1 && pBlock.CurState == BlockState.Normal)
                    {
                        GlobalVars.UsingItemTarget = new Position(x, y);
                        SetTarget(GlobalVars.UsingItemTarget);
                        break;
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
    public override void OnShow()
    {
        base.OnShow();
        //GameLogic.Singleton.PauseGame();

        //获取道具信息
        m_msgLabel.text  = Localization.instance.Get("Use_" + GlobalVars.UsingItem.ToString());
        m_costLabel.text = CapsConfig.GetItemPrice(GlobalVars.UsingItem).ToString();
        m_coinDrawer.SetNumberRapid(CapsConfig.GetItemPrice(GlobalVars.UsingItem));
        m_itemIcon.spriteName = GlobalVars.UsingItem.ToString();

        UIGameHead gamehead = UIWindowManager.Singleton.GetUIWindow <UIGameHead>();

        gamehead.ShowCoin(true);
    }
Ejemplo n.º 4
0
    public void OnChangeStep(int curStep)
    {
        m_stepDrawer.SetNumberRapid(curStep);
        m_stepChangeAnim.Play();

        if (curStep <= 5 && curStep > 0 && GameLogic.Singleton.GetGameFlow() == TGameFlow.EGameState_Playing)       //1到5步时播粒子
        {
            if (!m_hurryStepParticle.activeSelf)
            {
                m_hurryStepParticle.SetActive(true);
            }
        }
        else                    //大于5步时关闭粒子
        {
            if (m_hurryStepParticle.activeSelf)
            {
                m_hurryStepParticle.SetActive(false);
            }
        }
    }
Ejemplo n.º 5
0
    public override void OnUpdate()
    {
        base.OnUpdate();

        if (GlobalVars.HeartCount < 5)
        {
            int ticks           = (int)((System.DateTime.Now.Ticks - GlobalVars.GetHeartTime.Ticks) / 10000);
            int ticksToGetHeart = CapsConfig.Instance.GetHeartInterval * 1000 - ticks;
            int min             = ticksToGetHeart / 1000 / 60;
            int second          = ticksToGetHeart / 1000 % 60;
            m_minNumber.SetNumberRapid(min);
            m_secNumber.SetNumberRapid(second);

            m_heartSprite.fillAmount = 1.0f - (ticksToGetHeart / 1000.0f) / CapsConfig.Instance.GetHeartInterval;
        }
        else
        {
            m_heartSprite.fillAmount = 1.0f;
        }
    }
Ejemplo n.º 6
0
    public override void OnShow()
    {
        base.OnShow();

        m_levelNumber.SetNumberRapid(GlobalVars.CurStageNum);

        for (int i = 0; i < 3; ++i)
        {
            UISprite star = GetChildComponent <UISprite>("Star" + (i + 1));
            if (GlobalVars.StageStarArray[GlobalVars.CurStageNum - 1] > i)
            {
                star.spriteName = "Star_Large";
            }
            else
            {
                star.spriteName = "Star_Dark";
            }
        }

        UISprite itemIcon = GetChildComponent <UISprite>("Item1Icon");

        if (GlobalVars.CurStageData.StepLimit > 0)
        {
            m_items[0] = PurchasedItem.ItemPreGame_PlusStep;
        }
        else if (GlobalVars.CurStageData.TimeLimit > 0)
        {
            m_items[0] = PurchasedItem.ItemPreGame_PlusTime;
        }

        m_items[1] = PurchasedItem.ItemPreGame_AddEatColor;
        m_items[2] = PurchasedItem.ItemPreGame_ExtraScore;

        itemIcon.spriteName = m_items[0].ToString();

        for (int i = 0; i < 3; ++i)
        {
            m_itemCostLabels[i].text = CapsConfig.GetItemPrice(m_items[i]).ToString();
            m_itemToggles[i].SetWithoutTrigger(false);

            if (CapsConfig.ItemUnLockLevelArray[(int)m_items[i]] <= GlobalVars.AvailabeStageCount || GlobalVars.DeveloperMode)       //判断道具是否已经解锁?
            {
                m_lockItemSprite[i].gameObject.SetActive(false);
                m_itemToggles[i].enabled = true;
                m_itemCostLabels[i].gameObject.SetActive(true);
                m_background[i].spriteName = "Item_Large";
            }
            else
            {
                m_lockItemSprite[i].gameObject.SetActive(true);
                m_itemToggles[i].enabled = false;
                m_itemCostLabels[i].gameObject.SetActive(false);
                m_background[i].spriteName = "Item_Large_Disable";
            }
        }

        NumberDrawer number = GetChildComponent <NumberDrawer>("StageTarget");

        number.SetNumber(GlobalVars.CurStageData.StarScore[2], 0.0f);

        UIWindowManager.Singleton.GetUIWindow <UIMainMenu>().HideWindow();

        RefreshTotalMoney();

        if (GlobalVars.AvailabeStageCount == GlobalVars.CurStageNum && GlobalVars.AvailabeStageCount == 2)      //若在第二关,显示手指
        {
            Transform gameAreaTrans = GameObject.Find("GameArea").transform;
            if (UIWindowManager.Singleton.GetUIWindow <UIFTUE>() == null)        //若已经出FTUE了
            {
                UIWindowManager.Singleton.CreateWindow <UIFTUE>();
            }
            m_pointer = UIWindowManager.Singleton.GetUIWindow <UIFTUE>().m_pointer;
            GameObject playBtn = GameObject.Find("PlayBtn");
            m_pointer.transform.parent        = playBtn.transform;
            m_pointer.transform.localPosition = new Vector3(-26, 48, 0);
            //m_pointer.transform.parent = gameAreaTrans;                     //恢复父窗口
            m_pointer.SetActive(false);
            m_pointer.SetActive(true);
            m_pointer.GetComponent <TweenScale>().enabled = true;
        }

        //根据关卡类型显示提示信息
        m_stageIcon.spriteName = "MapPoint_Type" + CapsConfig.StageTypeArray[GlobalVars.CurStageNum - 1];
        m_stageInfoLabel.text  = Localization.instance.Get("StageInfoHelpType" + CapsConfig.StageTypeArray[GlobalVars.CurStageNum - 1]);
    }
Ejemplo n.º 7
0
    public override void OnUpdate()
    {
        base.OnUpdate();

        if (uiWindowState != UIWindowStateEnum.Show)
        {
            return;
        }

        GlobalVars.RefreshHeart();

        //显示心数和时间////////////////////////////////////////////////////////////////////////
        if (!m_heartUI.Visible)
        {
            if (!GlobalVars.InMapFTUE)
            {
                m_heartUI.ShowWindow();
            }
        }
        else
        {
            UISprite heartNum = m_heartUI.GetChildComponent <UISprite>("HeartNum");
            heartNum.spriteName = "Large_" + GlobalVars.HeartCount;
            m_coinNumber.SetNumber((int)Unibiller.GetCurrencyBalance("gold"));

            if (GlobalVars.HeartCount < 5)               //若心没满,要显示时间
            {
                if (!m_timeNumber.activeSelf)
                {
                    m_timeNumber.SetActive(true);
                }

                int ticks           = (int)((System.DateTime.Now.Ticks - GlobalVars.GetHeartTime.Ticks) / 10000);
                int ticksToGetHeart = CapsConfig.Instance.GetHeartInterval * 1000 - ticks;
                int min             = ticksToGetHeart / 1000 / 60;
                int second          = ticksToGetHeart / 1000 % 60;
                m_minNumber.SetNumberRapid(min);
                m_secNumber.SetNumberRapid(second);
            }
            else
            {
                if (m_timeNumber.activeSelf)
                {
                    m_timeNumber.SetActive(false);
                }
            }
        }

        if (GlobalVars.InMapFTUE)
        {
            return;
        }

        //处理头像在地图上移动
        if (m_newStageNumber > -1)          //若正在移动
        {
            m_newStageMoveTime -= Time.deltaTime;
            if (m_newStageMoveTime < 0)     //若移动到了
            {
                RefreshButtonStar(m_newStageNumber);
                AddStagePartile(m_newStageNumber);
                m_headSprite.gameObject.transform.localPosition = new Vector3(m_stageBtns[m_newStageNumber - 1].localPosition.x, m_stageBtns[m_newStageNumber - 1].localPosition.y + HeadYOffset, m_stageBtns[m_newStageNumber - 1].localPosition.z); ////移到目标点
                GlobalVars.HeadStagePos = GlobalVars.AvailabeStageCount;                                                                                                                                                                              //记录头像移动
                PlayerPrefs.SetInt("HeadStagePos", GlobalVars.HeadStagePos);                                                                                                                                                                          //记录
                RefreshButton(m_newStageNumber - 1);
                if (m_newStageNumber >= 2)
                {
                    RefreshButton(m_newStageNumber - 2);
                }

                if (m_newStageNumber == 2)                                      //需要出FTUE的情况
                {
                    GlobalVars.InMapFTUE = true;
                    m_heartUI.HideWindow();
                    //进入FTUE状态
                    UIFTUE ftue = UIWindowManager.Singleton.GetUIWindow <UIFTUE>();
                    if (ftue == null)
                    {
                        ftue = UIWindowManager.Singleton.CreateWindow <UIFTUE>();
                    }

                    ftue.ResetFTUEStep();
                    System.Collections.Generic.List <FTUEData> ftueData = new System.Collections.Generic.List <FTUEData>();
                    FTUEData data = new FTUEData();
                    data.dialog            = Localization.instance.Get("FTUEStep3");
                    data.headImage         = "Speicher";
                    data.pointToGameObject = "Stage2";
                    data.from = new Position();
                    data.from.MakeItUnAvailable();
                    ftueData.Add(data);             //第4句话
                    data = new FTUEData();

                    ftue.ShowFTUE(0, ftueData);
                }
                else                                                            //不需要出FTUE,自动点关卡按钮
                {
                    int tempNum = m_newStageNumber;
                    Timer.AddDelayFunc(1.0f, delegate()
                    {
                        UIButton.current = m_stageBtns[tempNum - 1].GetComponent <UIButton>();
                        OnStageClicked();
                    });
                }

                m_newStageNumber = -1;

                m_inputBlocker.SetActive(false);
            }
            else
            {
                if (!m_inputBlocker.activeInHierarchy)
                {
                    m_inputBlocker.SetActive(true);
                }
                Vector3 target  = new Vector3(m_stageBtns[m_newStageNumber - 1].localPosition.x, m_stageBtns[m_newStageNumber - 1].localPosition.y + HeadYOffset, m_stageBtns[m_newStageNumber - 1].localPosition.z);
                Vector3 fromPos = m_stageBtns[m_newStageNumber - 2].localPosition;
                fromPos.y += HeadYOffset;
                m_headSprite.gameObject.transform.localPosition = Vector3.Lerp(fromPos, target, (1 - m_newStageMoveTime / HeadMoveTime));
            }
        }
        //5105 - 2045 = 3060
        //处理云的移动
        //float y = (mUIObject.transform.localPosition.y - (454.0f)) * 3054 / 3964.0f;
        //m_cloudSprite.transform.LocalPositionY(-y);

        m_cloudSprite.LocalPositionY((m_mapObj.transform.localPosition.y * 2) % 1135);

        if (m_cloudSprite.transform.localPosition.y > 0)
        {
            m_cloud2Sprite.transform.LocalPositionY(m_cloudSprite.transform.localPosition.y - 1135);
        }
        else
        {
            m_cloud2Sprite.transform.LocalPositionY(m_cloudSprite.transform.localPosition.y + 1135);
        }

        if (m_stageUI.Visible)
        {
            m_lastClickStageTime = Timer.GetRealTimeSinceStartUp();     //更新关卡点击时间
        }
        //else if (Timer.GetRealTimeSinceStartUp() - m_lastClickStageTime > 5.0f)      //5秒没有有效操作
        else
        {
            SetStageHelp(true);
        }

        if (m_stageUI.Visible)                       //若关卡UI显示了
        {
            if (!m_blurSprites[0].activeInHierarchy) //若模糊层没显示
            {
                for (int i = 0; i < 3; ++i)
                {
                    m_blurSprites[i].SetActive(true);
                    m_blurSprites[i].GetComponent <TweenAlpha>().Play(true);
                }
                EventDelegate.Set(m_blurSprites[0].GetComponent <TweenAlpha>().onFinished, null);
            }
        }
        else
        {
            if (m_blurSprites[0].activeInHierarchy)
            {
                for (int i = 0; i < 3; ++i)
                {
                    m_blurSprites[i].GetComponent <TweenAlpha>().Play(false);
                }
                EventDelegate.Set(m_blurSprites[0].GetComponent <TweenAlpha>().onFinished, delegate()
                {
                    for (int i = 0; i < 3; ++i)
                    {
                        m_blurSprites[i].SetActive(false);
                    }
                });
            }
        }
    }
Ejemplo n.º 8
0
    public void RefreshData()
    {
        if (GameLogic.Singleton.IsStageFinish() && GameLogic.Singleton.CheckGetEnoughScore())         //检查关卡是否结束
        {
            m_bWin = true;
        }
        else
        {
            m_bWin = false;
            if (GlobalVars.CurStageData.Target == GameTarget.ClearJelly)
            {
                m_infoLabel.text = Localization.instance.Get("DidNotClearIce");
            }
            else if (GlobalVars.CurStageData.Target == GameTarget.BringFruitDown)
            {
                m_infoLabel.text = Localization.instance.Get("DidNotBringNuts");
            }
            else if (GlobalVars.CurStageData.Target == GameTarget.Collect)
            {
                m_infoLabel.text = Localization.instance.Get("DidNotCollectEnough");
            }
            else if (GlobalVars.CurStageData.Target == GameTarget.GetScore)             //分数要求的情况
            {
                m_infoLabel.text = Localization.instance.Get("NotEnoughScore");
            }
            else
            {
                m_infoLabel.text = Localization.instance.Get("EndGameByHimSelf");
            }
        }

        if (m_bWin)
        {
            GlobalVars.AddHeart(1);          //若关卡成功,需要把之前扣的心恢复回来
        }

        if (m_bWin)
        {
            if (GlobalVars.AvailabeStageCount == GlobalVars.CurStageNum)
            {
                if (GlobalVars.AvailabeStageCount < GlobalVars.TotalStageCount)
                {
                    ++GlobalVars.AvailabeStageCount;            //开启下一关
                }
                //UIWindowManager.Singleton.GetUIWindow<UIMap>().OpenNewButton(GlobalVars.AvailabeStageCount);
            }

            for (int i = 2; i >= 0; --i)
            {
                if (GameLogic.Singleton.GetProgress() >= GlobalVars.CurStageData.StarScore[i])
                {
                    m_starCount = i + 1;
                    break;
                }
            }

            if (GlobalVars.StageStarArray[GlobalVars.CurStageNum] == 0)                         //if it's the first time of finishing the stage
            {
                float scorePercent = (float)GameLogic.Singleton.GetProgress() / GameLogic.Singleton.PlayingStageData.StarScore[0];
                if (CapsConfig.EnableGA)                                                                                                                 //游戏过关后的记录
                {
                    GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:StepLeft", GameLogic.Singleton.m_stepCountWhenReachTarget); //
                    GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:Score_Percent", scorePercent);                              //记录当前开始的关卡的百分比
                    GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:StarCount", m_starCount);
                    GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:FailedTimes", GlobalVars.StageFailedArray[GlobalVars.CurStageNum]);
                    GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:PlayTime", GameLogic.Singleton.GetStagePlayTime());
                }

#if UNITY_ANDROID || UNITY_IPHONE
                if (CapsConfig.EnableTalkingData)
                {
                    Dictionary <string, object> param = new Dictionary <string, object>();
                    if (GameLogic.Singleton.m_stepCountWhenReachTarget > 10)
                    {
                        param["StepLeft"] = ">10";
                    }
                    else if (GameLogic.Singleton.m_stepCountWhenReachTarget > 5)
                    {
                        param["StepLeft"] = ">5";
                    }
                    else
                    {
                        param["StepLeft"] = GameLogic.Singleton.m_stepCountWhenReachTarget.ToString();
                    }

                    param["StarCount"] = m_starCount.ToString();

                    if (scorePercent > 5)
                    {
                        param["ScorePercent"] = ">5";
                    }
                    else if (scorePercent > 3)
                    {
                        param["ScorePercent"] = ">3";
                    }
                    else if (scorePercent > 2)
                    {
                        param["ScorePercent"] = ">2";
                    }
                    else if (scorePercent > 1.5)
                    {
                        param["ScorePercent"] = ">1.5";
                    }
                    else
                    {
                        param["ScorePercent"] = ">1";
                    }

                    float playTime = GameLogic.Singleton.GetStagePlayTime();

                    if (playTime > 600)
                    {
                        param["PlayTime"] = ">10min";
                    }
                    else if (playTime > 60)
                    {
                        param["PlayTime"] = ((int)(playTime / 60)).ToString() + "min";
                    }
                    else
                    {
                        param["PlayTime"] = "<1min";
                    }

                    int failedTimes = GlobalVars.StageFailedArray[GlobalVars.CurStageNum];

                    if (failedTimes > 20)
                    {
                        param["FailedTime"] = ">20";
                    }
                    else if (failedTimes > 10)
                    {
                        param["PlayTime"] = ">10";
                    }
                    else if (failedTimes > 5)
                    {
                        param["PlayTime"] = ">5";
                    }
                    else
                    {
                        param["PlayTime"] = failedTimes.ToString();
                    }


                    TalkingDataPlugin.TrackEventWithParameters("Stage" + GlobalVars.CurStageNum + ":FirstSucceed", "", param);
                }
#endif
            }

            PlayerPrefs.SetInt("StageAvailableCount", GlobalVars.AvailabeStageCount);       //保存进度
            if (m_starCount > GlobalVars.StageStarArray[GlobalVars.CurStageNum - 1])
            {
                GlobalVars.StageStarArray[GlobalVars.CurStageNum - 1] = m_starCount;            //保存星数
                PlayerPrefsExtend.SetIntArray("StageStars", GlobalVars.StageStarArray);         //保存进度
            }

            if (GameLogic.Singleton.GetProgress() > GlobalVars.StageScoreArray[GlobalVars.CurStageNum - 1])     //记录分数记录
            {
                GlobalVars.StageScoreArray[GlobalVars.CurStageNum - 1] = GameLogic.Singleton.GetProgress();
                PlayerPrefsExtend.SetIntArray("StageScores", GlobalVars.StageScoreArray);
            }

            UIWindowManager.Singleton.GetUIWindow <UIMap>().RefreshButtonStar(GlobalVars.CurStageNum);       //刷新当前关卡的星星
            UIWindowManager.Singleton.GetUIWindow <UIMap>().RefreshButton(GlobalVars.CurStageNum - 1);       //刷新当前关卡的星星
        }
        else
        {
            GlobalVars.StageFailedArray[GlobalVars.CurStageNum]++;
            PlayerPrefsExtend.SetIntArray("StageFailed", GlobalVars.StageFailedArray);
        }

        m_levelLabel.SetNumberRapid(GlobalVars.CurStageNum);
    }
Ejemplo n.º 9
0
    public void OnChangeProgress(int progress)
    {
        for (int i = 0; i < 3; ++i)
        {
            if (progress >= GlobalVars.CurStageData.StarScore[i])
            {
                if (m_startCount < i + 1)
                {
                    m_starsSprites[i].spriteName = "LightStar";
                    ParticleSystem par = m_starsSprites[i].GetComponentInChildren <ParticleSystem>();
                    if (par != null)
                    {
                        par.Play();
                        if (GlobalVars.UseSFX)
                        {
                            if (i == 0)
                            {
                                NGUITools.PlaySound(CapsConfig.CurAudioList.GetStar1Clip);
                            }
                            if (i == 1)
                            {
                                NGUITools.PlaySound(CapsConfig.CurAudioList.GetStar2Clip);
                            }
                            if (i == 2)
                            {
                                NGUITools.PlaySound(CapsConfig.CurAudioList.GetStar3Clip);
                            }
                        }
                    }
                    m_startCount = i + 1;
                }
            }
        }
        if (progress == 0)
        {
            m_scoreDrawer.SetNumberRapid(progress);
        }
        else
        {
            m_scoreChangeAnim.Play();
            m_scoreDrawer.SetNumber(progress);
        }

        float completeRatio = 0.0f;

        if (GlobalVars.CurStageData.StarScore[2] > 0)
        {
            completeRatio = (float)GameLogic.Singleton.GetProgress() / GlobalVars.CurStageData.StarScore[2];
        }
        completeRatio = Mathf.Min(1.0f, completeRatio);

        if (completeRatio >= 1.0f)
        {
            completeRatio = 1.0f;
        }
        else
        {
            completeRatio = (completeRatio * ProgressLenth) / ProgressRealLenth;
        }

        if (completeRatio != 0.0f)
        {
            m_progressSprite.gameObject.SetActive(true);
            m_progressSprite.fillAmount = completeRatio;
        }
    }
Ejemplo n.º 10
0
    public override void OnShow()
    {
        base.OnShow();
        UISprite sprite = GetChildComponent <UISprite>("FailedReason");

        if ((GameLogic.Singleton.CheckLimit() || GameLogic.Singleton.ResortFailed) &&        //若关卡步数(时间)限制到了,或重排失败
            GameLogic.Singleton.GetGameFlow() == TGameFlow.EGameState_End)
        {
            if (GlobalVars.CurStageData.StepLimit > 0)
            {
                sprite.spriteName = "NoMoves";
            }
            else if (GlobalVars.CurStageData.TimeLimit > 0)
            {
                sprite.spriteName = "NoTime";
            }

            m_continueTipBoard.gameObject.SetActive(true);
            m_pauseTipBoard.gameObject.SetActive(false);

            m_curScore.SetNumber(GameLogic.Singleton.GetProgress());
            m_targetScore.SetNumber(GlobalVars.CurStageData.StarScore[0]);

            if (GameLogic.Singleton.ResortFailed)
            {
                m_playOnBtn.gameObject.SetActive(false);
                m_playOnWithPayBtn.gameObject.SetActive(false);

                m_continueTipBoard.gameObject.SetActive(false);
                m_planOnItemIcon.gameObject.SetActive(false);
                m_EndGameBtn.LocalPositionX(0);
            }
            else
            {
                if (GlobalVars.CurStageData.StepLimit > 0)
                {
                    m_planOnItemIcon.spriteName = PurchasedItem.ItemAfterGame_PlusStep.ToString();
                    m_itemIntro.text            = Localization.instance.Get("Intro_" + PurchasedItem.ItemAfterGame_PlusStep.ToString());
                }
                else if (GlobalVars.CurStageData.TimeLimit > 0)
                {
                    m_planOnItemIcon.spriteName = PurchasedItem.ItemAfterGame_PlusTime.ToString();
                    m_itemIntro.text            = Localization.instance.Get("Intro_" + PurchasedItem.ItemAfterGame_PlusTime.ToString());
                }

                m_EndGameBtn.LocalPositionX(-108);
                m_continueTipBoard.gameObject.SetActive(true);
                m_planOnItemIcon.gameObject.SetActive(true);

                m_playOnBtn.gameObject.SetActive(false);
                m_playOnWithPayBtn.gameObject.SetActive(true);
            }
        }
        else
        {
            m_planOnItemIcon.gameObject.SetActive(false);
            sprite.spriteName = "GamePauseText";

            m_continueTipBoard.gameObject.SetActive(false);
            m_pauseTipBoard.gameObject.SetActive(true);

            m_playOnBtn.gameObject.SetActive(true);
            m_playOnWithPayBtn.gameObject.SetActive(false);

            m_curScore.SetNumberRapid(GameLogic.Singleton.GetProgress());
            m_targetScore.SetNumberRapid(GlobalVars.CurStageData.StarScore[0]);
        }

        m_scoreCheck.SetWithoutTrigger((GameLogic.Singleton.GetProgress() >= GlobalVars.CurStageData.StarScore[0]));


        if (GlobalVars.CurStageData.Target == GameTarget.ClearJelly)
        {
            m_jellyCheck.transform.parent.gameObject.SetActive(true);
            m_nutsCheck.transform.parent.gameObject.SetActive(false);
            m_collectCheck.transform.parent.gameObject.SetActive(false);

            int totalJellyCount = GlobalVars.CurStageData.GetSingleJellyCount() + GlobalVars.CurStageData.GetDoubleJellyCount() * 2;
            int curJellyCount   = GameLogic.Singleton.PlayingStageData.GetSingleJellyCount() + GameLogic.Singleton.PlayingStageData.GetDoubleJellyCount() * 2;

            m_curJelly.SetNumber(totalJellyCount - curJellyCount);
            m_targetJelly.SetNumber(totalJellyCount);

            m_jellyCheck.value = (curJellyCount == 0);
        }
        else if (GlobalVars.CurStageData.Target == GameTarget.BringFruitDown)
        {
            m_curNut1.SetNumber(GameLogic.Singleton.PlayingStageData.Nut1Count);
            m_targetNut1.SetNumber(GlobalVars.CurStageData.Nut1Count);
            m_curNut2.SetNumber(GameLogic.Singleton.PlayingStageData.Nut2Count);
            m_targetNut2.SetNumber(GlobalVars.CurStageData.Nut2Count);

            m_nutsCheck.transform.parent.gameObject.SetActive(true);
            m_jellyCheck.transform.parent.gameObject.SetActive(false);
            m_collectCheck.transform.parent.gameObject.SetActive(false);

            m_nutsCheck.value = (GameLogic.Singleton.PlayingStageData.Nut1Count == GlobalVars.CurStageData.Nut1Count && GameLogic.Singleton.PlayingStageData.Nut2Count == GlobalVars.CurStageData.Nut2Count);
        }
        else if (GlobalVars.CurStageData.Target == GameTarget.Collect)      //处理搜集关的显示
        {
            m_nutsCheck.transform.parent.gameObject.SetActive(false);
            m_jellyCheck.transform.parent.gameObject.SetActive(false);
            m_collectCheck.transform.parent.gameObject.SetActive(true);

            for (int i = 0; i < 3; ++i)
            {
                if (GlobalVars.CurStageData.CollectCount[i] > 0)
                {
                    m_collectLabel[i].gameObject.SetActive(true);


                    switch (GlobalVars.CurStageData.CollectSpecial[i])
                    {
                    case TSpecialBlock.ESpecial_Normal:
                    {
                        m_collectSprite[i].spriteName = "Item" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None);
                    }
                    break;

                    case TSpecialBlock.ESpecial_NormalPlus6:
                    {
                        m_collectSprite[i].spriteName = "TimeAdded" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None);
                    }
                    break;

                    case TSpecialBlock.ESpecial_EatLineDir0:
                        m_collectSprite[i].spriteName = "Line" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None) + "_3";
                        break;

                    case TSpecialBlock.ESpecial_EatLineDir1:
                        m_collectSprite[i].spriteName = "Line" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None) + "_1";
                        break;

                    case TSpecialBlock.ESpecial_EatLineDir2:
                        m_collectSprite[i].spriteName = "Line" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None) + "_2";
                        break;

                    case TSpecialBlock.ESpecial_Bomb:
                        m_collectSprite[i].spriteName = "Bomb" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None);
                        break;

                    case TSpecialBlock.ESpecial_EatAColor:
                        m_collectSprite[i].spriteName = "Rainbow";
                        break;

                    default:
                        break;
                    }
                    m_collectLabel[i].text = GameLogic.Singleton.PlayingStageData.CollectCount[i].ToString() + "/" + GlobalVars.CurStageData.CollectCount[i].ToString();
                    if (GameLogic.Singleton.PlayingStageData.CollectCount[i] >= GlobalVars.CurStageData.CollectCount[i])
                    {
                        m_collectLabel[i].color = new Color(0, 1, 0);
                    }
                    else
                    {
                        m_collectLabel[i].color = new Color(0, 0, 0);
                    }
                }
                else
                {
                    m_collectLabel[i].gameObject.SetActive(false);
                }
            }
        }
        else
        {
            m_nutsCheck.transform.parent.gameObject.SetActive(false);
            m_jellyCheck.transform.parent.gameObject.SetActive(false);
            m_collectCheck.transform.parent.gameObject.SetActive(false);
        }

        m_levelLabel.SetNumberRapid(GlobalVars.CurStageNum);        //显示关卡编号
    }
Ejemplo n.º 11
0
    public override void OnShow()
    {
        base.OnShow();


        m_collectBoard.gameObject.SetActive(false);
        m_jellyBoard.gameObject.SetActive(false);
        m_scoreBoard.gameObject.SetActive(false);
        m_nutBoard.gameObject.SetActive(false);
        m_gameFailedBoard.gameObject.SetActive(false);
        m_resortBoard.gameObject.SetActive(false);
        m_autoResortBoard.gameObject.SetActive(false);
        m_stepLimitBoard.gameObject.SetActive(false);
        m_timeLimitBoard.gameObject.SetActive(false);
        m_sugarCrushBoard.gameObject.SetActive(false);

        Transform curBoard;

        if (Mode == TargetMode.StageTarget)
        {
            m_background.spriteName = "TargetBar";
            StageData stage = GlobalVars.CurStageData;
            if (stage.Target == GameTarget.GetScore)
            {
                m_scoreBoard.gameObject.SetActive(true);
                curBoard = m_scoreBoard;
                NumberDrawer scoreLabel = UIToolkits.FindComponent <NumberDrawer>(curBoard, "Score");
                scoreLabel.SetNumberRapid(stage.StarScore[0]);
            }
            else if (stage.Target == GameTarget.ClearJelly)
            {
                m_jellyBoard.gameObject.SetActive(true);
                curBoard = m_jellyBoard;



                if (stage.GetDoubleJellyCount() > 0 && stage.GetSingleJellyCount() > 0)
                {
                    m_jellyBoard.LocalPositionX(-30.0f);
                    NumberDrawer jelly2Label = GetChildComponent <NumberDrawer>("Jelly2Count");
                    jelly2Label.SetNumberRapid(stage.GetDoubleJellyCount());
                    NumberDrawer jellyLabel = GetChildComponent <NumberDrawer>("JellyCount");
                    jellyLabel.SetNumberRapid(stage.GetSingleJellyCount());

                    jellySplash.gameObject.SetActive(true);
                    jellyIcon.gameObject.SetActive(true);
                    jellyDoubleIcon.gameObject.SetActive(true);

                    jellyIcon.LocalPositionX(48.0f);
                    jellyDoubleIcon.LocalPositionX(253.2f);
                }
                else if (stage.GetDoubleJellyCount() > 0 && stage.GetSingleJellyCount() == 0)
                {
                    NumberDrawer jelly2Label = GetChildComponent <NumberDrawer>("Jelly2Count");
                    jelly2Label.SetNumberRapid(stage.GetDoubleJellyCount());
                    jellySplash.gameObject.SetActive(false);
                    jellyIcon.gameObject.SetActive(false);
                    jellyDoubleIcon.gameObject.SetActive(true);
                    jellyDoubleIcon.LocalPositionX(48.0f);
                    m_jellyBoard.LocalPositionX(86.0f);
                }
                else
                {
                    NumberDrawer jellyLabel = GetChildComponent <NumberDrawer>("JellyCount");
                    jellyLabel.SetNumberRapid(stage.GetSingleJellyCount());
                    jellySplash.gameObject.SetActive(false);
                    jellyIcon.gameObject.SetActive(true);
                    jellyIcon.LocalPositionX(48.0f);
                    jellyDoubleIcon.gameObject.SetActive(false);
                    m_jellyBoard.LocalPositionX(86.0f);
                }
            }
            else if (stage.Target == GameTarget.BringFruitDown)
            {
                m_nutBoard.gameObject.SetActive(true);
                curBoard = m_nutBoard;

                if (stage.Nut1Count > 0)
                {
                    nut1Label.SetNumberRapid(stage.Nut1Count);

                    nut1Label.gameObject.SetActive(true);
                    nut1Icon.gameObject.SetActive(true);
                    nut1Label.LocalPositionX(-14);
                }
                else
                {
                    nut1Label.gameObject.SetActive(false);
                    nut1Icon.gameObject.SetActive(false);
                }

                if (stage.Nut2Count > 0)
                {
                    nut2Label.SetNumberRapid(stage.Nut2Count);

                    nut2Label.gameObject.SetActive(true);
                    nut2Icon.gameObject.SetActive(true);
                    nut2Label.LocalPositionX(-14);
                }
                else
                {
                    nut2Label.gameObject.SetActive(false);
                    nut2Icon.gameObject.SetActive(false);
                }

                if (stage.Nut1Count > 0 && stage.Nut2Count > 0)
                {
                    nutSplash.gameObject.SetActive(true);

                    nut1Label.LocalPositionX(-101);
                    nut2Label.LocalPositionX(71);
                }
                else
                {
                    nutSplash.gameObject.SetActive(false);
                }
            }
            else                //Collect
            {
                m_collectBoard.gameObject.SetActive(true);
                curBoard = m_collectBoard;
                int collectCount = 0;

                for (int i = 0; i < 3; ++i)
                {
                    if (stage.CollectCount[i] > 0)
                    {
                        ++collectCount;
                        collectLabel[i].gameObject.SetActive(true);
                        collectIcon[i].gameObject.SetActive(true);

                        collectLabel[i].text = stage.CollectCount[i].ToString();

                        switch (GlobalVars.CurStageData.CollectSpecial[i])
                        {
                        case TSpecialBlock.ESpecial_Normal:
                        {
                            collectIcon[i].spriteName = "Item" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None);
                        }
                        break;

                        case TSpecialBlock.ESpecial_NormalPlus6:
                        {
                            collectIcon[i].spriteName = "TimeAdded" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None);
                        }
                        break;

                        case TSpecialBlock.ESpecial_EatLineDir0:
                            collectIcon[i].spriteName = "Line" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None) + "_3";
                            break;

                        case TSpecialBlock.ESpecial_EatLineDir1:
                            collectIcon[i].spriteName = "Line" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None) + "_1";
                            break;

                        case TSpecialBlock.ESpecial_EatLineDir2:
                            collectIcon[i].spriteName = "Line" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None) + "_2";
                            break;

                        case TSpecialBlock.ESpecial_Bomb:
                            collectIcon[i].spriteName = "Bomb" + (int)(GlobalVars.CurStageData.CollectColors[i] - TBlockColor.EColor_None);
                            break;

                        case TSpecialBlock.ESpecial_EatAColor:
                            collectIcon[i].spriteName = "Rainbow";
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        collectLabel[i].gameObject.SetActive(false);
                        collectIcon[i].gameObject.SetActive(false);
                    }
                }

                if (collectCount == 3)
                {
                    m_collectBoard.LocalPositionX(0);
                }
                else if (collectCount == 2)
                {
                    m_collectBoard.LocalPositionX(67);
                }
                else
                {
                    m_collectBoard.LocalPositionX(120);
                }
            }

            if (stage.StepLimit > 0)
            {
                m_stepLimitBoard.gameObject.SetActive(true);
                NumberDrawer stepLabel = UIToolkits.FindComponent <NumberDrawer>(m_stepLimitBoard, "StepNum");
                stepLabel.SetNumberRapid(stage.StepLimit);
            }
            else
            {
                m_timeLimitBoard.gameObject.SetActive(true);
                NumberDrawer timeLabel = UIToolkits.FindComponent <NumberDrawer>(m_timeLimitBoard, "TimeNum");
                timeLabel.SetNumberRapid(stage.TimeLimit);
            }
        }
        else
        {
            if (Mode == TargetMode.GameFailed)
            {
                m_background.spriteName = "FailedBar";
                m_gameFailedBoard.gameObject.SetActive(true);
            }
            else if (Mode == TargetMode.AutoResort)
            {
                m_background.spriteName = "ResortBar";
                m_autoResortBoard.gameObject.SetActive(true);
            }
            else if (Mode == TargetMode.SugarCrush)
            {
                m_background.spriteName = "TargetBar";
                m_sugarCrushBoard.gameObject.SetActive(true);
            }
        }
    }