Exemplo n.º 1
0
    public override void OnActivate()
    {
        BaseItemCard theCard = ActivityManager.Instance.SelectedCard;

        //Get the card icon
        string IconName = theCard.DisplayInfo.IconName;

        CardIcon.spriteName  = IconName;
        CardIcon1.spriteName = IconName;
        CardIcon2.spriteName = IconName;

        //Get the name.
        string CardName = theCard.Label;

        CardLabel.text = CardName;

        //Set the color.
        CardBG.color = theCard.DisplayInfo.BGColor;

        //Set up the mission view list.

        if (UseView)
        {
            mviewer.AssignedMission = theCard.BreathlessMission;
            return;
        }

        //Set the Mission viewer info.
        viewer.ReAssignMissions();
    }
Exemplo n.º 2
0
    public void ReAssignMission()
    {
        if (!populated)
        {
            PopulateList();
            //return;
        }


        //Grab the selected cannon from the activity manager.
        BaseItemCard selectedCard = ActivityManager.Instance.SelectedCard;

        //Grab the first list of missions on the list.
        if (AssignedMission == null)
        {
            AssignedMission = selectedCard.Missions[0];
        }

        //Set teh mission label
        MissionName.text = AssignedMission.DisplayName;

        int index = 0;

        //Go through the mission and assign the badge at index of the objective
        foreach (BaseMission.GameObjective gobjective in  AssignedMission.MissionObjectives)
        {
            _objectiveslist[index].AssignedObjective = gobjective;
            index++;
        }
    }
    public void ReAssignMissions()
    {
        if (!populated)
        {
            PopulateList();
            //return;
        }


        //Grab the selected cannon from the activity manager.
        BaseItemCard selectedCard = ActivityManager.Instance.SelectedCard;

        int index = 0;

        foreach (BaseMission mission in selectedCard.Missions)
        {
            //If our current index is beyond the size then we have gone to far!
            if (index >= _missionViewersList.Count)
            {
                Debug.LogError("Mission viewer table size not big enough!");
                return;
            }

            //Grab the current FUIMissionviewer
            FUIMissionViewer mview = _missionViewersList[index];
            mview.gameObject.SetActive(true);
            MissionsTable.Reposition();

            //Set teh assigned mission.
            mview.AssignedMission = mission;

            index++;
        }
    }
    public void Clear()
    {
        //Set clearing values.
        IsOpen      = false;
        IsAvailable = true;

        Type = EntityFactory.CannonTypes.NULL;

        if (StartActive)
        {
            IsOpen = true;
            Type   = EntityFactory.CannonTypes.Zebra;
        }

        _myItem   = null;
        _iconName = "Thermometer-Units";
    }
Exemplo n.º 5
0
    void Update()
    {
        if (_data == null)
        {
            phaseLabel.text        = "XX:XX";
            phaseSprite.spriteName = "phaseunknown";
            return;
        }

        if (completed)
        {
            return;
        }

        if (_data.PhaseCompletionPunch != -1.0f)
        {
            //Debug.Log("Phase Completion Punch Pass at " + FormatSeconds(_data.PhaseCompletionPunch));

            //set the phase data
            phaseLabel.text                = FormatSeconds(_data.PhaseCompletionPunch);
            phaseSprite.spriteName         = _data.IconTextureName;
            phaseBestTimeBadgeSprite.alpha = 0.0f;
            CannonBadge.alpha              = 1.0f;


            //Grab player data.
            EntityFactory.CannonTypes cType = _data.PhaseStatistics.CompletionCannon;
            BaseItemCard card = GameObjectTracker.instance._PlayerData.FindCardByCannonType(cType);

            //Check if its a valid card theng grab the icon name.
            if (card == null || cType == EntityFactory.CannonTypes.NULL ||
                cType == EntityFactory.CannonTypes.Empty)
            {
                CannonBadge.spriteName = "phaseunknown";
                completed = true;
                return;
            }

            CannonBadge.spriteName = card.DisplayInfo.IconName;

            //Maybe check for objective completion here.

            //Set completed.
            completed = true;
        }
    }
Exemplo n.º 6
0
    void PopulateList()
    {
        //Grab the selected cannon from the activity manager.
        BaseItemCard selectedCard = ActivityManager.Instance.SelectedCard;

        if (selectedCard == null)
        {
            return;
        }

        if (_objectiveslist == null)
        {
            Debug.LogError("NO OBJECTIVE LIST!! WTF!!");
            _objectiveslist = new List <FUIObjectiveBadge>();
        }


        //Grab the first list of missions on the list.
        BaseMission mission = selectedCard.Missions[0];

        //Store a placeholder objective badge
        FUIObjectiveBadge newBadge = null;

        foreach (BaseMission.GameObjective gobjective in mission.MissionObjectives)
        {
            //Allocate the new badge.
            newBadge = NGUITools.AddChild(ObjectivesListTable.gameObject, ObjectiveBadgePrefab.gameObject).GetComponent <FUIObjectiveBadge>();

            //Set the variables
            newBadge.AssignedObjective = gobjective;

            //Add it to the list.
            _objectiveslist.Add(newBadge);

            //Repositioning the table.
            ObjectivesListTable.Reposition();
        }


        populated = true;
    }
    void PopulateList()
    {
        //Grab the selected cannon from the activity manager.
        BaseItemCard selectedCard = ActivityManager.Instance.SelectedCard;

        if (selectedCard == null)
        {
            return;
        }

        if (_missionViewersList == null)
        {
            Debug.LogError("NO Mission Viewer LIST!! WTF!!");
            _missionViewersList = new List <FUIMissionViewer>();
        }


        //Store a placeholder objective badge
        FUIMissionViewer newMission = null;

        for (int i = 0; i < InitialSize; i++)
        {
            //Allocate the new badge.
            newMission = NGUITools.AddChild(MissionsTable.gameObject, MissionViewerTemplate.gameObject).GetComponent <FUIMissionViewer>();

            //Set the variables
            //newMission.AssignedMission = mission;

            //Add it to the list.
            _missionViewersList.Add(newMission);

            //Repositioning the table.
            MissionsTable.Reposition();

            //Disable
            newMission.gameObject.SetActive(false);
        }


        populated = true;
    }
    public void ApplyRunStatsToCards(Statistics stats)
    {
        //Sets add on the time and score to the full stats count.
        _gameStatistics.Score      += stats.Score;
        _gameStatistics.TimeAmount += stats.TimeAmount;

        //Add the stats to the game histroy
        _gameHistory.Push(stats);

        //Apply score to the xp.
        TotalXP += stats.Score;

        //Get the completion cannon!
        BaseItemCard card = FindCardByCannonType(stats.CompletionCannon);

        //Check if the card has ac annon. it may not.
        if (card != null)
        {
            card.ApplyStatsToMission(stats, "PTPMission");
        }
    }
Exemplo n.º 9
0
//	public void ButtonOpenCannonListPressed(){
//
//		// when the slot is clicked, and we know the slot is available to change.
//		// tell the activity to open up the cannon grid to select the cannon.
//		// The slot is not told that the button to select cannon has been clicked
//		// Two different scripts
//		if (_myActivity != null){
//			_myActivity.StartCannonSelect(this);
//		}
//	}

    public void ButtonCannonSelectedPressed(BaseItemCard ForcedCard = null)
    {
        BaseItemCard cannonItemCard = ActivityManager.Instance.HighlitedCard;

        //Lets check if there is no selected item
        if (cannonItemCard == null)
        {
            //Turn off the info window.
            //SlotInfo.ToggleWindowOff();

            //Play sound.
            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.Select);

            //If we press the button and we have no cannon then we clear the slot.
            if (_myslot.Type != EntityFactory.CannonTypes.NULL)
            {
                //Clear slot if pressed with nothign selected.
                _myslot.Type = EntityFactory.CannonTypes.NULL;

                //Play the clear animation
                DeSelectAnimation.Reset();
                DeSelectAnimation.Play(true);


                //Set to zebra as default.
                if (_myslot.StartActive)
                {
                    _myslot.Type      = EntityFactory.CannonTypes.Zebra;
                    _lblSlotName.text = "Default";
                }


                ToyBox.GetPandora().AssignSlot(_myslot.Type, _slotIndex);

                //Since we cleared the slow, play the cleared slot label.
                _lblSlotName.text = EmptySlotLabel;

                //Update teh costs here.
                GameObjectTracker.instance._PlayerData.GemCart -= _slotitemCost;
                _slotitemCost = 0;

                // then update the slot visuals
                UpdateDisplay();
                return;
            }

            MinusSlot();
//			Debug.LogError("Slot Minused");
            return;
        }



        // the cannon isn't used, assign it
        ToyBox.GetPandora().AssignSlot(cannonItemCard.ContainedCannonType, _slotIndex);

        // then update the slot visuals
        _sprIcon.spriteName = cannonItemCard.DisplayInfo.IconName;
        _lblSlotName.text   = cannonItemCard.Label;

        //Check here if slot is 0 then apply cost. or it would apply cost every time we tap.
        if (_slotitemCost != cannonItemCard.DisplayInfo.GemRequirements)
        {
            //Negate the current item cost count before we update.
            GameObjectTracker.instance._PlayerData.GemCart -= _slotitemCost;

            //Set the cost.
            _slotitemCost = cannonItemCard.DisplayInfo.GemRequirements;
            GameObjectTracker.instance._PlayerData.GemCart += _slotitemCost;
        }

        //Play the animation
        if (SelectTween)
        {
            SelectTween.Reset();
            SelectTween.Play(true);

            //Play audio sound
            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotPushed);

            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotSelect);
        }
    }
    public override void OnActivate()
    {
        //Prepare the grid.
        if (!prepredPhaseGrid)
        {
            PreparePhaseGrid();
        }

        if (presented)
        {
            //Toggle back on the game over window.
            PhasesCountWindow.ToggleWindowOn();
            BG.ToggleWindowOn();
            ActivityManager.Instance.ToggleHud(false);

            return;
        }

        //Fill up the list.
        int index = 0;

        foreach (BasePhase.PhaseData phase in GameObjectTracker.instance._PlayerData.Breathless.PhaseList)
        {
            _resultList[index].PhaseData = phase;
            index++;
        }


        GameOverWindow.SetWindowAlpha(1.0f);
        //Set the information
        GameOverWindow.ToggleWindowOn();

        //Reset the game over window animations for bring in.
        GOAlpha.Reset();
        GOAlpha.Play(true);
        GOPosition.Reset();
        GOPosition.Play(true);
        GOBringIN.Reset();
        GOBringIN.Play(true);


        //Set the timer to game over duration upon activate.
        ResetTimer(GameOverDuration);
        curState = state.GameOver;

        //Grab the games statistics. By now the game stats should be of a completed game.
        Statistics gameStats = GameObjectTracker.instance.RunStatistics;

        if (gameStats == null)
        {
            return;
        }

        //Set the score.
        ScoreLabel.text = string.Format("{0:#,#,#}", gameStats.Score);

        //Set the time.
        //TimeLabel.text = FormatSeconds(gameStats.TimeAmount);

        //Set the bonus amount
        BonusLabel.text = "N/A";

        //Set the coins collected.
        //MoneyLabel.text =  string.Format("{0:C}",gameStats.Money);
        //MoneyLabel.text =  gameStats.Money.ToString();

        //Set the PPS label
        //PPSLabel.text = gameStats.PPS.ToString() + " PPS";
        PPSText   = string.Format("{0:#,#,#} PPS", gameStats.PPS);
        ScoreText = string.Format("{0:#,#,#}", gameStats.Score);
        CoinsText = string.Format("{0:C}", gameStats.Money);

        PPSLabel.text = ScoreText;
        viewPPS       = false;

        MoneyLabel.text = CoinsText;

        //Set the animal.

        //Grab player data.
        BaseItemCard card = GameObjectTracker.instance._PlayerData.FindCardByCannonType(gameStats.CompletionCannon);

        //Check if its a valid card theng grab the icon name.
        if (card == null || gameStats.CompletionCannon == EntityFactory.CannonTypes.NULL ||
            gameStats.CompletionCannon == EntityFactory.CannonTypes.Empty)
        {
            Animal.spriteName = "phaseunknown";
            return;
        }

        Animal.spriteName = card.DisplayInfo.IconName;
    }