상속: MonoBehaviour
예제 #1
0
    public override void OnCreate()
    {
        base.OnCreate();

        m_playOnBtn = UIToolkits.FindComponent<UIButton>(mUIObject.transform, "PlayOnBtn");
        m_EndGameBtn = UIToolkits.FindComponent<UIButton>(mUIObject.transform, "EndGameBtn");
		
		m_curScore = UIToolkits.FindComponent<NumberDrawer>(mUIObject.transform, "CurScore");
        m_targetScore = UIToolkits.FindComponent<NumberDrawer>(mUIObject.transform, "TargetScore");

        m_curJelly = UIToolkits.FindComponent<NumberDrawer>(mUIObject.transform, "CurJelly");
        m_targetJelly = UIToolkits.FindComponent<NumberDrawer>(mUIObject.transform, "TargetJelly");

        m_curNut1 = UIToolkits.FindComponent<NumberDrawer>(mUIObject.transform, "CurNut1");
        m_targetNut1 = UIToolkits.FindComponent<NumberDrawer>(mUIObject.transform, "TargetNut1");
        m_curNut2 = UIToolkits.FindComponent<NumberDrawer>(mUIObject.transform, "CurNut2");
        m_targetNut2 = UIToolkits.FindComponent<NumberDrawer>(mUIObject.transform, "TargetNut2");

        m_scoreCheck = UIToolkits.FindComponent<UIToggle>(mUIObject.transform, "CheckBoxScore");
        m_jellyCheck = UIToolkits.FindComponent<UIToggle>(mUIObject.transform, "CheckBoxJelly");
        m_nutsCheck = UIToolkits.FindComponent<UIToggle>(mUIObject.transform, "CheckBoxNuts");
		
        AddChildComponentMouseClick("EndGameBtn", OnEndGameClicked);
        AddChildComponentMouseClick("PlayOnBtn", OnPlayOnClicked);
    }
예제 #2
0
    public override void OnCreate()
    {
        base.OnCreate();

		m_collectBoard = mUIObject.transform.FindChild("CollectBoard");
		m_jellyBoard = mUIObject.transform.FindChild("JellyBoard");
        m_scoreBoard = mUIObject.transform.FindChild("ScoreBoard");
		m_nutBoard = mUIObject.transform.FindChild("NutBoard");
		
        m_gameFailedBoard = mUIObject.transform.FindChild("FailedBoard");
        m_resortBoard = mUIObject.transform.FindChild("ResortBoard");
        m_autoResortBoard = mUIObject.transform.FindChild("AutoResortBoard");
        m_sugarCrushBoard = mUIObject.transform.FindChild("SugarCrushBoard");

        m_stepLimitBoard = mUIObject.transform.FindChild("StepLimitBoard");
        m_timeLimitBoard = mUIObject.transform.FindChild("TimeLimitBoard");

        nut1Label = GetChildComponent<NumberDrawer>("NutCount1");
        nut2Label = GetChildComponent<NumberDrawer>("NutCount2");
		nut1Icon = GetChildComponent<UISprite>("NutIcon1");
		nut2Icon = GetChildComponent<UISprite>("NutIcon2");
        nutSplash = GetChildComponent<UISprite>("NutSplash");

		jellyIcon = GetChildComponent<UISprite>("SingleIcon");
		jellyDoubleIcon = GetChildComponent<UISprite>("DoubleIcon");
		jellySplash = GetChildComponent<UISprite>("JellySlash");

        m_background = GetChildComponent<UISprite>("Background");

        for (int i = 0; i < 3; ++i )
        {
            collectLabel[i] = GetChildComponent<UILabel>("CollectCount" + (i + 1));
            collectIcon[i] = GetChildComponent<UISprite>("Icon" + (i + 1));
        }
    }
예제 #3
0
    public override void OnCreate()
    {
        base.OnCreate();

        //m_resultLabel = UIToolkits.FindComponent<UILabel>(mUIObject.transform, "ResultLabel");
        m_infoLabel = UIToolkits.FindComponent<UILabel>(mUIObject.transform, "EndInfomation");

        m_levelLabel = GetChildComponent<NumberDrawer>("LevelLabel");

        m_winBoard = UIToolkits.FindChild(mUIObject.transform, "WinBoard");
        m_failedBoard = UIToolkits.FindChild(mUIObject.transform, "FailedBoard");

        m_retryBtn = GetChildComponent<UIButton>("RetryBtn");

        AddChildComponentMouseClick("CloseBtn", OnCloseClicked);
        AddChildComponentMouseClick("RetryBtn", OnRetryClicked);
        AddChildComponentMouseClick("NextLevelBtn", OnNextLevelClicked);

        for (int i = 0; i < 3; ++i)
        {
            m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1));      //查找sprite
	        m_starParticles[i] = GetChildComponent<ParticleSystem>("StarEffect" + (i + 1));
            m_starParticles[i].Stop(true);
            //m_starParticles[i].gameObject.SetActive(false);
            //for (int index = 0; index < m_starParticles[i].transform.childCount; ++index)
            //{
            //    m_starParticles[i].transform.GetChild(index).gameObject.SetActive(false);
            //}
        }
    }
예제 #4
0
    public override void OnCreate()
    {
        base.OnCreate();

        m_collectBoard = mUIObject.transform.FindChild("CollectBoard");
        m_jellyBoard   = mUIObject.transform.FindChild("JellyBoard");
        m_scoreBoard   = mUIObject.transform.FindChild("ScoreBoard");
        m_nutBoard     = mUIObject.transform.FindChild("NutBoard");

        m_gameFailedBoard = mUIObject.transform.FindChild("FailedBoard");
        m_resortBoard     = mUIObject.transform.FindChild("ResortBoard");
        m_autoResortBoard = mUIObject.transform.FindChild("AutoResortBoard");
        m_sugarCrushBoard = mUIObject.transform.FindChild("SugarCrushBoard");

        m_stepLimitBoard = mUIObject.transform.FindChild("StepLimitBoard");
        m_timeLimitBoard = mUIObject.transform.FindChild("TimeLimitBoard");

        nut1Label = GetChildComponent <NumberDrawer>("NutCount1");
        nut2Label = GetChildComponent <NumberDrawer>("NutCount2");
        nut1Icon  = GetChildComponent <UISprite>("NutIcon1");
        nut2Icon  = GetChildComponent <UISprite>("NutIcon2");
        nutSplash = GetChildComponent <UISprite>("NutSplash");

        jellyIcon       = GetChildComponent <UISprite>("SingleIcon");
        jellyDoubleIcon = GetChildComponent <UISprite>("DoubleIcon");
        jellySplash     = GetChildComponent <UISprite>("JellySlash");

        m_background = GetChildComponent <UISprite>("Background");

        for (int i = 0; i < 3; ++i)
        {
            collectLabel[i] = GetChildComponent <UILabel>("CollectCount" + (i + 1));
            collectIcon[i]  = GetChildComponent <UISprite>("Icon" + (i + 1));
        }
    }
예제 #5
0
    public override void OnCreate()
    {
        base.OnCreate();

        for (int i = 0; i < 3; ++i )
        {
            m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1));      //查找sprite
        }
        m_progressSprite = GetChildComponent<UISprite>("Progress");      //查找sprite

        stageBoard = GetChildComponent<UISprite>("StageBoard");

        m_speedSlider = GetChildComponent<UISlider>("SpeedSlider");
        m_speedLabel = GetChildComponent<UILabel>("SpeedLabel");

        m_timeBar = GetChildComponent<UISprite>("TimeBar");

        m_scoreDrawer = GetChildComponent<NumberDrawer>("ScoreDrawer");
        m_stepDrawer = GetChildComponent<NumberDrawer>("StepDrawer");

        m_timeNumber = UIToolkits.FindChild(mUIObject.transform, "TimeNumber").gameObject;
        m_minNumber = GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = GetChildComponent<NumberDrawer>("SecNumber");
        
    }
예제 #6
0
    public override void OnCreate()
    {
        base.OnCreate();

        m_levelNumber = GetChildComponent<NumberDrawer>("LevelNumber");
        m_totalCostNumber = GetChildComponent<NumberDrawer>("ItemTotalCost");

        m_stageIcon = GetChildComponent<UISprite>("StageIcon");
        m_stageInfoLabel = GetChildComponent<UILabel>("StageInfoLabel");

        for (int i = 0; i < 3; ++i )
        {
            m_itemCostLabels[i] = GetChildComponent<UILabel>("Item" + (i+1).ToString() +"Cost");
            m_itemToggles[i] = GetChildComponent<UIToggle>("Item" + (i + 1).ToString() + "Btn");
			m_itemToggles[i].SetWithoutTrigger(false);
            m_lockItemSprite[i] = GetChildComponent<UISprite>("LockItem" + (i + 1).ToString());

            m_background[i] = GetChildComponent<UISprite>("Background" + (i + 1).ToString());

            EventDelegate.Set(m_itemToggles[i].onChange, OnToggle);
        }

        m_playBtn = UIToolkits.FindChild(mUIObject.transform, "PlayBtn").gameObject;
        m_playPayCoinBtn = UIToolkits.FindChild(mUIObject.transform, "PlayPlayCoinBtn").gameObject;

        m_itemBoard = UIToolkits.FindChild(mUIObject.transform, "Board").gameObject;
        m_itemBoardWithArrow = UIToolkits.FindChild(mUIObject.transform, "BoardWithArrow").gameObject;
        
        AddChildComponentMouseClick("CloseBtn", OnCloseClicked);
        AddChildComponentMouseClick("PlayBtn", OnPlayClicked);
        AddChildComponentMouseClick("PlayPlayCoinBtn", OnPlayClicked);
    }
예제 #7
0
    public override void OnCreate()
    {
        base.OnCreate();

        for (int i = 0; i < 3; ++i )
        {
            m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1));      //查找sprite
        }
        m_progressSprite = GetChildComponent<UISprite>("Progress");      //查找sprite

        stageBoard = GetChildComponent<UISprite>("StageBoard");

        m_speedSlider = GetChildComponent<UISlider>("SpeedSlider");
        m_speedLabel = GetChildComponent<UILabel>("SpeedLabel");

        m_timeBar = GetChildComponent<UISprite>("TimeBar");

        m_scoreDrawer = GetChildComponent<NumberDrawer>("ScoreDrawer");
        m_stepDrawer = GetChildComponent<NumberDrawer>("StepDrawer");

        m_timeNumber = UIToolkits.FindChild(mUIObject.transform, "TimeNumber").gameObject;
        m_minNumber = GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = GetChildComponent<NumberDrawer>("SecNumber");

        m_stepChangeAnim = m_stepDrawer.GetComponent<Animation>();
        m_scoreChangeAnim = m_scoreDrawer.GetComponent<Animation>();

        m_hurryStepParticle = UIToolkits.FindChild(mUIObject.transform, "Effect_HurryStep").gameObject;
        m_hurryStepParticle.SetActive(false);

        m_hurryTimeParticle = UIToolkits.FindChild(mUIObject.transform, "Effect_HurryTime").gameObject;
        m_hurryTimeParticle.SetActive(false);
    }
예제 #8
0
    public override void OnCreate()
    {
        base.OnCreate();
        AddChildComponentMouseClick("ConfirmBtn", OnConfirmClicked);
        AddChildComponentMouseClick("CancelBtn", OnCancelClicked);
		m_msgLabel = GetChildComponent<UILabel>("IntroduceLabel");
		m_costLabel = GetChildComponent<UILabel>("CostLabel");
        m_itemIcon = GetChildComponent<UISprite>("ItemIcon");

        m_coinDrawer = GetChildComponent<NumberDrawer>("CoinNumber");
    }
예제 #9
0
    public override void OnCreate()
    {
        base.OnCreate();
        AddChildComponentMouseClick("ConfirmBtn", OnConfirmClicked);
        AddChildComponentMouseClick("CancelBtn", OnCancelClicked);
		m_msgLabel = GetChildComponent<UILabel>("IntroduceLabel");
		m_costLabel = GetChildComponent<UILabel>("CostLabel");
        m_target = GameObject.Find("TargetBlock");
        m_target.SetActive(false);

        m_coinDrawer = GetChildComponent<NumberDrawer>("CoinNumber");
    }
예제 #10
0
    public void ShowCoin(bool bShow)
    {
        if (bShow)
        {
            m_showCoinTweener.delay = 0;
        }
        else
        {
            m_showCoinTweener.delay = 1;
        }
        m_showCoinTweener.Play(bShow);
        NumberDrawer coinLabel = GetChildComponent <NumberDrawer>("CoinCount");

        coinLabel.SetNumber((int)Unibiller.GetCurrencyBalance("gold"));
    }
예제 #11
0
    public override void OnCreate()
    {
        base.OnCreate();

        //m_resultLabel = UIToolkits.FindComponent<UILabel>(mUIObject.transform, "ResultLabel");
        m_infoLabel = UIToolkits.FindComponent<UILabel>(mUIObject.transform, "EndInfomation");

        m_stageNumber = GetChildComponent<NumberDrawer>("LevelNumber");

        AddChildComponentMouseClick("CloseBtn", OnCloseClicked);
        AddChildComponentMouseClick("RetryBtn", OnRetryClicked);
        AddChildComponentMouseClick("NextLevelBtn", OnNextLevelClicked);

        for (int i = 0; i < 3; ++i)
        {
            m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1));      //查找sprite
        }
    }
예제 #12
0
    public override void OnCreate()
    {
        base.OnCreate();

        m_playOnBtn = GetChildComponent<UIButton>("PlayOnBtn");
        m_playOnWithPayBtn = GetChildComponent<UIButton>("PlayOnWithPayBtn");
        m_EndGameBtn = GetChildComponent<UIButton>("EndGameBtn");

        m_curScore = GetChildComponent<NumberDrawer>("CurScore");
        m_targetScore = GetChildComponent<NumberDrawer>("TargetScore");

        m_curJelly = GetChildComponent<NumberDrawer>("CurJelly");
        m_targetJelly = GetChildComponent<NumberDrawer>("TargetJelly");

        m_curNut1 = GetChildComponent<NumberDrawer>("CurNut1");
        m_targetNut1 = GetChildComponent<NumberDrawer>("TargetNut1");
        m_curNut2 = GetChildComponent<NumberDrawer>("CurNut2");
        m_targetNut2 = GetChildComponent<NumberDrawer>("TargetNut2");

        m_scoreCheck = GetChildComponent<UIToggle>("CheckBoxScore");
        m_jellyCheck = GetChildComponent<UIToggle>("CheckBoxJelly");
        m_nutsCheck = GetChildComponent<UIToggle>("CheckBoxNuts");
        m_collectCheck = GetChildComponent<UIToggle>("CheckCollect");

        m_continueTipBoard = GetChildComponent<UISprite>("ContinueTipBoard");
        m_pauseTipBoard = GetChildComponent<UISprite>("PauseTipBoard");

        m_planOnItemIcon = GetChildComponent<UISprite>("ItemIcon");
        m_itemIntro = GetChildComponent<UILabel>("ItemIntro");
		
        AddChildComponentMouseClick("EndGameBtn", OnEndGameClicked);
        AddChildComponentMouseClick("PlayOnBtn", OnPlayOnClicked);
        AddChildComponentMouseClick("PlayOnWithPayBtn", OnPlayOnClicked);

        m_levelLabel = GetChildComponent<NumberDrawer>("LevelNumber");

        for (int i = 0; i < 3; ++i)
        {
            m_collectSprite[i] = GetChildComponent<UISprite>("Collect" + i);
            m_collectLabel[i] = GetChildComponent<UILabel>("CollectLabel" + i);
        }
    }
예제 #13
0
파일: UIGameEnd.cs 프로젝트: vcan/CapsUnity
    public override void OnCreate()
    {
        base.OnCreate();

        m_playOnBtn        = GetChildComponent <UIButton>("PlayOnBtn");
        m_playOnWithPayBtn = GetChildComponent <UIButton>("PlayOnWithPayBtn");
        m_EndGameBtn       = GetChildComponent <UIButton>("EndGameBtn");

        m_curScore    = GetChildComponent <NumberDrawer>("CurScore");
        m_targetScore = GetChildComponent <NumberDrawer>("TargetScore");

        m_curJelly    = GetChildComponent <NumberDrawer>("CurJelly");
        m_targetJelly = GetChildComponent <NumberDrawer>("TargetJelly");

        m_curNut1    = GetChildComponent <NumberDrawer>("CurNut1");
        m_targetNut1 = GetChildComponent <NumberDrawer>("TargetNut1");
        m_curNut2    = GetChildComponent <NumberDrawer>("CurNut2");
        m_targetNut2 = GetChildComponent <NumberDrawer>("TargetNut2");

        m_scoreCheck   = GetChildComponent <UIToggle>("CheckBoxScore");
        m_jellyCheck   = GetChildComponent <UIToggle>("CheckBoxJelly");
        m_nutsCheck    = GetChildComponent <UIToggle>("CheckBoxNuts");
        m_collectCheck = GetChildComponent <UIToggle>("CheckCollect");

        m_continueTipBoard = GetChildComponent <UISprite>("ContinueTipBoard");
        m_pauseTipBoard    = GetChildComponent <UISprite>("PauseTipBoard");

        m_planOnItemIcon = GetChildComponent <UISprite>("ItemIcon");
        m_itemIntro      = GetChildComponent <UILabel>("ItemIntro");

        AddChildComponentMouseClick("EndGameBtn", OnEndGameClicked);
        AddChildComponentMouseClick("PlayOnBtn", OnPlayOnClicked);
        AddChildComponentMouseClick("PlayOnWithPayBtn", OnPlayOnClicked);

        m_levelLabel = GetChildComponent <NumberDrawer>("LevelNumber");

        for (int i = 0; i < 3; ++i)
        {
            m_collectSprite[i] = GetChildComponent <UISprite>("Collect" + i);
            m_collectLabel[i]  = GetChildComponent <UILabel>("CollectLabel" + i);
        }
    }
예제 #14
0
파일: UIMap.cs 프로젝트: hiyijia/CapsUnity
    public override void OnCreate()
    {
        base.OnCreate();

        m_heartUI = UIWindowManager.Singleton.CreateWindow<UIWindow>("UIMapHeart", UIWindowManager.Anchor.TopLeft);

        m_backGroundTrans = mUIObject.transform;
        
        m_stageBtns = new Transform[GlobalVars.TotalStageCount];

        GlobalVars.AvailabeStageCount = PlayerPrefs.GetInt("StageAvailableCount");
        if (GlobalVars.AvailabeStageCount == 0)
        {
            GlobalVars.AvailabeStageCount = 1;
        }
		GlobalVars.StageStarArray = PlayerPrefsExtend.GetIntArray("StageStars", 0, 100);
        GlobalVars.StageScoreArray = PlayerPrefsExtend.GetIntArray("StageScores", 0, 100);
		GlobalVars.StageFailedArray = PlayerPrefsExtend.GetIntArray("StageFailed", 0, 100);
        GlobalVars.LastStage = GlobalVars.AvailabeStageCount;
		
		if(!PlayerPrefs.HasKey("Coins"))
		{
			GlobalVars.Coins = 10;
			PlayerPrefs.SetInt("Coins", 0);
		}
		else
		{
			GlobalVars.Coins = PlayerPrefs.GetInt("Coins");
		}
		
		GlobalVars.PurchasedItemArray = PlayerPrefsExtend.GetIntArray("PurchasedItemArray", 0, 2);
		
		springPanel = mUIObject.AddComponent<SpringPanel>();
        UIPanel panel = mUIObject.GetComponent<UIPanel>();
        panel.baseClipRegion = new Vector4(0, 0, CapsApplication.Singleton.Width, CapsApplication.Singleton.Height);

        m_timeNumber = UIToolkits.FindChild(m_heartUI.mUIObject.transform, "TimeNumber").gameObject;
        m_fullText = UIToolkits.FindChild(m_heartUI.mUIObject.transform, "HeartFull").gameObject;
        m_minNumber = m_heartUI.GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = m_heartUI.GetChildComponent<NumberDrawer>("SecNumber");
    }
예제 #15
0
    public override void OnCreate()
    {
        base.OnCreate();
        AddChildComponentMouseClick("CloseBtn", Close);
		
		m_minNumber = GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = GetChildComponent<NumberDrawer>("SecNumber");
		m_heartSprite = GetChildComponent<UISprite>("HeartToCull");

        //AddChildComponentMouseClick("Buy1HeartBtn", delegate()
        //{
        //    if (Unibiller.DebitBalance("gold", 25))
        //    {
        //        UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetString(Localization.instance.Get("PurchaseSucceed"));
        //        UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetFunc(delegate()
        //        {
        //            GlobalVars.AddHeart(1);
        //            ContinuePlay();
        //        });
        //        UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().ShowWindow();
        //    }
        //    else
        //    {
        //        HideWindow();
        //        UIWindowManager.Singleton.GetUIWindow<UIStore>().ShowWindow();
        //        GlobalVars.OnPurchaseFunc = delegate()
        //        {
        //            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetString(Localization.instance.Get("PurchaseSucceed"));
        //            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetFunc(delegate()
        //            {
        //                Unibiller.DebitBalance("gold", 25);
        //                GlobalVars.AddHeart(1);
        //                ContinuePlay();
        //            });
        //            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().ShowWindow();
        //        };
        //        GlobalVars.OnCancelFunc = delegate()
        //        {
        //            Close();
        //        };
        //    }
        //});

        AddChildComponentMouseClick("Buy5HeartBtn", delegate()
        {
            if (Unibiller.DebitBalance("gold", 60))
            {
                UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetString(Localization.instance.Get("PurchaseSucceed"));
                UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetFunc(delegate()
                {
                    CapsApplication.Singleton.SubmitUseItemData("BuyHearts");
                    GlobalVars.AddHeart(5);
                    ContinuePlay();
                });
                UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().ShowWindow();
            }
            else
            {
                HideWindow();
                GlobalVars.UsingItem = PurchasedItem.Item_Hearts;
                UIWindowManager.Singleton.GetUIWindow<UIPurchaseNotEnoughMoney>().ShowWindow();
                GlobalVars.OnPurchaseFunc = delegate()
                {
                    GlobalVars.UsingItem = PurchasedItem.None;
                    Unibiller.DebitBalance("gold", 60);
                    CapsApplication.Singleton.SubmitUseItemData("BuyHearts");
                    GlobalVars.AddHeart(5);
                    ContinuePlay();
                };
                GlobalVars.OnCancelFunc = delegate()
                {
                    GlobalVars.UsingItem = PurchasedItem.None;
                    Close();
                };
            }
        });
    }
예제 #16
0
파일: UIMap.cs 프로젝트: kofight/CapsUnity
    public override void OnCreate()
    {
        base.OnCreate();

        m_newStageNumber = -1;

        m_heartUI = UIWindowManager.Singleton.CreateWindow<UIWindow>("UIMapHeart", UIWindowManager.Anchor.TopLeft);

        m_backGroundTrans = mUIObject.transform;
        
        m_stageBtns = new Transform[GlobalVars.TotalStageCount];
		m_stageNumbers = new Transform[GlobalVars.TotalStageCount];

        GlobalVars.AvailabeStageCount = PlayerPrefs.GetInt("StageAvailableCount");
        GlobalVars.HeadStagePos = PlayerPrefs.GetInt("HeadStagePos");

        if (GlobalVars.AvailabeStageCount == 0)
        {
            GlobalVars.AvailabeStageCount = 1;
        }
        if (GlobalVars.AvailabeStageCount > GlobalVars.TotalStageCount)
        {
            GlobalVars.AvailabeStageCount = GlobalVars.TotalStageCount;
        }
        if (GlobalVars.HeadStagePos > GlobalVars.TotalStageCount)
        {
            GlobalVars.HeadStagePos = GlobalVars.TotalStageCount;
        }
        if (GlobalVars.HeadStagePos == 0)
        {
            GlobalVars.HeadStagePos = 1;
        }
		GlobalVars.StageStarArray = PlayerPrefsExtend.GetIntArray("StageStars", 0, 100);
        GlobalVars.StageScoreArray = PlayerPrefsExtend.GetIntArray("StageScores", 0, 100);
		GlobalVars.StageFailedArray = PlayerPrefsExtend.GetIntArray("StageFailed", 0, 100);
        GlobalVars.LastStage = GlobalVars.AvailabeStageCount;
		
		if(!PlayerPrefs.HasKey("Coins"))
		{
			GlobalVars.Coins = 10;
			PlayerPrefs.SetInt("Coins", 0);
		}
		else
		{
			GlobalVars.Coins = PlayerPrefs.GetInt("Coins");
		}
		
		GlobalVars.PurchasedItemArray = PlayerPrefsExtend.GetIntArray("PurchasedItemArray", 0, 2);

        m_mapObj = mUIObject.transform.FindChild("MapObj").gameObject;
        springPanel = m_mapObj.AddComponent<SpringPanel>();
        springPanel.strength = 1000;
        UIPanel panel = m_mapObj.GetComponent<UIPanel>();
        //panel.baseClipRegion = new Vector4(0, 0, CapsApplication.Singleton.Width, CapsApplication.Singleton.Height);

        //心面板
        m_timeNumber = UIToolkits.FindChild(m_heartUI.mUIObject.transform, "TimeNumber").gameObject;
        m_minNumber = m_heartUI.GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = m_heartUI.GetChildComponent<NumberDrawer>("SecNumber");
        UIButton heartBtn = m_heartUI.GetChildComponent<UIButton>("HeartBtn");
        EventDelegate.Set(heartBtn.onClick, delegate()
        {
            if (GlobalVars.HeartCount == 5)
            {
                return;
            }

            if (GlobalVars.UseSFX)
            {
                NGUITools.PlaySound(CapsConfig.CurAudioList.ButtonClip);
            }

            UINoMoreHearts noMoreHeartUI = UIWindowManager.Singleton.GetUIWindow<UINoMoreHearts>();
            UIStageInfo stageInfoUI = UIWindowManager.Singleton.GetUIWindow<UIStageInfo>();

            if (stageInfoUI.Visible)
            {
                stageInfoUI.HideWindow();
            }

            noMoreHeartUI.NeedOpenStageInfoAfterClose = false;
            noMoreHeartUI.ShowWindow();
        });

        //金币面板
        m_coinNumber = m_heartUI.GetChildComponent<NumberDrawer>("MoneyNumber");
        UIButton button = m_heartUI.GetChildComponent<UIButton>("StoreBtn");
        EventDelegate.Set(button.onClick, delegate()
        {
            if (GlobalVars.UseSFX)
            {
                NGUITools.PlaySound(CapsConfig.CurAudioList.ButtonClip);
            }

            UIStore storeUI = UIWindowManager.Singleton.GetUIWindow<UIStore>();
            UIStageInfo stageInfoUI = UIWindowManager.Singleton.GetUIWindow<UIStageInfo>();

            if (stageInfoUI.Visible)
            {
                stageInfoUI.HideWindow();
                GlobalVars.OnCancelFunc = delegate()
                {
                    stageInfoUI.ShowWindow();
                };
                GlobalVars.OnPurchaseFunc = delegate()
                {
                    stageInfoUI.ShowWindow();
                };
            }

            
            storeUI.ShowWindow();
        }
        );

        m_headSprite = GetChildComponent<UISprite>("Head");


        GameObject obj = GameObject.Find("Cloud");
        m_cloudSprite = obj.GetComponent<UISprite>();
        m_cloudSprite.gameObject.SetActive(false);

        obj = GameObject.Find("Cloud2");
        m_cloud2Sprite = obj.GetComponent<UISprite>();
        m_cloud2Sprite.gameObject.SetActive(false);

        m_inputBlocker = mUIObject.transform.Find("Blocker").gameObject;

        m_stageUI = UIWindowManager.Singleton.GetUIWindow<UIStageInfo>();

        for (int i=0; i<3; ++i)
        {
            m_blurSprites[i] = UIToolkits.FindChild( mUIObject.transform, "MapPicBlur" + i).gameObject;
            m_blurSprites[i].SetActive(false);
        }
		
		for (int i = 0; i < GlobalVars.TotalStageCount; ++i)
        {
			Transform transform = UIToolkits.FindChild(mUIObject.transform, "Stage" + (i + 1));      //找到对象

            if (transform == null)
            {
                Debug.LogError("There's no " + "Stage" + (i + 1).ToString() + " Button");
                continue;
            }
			
			m_stageBtns[i] = transform;
			m_stageNumbers[i] = transform.FindChild("StageNumber");
		}
    }
예제 #17
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);
            }
        }
    }