public static void SaveCard(this SettingComponent setting, UserCard userCard)
        {
            var userCardList = setting.GetObject <List <UserCard> >(Constant.Setting.UserCard);

            bool HasCard = false;

            for (int i = 0; i < userCardList.Count; i++)
            {
                if (userCardList[i].id == userCard.id)
                {
                    //覆盖
                    userCardList[i].name    = userCard.name;
                    userCardList[i].content = userCard.content;
                    userCardList[i].type    = userCard.type;
                    HasCard = true;
                }
            }

            //保存
            if (!HasCard)
            {
                userCardList.Add(userCard);
            }

            setting.SetObject(Constant.Setting.UserCard, userCardList);
        }
Esempio n. 2
0
        public void OnCreatCard()
        {
            var userCard = new UserCard(cardId, cardName, cardContent, cardType);

            GameEntry.Setting.SaveCard(userCard);
        }