示例#1
0
        public void CreateTable(int size)
        {
            _Table = gameObject.GetComponent <UITable>();
            if (_Table == null)
            {
                Debug.Log("UITable not initialized ");
                return;
            }

            GameObject sourcePrefab = Resources.Load(SOURCE_PATH) as GameObject;

            if (sourcePrefab == null)
            {
                Debug.Log("Could not load source from path " + SOURCE_PATH);
            }

            ShanghaiUtils.RemoveAllChildren(transform);

            for (int x = 0; x < size; x++)
            {
                GameObject source = GameObject.Instantiate(sourcePrefab) as GameObject;

                SourceController sourceCtr = source.GetComponent <SourceController>();
                sourceCtr.Key = x;

                source.name                    = string.Format("{0}", x);
                source.transform.parent        = transform;
                source.transform.localPosition = Vector3.zero;
                source.transform.localScale    = Vector3.one;
            }
            _Table.repositionNow = true;
        }
示例#2
0
        private void OnSourceCellUpdated(SourceCell sourceCell)
        {
            Transform sourceTrans = transform.Find(string.Format("{0}", sourceCell.Key));

            if (sourceTrans != null)
            {
                SourceController sourceCtr = sourceTrans.GetComponent <SourceController>();
                if (sourceCtr != null)
                {
                    sourceCtr.UpdateSource(sourceCell);
                }
            }
        }
示例#3
0
 private void OnTelegramOver(SourceController srcCont)
 {
     _OverSource = srcCont;
 }