Пример #1
0
    public virtual Dictionary <string, object> Load(bool destroyUnloaded = false)
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //load dictionary
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        Dictionary <string, int> itemPaths;

        itemPaths = DataPersitanceHelpers.GetValueFromDictionary <Dictionary <string, int> >(ref dataDictionary, "items");

        //Remove all items;
        RemoveAll();

        //add loaded items
        foreach (var itemPath in itemPaths)
        {
            //load asset
            var item = Resources.Load <Item>(itemPath.Key);

            for (int i = 0; i < itemPath.Value; i++)
            {
                AddItem(item as Item, false);
            }
        }

        return(dataDictionary);
    }
    public Dictionary <string, object> Load(bool destroyUnloaded = false)
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //load dictionary
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        IsInteractable = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "IsInteractable");
        Toggle         = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "Toggle");
        triggered      = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "triggered");

        if (TriggerAnimator != null)
        {
            TriggerAnimator.SetBool(OnTriggerAnimation, triggered);
        }

        //OnTrigger?.Invoke(triggered, this);

        return(dataDictionary);
    }
Пример #3
0
    public virtual Dictionary <string, object> Save()
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //Load currently saved values
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        //TODO save path of items
        Dictionary <string, int> itemPaths = new Dictionary <string, int>();

        foreach (var inventoryItem in items)
        {
            var item = inventoryItem.InventoryItem?.Item;
            if (item)
            {
                itemPaths.Add(item.AssetPath.Replace("Resources/", "").Replace(".asset", ""), inventoryItem.InventoryItem.Quantity);
            }
        }
        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "items", itemPaths);

        //save json to file
        DataPersitanceHelpers.SaveDictionary(ref dataDictionary, uuid.ID);

        return(dataDictionary);
    }
Пример #4
0
    public Dictionary <string, object> Load(bool destroyUnloaded = false)
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //load dictionary
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        AlertMeter = DataPersitanceHelpers.GetValueFromDictionary <int>(ref dataDictionary, "AlertMeter");

        return(dataDictionary);
    }
    public Dictionary <string, object> Load(bool destroyUnloaded = false)
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //load dictionary
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        TriggeredPositionOffset = DataPersitanceHelpers.GetValueFromDictionary <Vector3>(ref dataDictionary, "TriggeredPositionOffset");
        targetPosition          = DataPersitanceHelpers.GetValueFromDictionary <Vector3>(ref dataDictionary, "targetPosition");

        return(dataDictionary);
    }
Пример #6
0
    public Dictionary <string, object> Load(bool destroyUnloaded = false)
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //load dictionary
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        TargetPortalIndex    = DataPersitanceHelpers.GetValueFromDictionary <int>(ref dataDictionary, "TargetPortalIndex");
        previousTargetPortal = DataPersitanceHelpers.GetValueFromDictionary <int>(ref dataDictionary, "previousTargetPortal");

        return(dataDictionary);
    }
Пример #7
0
    public Dictionary <string, object> Save()
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //Load currently saved values
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "AlertMeter", AlertMeter);

        //save json to file
        DataPersitanceHelpers.SaveDictionary(ref dataDictionary, uuid.ID);

        return(dataDictionary);
    }
    public Dictionary <string, object> Save()
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //Load currently saved values
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        //save transform
        DataPersitanceHelpers.SaveTransform(ref dataDictionary, transform, "persistantTransform");

        //save json to file
        DataPersitanceHelpers.SaveDictionary(ref dataDictionary, uuid.ID);

        return(dataDictionary);
    }
    public Dictionary <string, object> Save()
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //Load currently saved values
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "TriggeredPositionOffset", TriggeredPositionOffset);
        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "targetPosition", targetPosition);

        //save json to file
        DataPersitanceHelpers.SaveDictionary(ref dataDictionary, uuid.ID);

        return(dataDictionary);
    }
Пример #10
0
    public Dictionary <string, object> Save()
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //Load currently saved values
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "TargetPortalIndex", TargetPortalIndex);
        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "previousTargetPortal", previousTargetPortal);

        //save json to file
        DataPersitanceHelpers.SaveDictionary(ref dataDictionary, uuid.ID);

        return(dataDictionary);
    }
    public Dictionary <string, object> Load(bool destroyUnloaded = false)
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //load dictionary
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        ////if dictionary is empty then we assume no saved data for the object, so destroy it
        //if (destroyUnloaded && (dataDictionary == null || dataDictionary.Count == 0))
        //    gameObject.SetActive(false);

        //load transform
        DataPersitanceHelpers.LoadTransform(ref dataDictionary, transform, "persistantTransform");

        return(dataDictionary);
    }
    public Dictionary <string, object> Save()
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //Load currently saved values
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "IsInteractable", IsInteractable);
        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "Toggle", Toggle);
        DataPersitanceHelpers.SaveValueToDictionary(ref dataDictionary, "triggered", triggered);

        //save json to file
        DataPersitanceHelpers.SaveDictionary(ref dataDictionary, uuid.ID);

        return(dataDictionary);
    }
Пример #13
0
    public Dictionary <string, object> Load(bool destroyUnloaded = false)
    {
        //create new dictionary to contain data for characterbase
        Dictionary <string, object> dataDictionary = new Dictionary <string, object>();

        if (!uuid)
        {
            return(dataDictionary);
        }

        //load dictionary
        DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID);

        IsLocked = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "IsLocked");

        if (Animator != null)
        {
            Animator.SetBool(OnTriggerAnimation, InteractionTrigger.AnyTrue(InteractTriggers));
        }

        return(dataDictionary);
    }