Esempio n. 1
0
 public void createScollPane (List<TableItem> listTable, int typeRoom) {
     gameControl.panelWaiting.onShow ();
     setGameName ();
     listTableBehavior.Clear ();
     try {
         if(this.gameObject.activeInHierarchy) {
             for(int i = 0; i < listTable.Count; i++) {
                 TableBehavior tableBehavior = new TableBehavior ();
                 tableBehavior.id = listTable[i].id;
                 tableBehavior.status = listTable[i].status;
                 tableBehavior.name = listTable[i].name;
                 tableBehavior.masid = listTable[i].masid;
                 tableBehavior.nUser = listTable[i].nUser;
                 tableBehavior.maxUser = listTable[i].maxUser;
                 tableBehavior.money = listTable[i].money;
                 tableBehavior.needMoney = listTable[i].needMoney;
                 tableBehavior.maxMoney = listTable[i].maxMoney;
                 tableBehavior.Lock = listTable[i].Lock;
                 tableBehavior.typeTable = listTable[i].typeTable;
                 tableBehavior.choinhanh = listTable[i].choinhanh;
                 listTableBehavior.Add (tableBehavior);
             }
             _instanListViewControler.InitTableView (listTableBehavior, 0);
         }
     } catch(Exception e) {
         Debug.LogException (e);
     }
     gameControl.panelWaiting.onHide ();
 }
 private void FindTable()
 {
     _table    = GameObject.FindObjectOfType <TableBehavior>();
     _listView = new MaterialListView(_treeViewState, _table, MaterialSelected);
 }
Esempio n. 3
0
    public IEnumerator ItemIsInvisible(int itemNumber)
    {
        if (isUpdatingList)
        {
            yield return(null);
        }
        isUpdatingList = true;
        if (dataList.Count > poolSize) // we need to do something "smart"...
        {
            Transform item          = itemsPool[itemNumber];
            int       itemDataIndex = 0;
            if (item.tag.Equals(itemPrefab.gameObject.tag.ToString()))
            {
                itemDataIndex = item.GetComponent <TableBehavior> ().itemDataIndex;
            }

            int           indexToCheck = 0;
            TableBehavior infItem      = null;
            TableBehavior infSection   = null;
            if (dataTracker.ContainsKey(itemDataIndex + 1))
            {
                infItem    = itemsPool[(int)(dataTracker[itemDataIndex + 1])].GetComponent <TableBehavior> ();
                infSection = itemsPool[(int)(dataTracker[itemDataIndex + 1])].GetComponent <TableBehavior> ();

                if ((infItem != null && infItem.verifyVisibility()) || (infSection != null && infSection.verifyVisibility()))
                {
                    // dragging upwards (scrolling down)
                    indexToCheck = itemDataIndex - (extraBuffer / 2);
                    if (dataTracker.ContainsKey(indexToCheck))
                    {
                        //do we have an extra item(s) as well?
                        for (int i = indexToCheck; i >= 0; i--)
                        {
                            if (dataTracker.ContainsKey(i))
                            {
                                infItem    = itemsPool[(int)(dataTracker[i])].GetComponent <TableBehavior> ();
                                infSection = itemsPool[(int)(dataTracker[i])].GetComponent <TableBehavior> ();
                                if ((infItem != null && !infItem.verifyVisibility()) || (infSection != null && !infSection.verifyVisibility()))
                                {
                                    item = itemsPool[(int)(dataTracker[i])];
                                    if ((i) + poolSize < dataList.Count && i > -1)
                                    {
                                        PrepareListItemWithIndex(item, i + poolSize, i);
                                    }
                                }
                            }
                            else
                            {
                                scrollCursor = itemDataIndex - 1;
                                break;
                            }
                        }
                    }
                }
            }
            if (dataTracker.ContainsKey(itemDataIndex - 1))
            {
                infItem    = itemsPool[(int)(dataTracker[itemDataIndex - 1])].GetComponent <TableBehavior> ();
                infSection = itemsPool[(int)(dataTracker[itemDataIndex - 1])].GetComponent <TableBehavior> ();

                if ((infItem != null && infItem.verifyVisibility()) || (infSection != null && infSection.verifyVisibility()))
                {
                    //dragging downwards check the item below
                    indexToCheck = itemDataIndex + (extraBuffer / 2);

                    if (dataTracker.ContainsKey(indexToCheck))
                    {
                        // if we have an extra item
                        for (int i = indexToCheck; i < dataList.Count; i++)
                        {
                            if (dataTracker.ContainsKey(i))
                            {
                                infItem    = itemsPool[(int)(dataTracker[i])].GetComponent <TableBehavior> ();
                                infSection = itemsPool[(int)(dataTracker[i])].GetComponent <TableBehavior> ();
                                if ((infItem != null && !infItem.verifyVisibility()) || (infSection != null && !infSection.verifyVisibility()))
                                {
                                    item = itemsPool[(int)(dataTracker[i])];
                                    if ((i) - poolSize > -1 && (i) < dataList.Count)
                                    {
                                        PrepareListItemWithIndex(item, i - poolSize, i);
                                    }
                                }
                            }
                            else
                            {
                                scrollCursor = itemDataIndex + 1;
                                break;
                            }
                        }
                    }
                }
            }
        }
        isUpdatingList = false;
    }
 protected virtual void OnEnable()
 {
     _table = (target as MonoBehaviour)?.gameObject.GetComponentInParent <TableBehavior>();
     PopulateDropDownOptions();
     EditorApplication.hierarchyChanged += OnHierarchyChange;
 }
        public static void ImportRenderObject(IRenderable item, RenderObject ro, GameObject obj, TableBehavior table)
        {
            if (ro.Mesh == null)
            {
                Logger.Warn($"No mesh for object {obj.name}, skipping.");
                return;
            }

            var mesh = ro.Mesh.ToUnityMesh($"{obj.name}_mesh");

            // apply mesh to game object
            var mf = obj.AddComponent <MeshFilter>();

            mf.sharedMesh = mesh;

            // apply material
            var mr = obj.AddComponent <MeshRenderer>();

            mr.sharedMaterial = ro.Material.ToUnityMaterial(table);
            mr.enabled        = ro.IsVisible;

            // patch
            table.Patcher.ApplyPatches(item, ro, obj);
        }
 public VPEUtilities(DebugUI debugUI, TableBehavior tableBehavior)
 {
     _debugUI      = debugUI;
     _player       = GameObject.FindObjectsOfType <Player>()?[0];
     _worldToLocal = tableBehavior.gameObject.transform.worldToLocalMatrix;
 }
        public static UnityEngine.Material ToUnityMaterial(this PbrMaterial vpxMaterial, TableBehavior table, StringBuilder debug = null)
        {
            if (table != null)
            {
                var existingMat = table.GetMaterial(vpxMaterial);
                if (existingMat != null)
                {
                    return(existingMat);
                }
            }

            var unityMaterial = MaterialConverter.CreateMaterial(vpxMaterial, table, debug);

            if (table != null)
            {
                table.AddMaterial(vpxMaterial, unityMaterial);
            }

            return(unityMaterial);
        }
 /// <summary>
 /// Is called by the <see cref="LayerEditor"/> when a new TableBehavior is created/deleted
 /// </summary>
 /// <param name="tableBehavior"></param>
 public void OnHierarchyChange(TableBehavior tableBehavior)
 {
     _tableBehavior = tableBehavior;
     _layers.Clear();
     Rebuild();
 }
Esempio n. 9
0
 public void Init(TableBehavior tableBehavior)
 {
 }