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); } }
public void VisitScene(String sceneName) { PlayerData.SceneChange findSceneChange = null; foreach (PlayerData.SceneChange sc in playerData.SceneChangeList) { if (sceneName == sc.SceneName) { findSceneChange = sc; break; } } if (findSceneChange == null) { Console.WriteLine("信息:首次进入场景" + sceneName); PlayerData.SceneChange sceneChange = new PlayerData.SceneChange(); sceneChange.SceneName = sceneName; playerData.SceneChangeList.Add(sceneChange); } else { // 覆盖场景档案信息 #region TODO 待更新 //foreach (PlayerData.SceneChange.ItemParamChange ipc in findSceneChange.ItemChangeList) //{ // switch (ipc.ItemType) // { // case GlobalItemName.Obstacle: // foreach (Obstacle item in SceneMgr.Instance.obstacleMgr.Items) // { // if (item.Label == ipc.ItemLabel) // { // // item.SetValueByGlobalName(ipc.ParamName, ipc.Value); // } // } // break; // default: // Console.WriteLine("警告:Item属性修改信息的Case不存在,TypeName:"+ipc.ItemType.ToString()); // break; // } //} #endregion TODO 待更新 } }