Exemplo n.º 1
0
    public void PopulateCannonsList()
    {
        // We have the activity.  Populate the grid with Cannons!!
        EntityFactory ef = EntityFactory.GetEF();

        if (ef == null)
        {
            return;
        }

        // Getting ItemCards from Playerdata to populate list based on item cards not the entity factory calalog
        GameObjectTracker go = GameObjectTracker.GetGOT();

        if (go == null)
        {
            return;
        }

        if (_CardSelectors == null)
        {
            return;
        }

        // keeping track of the list of cannon selection objects locally

        // the next object to temp strore data for the list
        CannonSelectionObject newCannon = null;


        // Grab the deck of cards from the player data
        allItemCards = go._PlayerData.CardDeck;

        int cannonItemCardIndex = 0;

        foreach (CannonItemCard canItem in allItemCards)
        {
            //Create cannon and assign the reference.
            newCannon = NGUITools.AddChild(_gridOfCannons.gameObject, _refPrefab.gameObject).GetComponent <CannonSelectionObject>();
            newCannon.MyCannonCard = canItem;

            //Set the checkbox root.
            UICheckbox cbox = newCannon.GetComponent <UICheckbox>();
            if (cbox)
            {
                cbox.radioButtonRoot = this.transform;
            }

            _gridOfCannons.Reposition();

            _CardSelectors.Add(newCannon);

            cannonItemCardIndex++;
        }

        //Is populated is true,
        isPopulated = true;

        //And list give the list to the activity manager so they can grab it.
        ActivityManager.Instance.CardSelectors = _CardSelectors;
    }
 public void Awake()
 {
     if (_myObject == null)
     {
         Transform             parent = gameObject.transform.parent;
         CannonSelectionObject testCannonSelectionObject = parent.gameObject.GetComponent <CannonSelectionObject>();
         if (testCannonSelectionObject)
         {
             _myObject = testCannonSelectionObject;
         }
     }
 }
Exemplo n.º 3
0
    public void PopulateCannonsList()
    {
        // We have the activity.  Populate the grid with Cannons!!
        EntityFactory ef = EntityFactory.GetEF();

        if (ef == null)
        {
            return;
        }



        Debug.LogError("GRID CANNON LIST SCRIPT CALLED!");

        // keeping track of the list of cannon selection objects locally
        _CannonList = new List <CannonSelectionObject>();
        // the next object to allocate
        CannonSelectionObject newCannon = null;

        allCannonsInCatalogue = ef.CannonCatalogue;

        int cannonCatalogeIndex = 0;

        foreach (Cannon can in allCannonsInCatalogue)
        {
            newCannon = NGUITools.AddChild(_gridOfCannons.gameObject, _refPrefab.gameObject).GetComponent <CannonSelectionObject>();

            newCannon._sprIcon.spriteName = can.CannonTextureName;
            newCannon._lblCannonName.text = can.CannonName;

            _gridOfCannons.Reposition();

            _CannonList.Add(newCannon);

            cannonCatalogeIndex++;
        }

        isPopulated = true;
    }
 // Use this for initialization
 void Start()
 {
     // the open cannon script better be part of a slot selection object with in an activity
     myCannonSelectionObject = gameObject.transform.parent.GetComponent <CannonSelectionObject>();
 }