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. }
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); }
public void ScanCurrentTexture() { currentProfile.StartNewScan(baseSprite.texture, trainSpeed); currentProfile.ApplyWeightedTexture(targetImage, Exploration); if (ShouldLoadSave) { SaveLoadHanlder.Save(currentProfile, currentProfile.SavePath, false); } }
public void LoadPlayerMadeData() { List <WeaponData> data = SaveLoadHanlder.LoadWeaponData(); Sprites.AddRange(SaveLoadHanlder.LoadWeaponImages()); foreach (WeaponData wd in data) { AddWeapon(wd, WeaponSortType.playerMade); } }
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); }
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(); } }
public void AddItem(ItemData i) { inventory.AddItem(i); SaveLoadHanlder.Save(inventory, "/Inventory.dat", true); }
public void Load() { SaveLoadHanlder.Load(inventory, "/Inventory.dat", true); }
public void TryLoad() { SaveLoadHanlder.Load(this, SavePath); }
public void Save() { SaveLoadHanlder.Save(this, SavePath); }