public void ExecOnChildProductClickedCallbacks(StandGenerator stg, ShelfGenerator shg, bool[] selected)
 {
     foreach (OnChildProductClickedCallback f in onChildProductClickedCallBacks)
     {
         f(stg, shg, selected);
     }
 }
    public void OnProductClickedInSimulation(StandGenerator stand, ShelfGenerator shelf, bool[] selected)
    {
        int stand_index = standList.IndexOf(stand);
        int shelf_index = standList[stand_index].shelves.IndexOf(shelf);

        _UIController.UpdateUIState(stand_index, shelf_index, selected, true);
    }
 public void ExecOnItemAttachedCallbacks(StandGenerator stand, ShelfGenerator shelf, Drag3D cube)
 {
     foreach (OnItemAttachedCallback f in onItemAttachedCallBacks)
     {
         f(stand, shelf, cube, childs_selected.ToArray());
     }
 }
    public void GenerateScene(SceneData sd)
    {
        sceneData = sd;

        stands   = new List <StandGenerator>();
        id2stand = new Dictionary <int, GameObject>();

        for (int i = 0; i < sceneData.stands.Length; i++)
        {
            GameObject g = new GameObject(sceneData.stands[i].name);
            g.transform.SetParent(transform);

            StandGenerator STD = g.AddComponent(typeof(StandGenerator)) as StandGenerator;
            stands.Add(STD);
            id2stand.Add(STD.gameObject.GetInstanceID(), STD.gameObject);

            STD.Initialize(sceneData.stands[i]);
        }

        //if (AUTOSTART)
        //{
        //    GameObject UI = GameObject.Find("UIController");
        //    UIController uiController = UI.GetComponent<UIController>();
        //    uiController.SetStandList(stands);
        //}
    }
 // Clear any other selected stand
 public void ChildStandWasSelected(StandGenerator sg)
 {
     if (selected_stand != null && selected_stand != sg)
     {
         selected_stand.ClearSelected();
     }
     selected_stand = sg;
 }
    public void OnShelfClicked(ShelfGenerator shg, StandGenerator stg)
    {
        int standIndex = _UIController.standList.IndexOf(stg);
        int shelfIndex = _UIController.standList[standIndex].shelves.IndexOf(shg);

        int len = _UIController.standList[standIndex].shelves[shelfIndex].cubes.Count;

        bool[] sel = UIController.GetSelectedArray(new int[] {}, len);

        _UIController.UpdateUIState(standIndex, shelfIndex, sel, true, false);
    }
    public void OnProdcutRemovedFromShelf(StandGenerator stand, ShelfGenerator shelf, Drag3D cube, bool[] selected)
    {
        // When a product is added or removed from a shelf we should update the UI
        // To avoid any (out of bounds) errors and dislpaying incorrect information

        if (stand == _UIController.standList[_UIController.stand_dropdown_index] &&
            shelf == _UIController.standList[_UIController.stand_dropdown_index].shelves[_UIController.shelf_dropdown_index])
        {
            _UIController.UpdateUIState(_UIController.stand_dropdown_index, _UIController.shelf_dropdown_index, selected, true, true);
        }
    }
    public void OnProductAddedToShelf(StandGenerator stand, ShelfGenerator shelf, Drag3D cube, bool[] selected)
    {
        //if (stand == _UIController.standList[_UIController.stand_dropdown_index] &&
        //shelf == _UIController.standList[_UIController.stand_dropdown_index].shelves[_UIController.shelf_dropdown_index])
        {
            int stand_idx = _UIController.standList.IndexOf(stand);
            int shelf_idx = _UIController.standList[stand_idx].shelves.IndexOf(shelf);

            //int len = _UIController.standList[stand_idx].shelves[shelf_idx].cubes.Count;
            //bool[] sel = UIController.GetSelectedArray( new int[]{len-1}, len);

            _UIController.UpdateUIState(stand_idx, shelf_idx, selected, true, true);
        }
    }
    public void RegisterChild(StandGenerator s)
    {
        if (stands == null)
        {
            stands = new List <StandGenerator>();
        }

        stands.Add(s);
        id2stand.Add(s.gameObject.GetInstanceID(), s.gameObject);

        //    // TODO probably needs a less crappy style
        //    if (AUTOSTART)
        //    {
        //        GameObject UI = GameObject.Find("UIController");
        //        UIController uiController = UI.GetComponent<UIController>();
        //        uiController.SetStandList(stands);
        //    }
    }
예제 #10
0
    public bool AddFloatingProduct(Drag3D fp, ShelfGenerator shg, StandGenerator sg)
    {
        // Only 1 product at a time
        if (floatingProduct != null)
        {
            return(false);
        }

        floatingProduct       = fp;
        floatingPordOrigStand = sg;
        floatingProdOrigShelf = shg;

        // Transfer the parenthood form the shg to this
        // Move to the same position as the shelf generator so the position of the product is not alterd
        transform.localPosition = shg.transform.localPosition;
        fp.transform.parent     = this.transform;

        return(true);
    }