public void Awake() { TableManager.Load(); LocalData.Load(); IngameManager.Instance.Init(); UIManager.Instance.Open("UIDungeon"); }
public bool FPS(ActivateModel model) { if (string.IsNullOrEmpty(model.Key)) { return(false); } string msg; CUser clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); STUser dbuser = new STUser(); int ret = clUser.GetRecordByUserKey(model.Key, out dbuser, out msg); if (ret != 0) { return(false); } else { string salt = CreateSalt(); string password = CreatePasswordHash(model.NewPassword, salt); if (clUser.FPS(dbuser.userid, password, salt, out msg) != 0) { return(false); } } return(true); }
// // GET: /Report/ public ActionResult Indexd() { if (Request.IsAuthenticated) { CUser clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); STUser stUser; string msg; clUser.GetRecordByUserId(LocalData.UserId(), out stUser, out msg); if (!stUser.oldpass) { ReportParamModels param = new ReportParamModels(); param.BeginDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0, 0); DateTime end = DateTime.Now; end = end.AddMonths(1); end = new DateTime(end.Year, end.Month, 1, 0, 0, 0, 0); end = end.AddDays(-1); param.EndDate = new DateTime(end.Year, end.Month, end.Day, 23, 59, 59, 0); return(View(param)); } else { return(RedirectToAction("ChangePassword", "Account")); } } else { return(RedirectToAction("Index", "Home")); } }
public UserModels GetUserByLogin(string login) { UserModels ret = new UserModels(); STUser data = new STUser(); string msg; CCondition clCondition = new CCondition(); CPermission clPermission = new CPermission(); try { CUser clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); int retvalue = clUser.GetRecordByUserLogin(login, out data, out msg); ret = new UserModels(); ret.UserId = data.userid; ret.UserName = data.username; ret.Login = data.login; ret.Comments = data.comments; ret.Condition = clCondition.GetName(data.condition); ret.Permission = clPermission.GetName(data.permission); // ret.Password = data.password; // ret.ConfirmPassword = ret.Password; ret.Email = data.email; ret.OwnerUserId = data.owneruserid; ret.OwnerUserName = data.ownerusername; } catch (Exception ex) { msg = ex.Message; } return(ret); }
// проверка кэша паролей public bool CheckPassCache(string login, string password) { string msg = null; STUser dbuser; CUser clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); // находим юзера в БД по логину int retvalue = clUser.GetRecordByUserLogin(login, out dbuser, out msg); // находим кэш паролей в БД по логину юзера List <STPassCache> lstpc = new List <STPassCache>(); retvalue = clUser.GetPassCache(login, out lstpc, out msg); if (lstpc.Count <= 0) { return(false); } // сравниваем введенный пароль со спсиком паролей foreach (STPassCache pc in lstpc) { string PASS = CreatePasswordHash(password, pc.passwordsalt); if (pc.password == PASS) { return(true); } } return(false); }
public async Task <SchedulerModel> ModifyAsync(SchedulerModel model) { try { if (model == null) { return(null); } if (model.Id == Guid.Empty) { model.Id = Guid.NewGuid(); model.Created = DateTime.Now.ToUniversalTime(); } else { var tempModel = (SchedulerModel) new SchedulerModel().InjectFrom(model); model = await LoadAsync(model.Id).ConfigureAwait(false); model.InjectFrom(tempModel); model.Modified = DateTime.Now.ToUniversalTime(); } return(await LocalData .Modify(model) .ConfigureAwait(false)); } catch (Exception e) { throw e; } }
void Start() { //If the player wants a game to load, start by trying to load the data if (!LocalData.startNewGame) { //Load game gameData = SaveSystem.instance.LoadGame(); //If there is a save file if (gameData != null) { //Load the saved scene LocalData.NextSceneLoader(gameData.getSceneIndex()); } //If not, a load file was not found. Just start a new game else { //Load first level LocalData.NextSceneLoader(3); } } //If the player wants a new game, simply load in the first level else { //Load first level LocalData.NextSceneLoader(3); } }
/// <summary> /// Initializes a new instance of the <see cref="LoginViewModel"/> class. /// </summary> public LoginViewModel() { //检查是否记住密码 LocalData cacheData = null; try { cacheData = IsolatedStorageHelper.Get <LocalData>(); } catch (Exception ex) { Logger.WriteLog(LogType.WARN, "读取本地配置错误", ex); } if (cacheData == null) { return; } Num = cacheData.Num; LoginName = cacheData.LoginName; LoginPwd = cacheData.LoginPwd; AutoLogin = cacheData.AutoLogin; RememberPassword = cacheData.RememberPassword; if (AutoLogin) { ExecuteLoginCommand(); } }
static void synFromWGS_BaseonAddr08222018() { DLocalData dld = new DLocalData(); DLocalDataGCJ gcj = new DLocalDataGCJ(); DLocalDataWGS wgs = new DLocalDataWGS(); IList <LocalData> ldwgs = wgs.SELECT_ALL(); int countName = 0; int countTele = 0; foreach (LocalData ele in ldwgs) { LocalData edd = dld.SELECT_BY_ADDR(ele.Address); LocalData edg = gcj.SELECT_BY_ADDR(ele.Address); if (ele.Name != edd.Name) { edd.Name = ele.Name; edg.Name = ele.Name; dld.UPDATE(edd); gcj.UPDATE(edg); countName++; } if (ele.Tele != edd.Tele) { edd.Tele = ele.Tele; edg.Tele = ele.Tele; dld.UPDATE(edd); gcj.UPDATE(edg); countTele++; } } Console.WriteLine(); Console.WriteLine("Name changes: " + countName); Console.WriteLine("Telenum changes: " + countTele); }
/// <summary> /// 获取 /// </summary> /// <param name="thriftFileName"></param> /// <returns></returns> public static ServiceModel Get(string thriftFilePath) { if (string.IsNullOrEmpty(thriftFilePath)) { return(new ServiceModel()); } if (!File.Exists(thriftFilePath)) { return(new ServiceModel()); } var filePath = thriftFilePath + ".xml"; var data = new LocalData(); try { if (File.Exists(filePath)) { data = XmlHelper.XmlDeserializeFromFile <LocalData>(filePath) ?? new LocalData(); } } catch (Exception) { } if (data != null && !string.IsNullOrEmpty(data.ThriftFileName)) { return new ServiceModel() { ServiceName = data.ServiceName, ConfigServiceName = string.IsNullOrEmpty(data.ConfigServiceName) ? data.ServiceName : data.ConfigServiceName, NugetId = data.NugetId, Port = data.Port, Publish = data.Publish } } ; return(new ServiceModel()); //var list = new List<LocalData>(); //try //{ // if (File.Exists(filePath)) // list = XmlHelper.XmlDeserializeFromFile<List<LocalData>>(filePath) ?? new List<LocalData>(); //} //catch (Exception) { } //var existData = list.Find(oo => oo.ThriftFileName == thriftFileName); //if (existData != null && existData.ThriftFileName == thriftFileName) // return new ServiceModel() // { // ServiceName = existData.ServiceName, // ConfigServiceName = string.IsNullOrEmpty(existData.ConfigServiceName) ? existData.ServiceName : existData.ConfigServiceName, // NugetId = existData.NugetId, // Port = existData.Port, // Publish = existData.Publish // }; //return new ServiceModel(); } }
public void Update(User user, Mode mode, LocalData localData) { Debug.WriteLine("[m] [FriendsView] Update running"); _mode = mode; _localData = localData; _user = user; _newFriendBt.IsVisible = mode != Mode.ReadOnly; if (mode == Mode.ReadOnly) { _user.Friends = _localData.FindFriendsOfUser(_user); } if (_user.Friends.Count == 0) { _noFriendsLabel.IsVisible = true; _listView.IsVisible = false; } else { _noFriendsLabel.IsVisible = false; _listView.IsVisible = true; Friends = user.Friends; FriendNames = Friends.Select(x => x.Name).ToList(); _listView.ItemsSource = FriendNames; BindingContext = this; } }
private void BoxClick() { if (UIManager.GetInstance().currentUIStep == UIManager.UIStep.Win) { GameController.GetInstance().audioMgr.PlaySound(AudioManager.SoundButtonClick); if (starNum == 3) { if (boxOpen == false) { GameController.GetInstance().audioMgr.PlaySound(AudioManager.SoundReward); int boxCoin = 300; LocalData.GetInstance().SetCoin(300); LocalData.GetInstance().SaveLocalData(); UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "恭喜您获得金币" + boxCoin); btnBox.GetComponent <Image>().sprite = spriteBox[1]; boxOpen = true; } else { UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "宝箱已经打开"); } } else { UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "获得三星评价才能打开宝箱"); } } }
/// <summary> /// 道具 护盾 使用 /// </summary> public void Item0Click() { if (UIManager.GetInstance().currentUIStep == UIManager.UIStep.Game) { GameController.GetInstance().audioMgr.PlaySound(AudioManager.SoundButtonClick); if (LocalData.GetInstance().GetItemSaveNum() > 0) { if (player.GetComponent <Player>().playerSaveTime <= 0) { LocalData.GetInstance().ChangeItemSaveNum(-1); player.GetComponent <Player>().SavePlayerStart(); GameController.GetInstance().audioMgr.PlaySound(AudioManager.SoundItem0); textItemNum0.text = LocalData.GetInstance().GetItemSaveNum() + ""; } } else { if (LocalData.GetInstance().GetCoin() >= 400) { if (player.GetComponent <Player>().playerSaveTime <= 0) { player.GetComponent <Player>().SavePlayerStart(); GameController.GetInstance().audioMgr.PlaySound(AudioManager.SoundItem0); LocalData.GetInstance().SetCoin(-400); textUICoin.text = LocalData.GetInstance().GetCoin() + ""; } } else { //UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "金币不足" + 1000 + ",无法使用道具"); OpenShop(); } } } }
private bool CheckCaja() { bool continuar = false; try { var caja = ventasB.GetIdCajaByUser(curUser); if (caja != 0) { var formasList = LocalData.GetPagosCaja(caja); if (formasList.Count == 0) { MessageBox.Show("No están definidas las formas de pago para la caja # " + caja); continuar = false; } else { curCaja = caja; /// actualiza estado cajas var affectedCajas = ventasB.UpdateStatusCaja(false, curCaja); continuar = true; } } else { MessageBox.Show("La caja no está definida o no esta disponible"); continuar = false; } } catch (Exception ex) { ControlBusiness.BusinessHelpers.General.DoError(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } return(continuar); }
public IList <LocalData> SELECT_BY_KW(string keyword) { string sqlstr = "select id, b_name, addr, lng, lat, key_w, b_group, b_type, tele, pic, des, isused, OCW FROM yxg_localdata_wgs WHERE b_name like '%"; string sqlend = "%';"; DataSet ds = MySqlHelper.ExecuteQuery(sqlstr + keyword + sqlend); DataTable dt = ds.Tables[0]; IList <LocalData> result = new List <LocalData>(); for (int i = 0; i < dt.Rows.Count; i++) { LocalData temp = new LocalData(); temp.ID = int.Parse(dt.Rows[i][0].ToString()); temp.Name = dt.Rows[i][1].ToString(); temp.Address = dt.Rows[i][2].ToString(); temp.Lng = double.Parse(dt.Rows[i][3].ToString()); temp.Lat = double.Parse(dt.Rows[i][4].ToString()); temp.Key_W = dt.Rows[i][5].ToString(); temp.Group = dt.Rows[i][6].ToString(); temp.Type = dt.Rows[i][7].ToString(); temp.Tele = dt.Rows[i][8].ToString(); temp.Pic = dt.Rows[i][9].ToString(); temp.Des = dt.Rows[i][10].ToString(); temp.Isused = short.Parse(dt.Rows[i][11].ToString()); temp.OCW = dt.Rows[i][12].ToString(); result.Add(temp); } return(result); }
static void changeData08222018() { StreamReader sr = new StreamReader("C://ttxy/download/script.txt", Encoding.UTF8); String line = sr.ReadToEnd(); IList <LocalData> upd = new List <LocalData>(); if (line != null) { String[] list = line.Split(';'); foreach (String element in list) { String[] s = element.Split('#'); if (s[0] == "") { Console.WriteLine(element); } else { LocalData tmp = new LocalData(); tmp.ID = int.Parse(s[0]); tmp.Name = s[1]; tmp.Address = s[2]; tmp.Tele = s[8]; upd.Add(tmp); } } Console.WriteLine(upd.Count); DLocalDataWGS dldw = new DLocalDataWGS(); int countName = 0; int countTele = 0; foreach (LocalData eld in upd) { if (eld.ID != 0) { LocalData stmp = dldw.SELECT_BY_ID(eld.ID); if (eld.Name != stmp.Name) { stmp.Name = eld.Name; dldw.UPDATE(stmp); countName++; } if (eld.Tele != stmp.Tele) { stmp.Tele = eld.Tele; dldw.UPDATE(stmp); countTele++; } } } Console.WriteLine(); Console.WriteLine("Name Change: " + countName); Console.WriteLine("Telenum Change: " + countTele); //Console.WriteLine(line.ToString()); //Console.WriteLine(list[0]); //Console.WriteLine(list[1]); //Console.WriteLine(list.Length); } }
void ClickGet1() { if (UIManager.GetInstance().currentUIStep == UIManager.UIStep.Shop) { GameController.GetInstance().audioMgr.PlaySound(AudioManager.SoundButtonClick); if (LocalData.GetInstance().GetCoin() >= 1000) { LocalData.GetInstance().SetCoin(-1000); LocalData.GetInstance().ChangeItemFireNum(1); //UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "恭喜您使用1000金币购买火力援助X1"); //更新显示文本 textItemNum1.text = LocalData.GetInstance().GetItemFireNum() + ""; textCoin.text = LocalData.GetInstance().GetCoin() + ""; GameController.GetInstance().audioMgr.PlaySound(AudioManager.SoundReward); //刷新游戏UI if (nextStep == UIManager.UIStep.Game) { UIManager.GetInstance().game.GetComponent <Game>().textItemNum1.text = LocalData.GetInstance().GetItemFireNum() + ""; UIManager.GetInstance().game.GetComponent <Game>().textUICoin.text = LocalData.GetInstance().GetCoin() + ""; } } else { UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "金币不足" + 1000 + ",无法购买"); } } }
public void StoreDataTest() { const string id = "StoreDataTest"; //clean data var testData = new TestLocalData(); //new data var newInt = int.MaxValue; var newBool = true; var newFloat = 123.123141f; var newString = "ycaro"; //change test data testData.TestInt = newInt; testData.TestBool = newBool; testData.TestNestedData = new TestLocalData.NestedLocalData() { TestFloat = newFloat, TestString = newString }; //store the data locally LocalData.StoreData(testData, id); //get the stored data var retrievedData = LocalData.LoadData <TestLocalData>(id); //compare data Assert.True(testData.IsEqual(retrievedData)); }
public async Task <CustomerModel> LoadAsync(Guid id) { try { if (id.Equals(Guid.Empty)) { return(null); } // load customer var model = await LocalData.Load(id).ConfigureAwait(false); // load foreing key fields await SQLiteControllerBase .DatabaseAsync .GetChildrenAsync <CustomerModel>(model, true) .ConfigureAwait(false); return(model); } catch (Exception e) { throw e; } }
private bool IsLocalActorValid(MemoryContext ctx) { _localData = _localData ?? ctx.DataSegment.LocalData; _localData.TakeSnapshot(); if (_localData.Read <byte>(0) == 0xCD) // structure is being updated, everything is cleared with 0xCD ('-') { if (!_isLocalActorReady) { return(false); } } else { if (!_localData.IsStartUpGame) { if (!_isLocalActorReady) { _isLocalActorReady = true; OnLocalActorCreated(); } } else { if (_isLocalActorReady) { _isLocalActorReady = false; OnLocalActorDisposed(); } return(false); } } return(true); }
public void Click() { if (UIManager.GetInstance().currentUIStep == UIManager.UIStep.SelectLevel) { if (LocalData.GetInstance().GetLevelBoxStarsStateIndex(boxID) == 0) { if (GetAllLevelStarsNum() >= starNeedNum[boxID]) { GameController.GetInstance().audioMgr.PlaySound(AudioManager.SoundReward); LocalData.GetInstance().SetCoin(openBoxGetCoinNum[boxID]); UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "恭喜获得金币" + openBoxGetCoinNum[boxID]); LocalData.GetInstance().SetLevelBoxStarsStateIndex(boxID, 1); UIManager.GetInstance().selectLevel.GetComponent <SelectLevel>().RefurshTextCoin(); InitBaseData(boxID); } else { UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "星星数量不足,无法开启宝箱"); } } else { UIManager.GetInstance().ShowOrHideUI(UIManager.UIStep.TipsPanel, true, "宝箱已打开"); } } }
public MainPage(Themes themes, LocalData localData) { Debug.WriteLine("MainPage running"); InitializeComponent(); _themes = themes; _localData = localData; _renderer = new Renderer(); _themes.ThemeLoaded += ThemeLoaded; menu.SetTheme(themes.CurrentTheme); menu.SetFriendsViewRequest += SetFriendsView; menu.SetGroupsViewRequest += SetGroupsView; menu.SetMessagesViewRequest += SetMessagesView; menu.SetSettingsViewRequest += SetSettingsView; menu.SetCurrentUserViewRequest += SetUserView; if (_user == null) { menu.SetButtonsEnable(false); RequestForUser(UserRequestDialog.RequestPurpose.currentName); } else { SetUserView(); menu.SetButtonsEnable(true); } Debug.WriteLine("MainPage end"); }
// проверка текущего пароля public bool ValidateChangePassword(string login, string password, out string msg) { msg = null; bool ret = true; try { STUser dbuser; CUser clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); // находим юзера в БД по логину int retvalue = clUser.GetRecordByUserLogin(login, out dbuser, out msg); // сравниваем пароль if (dbuser.password == CreatePasswordHash(password, dbuser.passwordsalt) && dbuser.isactivated == true) { return(true); } else { msg = "The current password is incorrect."; return(false); } } catch (Exception ex) { msg = ex.Message; ret = false; } return(ret); }
public static void LoadData() { if (!File.Exists(Application.persistentDataPath + "/LocalData.data")) { // 说明是第一次进入游戏,先存入本地初始化数据 _localData = new LocalData(); // 初始化数据 SaveData(); return; } try { BinaryFormatter bf = new BinaryFormatter(); using (FileStream fs = File.Open(Application.persistentDataPath + "/LocalData.data", FileMode.Open)) { fs.Position = 0; _localData = (LocalData)bf.Deserialize(fs); } } catch (System.Exception ex) { Debug.Log(ex.Message); } }
public bool SentLink(STUser stUser) { string msg = null; try { CUser clUser = new CUser(stUser.userid, LocalData.CSDbUsers(), LocalData.LogPath()); string key = GenerateKey(); int ret = clUser.SetKeyFPS(stUser.userid, key, out msg); if (ret != 0) { return(false); } CMail clMail = new CMail(stUser.userid, LocalData.CSDbUsers(), LocalData.LogPath()); STMail maildata = new STMail(); maildata.to = stUser.email; maildata.linkkey = key; maildata.tamplate = "MailToUserChangePassword.txt"; maildata.fleetpwd = null; maildata.pan = null; maildata.dtcreate = DateTime.Now.ToString("yyyyMMddHHmmss"); maildata.dtmistsent = null; clMail.Insert(maildata, out msg); SMTPNotice smtp = new SMTPNotice(LocalData.SmtpHost(), LocalData.SmtpPort(), LocalData.SmtpUseSSL(), LocalData.SmtpUserName(), LocalData.SmtpPassword(), LocalData.SmtpFrom(), LocalData.CSDbUsers(), LocalData.LogPath(), LocalData.GetTemplatePath(), LocalData.Images()); smtp.SendNotice(out msg); } catch (Exception ex) { msg = ex.Message; return(false); } return(true); }
private static void LoadGameData(LocalData data) { LocalSaveSystem.SaveLocalData(data); var charactersData = data.Characters; var platformsData = data.Platforms; var gameData = DataManager.Instance.GameData; foreach (var characterData in charactersData) { var character = gameData.Characters.FirstOrDefault(c => c.Id == characterData.Id); if (character != null) { character.IsPurchased = characterData.IsPurchased; character.IsSelected = characterData.IsSelected; character.IsEffectEnabled = characterData.IsEffectEnabled; } } foreach (var platformData in platformsData) { var platform = gameData.Platforms.FirstOrDefault(p => p.Id == platformData.Id); if (platform != null) { platform.IsPurchased = platformData.IsPurchased; platform.IsActive = platformData.IsActive; } } gameData.HighScore = data.HighScore; gameData.Coins = data.Coins; }
public void Update(Conversation conversation, User user, Theme newTheme, LocalData localData) { User = user; int id1 = conversation.member1.Id; int id2 = conversation.member2.Id; _conversation = localData.GetConversations().First(c => (c.member1.Id == id1 && c.member2.Id == id2) || (c.member1.Id == id2 && c.member2.Id == id1)); messagesId = new Dictionary <Guid, Message>(); theme = newTheme; _localData = localData; if (_conversation.messages == null) { _conversation.messages = new List <Message>(); } List <Message> orderedEnumerable = _conversation.messages.OrderBy(x => x.DateTime).ToList(); int length = orderedEnumerable.Count(); stack.Children.Clear(); for (int i = 0; i < length; i++) { Message message = orderedEnumerable.ElementAt(i); Button button = CreateButton(message, _conversation.member1 == user); button.SetTheme(theme); stack.Children.Add(button); } }
public LocalData SELECT_BY_ADDR(string addr) { string sqlstr = "SELECT id, b_name, addr, lng, lat, key_w, b_group, b_type, tele, pic, des, isused, OCW FROM yxg_localdata_wgs WHERE addr='"; DataSet ds = MySqlHelper.ExecuteQuery(sqlstr + addr + "'"); DataTable dt = ds.Tables[0]; LocalData temp = new LocalData(); temp.ID = int.Parse(dt.Rows[0][0].ToString()); temp.Name = dt.Rows[0][1].ToString(); temp.Address = dt.Rows[0][2].ToString(); temp.Lng = double.Parse(dt.Rows[0][3].ToString()); temp.Lat = double.Parse(dt.Rows[0][4].ToString()); temp.Key_W = dt.Rows[0][5].ToString(); temp.Group = dt.Rows[0][6].ToString(); temp.Type = dt.Rows[0][7].ToString(); temp.Tele = dt.Rows[0][8].ToString(); temp.Pic = dt.Rows[0][9].ToString(); temp.Des = dt.Rows[0][10].ToString(); temp.Isused = short.Parse(dt.Rows[0][11].ToString()); temp.OCW = dt.Rows[0][12].ToString(); return(temp); }
public void LoadLocalData() { if (!File.Exists(StoreFileName)) { LocalData = new VMCALocalData(); return; } try { using (var ms = new MemoryStream()) { var bytes = File.ReadAllBytes(StoreFileName); ms.Write(bytes, 0, bytes.Length); ms.Seek(0, SeekOrigin.Begin); var xmlSerializer = new XmlSerializer(typeof(VMCALocalData)); LocalData = xmlSerializer.Deserialize(ms) as VMCALocalData; LocalData.FillServerQueue(); } } catch (Exception) { } }
/// <summary> /// 初始化按钮数据状态 /// </summary> /// <param name="_levelNum">关卡值</param> public void InitBtnBaseData(int _levelNum) { levelNum = _levelNum; textLevelNum.text = "" + (levelNum + 1); starNum = LocalData.GetInstance().GetLevelStarsIndex(levelNum); if (starNum == 3) { imageBack.sprite = btnImageBack[1]; } else if (starNum == 2) { starImg2.color = Color.clear; } else if (starNum == 1) { starImg1.color = Color.clear; starImg2.color = Color.clear; } else { if (LocalData.GetInstance().GetMaxOpenLevel() < levelNum + 1) { imageBack.sprite = btnImageBack[2]; textLevelNum.text = ""; } starImg0.color = Color.clear; starImg1.color = Color.clear; starImg2.color = Color.clear; } }
public LocalDataService() { //Get Data From embedded resources var assembly = Assembly.Load(new AssemblyName("TransitApp.Core")); var resourceNames = assembly.GetManifestResourceNames(); var resourcePaths = resourceNames .Where(x => x.EndsWith("LocalData.json", StringComparison.CurrentCultureIgnoreCase)) .ToArray(); using (StreamReader streamReader = new StreamReader(assembly.GetManifestResourceStream(resourcePaths.Single()))) { var json = streamReader.ReadToEnd(); _localData = JsonConvert.DeserializeObject<LocalData>(json); foreach (var station in _localData.Stations) { station.Lines = _localData.Lines.Where(x => station.Lines.Any(y => y.Id == x.Id)).ToList(); } } }
public DataStack(IExecutionContext context) { _context = context; _localData = new LocalData(_context.OutStream); }
private bool IsLocalActorValid(Engine engine) { _localData = _localData ?? engine.LocalData; byte isNotInGame = (byte)_localData.x04_IsNotInGame; //byte isActorCreated = (byte)_localData.x00_IsActorCreated; if (isNotInGame == 0xCD) // structure is being updated, everything is cleared with 0xCD ('-') { if (!_isLocalActorReady) return false; } else { if (isNotInGame == 0) { if (!_isLocalActorReady) { _isLocalActorReady = true; OnLocalActorCreated(); } } else { if (_isLocalActorReady) { _isLocalActorReady = false; OnLocalActorDisposed(); } return false; } } return true; }
// Authentication public async Task<bool> PreAuthenticate() { LocalData ld = new LocalData(); User loc = ld.GetLocalUser(); if (loc != null) { CurrentUser = loc; //await ReloadUser (); if (string.IsNullOrEmpty(CurrentUser.Phone)) { IsTour = true; } return true; } return false; }
public async Task Authenticate(UIViewController view) { try { LocalData ld = new LocalData(); if (await PreAuthenticate()) { return; } // UIKit.UIViewController view = UIApplication.SharedApplication.KeyWindow.RootViewController; user = await client.LoginAsync(view, MobileServiceAuthenticationProvider.Facebook); //user = await client.LoginAsync(view,MobileServiceAuthenticationProvider.Facebook); Dictionary<string,string> uid = new Dictionary<string,string>(); uid.Add("userid",user.UserId); CurrentUser = await client.InvokeApiAsync<User> ("UsersCustom/UniversalUserId/", HttpMethod.Get, uid); ld.InsertLocalUser(CurrentUser); if (string.IsNullOrEmpty(CurrentUser.Phone)) { IsTour = true; } } catch (Exception ex) { Console.Error.WriteLine (@"ERROR - AUTHENTICATION FAILED {0}", ex.Message); } }
public async Task AuthenticateCustom(string username, string password) { try { LoginRequest lr = new LoginRequest(){ username = username, password = password }; CurrentUser = await client.InvokeApiAsync<LoginRequest,User> ("CustomLogin/Post/", lr); if (CurrentUser != null) { LocalData ld = new LocalData(); ld.InsertLocalUser(CurrentUser); if (string.IsNullOrEmpty(CurrentUser.Phone)) { IsTour = true; } } } catch (Exception ex) { Console.Error.WriteLine (@"ERROR - AUTHENTICATION FAILED {0}", ex.Message); } }
public async Task RegisterDevice(NSData deviceToken) { var DeviceToken = deviceToken.Description; if (!string.IsNullOrWhiteSpace(DeviceToken)) { DeviceToken = DeviceToken.Trim('<').Trim('>'); } LocalData ld = new LocalData (); DeviceRegistration dr = ld.GetDeviceRegistration (); bool needNewRegistration = false; if (dr != null) { dr = ld.GetDeviceRegistration (); //update registration DeviceRegistrationDTO drtoo = new DeviceRegistrationDTO () { Platform = dr.Platform, Handle = dr.Handle, Tags = dr.Tags.Split('|'), RegistrationId = dr.RegistrationId }; string result = await client.InvokeApiAsync<DeviceRegistrationDTO,string> ("NotificationCustom/RegistrationUpdate/", drtoo); if (result == "gone") { needNewRegistration = true; ld.DeleteDeviceRegistration (); } } if (dr == null || needNewRegistration) { //get token string token = await client.InvokeApiAsync<string,string> ("NotificationCustom/RegistrationCreate/", " "); DeviceRegistrationDTO drto = new DeviceRegistrationDTO () { Platform = "apns", Handle = DeviceToken, Tags = new string[]{ "ios_users", "all_users", "userid_" + CurrentUser.Id, "areacode_" + CurrentUser.AreaCode }, RegistrationId = token }; //update registration string result = await client.InvokeApiAsync<DeviceRegistrationDTO, string> ("NotificationCustom/RegistrationUpdate/", drto); ld.InsertDeviceRegistration (dr); } }
public async Task ReloadUser() { Dictionary<string,string> uid = new Dictionary<string,string>(); uid.Add("userid",CurrentUser.Id); CurrentUser = await client.InvokeApiAsync<User> ("UsersCustom/GetUser/", HttpMethod.Get, uid); LocalData ld = new LocalData(); ld.InsertLocalUser(CurrentUser); }