Example #1
0
 public override void Awake()
 {
     base.Awake();
     childDatas = new ChildData[Main.settings.numberOfColumns];
     for (int i = 0; i < Main.settings.numberOfColumns; i++)
     {
         Transform child = transform.GetChild(i);
         childDatas[i] = new ChildData(child);
     }
     //Main.Logger.Log("WarehouseItem Awake " + childDatas.Length);
 }
Example #2
0
 private void SetCell(ItemCell itemCell, int index)
 {
     if (actor)
     {
         int  num2 = DateFile.instance.MianActorID();
         bool flag = !Main.settings.remoteWarehouse;
         if (flag)
         {
             flag = HomeSystem.instance.homeMapPartId != DateFile.instance.mianPartId || HomeSystem.instance.homeMapPlaceId != DateFile.instance.mianPlaceId;
         }
         WarehouseItem item = itemCell as WarehouseItem;
         if (item == null)
         {
             Main.Logger.Log("WarehouseItem出错。。。");
             return;
         }
         ChildData[] childDatas = item.childDatas;
         for (int i = 0; i < Main.settings.numberOfColumns; i++)
         {
             int idx = (index - 1) * Main.settings.numberOfColumns + i;
             if (i < childDatas.Length)
             {
                 ChildData childData = childDatas[i];
                 if (idx < m_data.Length)
                 {
                     int        num3 = m_data[idx];
                     GameObject go   = childData.gameObject;
                     if (!go.activeSelf)
                     {
                         go.SetActive(true);
                     }
                     go.name = "ActorItem," + num3;
                     childData.setItem.SetWarehouseItemIcon(num2, num3, int.Parse(DateFile.instance.GetItemDate(num3, 3, true)) != 1 || flag);
                 }
                 else
                 {
                     GameObject go = childData.gameObject;
                     if (go.activeSelf)
                     {
                         go.SetActive(false);
                     }
                 }
             }
             else
             {
                 Main.Logger.Log("数据出错。。。");
             }
         }
     }
     else
     {
         int  num4     = -999;
         bool cantTake = !Main.settings.remoteWarehouse;
         if (cantTake)
         {
             cantTake = HomeSystem.instance.homeMapPartId != DateFile.instance.mianPartId || HomeSystem.instance.homeMapPlaceId != DateFile.instance.mianPlaceId;
         }
         WarehouseItem item = itemCell as WarehouseItem;
         if (item == null)
         {
             Main.Logger.Log("WarehouseItem出错。。。");
             return;
         }
         ChildData[] childDatas = item.childDatas;
         for (int i = 0; i < Main.settings.numberOfColumns; i++)
         {
             int idx = (index - 1) * Main.settings.numberOfColumns + index - 1 + i;
             if (i < childDatas.Length)
             {
                 ChildData childData = childDatas[i];
                 if (idx < m_data.Length)
                 {
                     int        num5 = m_data[idx];
                     GameObject go   = childData.gameObject;
                     if (!go.activeSelf)
                     {
                         go.SetActive(true);
                     }
                     go.name = "WarehouseItem," + num5;
                     childData.setItem.SetWarehouseItemIcon(num4, num5, cantTake);
                 }
                 else
                 {
                     GameObject go = childData.gameObject;
                     if (go.activeSelf)
                     {
                         go.SetActive(false);
                     }
                 }
             }
             else
             {
                 Main.Logger.Log("数据出错。。。");
             }
         }
     }
 }