public void PurgeUserData(ICreateNewUser createInstance, bool plusGame) { if (!plusGame) { User_trophy = null; User_plus = null; } User_basic = null; User_record = null; Ship_book.Clear(); Slot_book.Clear(); User_ship.Clear(); User_slot.Clear(); User_useItem.Clear(); User_turn = null; User_deckpractice = null; User_deck.Clear(); User_EscortDeck.Clear(); User_furniture.Clear(); User_ndock.Clear(); User_kdock.Clear(); User_mapcomp.Clear(); User_mapclear.Clear(); User_material.Clear(); User_missioncomp.Clear(); User_quest.Clear(); User_questcount.Clear(); User_tanker.Clear(); User_rebellion_point.Clear(); User_room.Clear(); Temp_escortship.Clear(); Temp_deckship.Clear(); User_history.Clear(); }
public bool SetUserData() { XElement elements = VitaSaveManager.Instance.Elements; if (elements == null) { return(false); } Mem_basic user_basic = Model_Base.SetUserData <Mem_basic>(elements.Elements(Mem_basic.tableName).First()); Mem_record user_record = Model_Base.SetUserData <Mem_record>(elements.Elements(Mem_record.tableName).First()); Mem_turn user_turn = Model_Base.SetUserData <Mem_turn>(elements.Elements(Mem_turn.tableName).First()); Mem_deckpractice user_deckpractice = Model_Base.SetUserData <Mem_deckpractice>(elements.Elements(Mem_deckpractice.tableName).First()); XElement xElement = elements.Elements(Mem_trophy.tableName).FirstOrDefault(); Mem_trophy user_trophy = (xElement != null) ? Model_Base.SetUserData <Mem_trophy>(xElement) : new Mem_trophy(); XElement xElement2 = elements.Elements(Mem_newgame_plus.tableName).FirstOrDefault(); Mem_newgame_plus user_plus = (xElement2 != null) ? Model_Base.SetUserData <Mem_newgame_plus>(xElement2) : new Mem_newgame_plus(); User_basic = null; User_basic = user_basic; User_record = null; User_record = user_record; User_turn = null; User_turn = user_turn; User_deckpractice = null; User_deckpractice = user_deckpractice; User_trophy = user_trophy; User_plus = user_plus; Dictionary <int, Mem_book> dictionary = new Dictionary <int, Mem_book>(); Dictionary <int, Mem_book> dictionary2 = new Dictionary <int, Mem_book>(); Dictionary <int, Mem_deck> dictionary3 = new Dictionary <int, Mem_deck>(); Dictionary <int, Mem_esccort_deck> dictionary4 = new Dictionary <int, Mem_esccort_deck>(); Dictionary <int, Mem_furniture> dictionary5 = new Dictionary <int, Mem_furniture>(); Dictionary <int, Mem_kdock> dictionary6 = new Dictionary <int, Mem_kdock>(); Dictionary <int, Mem_mapcomp> dictionary7 = new Dictionary <int, Mem_mapcomp>(); Dictionary <int, Mem_mapclear> dictionary8 = new Dictionary <int, Mem_mapclear>(); Dictionary <enumMaterialCategory, Mem_material> dictionary9 = new Dictionary <enumMaterialCategory, Mem_material>(); Dictionary <int, Mem_missioncomp> dictionary10 = new Dictionary <int, Mem_missioncomp>(); Dictionary <int, Mem_ndock> dictionary11 = new Dictionary <int, Mem_ndock>(); Dictionary <int, Mem_quest> dictionary12 = new Dictionary <int, Mem_quest>(); Dictionary <int, Mem_questcount> dictionary13 = new Dictionary <int, Mem_questcount>(); Dictionary <int, Mem_ship> dictionary14 = new Dictionary <int, Mem_ship>(); Dictionary <int, Mem_slotitem> dictionary15 = new Dictionary <int, Mem_slotitem>(); Dictionary <int, Mem_tanker> dictionary16 = new Dictionary <int, Mem_tanker>(); Dictionary <int, Mem_useitem> dictionary17 = new Dictionary <int, Mem_useitem>(); Dictionary <int, Mem_rebellion_point> dictionary18 = new Dictionary <int, Mem_rebellion_point>(); Dictionary <int, Mem_room> dictionary19 = new Dictionary <int, Mem_room>(); HashSet <int> hashSet = new HashSet <int>(); HashSet <int> hashSet2 = new HashSet <int>(); List <Mem_history> list = new List <Mem_history>(); foreach (XElement item2 in elements.Elements("ship_books").Elements("mem_book")) { Mem_book mem_book = Model_Base.SetUserData <Mem_book>(item2); dictionary.Add(mem_book.Table_id, mem_book); } Ship_book.Clear(); Ship_book = dictionary; foreach (XElement item3 in elements.Elements("slot_books").Elements("mem_book")) { Mem_book mem_book2 = Model_Base.SetUserData <Mem_book>(item3); dictionary2.Add(mem_book2.Table_id, mem_book2); } Slot_book.Clear(); Slot_book = dictionary2; foreach (XElement item4 in elements.Elements(Mem_deck.tableName + "s").Elements(Mem_deck.tableName)) { Mem_deck mem_deck = Model_Base.SetUserData <Mem_deck>(item4); dictionary3.Add(mem_deck.Rid, mem_deck); } User_deck.Clear(); User_deck = dictionary3; foreach (XElement item5 in elements.Elements(Mem_esccort_deck.tableName + "s").Elements(Mem_esccort_deck.tableName)) { Mem_esccort_deck mem_esccort_deck = Model_Base.SetUserData <Mem_esccort_deck>(item5); dictionary4.Add(mem_esccort_deck.Rid, mem_esccort_deck); } User_EscortDeck.Clear(); User_EscortDeck = dictionary4; foreach (XElement item6 in elements.Elements(Mem_furniture.tableName + "s").Elements(Mem_furniture.tableName)) { Mem_furniture mem_furniture = Model_Base.SetUserData <Mem_furniture>(item6); dictionary5.Add(mem_furniture.Rid, mem_furniture); } User_furniture.Clear(); User_furniture = dictionary5; foreach (XElement item7 in elements.Elements(Mem_kdock.tableName + "s").Elements(Mem_kdock.tableName)) { Mem_kdock mem_kdock = Model_Base.SetUserData <Mem_kdock>(item7); dictionary6.Add(mem_kdock.Rid, mem_kdock); } User_kdock.Clear(); User_kdock = dictionary6; foreach (XElement item8 in elements.Elements(Mem_mapcomp.tableName + "s").Elements(Mem_mapcomp.tableName)) { Mem_mapcomp mem_mapcomp = Model_Base.SetUserData <Mem_mapcomp>(item8); dictionary7.Add(mem_mapcomp.Rid, mem_mapcomp); } User_mapcomp.Clear(); User_mapcomp = dictionary7; foreach (XElement item9 in elements.Elements(Mem_mapclear.tableName + "s").Elements(Mem_mapclear.tableName)) { Mem_mapclear mem_mapclear = Model_Base.SetUserData <Mem_mapclear>(item9); dictionary8.Add(mem_mapclear.Rid, mem_mapclear); } User_mapclear.Clear(); User_mapclear = dictionary8; foreach (XElement item10 in elements.Elements(Mem_material.tableName + "s").Elements(Mem_material.tableName)) { Mem_material mem_material = Model_Base.SetUserData <Mem_material>(item10); dictionary9.Add(mem_material.Rid, mem_material); } User_material.Clear(); User_material = dictionary9; foreach (XElement item11 in elements.Elements(Mem_missioncomp.tableName + "s").Elements(Mem_missioncomp.tableName)) { Mem_missioncomp mem_missioncomp = Model_Base.SetUserData <Mem_missioncomp>(item11); dictionary10.Add(mem_missioncomp.Rid, mem_missioncomp); } User_missioncomp.Clear(); User_missioncomp = dictionary10; foreach (XElement item12 in elements.Elements(Mem_ndock.tableName + "s").Elements(Mem_ndock.tableName)) { Mem_ndock mem_ndock = Model_Base.SetUserData <Mem_ndock>(item12); dictionary11.Add(mem_ndock.Rid, mem_ndock); } User_ndock.Clear(); User_ndock = dictionary11; foreach (XElement item13 in elements.Elements(Mem_quest.tableName + "s").Elements(Mem_quest.tableName)) { Mem_quest mem_quest = Model_Base.SetUserData <Mem_quest>(item13); dictionary12.Add(mem_quest.Rid, mem_quest); } User_quest.Clear(); User_quest = dictionary12; foreach (XElement item14 in elements.Elements(Mem_questcount.tableName + "s").Elements(Mem_questcount.tableName)) { Mem_questcount mem_questcount = Model_Base.SetUserData <Mem_questcount>(item14); dictionary13.Add(mem_questcount.Rid, mem_questcount); } User_questcount.Clear(); User_questcount = dictionary13; foreach (XElement item15 in elements.Elements(Mem_slotitem.tableName + "s").Elements(Mem_slotitem.tableName)) { Mem_slotitem mem_slotitem = Model_Base.SetUserData <Mem_slotitem>(item15); dictionary15.Add(mem_slotitem.Rid, mem_slotitem); } User_slot.Clear(); User_slot = dictionary15; foreach (XElement item16 in elements.Elements(Mem_ship.tableName + "s").Elements(Mem_ship.tableName)) { Mem_ship mem_ship = Model_Base.SetUserData <Mem_ship>(item16); dictionary14.Add(mem_ship.Rid, mem_ship); } User_ship.Clear(); User_ship = dictionary14; foreach (XElement item17 in elements.Elements(Mem_tanker.tableName + "s").Elements(Mem_tanker.tableName)) { Mem_tanker mem_tanker = Model_Base.SetUserData <Mem_tanker>(item17); dictionary16.Add(mem_tanker.Rid, mem_tanker); } User_tanker.Clear(); User_tanker = dictionary16; foreach (XElement item18 in elements.Elements(Mem_useitem.tableName + "s").Elements(Mem_useitem.tableName)) { Mem_useitem mem_useitem = Model_Base.SetUserData <Mem_useitem>(item18); dictionary17.Add(mem_useitem.Rid, mem_useitem); } User_useItem.Clear(); User_useItem = dictionary17; foreach (XElement item19 in elements.Elements(Mem_rebellion_point.tableName + "s").Elements(Mem_rebellion_point.tableName)) { Mem_rebellion_point mem_rebellion_point = Model_Base.SetUserData <Mem_rebellion_point>(item19); dictionary18.Add(mem_rebellion_point.Rid, mem_rebellion_point); } User_rebellion_point.Clear(); User_rebellion_point = dictionary18; foreach (XElement item20 in elements.Elements(Mem_room.tableName + "s").Elements(Mem_room.tableName)) { Mem_room mem_room = Model_Base.SetUserData <Mem_room>(item20); dictionary19.Add(mem_room.Rid, mem_room); } User_room.Clear(); User_room = dictionary19; foreach (XElement item21 in elements.Element("temp_escortships").Elements()) { string value = item21.Value; hashSet.Add(int.Parse(value)); } Temp_escortship.Clear(); Temp_escortship = hashSet; foreach (XElement item22 in elements.Element("temp_deckships").Elements()) { string value2 = item22.Value; hashSet2.Add(int.Parse(value2)); } Temp_deckship.Clear(); Temp_deckship = hashSet2; foreach (XElement item23 in elements.Elements(Mem_history.tableName + "s").Elements(Mem_history.tableName)) { Mem_history item = Model_Base.SetUserData <Mem_history>(item23); list.Add(item); } User_history.Clear(); list.ForEach(delegate(Mem_history x) { Add_History(x); }); return(true); }