Esempio n. 1
0
 /// <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));
         }
     }
 }
Esempio n. 2
0
    /// <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);
    }