Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public static void RemoveGameData(this SettingComponent setting, int gameId)
        {
            var gameDataList = setting.GetObject <List <GameData> >(Constant.Setting.GameData);

            for (int i = 0; i < gameDataList.Count; i++)
            {
                if (gameDataList[i].gameId == gameId)
                {
                    gameDataList.RemoveAt(i);
                    setting.SetObject(Constant.Setting.GameData, gameDataList);
                    break;
                }
            }
        }
Exemplo n.º 3
0
        public static void RemoveCard(this SettingComponent setting, int cardId)
        {
            var userCardList = setting.GetObject <List <UserCard> >(Constant.Setting.UserCard);

            for (int i = 0; i < userCardList.Count; i++)
            {
                if (userCardList[i].id == cardId)
                {
                    userCardList.RemoveAt(i);
                    setting.SetObject(Constant.Setting.UserCard, userCardList);
                    break;
                }
            }
        }
Exemplo n.º 4
0
        public static void SaveGame(this SettingComponent setting, GameData gameData)
        {
            var gameDataList = setting.GetObject <List <GameData> >(Constant.Setting.GameData);

            bool HasGame = false;

            for (int i = 0; i < gameDataList.Count; i++)
            {
                if (gameDataList[i].gameId == gameData.gameId)
                {
                    //覆盖
                    gameDataList[i] = gameData;
                    HasGame         = true;
                }
            }

            //保存
            if (!HasGame)
            {
                gameDataList.Add(gameData);
            }

            setting.SetObject(Constant.Setting.GameData, gameDataList);
        }