示例#1
0
 public void CanStore(WarehouseAgent agent)
 {
     if (DialogueManager.Instance.TalkAble || DialogueManager.Instance.IsUIOpen || IsUIOpen)
     {
         return;
     }
     MWarehouse = agent.MWarehouse;
     StoreAble  = true;
     UIManager.Instance.EnableInteract(true, agent.name);
 }
 private void OnSelected(WarehouseAgent warehouse)
 {
     if (warehouse.IsSelected)
     {
         selected = warehouse.Data;
     }
     else if (warehouse.Data == selected)
     {
         selected = null;
     }
     deselect.interactable = list.SelectedIndices.Count > 0;
 }
示例#3
0
 void LoadWarehouse(SaveData data)
 {
     WarehouseAgent[] warehouseAgents = FindObjectsOfType <WarehouseAgent>();
     foreach (WarehouseData wd in data.warehouseDatas)
     {
         Warehouse warehouse = null;
         GameManager.TalkerDatas.TryGetValue(wd.handlerID, out TalkerData handler);
         if (handler)
         {
             warehouse = handler.warehouse;
         }
         else
         {
             WarehouseAgent wagent = Array.Find(warehouseAgents, x => x.ID == wd.handlerID);
             if (wagent)
             {
                 warehouse = wagent.MWarehouse;
             }
         }
         if (warehouse != null)
         {
             warehouse.size = new ScopeInt(wd.maxSize)
             {
                 Current = wd.currentSize
             };
             warehouse.Items.Clear();
             foreach (ItemData id in wd.itemDatas)
             {
                 ItemInfo newInfo = new ItemInfo(GameManager.GetItemByID(id.itemID), id.amount)
                 {
                     indexInGrid = id.indexInGrid
                 };
                 //TODO 把newInfo的耐久度等信息处理
                 warehouse.Items.Add(newInfo);
             }
         }
     }
 }
示例#4
0
 protected override void OnEnable()
 {
     base.OnEnable();
     agent     = target as WarehouseAgent;
     warehouse = serializedObject.FindProperty("warehouse");
 }