示例#1
0
    public void Save()
    {
        if (nameField.text.Length <= 2)
        {
            MessageManager.Instance.NewMessage("Come on, you need a longer name that that...");
            return;
        }

        AffinityData weapAffinity = PixelScanner.ScanTextureAffinity(image.sprite.texture, AssetManager.Instance.baseAffinities, Variables.Instance.PixelScannerThrehold);

        WeaponData wd = new WeaponData(nameField.text, null, nameField.text, BaseWeapon.damage.value, weapAffinity);

        weapAffinity.PrintMe();

        SaveLoadHanlder.SaveWeapon(image.sprite.texture, nameField.text, wd);

        SaveLoadHanlder.LoadSprite(nameField.text);

        ItemManager.Instance.AddWeapon(wd, WeaponSortType.playerMade);

        MessageManager.Instance.NewMessage("You have made a weapon... Good for you.");

        UIManager.Instance.ResetCanvas();

        InventoryManager.Instance.AddItem(wd);
        //To Do: Generate weapon stuffs.
    }
示例#2
0
    public bool DiscardItem(ItemData id)
    {
        bool b = inventory.RemoveItem(id);

        SaveLoadHanlder.Save(inventory, "/Inventory.dat", true);
        LootFactory.Instance.SpawnLootAroundPoint(CharacterController_2D.Instance.transform.position, id, 1);
        return(b);
    }
示例#3
0
 public void ScanCurrentTexture()
 {
     currentProfile.StartNewScan(baseSprite.texture, trainSpeed);
     currentProfile.ApplyWeightedTexture(targetImage, Exploration);
     if (ShouldLoadSave)
     {
         SaveLoadHanlder.Save(currentProfile, currentProfile.SavePath, false);
     }
 }
示例#4
0
    public void LoadPlayerMadeData()
    {
        List <WeaponData> data = SaveLoadHanlder.LoadWeaponData();

        Sprites.AddRange(SaveLoadHanlder.LoadWeaponImages());

        foreach (WeaponData wd in data)
        {
            AddWeapon(wd, WeaponSortType.playerMade);
        }
    }
示例#5
0
    public bool DestroyAllOfItem(ItemData id)
    {
        bool b = true;

        while (b)
        {
            b = inventory.RemoveItemByID(id.name);
        }
        SaveLoadHanlder.DeleteWeapon(id.name);
        SaveLoadHanlder.Save(inventory, "/Inventory.dat", true);
        return(true);
    }
示例#6
0
    public DetailedTextureProfile(string savePath, string label, int w, int h, bool shouldLoad = false)
    {
        //If load is successfull these variables will be overriden by the saved version
        name     = label;
        width    = w;
        height   = h;
        SavePath = savePath + "/" + label + ".dat";

        if (shouldLoad)
        {
            SaveLoadHanlder.Load(this, SavePath, false);
        }
        else
        {
            LoadFailed();
        }
    }
示例#7
0
 public void AddItem(ItemData i)
 {
     inventory.AddItem(i);
     SaveLoadHanlder.Save(inventory, "/Inventory.dat", true);
 }
示例#8
0
 public void Load()
 {
     SaveLoadHanlder.Load(inventory, "/Inventory.dat", true);
 }
示例#9
0
 public void TryLoad()
 {
     SaveLoadHanlder.Load(this, SavePath);
 }
示例#10
0
 public void Save()
 {
     SaveLoadHanlder.Save(this, SavePath);
 }