void Start() { saveService = FindObjectOfType <SaveService>(); saveService.Setup(new PlayerPrefsStorage()); saveService.Register(someService); saveService.Load(someService); }
public void SaveAndLoad() { var campaign = "campaign"; var name = "save1"; var data1 = new DataContainer { value = 42 }; Assert.True(_service.Save(campaign, name, data1)); Assert.True(_service.Load(campaign, name, out DataContainer data2)); Assert.AreEqual(data1.value, data2.value); }
/// <summary> /// Called by the View when the Mediator is registered /// </summary> public override void OnRegister() { if (setting.platform == AppConst.DefaultPlatform) { LoginButton.GetOrAddComponent <PointerEventTrigger>().onClick += OnEventHandler; GoRegButton.GetOrAddComponent <PointerEventTrigger>().onClick += OnEventHandler; BackButton.GetOrAddComponent <PointerEventTrigger>().onClick += OnEventHandler; RegButton.GetOrAddComponent <PointerEventTrigger>().onClick += OnEventHandler; RegistedButton.GetOrAddComponent <PointerEventTrigger>().onClick += OnEventHandler; //设置pid var pid = saveService.Load <string>("pid", ""); LoginPidText.text = pid; } else { LoginBlock.gameObject.SetActive(false); PlatformBlock.gameObject.SetActive(true); EnterGameButton.GetOrAddComponent <PointerEventTrigger>().onClick += OnEventHandler; } }