public SeriPC(Character.PC pc) { ActiveBox = pc.ActiveBox; Pokemons = new SeriPokemon[pc.AllBoxes.Length][]; for (int i = 0; i < Pokemons.Length; i++) { Pokemons[i] = new SeriPokemon[pc.AllBoxes[i].Length]; for (int j = 0; j < Pokemons[i].Length; j++) { Pokemons[i][j] = (SeriPokemon)pc.AllBoxes[i][j]; } } BoxNames = pc.BoxNames; BoxTextures = pc.BoxTextures; //Items = new int[pc.Items.Length]; //for (int i = 0; i < Items.Length; i++) //{ // Items[i] = (int)pc.Items[i]; //} //List<Inventory.Items> list = new List<Inventory.Items>(); List <int> list = new List <int>(); foreach (KeyValuePair <Inventory.Items, int> item in pc.Items) { for (int i = 0; i < item.Value; i++) { list.Add((int)item.Key); } } Items = list.ToArray(); }
public static SeriPokemon[][] Serialize(this Pokemon[][] pkmn) { if (pkmn != null) { SeriPokemon[][] pkmns = new SeriPokemon[pkmn.Length][]; for (int i = 0; i < pkmns.Length; i++) { pkmns[i] = pkmn[i].Serialize(); } return(pkmns); } else { //SeriPokemon[][] pkmns = new SeriPokemon[Core.STORAGEBOXES][]; SeriPokemon[][] pkmns = new SeriPokemon[0][]; for (int i = 0; i < pkmns.Length; i++) { pkmns[i] = new SeriPokemon[0]; for (int j = 0; j < pkmns[i].Length; j++) { pkmns[i][j] = (SeriPokemon) new Pokemon(Pokemons.NONE); } } return(pkmns); } }
public static SeriPokemon[] Serialize(this Pokemon[] pkmn) { if (pkmn != null) { SeriPokemon[] p = new SeriPokemon[pkmn.Length]; for (int i = 0; i < p.Length; i++) { p[i] = pkmn[i]; } return(p); } else { return(new SeriPokemon[0]); } }
public SeriPC(Monster.Pokemon[,] pokemons, string[] boxNames, int[] boxTextures, List <Inventory.Items> boxItems, byte box = 0) { ActiveBox = box; Pokemons = new SeriPokemon[pokemons.GetLength(0)][]; for (int i = 0; i < Pokemons.Length; i++) { Pokemons[i] = new SeriPokemon[pokemons.GetLength(1)]; for (int j = 0; j < Pokemons[i].Length; j++) { Pokemons[i][j] = (SeriPokemon)pokemons[i, j]; } } BoxNames = boxNames; BoxTextures = boxTextures; Items = new int[boxItems.Count]; for (int i = 0; i < Items.Length; i++) { Items[i] = (int)boxItems[i]; } }