Exemplo n.º 1
0
    // Token: 0x06000509 RID: 1289 RVA: 0x0001B18C File Offset: 0x0001938C
    public static void RemoveItemFromLog(Transform buildItem)
    {
        if (WorldData.instance == null)
        {
            return;
        }
        int instanceID = buildItem.GetInstanceID();

        if (WorldData.instance.placedTransforms.ContainsKey(instanceID))
        {
            WorldData.instance.placedTransforms.Remove(instanceID);
        }
        for (int i = 0; i < WorldData.instance.data.items.Count; i++)
        {
            if (WorldData.instance.data.items[i].instanceID == instanceID)
            {
                WorldData.instance.data.items.RemoveAt(i);
            }
        }
        WorldData.ItemCountUpdateHandler onItemCountUpdated = WorldData.OnItemCountUpdated;
        if (onItemCountUpdated == null)
        {
            return;
        }
        onItemCountUpdated(WorldData.instance.data.items.Count);
    }
Exemplo n.º 2
0
 // Token: 0x0600050A RID: 1290 RVA: 0x0001B248 File Offset: 0x00019448
 public static void RemoveLastItem()
 {
     if (WorldData.instance == null)
     {
         return;
     }
     if (WorldData.instance.data.items.Count == 0)
     {
         return;
     }
     WorldData.Data.Item item = WorldData.instance.data.items[WorldData.instance.data.items.Count - 1];
     if (!WorldData.instance.placedTransforms.ContainsKey(item.instanceID))
     {
         return;
     }
     UnityEngine.Object.Destroy(WorldData.instance.placedTransforms[item.instanceID].gameObject);
     WorldData.instance.placedTransforms.Remove(item.instanceID);
     WorldData.instance.data.items.RemoveAt(WorldData.instance.data.items.Count - 1);
     WorldData.ItemCountUpdateHandler onItemCountUpdated = WorldData.OnItemCountUpdated;
     if (onItemCountUpdated == null)
     {
         return;
     }
     onItemCountUpdated(WorldData.instance.data.items.Count);
 }
Exemplo n.º 3
0
 // Token: 0x06000508 RID: 1288 RVA: 0x0001B0E8 File Offset: 0x000192E8
 public static void AddItemToLog(Transform buildItemTransform, int itemVariantID)
 {
     if (WorldData.instance == null)
     {
         return;
     }
     WorldData.Data.Item item = new WorldData.Data.Item();
     item.instanceID    = buildItemTransform.GetInstanceID();
     item.itemVariantID = itemVariantID;
     item.position      = buildItemTransform.position;
     item.eularRotation = buildItemTransform.rotation.eulerAngles;
     WorldData.instance.data.items.Add(item);
     WorldData.instance.placedTransforms.Add(buildItemTransform.GetInstanceID(), buildItemTransform);
     WorldData.ItemCountUpdateHandler onItemCountUpdated = WorldData.OnItemCountUpdated;
     if (onItemCountUpdated == null)
     {
         return;
     }
     onItemCountUpdated(WorldData.instance.data.items.Count);
 }