Ejemplo n.º 1
0
 public void UpdateData(ToDoListItemData itemData)
 {
     if (mCachedData.ContainsKey(itemData.Id))
     {
         mCachedData [itemData.Id] = itemData;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存
        /// </summary>
        public static void Save(List <ToDoListItemData> itemList)
        {
            string titleStamp = "";

            for (int i = 0; i < itemList.Count - 1; i++)
            {
                ToDoListItemData item = itemList[i];
                titleStamp += item.Title + SPLIT_CODE;

                PlayerPrefs.SetString(item.Title, item.Content);
                PlayerPrefs.SetInt(TODO_LIST_COMPLETE_SUFFIX_KEY + item.Title, item.Complete ? 1 : 0);
                PlayerPrefs.SetInt(TODO_LIST_COMPLETE_DELETED_KEY + item.Title, item.Deleted ? 1 : 0);
            }

            if (itemList.Count > 1)
            {
                titleStamp += itemList [itemList.Count - 1].Title;

                PlayerPrefs.SetString(itemList [itemList.Count - 1].Title, itemList [itemList.Count - 1].Content);
                PlayerPrefs.SetInt(TODO_LIST_COMPLETE_SUFFIX_KEY + itemList [itemList.Count - 1].Title, itemList [itemList.Count - 1].Complete ? 1 : 0);
                PlayerPrefs.SetInt(TODO_LIST_COMPLETE_DELETED_KEY + itemList [itemList.Count - 1].Title, itemList [itemList.Count - 1].Deleted ? 1 : 0);
            }

            PlayerPrefs.SetString(TODO_LIST_TITLES_KEY, titleStamp);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 读取
        /// </summary>
        public static List <ToDoListItemData> Load()
        {
            List <ToDoListItemData> retList = new List <ToDoListItemData> ();

            string titlesStamp = PlayerPrefs.GetString(TODO_LIST_TITLES_KEY, "");

            Debug.Log(titlesStamp);
            string[] titles = titlesStamp.Split(new string[] { SPLIT_CODE }, System.StringSplitOptions.None);
            for (int i = 0; i < titles.Length; i++)
            {
                if (!string.IsNullOrEmpty(titles [i]))
                {
                    ToDoListItemData itemData = new ToDoListItemData();
                    itemData.Title    = titles [i];
                    itemData.Content  = PlayerPrefs.GetString(titles [i]);
                    itemData.Complete = PlayerPrefs.GetInt(TODO_LIST_COMPLETE_SUFFIX_KEY + titles [i]) == 1 ? true : false;
                    itemData.Deleted  = PlayerPrefs.GetInt(TODO_LIST_COMPLETE_DELETED_KEY + titles [i]) == 1 ? true : false;
                    if (!itemData.Deleted)
                    {
                        retList.Add(itemData);
                    }
                    itemData.Description();
                }
            }

            return(retList);
        }
Ejemplo n.º 4
0
 public ModifiedItemMsg(ushort msgId, string srcTitle, ToDoListItemData itemData) : base(msgId)
 {
     this.SrcTitle = srcTitle;
     this.ItemData = itemData;
 }
Ejemplo n.º 5
0
 public CreateNewItemMsg(ushort msgId, ToDoListItemData newItemData) : base(msgId)
 {
     this.NewItemData = newItemData;
 }
Ejemplo n.º 6
0
 public void UpdateData(ToDoListItemData itemData)
 {
     m_CachedData [itemData.Id] = itemData;
 }