Beispiel #1
0
        public void AddSceneSaveEntry(String sceneName, PlayerData.SceneChange.ItemPropertyChange itemPropertyChange)
        {
            PlayerData.SceneChange sceneChange = null;

            foreach (PlayerData.SceneChange sc in playerData.SceneChangeList)
            {
                if (sc.SceneName == sceneName)
                {
                    sceneChange = sc;
                }
            }
            if (sceneChange == null)
            {
                sceneChange = new PlayerData.SceneChange();
                sceneChange.SceneName = sceneName;
                playerData.SceneChangeList.Add(sceneChange);
            }

            bool findItemParamChange = false;
            // 修改
            foreach (PlayerData.SceneChange.ItemPropertyChange ipc in sceneChange.ItemChangeList)
            {
                if (itemPropertyChange.ItemLabel == ipc.ItemLabel && itemPropertyChange.PropertyName == ipc.PropertyName)
                {
                    findItemParamChange = true;
                    ipc.Value = itemPropertyChange.Value;
                }
            }
            // 不存在则添加
            if (!findItemParamChange)
            {
                sceneChange.ItemChangeList.Add(itemPropertyChange);
            }
        }
Beispiel #2
0
 // 重建档案
 public void NewPlayerData()
 {
     playerData = new PlayerData();
     // TODO [玩家名称支持输入或隐藏] 这里仅把新玩家名字设为随机数字,可能重复
     playerData.PlayerName = GameService.GetRandomInt(0, 9999).ToString();
 }