コード例 #1
0
ファイル: MonoTechTreeUI.cs プロジェクト: slb1988/agame
 public void InitNodes(CabinTechTree tree)
 {
     this._tree         = tree;
     this._nodeDataList = this._tree.GetNodeList();
     this.GetTreeArea();
     this._content.GetComponent <GridLayoutGroup>().constraintCount = this._row;
     this._originNormalizedPositin = new Vector2(0f, 0f);
     for (int i = 0; i < this._row; i++)
     {
         for (int j = 0; j < this._column; j++)
         {
             GameObject obj2 = UnityEngine.Object.Instantiate <GameObject>(this._nodePrefab);
             obj2.transform.SetParent(this._content.transform);
             obj2.GetComponent <RectTransform>().localScale = this._nodeScale;
             MonoTechNodeUI    component = obj2.GetComponent <MonoTechNodeUI>();
             CabinTechTreeNode dataByUI  = this.GetDataByUI(j, i);
             if (dataByUI != null)
             {
                 if ((dataByUI._metaData.X == 0) && (dataByUI._metaData.Y == 0))
                 {
                     this._originNormalizedPositin.x = ((float)j) / ((float)this._row);
                     this._originNormalizedPositin.y = 1f - (((float)i) / ((float)this._column));
                 }
                 obj2.name = string.Format("TechTreeNode_{0}", dataByUI._metaData.ID);
             }
             component.Init(dataByUI, j, i);
             component.RefreshStatus();
             this._nodeUIObjList.Add(component);
         }
     }
 }
コード例 #2
0
 public CabinTechTreeNode(CabinTechTree tree)
 {
     this._tree   = tree;
     this._status = TechTreeNodeStatus.Lock;
 }