public StorageHandler() { EasyStorageSettings.SetSupportedLanguages(EasyStorage.Language.English); HighScores = new HighScores(); Settings = new Settings(); #if WINDOWS saveDevice = new PCSaveDevice("Leximo"); useStorage = true; GetHighScoresFromDevice(); //sharedSaveDevice = saveDevice; #else // add the GamerServicesComponent // create and add our SaveDevice sharedSaveDevice = new SharedSaveDevice("Leximo"); //Components.Add(sharedSaveDevice); // hook an event for when the device is selected sharedSaveDevice.DeviceSelected += (s, e) => GetHighScoresFromDevice(); // hook two event handlers to force the user to choose a new device if they cancel the // device selector or if they disconnect the storage device after selecting it sharedSaveDevice.DeviceSelectorCanceled += new EventHandler<SaveDeviceEventArgs>(sharedSaveDevice_DeviceSelectorCanceled);//(s, e) => e.Response = SaveDeviceEventResponse.Prompt; sharedSaveDevice.DeviceDisconnected += new EventHandler<SaveDeviceEventArgs>(sharedSaveDevice_DeviceDisconnected); //(s, e) => e.Response = SaveDeviceEventResponse.Prompt; // prompt for a device on the next Update // make sure we hold on to the device saveDevice = sharedSaveDevice; #endif }
public Game1() { new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // we can set our supported languages explicitly or we can allow the // game to support all the languages. the first language given will // be the default if the current language is not one of the supported // languages. this only affects the text found in message boxes shown // by EasyStorage and does not have any affect on the rest of the game. EasyStorageSettings.SetSupportedLanguages(Language.French, Language.Spanish); // on PC we use a save that saves to the user's "Saved Games" folder instead // of using the Xna.Storage APIs // on Xbox, we use a save device that gets a shared StorageDevice to // handle our file IO. #if WINDOWS saveDevice = new PCSaveDevice("EasyStorageTestGame"); TestDevice(); #else // add the GamerServicesComponent Components.Add(new GamerServicesComponent(this)); // create and add our SaveDevice SharedSaveDevice sharedSaveDevice = new SharedSaveDevice(); Components.Add(sharedSaveDevice); // hook an event for when the device is selected to run our test sharedSaveDevice.DeviceSelected += (s, e) => TestDevice(); // hook two event handlers to force the user to choose a new device if they cancel the // device selector or if they disconnect the storage device after selecting it sharedSaveDevice.DeviceSelectorCanceled += (s, e) => e.Response = SaveDeviceEventResponse.Force; sharedSaveDevice.DeviceDisconnected += (s, e) => e.Response = SaveDeviceEventResponse.Force; // prompt for a device on the first Update we can sharedSaveDevice.PromptForDevice(); // make sure we hold on to the device saveDevice = sharedSaveDevice; #endif }