/// <summary> /// 存储新船 /// </summary> public void SetNew(IShip ship) { if (!MarkNew(ship)) { ServerListProxy m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy; string key = m_ServerListProxy.GetCurrentCharacterVO().UId.ToString(); HistoryShip m_HistoryShip = new HistoryShip(); if (PlayerPrefs.HasKey(key)) { m_HistoryShip = JsonUtility.FromJson <HistoryShip>(PlayerPrefs.GetString(key)); m_HistoryShip.m_ShipList.Add(ship.GetUID()); PlayerPrefs.SetString(key, JsonUtility.ToJson(m_HistoryShip)); } else { m_HistoryShip.m_ShipList.Add(ship.GetUID()); PlayerPrefs.SetString(key, JsonUtility.ToJson(m_HistoryShip)); } } }
/// <summary> /// 当前船是否为新船 /// </summary> /// <returns></returns> public bool MarkNew(IShip ship) { ServerListProxy m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy; string key = m_ServerListProxy.GetCurrentCharacterVO().UId.ToString(); HistoryShip m_HistoryShip = new HistoryShip(); if (PlayerPrefs.HasKey(key)) { m_HistoryShip = JsonUtility.FromJson <HistoryShip>(PlayerPrefs.GetString(key)); if (m_HistoryShip.m_ShipList.Contains(ship.GetUID())) { return(true); } else { return(false); } } return(false); }