예제 #1
0
        public override void OnUpdate()
        {
            int num = 0;

            foreach (BlueprintBuilding blueprintBuilding in inspector.blueprint.buildings)
            {
                int       protoId = blueprintBuilding.itemId;
                ItemProto proto   = LDB.items.Select(protoId);
                if (!proto.prefabDesc.isStation || proto.prefabDesc.isCollectStation)
                {
                    continue;
                }

                int[] parameters = blueprintBuilding.parameters;
                if (parameters != null && parameters.Length >= 2048)
                {
                    for (int i = 0; i < proto.prefabDesc.stationMaxItemKinds; i++)
                    {
                        if (parameters[i * 6] > 0)
                        {
                            int itemId = parameters[i * 6];
                            ELogisticStorage localLogic  = (ELogisticStorage)parameters[i * 6 + 1];
                            ELogisticStorage remoteLogic = (ELogisticStorage)parameters[i * 6 + 2];
                            StationData      data        = new StationData()
                            {
                                itemId = itemId,
                                local  = localLogic,
                                remote = remoteLogic,
                                slotId = i
                            };
                            SetItem(num++, blueprintBuilding.index, proto.prefabDesc.isStellarStation, data);
                        }
                    }
                }
            }

            ClearComponentItems(num);
        }
예제 #2
0
        public void SetItem(int index, int stationId, bool isStellar, StationData data)
        {
            if (index < 0)
            {
                return;
            }

            if (index > 256)
            {
                return;
            }

            while (index >= items.Count)
            {
                UIBlueprintStationItem uiblueprintComponentItem = Instantiate(prefab, prefab.transform.parent);
                uiblueprintComponentItem.Create(this);
                items.Add(uiblueprintComponentItem);
            }

            items[index].SetStation(stationId, isStellar);
            items[index].SetDisplay(index, data);
            items[index].Open();
        }